@@ -127,10 +127,19 @@ async function persistSessionEntry(params: PersistSessionEntryParams): Promise<v
127127 params . sessionStore [ params . sessionKey ] = persisted ;
128128}
129129
130- function resolveFallbackRetryPrompt ( params : { body : string ; isFallbackRetry : boolean } ) : string {
130+ function resolveFallbackRetryPrompt ( params : {
131+ body : string ;
132+ isFallbackRetry : boolean ;
133+ isSubagent ?: boolean ;
134+ } ) : string {
131135 if ( ! params . isFallbackRetry ) {
132136 return params . body ;
133137 }
138+ // Subagents carry their task in the first message body — replacing it with a
139+ // generic continuation prompt would drop the task context entirely.
140+ if ( params . isSubagent ) {
141+ return params . body ;
142+ }
134143 return "Continue where you left off. The previous model attempt failed or timed out." ;
135144}
136145
@@ -174,10 +183,12 @@ function runAgentAttempt(params: {
174183 primaryProvider : string ;
175184 sessionStore ?: Record < string , SessionEntry > ;
176185 storePath ?: string ;
186+ isSubagentLane : boolean ;
177187} ) {
178188 const effectivePrompt = resolveFallbackRetryPrompt ( {
179189 body : params . body ,
180190 isFallbackRetry : params . isFallbackRetry ,
191+ isSubagent : params . isSubagentLane ,
181192 } ) ;
182193 const bootstrapPromptWarningSignaturesSeen = resolveBootstrapWarningSignaturesSeen (
183194 params . sessionEntry ?. systemPromptReport ,
@@ -866,6 +877,7 @@ async function agentCommandInternal(
866877 primaryProvider : provider ,
867878 sessionStore,
868879 storePath,
880+ isSubagentLane,
869881 onAgentEvent : ( evt ) => {
870882 // Track lifecycle end for fallback emission below.
871883 if (
0 commit comments