@@ -29,6 +29,8 @@ type AcquireSessionWriteLockFn =
2929 typeof import ( "../../session-write-lock.js" ) . acquireSessionWriteLock ;
3030type ShouldPreemptivelyCompactBeforePromptFn =
3131 typeof import ( "./preemptive-compaction.js" ) . shouldPreemptivelyCompactBeforePrompt ;
32+ type WaitForCompactionRetryWithAggregateTimeoutFn =
33+ typeof import ( "./compaction-retry-aggregate-timeout.js" ) . waitForCompactionRetryWithAggregateTimeout ;
3234
3335type SubscriptionMock = ReturnType < SubscribeEmbeddedPiSessionFn > ;
3436type UnknownMock = Mock < ( ...args : unknown [ ] ) => unknown > ;
@@ -86,6 +88,7 @@ type AttemptSpawnWorkspaceHoisted = {
8688 ( sessionKey : string | undefined , config : unknown ) => number | undefined
8789 > ;
8890 limitHistoryTurnsMock : Mock < < T > ( messages : T , limit : number | undefined ) => T > ;
91+ waitForCompactionRetryWithAggregateTimeoutMock : Mock < WaitForCompactionRetryWithAggregateTimeoutFn > ;
8992 preemptiveCompactionCalls : Parameters < ShouldPreemptivelyCompactBeforePromptFn > [ 0 ] [ ] ;
9093 systemPromptOverrideTexts : string [ ] ;
9194 sessionManager : SessionManagerMocks ;
@@ -181,6 +184,10 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
181184 const limitHistoryTurnsMock = vi . fn << T > ( messages : T , limit : number | undefined ) => T > (
182185 ( messages ) => messages ,
183186 ) ;
187+ const waitForCompactionRetryWithAggregateTimeoutMock =
188+ vi . fn < WaitForCompactionRetryWithAggregateTimeoutFn > ( async ( ) => ( {
189+ timedOut : false ,
190+ } ) ) ;
184191 const preemptiveCompactionCalls : Parameters < ShouldPreemptivelyCompactBeforePromptFn > [ 0 ] [ ] = [ ] ;
185192 const systemPromptOverrideTexts : string [ ] = [ ] ;
186193 const sessionManager = {
@@ -221,6 +228,7 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
221228 detectAndLoadPromptImagesMock,
222229 getHistoryLimitFromSessionKeyMock,
223230 limitHistoryTurnsMock,
231+ waitForCompactionRetryWithAggregateTimeoutMock,
224232 preemptiveCompactionCalls,
225233 systemPromptOverrideTexts,
226234 sessionManager,
@@ -774,10 +782,9 @@ vi.mock("../utils.js", () => ({
774782} ) ) ;
775783
776784vi . mock ( "./compaction-retry-aggregate-timeout.js" , ( ) => ( {
777- waitForCompactionRetryWithAggregateTimeout : async ( ) => ( {
778- timedOut : false ,
779- aborted : false ,
780- } ) ,
785+ waitForCompactionRetryWithAggregateTimeout : (
786+ ...args : Parameters < WaitForCompactionRetryWithAggregateTimeoutFn >
787+ ) => hoisted . waitForCompactionRetryWithAggregateTimeoutMock ( ...args ) ,
781788} ) ) ;
782789
783790vi . mock ( "./compaction-timeout.js" , ( ) => ( {
@@ -956,6 +963,9 @@ export function resetEmbeddedAttemptHarness(
956963 hoisted . runContextEngineMaintenanceMock . mockReset ( ) . mockResolvedValue ( undefined ) ;
957964 hoisted . getHistoryLimitFromSessionKeyMock . mockReset ( ) . mockReturnValue ( undefined ) ;
958965 hoisted . limitHistoryTurnsMock . mockReset ( ) . mockImplementation ( ( messages ) => messages ) ;
966+ hoisted . waitForCompactionRetryWithAggregateTimeoutMock
967+ . mockReset ( )
968+ . mockResolvedValue ( { timedOut : false } ) ;
959969 hoisted . preemptiveCompactionCalls . length = 0 ;
960970 hoisted . systemPromptOverrideTexts . length = 0 ;
961971 hoisted . sessionManager . getLeafEntry . mockReset ( ) . mockReturnValue ( null ) ;
0 commit comments