@@ -191,6 +191,40 @@ test("updates running compactions to failed and cancelled boundaries", async ({
191191 await expect ( cancelled ) . not . toContainText ( "Summary before cancellation." )
192192} )
193193
194+ test ( "shows an interrupted outcome when stopping automatic compaction" , async ( { page } ) => {
195+ const timeline = await setupTimeline ( page , {
196+ sessionMessages : [ user , assistant ( true ) ] ,
197+ sessionStatus : { [ sessionID ] : { type : "busy" } } ,
198+ } )
199+ await timeline . send ( compactionStarted ( { sessionID, reason : "auto" , recent : "" } ) )
200+ await timeline . send ( compactionDelta ( { sessionID, text : "Partial automatic summary." } ) )
201+ const compaction = page . locator ( '[data-component="session-compaction-message"]' )
202+ await expect ( compaction . getByRole ( "status" ) . getByLabel ( "Compacting session" , { exact : true } ) ) . toBeVisible ( )
203+ await expect ( compaction ) . toContainText ( "Partial automatic summary." )
204+
205+ const request = page . waitForRequest (
206+ ( request ) =>
207+ request . method ( ) === "POST" && new URL ( request . url ( ) ) . pathname === `/api/session/${ sessionID } /interrupt` ,
208+ )
209+ await page . getByRole ( "button" , { name : "Stop" , exact : true } ) . click ( )
210+ await request
211+ await timeline . send (
212+ compactionFailed ( {
213+ sessionID,
214+ reason : "auto" ,
215+ error : { type : "compaction.interrupted" , message : "Compaction was interrupted" } ,
216+ } ) ,
217+ )
218+
219+ await expect ( compaction . getByText ( "Session compacting started" , { exact : true } ) ) . toBeVisible ( )
220+ await expect ( compaction . getByText ( "Session compaction interrupted" , { exact : true } ) ) . toBeVisible ( )
221+ await expect ( compaction . getByText ( "Session compaction failed" , { exact : true } ) ) . toHaveCount ( 0 )
222+ await expect ( compaction . getByText ( "Session compacted" , { exact : true } ) ) . toHaveCount ( 0 )
223+ await expect ( compaction . getByRole ( "status" ) ) . toHaveCount ( 0 )
224+ await expect ( compaction ) . not . toContainText ( "Partial automatic summary." )
225+ await expect ( compaction ) . not . toContainText ( "Compaction was interrupted" )
226+ } )
227+
194228test ( "moves blocking work to the background with Ctrl+B" , async ( { page } ) => {
195229 await setupTimeline ( page , {
196230 settings : {
0 commit comments