@@ -4168,7 +4168,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
41684168 ) ;
41694169 } ) ;
41704170
4171- it . effect ( "Stop ends a background command no Codex process tracks any more " , ( ) =>
4171+ it . effect ( "settles a background command automatically after the Codex process exits " , ( ) =>
41724172 Effect . scoped (
41734173 Effect . gen ( function * ( ) {
41744174 const fs = yield * FileSystem . FileSystem ;
@@ -4244,27 +4244,19 @@ describe("CodexAdapterV2 post-settle continuation", () => {
42444244 yield * worker . drain ( ) ;
42454245 yield * Fiber . join ( settled ) ;
42464246 yield * worker . drain ( ) ;
4247- const before = yield * orchestrator . getThreadShell ( threadId ) ;
4248- assert . deepEqual (
4249- before ?. pendingBackgroundTasks ?. map ( ( task ) => task . kind ) ,
4250- [ "command" ] ,
4251- "the thread still shows the command the gone process never finished" ,
4252- ) ;
4253- const run = ( yield * orchestrator . getThreadProjection ( threadId ) ) . runs . at ( - 1 ) ! ;
4254- yield * orchestrator . dispatch ( {
4255- type : "run.interrupt" ,
4256- commandId : CommandId . make ( "stop-background-untracked" ) ,
4257- threadId,
4258- runId : run . id ,
4259- holdQueue : true ,
4260- } ) ;
4261- yield * worker . drain ( ) ;
42624247 const projection = yield * orchestrator . getThreadProjection ( threadId ) ;
42634248 assert . deepEqual (
42644249 projection . turnItems . flatMap ( ( item ) =>
42654250 item . type === "command_execution" ? [ item . status ] : [ ] ,
42664251 ) ,
4267- [ "interrupted" ] ,
4252+ [ "failed" ] ,
4253+ ) ;
4254+ const command = projection . turnItems . find ( ( item ) => item . type === "command_execution" ) ;
4255+ assert . isDefined ( command ) ;
4256+ assert . isNotNull ( command ?. completedAt ) ;
4257+ assert . notInclude (
4258+ projection . turnItems . map ( ( item ) => item . type ) ,
4259+ "run_interrupt_request" ,
42684260 ) ;
42694261 assert . equal ( projection . runs . at ( - 1 ) ?. status , "completed" ) ;
42704262 assert . deepEqual (
0 commit comments