@@ -4772,6 +4772,52 @@ describe("CodexAdapterV2 post-settle continuation", () => {
47724772 ] ,
47734773 } ) ;
47744774
4775+ it . effect ( "marks a root command it wakes the agent for once the command finishes" , ( ) =>
4776+ Effect . gen ( function * ( ) {
4777+ const harness = yield * makeCodexReplayHarness ( {
4778+ ...backgroundExecTranscript ,
4779+ entries : backgroundExecTranscript . entries . map ( ( entry ) =>
4780+ entry . type === "emit_inbound" && entry . label === "item/completed/command-late"
4781+ ? { ...entry , afterMs : 0 }
4782+ : entry ,
4783+ ) ,
4784+ } ) ;
4785+ yield * harness . runtime . startTurn (
4786+ makeCodexTestTurnInput ( {
4787+ threadId : harness . threadId ,
4788+ providerThread : harness . providerThread ,
4789+ now : yield * DateTime . now ,
4790+ attemptId : RunAttemptId . make ( "attempt-command-completion-wake" ) ,
4791+ text : BG_PROMPT ,
4792+ } ) ,
4793+ ) ;
4794+ const commands = ( ) =>
4795+ harness . events . flatMap ( ( event ) =>
4796+ event . type === "turn_item.updated" && event . turnItem . type === "command_execution"
4797+ ? [ [ event . turnItem . status , event . turnItem . completionWake ] ]
4798+ : [ ] ,
4799+ ) ;
4800+ yield * harness . until (
4801+ ( ) => harness . continuationRequests . length === 1 && commands ( ) . length === 2 ,
4802+ ) ;
4803+ // Restart recovery reads this to keep the wake the restart cut.
4804+ assert . deepEqual ( commands ( ) , [
4805+ [ "running" , "always" ] ,
4806+ [ "completed" , "always" ] ,
4807+ ] ) ;
4808+ } ) . pipe (
4809+ Effect . scoped ,
4810+ Effect . provide (
4811+ Layer . mergeAll (
4812+ IdAllocator . layer ,
4813+ McpProviderSessions . layer ,
4814+ NodeServices . layer ,
4815+ NodeCrypto . layer ,
4816+ ) ,
4817+ ) ,
4818+ ) ,
4819+ ) ;
4820+
47754821 it . effect ( "wakes with well-formed text when the cuts split an emoji" , ( ) =>
47764822 Effect . scoped (
47774823 Effect . gen ( function * ( ) {
0 commit comments