@@ -5249,6 +5249,7 @@ it.layer(layerTest)("usage-limit recovery", (it) => {
52495249 "independent-patches" ,
52505250 "expired-snooze" ,
52515251 "wake" ,
5252+ "stop" ,
52525253 ] as const ) ( "guards a scheduled usage-limit continuation against %s" , ( scenario ) =>
52535254 Effect . gen ( function * ( ) {
52545255 const orchestrator = yield * Orchestrator . OrchestratorV2 ;
@@ -5619,6 +5620,12 @@ it.layer(layerTest)("usage-limit recovery", (it) => {
56195620 commandId : CommandId . make ( `recovery:settle:${ scenario } ` ) ,
56205621 threadId,
56215622 } ) ;
5623+ if ( scenario === "stop" )
5624+ yield * orchestrator . dispatch ( {
5625+ type : "thread.stop" ,
5626+ commandId : CommandId . make ( `recovery:stop:${ scenario } ` ) ,
5627+ threadId,
5628+ } ) ;
56225629 if ( scenario === "replacement" ) {
56235630 const current = yield * orchestrator . getThreadProjection ( threadId ) ;
56245631 const error = current . turnItems . find ( ( item ) => item . type === "error" ) ! ;
@@ -5697,6 +5704,26 @@ it.layer(layerTest)("usage-limit recovery", (it) => {
56975704 ? 1
56985705 : 0 ) ,
56995706 ) ;
5707+ if ( scenario === "stop" ) {
5708+ assert . isTrue (
5709+ after . turnItems . some (
5710+ ( item ) => item . type === "run_interrupt_request" && item . runId === run . id ,
5711+ ) ,
5712+ ) ;
5713+ yield * orchestrator . dispatch ( {
5714+ type : "message.dispatch" ,
5715+ commandId : CommandId . make ( "recovery:manual-resume:stop" ) ,
5716+ messageId : MessageId . make ( "recovery:manual-resume:stop" ) ,
5717+ threadId,
5718+ manualContinuationOfRunId : run . id ,
5719+ text : "Continue where you left off." ,
5720+ attachments : [ ] ,
5721+ dispatchMode : { type : "start_immediately" } ,
5722+ createdBy : "user" ,
5723+ creationSource : "web" ,
5724+ } ) ;
5725+ assert . lengthOf ( ( yield * orchestrator . getThreadProjection ( threadId ) ) . runs , 2 ) ;
5726+ }
57005727 if ( scenario === "queued-resume" ) {
57015728 assert . equal ( after . runs [ 1 ] ?. status , "queued" ) ;
57025729 assert . isTrue ( after . runs [ 1 ] ?. queueHeld ) ;
0 commit comments