Skip to content

Commit dd6cca2

Browse files
committed
Nudge once when assistants print tool-call markup as text
Models sometimes emit <tool_call><function=...> wrappers as assistant text instead of real tool_call blocks. Catch that narrow shape, give one corrective nudge per no-real-tool epoch without counting it as incomplete-report narration, then fall through to the existing report policy. Thinking blocks and arbitrary XML stay out of scope; the epoch resets only on genuine tool activity or a parent follow-up.
1 parent c05b2f7 commit dd6cca2

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/subagent/nudge-director.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,24 @@ 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+
314332
const stop = evaluateSubAgentStop({
315333
hasToolCalls,
316334
thrashState: this.thrashState,

0 commit comments

Comments
 (0)