





















@@ -32,6 +32,8 @@ type AcquireSessionWriteLockFn =
3232typeof import("../../session-write-lock.js").acquireSessionWriteLock;
3333type ShouldPreemptivelyCompactBeforePromptFn =
3434typeof import("./preemptive-compaction.js").shouldPreemptivelyCompactBeforePrompt;
35+type WaitForCompactionRetryWithAggregateTimeoutFn =
36+typeof import("./compaction-retry-aggregate-timeout.js").waitForCompactionRetryWithAggregateTimeout;
35373638type SubscriptionMock = ReturnType<SubscribeEmbeddedPiSessionFn>;
3739type UnknownMock = Mock<(...args: unknown[]) => unknown>;
@@ -92,6 +94,7 @@ type AttemptSpawnWorkspaceHoisted = {
9294(sessionKey: string | undefined, config: unknown) => number | undefined
9395>;
9496limitHistoryTurnsMock: Mock<<T>(messages: T, limit: number | undefined) => T>;
97+waitForCompactionRetryWithAggregateTimeoutMock: Mock<WaitForCompactionRetryWithAggregateTimeoutFn>;
9598preemptiveCompactionCalls: Parameters<ShouldPreemptivelyCompactBeforePromptFn>[0][];
9699systemPromptOverrideTexts: string[];
97100sessionManager: SessionManagerMocks;
@@ -191,6 +194,10 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
191194const limitHistoryTurnsMock = vi.fn<<T>(messages: T, limit: number | undefined) => T>(
192195(messages) => messages,
193196);
197+const waitForCompactionRetryWithAggregateTimeoutMock =
198+vi.fn<WaitForCompactionRetryWithAggregateTimeoutFn>(async () => ({
199+timedOut: false,
200+}));
194201const preemptiveCompactionCalls: Parameters<ShouldPreemptivelyCompactBeforePromptFn>[0][] = [];
195202const systemPromptOverrideTexts: string[] = [];
196203const sessionManager = {
@@ -234,6 +241,7 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
234241 detectAndLoadPromptImagesMock,
235242 getHistoryLimitFromSessionKeyMock,
236243 limitHistoryTurnsMock,
244+ waitForCompactionRetryWithAggregateTimeoutMock,
237245 preemptiveCompactionCalls,
238246 systemPromptOverrideTexts,
239247 sessionManager,
@@ -790,10 +798,9 @@ vi.mock("../utils.js", () => ({
790798}));
791799792800vi.mock("./compaction-retry-aggregate-timeout.js", () => ({
793-waitForCompactionRetryWithAggregateTimeout: async () => ({
794-timedOut: false,
795-aborted: false,
796-}),
801+waitForCompactionRetryWithAggregateTimeout: (
802+ ...args: Parameters<WaitForCompactionRetryWithAggregateTimeoutFn>
803+) => hoisted.waitForCompactionRetryWithAggregateTimeoutMock(...args),
797804}));
798805799806vi.mock("./compaction-timeout.js", () => ({
@@ -975,6 +982,9 @@ export function resetEmbeddedAttemptHarness(
975982hoisted.runContextEngineMaintenanceMock.mockReset().mockResolvedValue(undefined);
976983hoisted.getHistoryLimitFromSessionKeyMock.mockReset().mockReturnValue(undefined);
977984hoisted.limitHistoryTurnsMock.mockReset().mockImplementation((messages) => messages);
985+hoisted.waitForCompactionRetryWithAggregateTimeoutMock
986+.mockReset()
987+.mockResolvedValue({ timedOut: false });
978988hoisted.preemptiveCompactionCalls.length = 0;
979989hoisted.systemPromptOverrideTexts.length = 0;
980990hoisted.sessionManager.getLeafEntry.mockReset().mockReturnValue(null);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。