@@ -31,10 +31,13 @@ const subagentEvent = (status: string, origin = "app_owned") =>
3131
3232it . effect ( "records each delegated task's final outcome once, without ids or prompts" , ( ) => {
3333 const recorded : Array < { event : string ; properties : unknown } > = [ ] ;
34+ let shellLookups = 0 ;
3435 return Effect . gen ( function * ( ) {
3536 const analytics = yield * DelegatedTaskAnalytics . DelegatedTaskAnalytics ;
3637 yield * analytics . onSubagent ( subagentEvent ( "running" ) ) ;
3738 yield * analytics . onSubagent ( subagentEvent ( "completed" , "provider_native" ) ) ;
39+ // The first parent lookup fails; the next final update still reports the task.
40+ yield * analytics . onSubagent ( subagentEvent ( "completed" ) ) ;
3841 yield * analytics . onSubagent ( subagentEvent ( "completed" ) ) ;
3942 yield * analytics . onSubagent ( subagentEvent ( "completed" ) ) ;
4043 expect ( recorded ) . toEqual ( [
@@ -60,12 +63,14 @@ it.effect("records each delegated task's final outcome once, without ids or prom
6063 Layer . mock ( Orchestrator . OrchestratorV2 ) ( {
6164 streamDomainEvents : Stream . empty ,
6265 getThreadShell : ( ) =>
63- Effect . succeed ( {
64- modelSelection : {
65- instanceId : ProviderInstanceId . make ( "codex" ) ,
66- model : "gpt-5.5" ,
67- } ,
68- } as never ) ,
66+ ++ shellLookups === 1
67+ ? Effect . die ( "thread store unavailable" )
68+ : Effect . succeed ( {
69+ modelSelection : {
70+ instanceId : ProviderInstanceId . make ( "codex" ) ,
71+ model : "gpt-5.5" ,
72+ } ,
73+ } as never ) ,
6974 } ) ,
7075 Layer . mock ( ProviderRegistry . ProviderRegistry ) ( {
7176 getProviders : Effect . succeed ( [
0 commit comments