@@ -311,24 +311,6 @@ export class SubAgentDirector extends DefaultDirector {
311311 this . thrashState = nextThrashState ( this . thrashState , content ) ;
312312 }
313313
314- if (
315- ! hasToolCalls &&
316- ! this . verbatimToolCallNudgeFired &&
317- hasVerbatimToolCallMarkup ( content )
318- ) {
319- this . verbatimToolCallNudgeFired = true ;
320- this . interventions ( {
321- id : "verbatim-tool-call" ,
322- class : "nudge" ,
323- state : this . interventionState ( ) ,
324- detail : "assistant emitted explicit tool-call markup as text" ,
325- } ) ;
326- return [
327- capabilities . checkpoint ( "subagent-verbatim-tool-call-nudge" ) ,
328- inferWithSubAgentNudge ( capabilities , VERBATIM_TOOL_CALL_NUDGE ) ,
329- ] ;
330- }
331-
332314 const stop = evaluateSubAgentStop ( {
333315 hasToolCalls,
334316 thrashState : this . thrashState ,
@@ -352,6 +334,27 @@ export class SubAgentDirector extends DefaultDirector {
352334 if ( compacted !== null ) return compacted ;
353335 return terminal ;
354336 }
337+
338+ // Below the stop policy so a finished report that merely quotes
339+ // tool-call markup still completes; a markup turn with no envelope
340+ // gets the corrective nudge instead of the generic wrap-up one.
341+ if (
342+ ! hasToolCalls &&
343+ ! this . verbatimToolCallNudgeFired &&
344+ hasVerbatimToolCallMarkup ( content )
345+ ) {
346+ this . verbatimToolCallNudgeFired = true ;
347+ this . interventions ( {
348+ id : "verbatim-tool-call" ,
349+ class : "nudge" ,
350+ state : this . interventionState ( ) ,
351+ detail : "assistant emitted explicit tool-call markup as text" ,
352+ } ) ;
353+ return [
354+ capabilities . checkpoint ( "subagent-verbatim-tool-call-nudge" ) ,
355+ inferWithSubAgentNudge ( capabilities , VERBATIM_TOOL_CALL_NUDGE ) ,
356+ ] ;
357+ }
355358 if ( stop === "incomplete-report" ) {
356359 // Tool-less turn after tools, no report envelope. Must not fall through
357360 // to super.decide — DefaultDirector completes any tool-less turn.
0 commit comments