Skip to content

Nudge once when assistants print tool-call markup as text - #885

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-7642-detect-verbatim-tool-markup
Sep 11, 2026
Merged

Nudge once when assistants print tool-call markup as text#885
TheGreatAxios merged 3 commits into
mainfrom
cl-7642-detect-verbatim-tool-markup

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Detects when assistants print <tool_call> markup as text instead of a real tool_call block and issues one corrective nudge per no-real-tool epoch
  • That nudge does not advance the tool-less narration spiral; thinking blocks stay out of report text
  • Documents the extra precedence in fleet stop policy and covers success recoveries after the nudge

Verification

  • bun test ./src/subagent/nudge-director.test.ts --randomize --seed 424242 passes (25 tests)
  • bun run check lint, typecheck, and build pass; remaining suite failures are pre-existing session/FS tests unrelated to this branch

Fixes CL-7642

@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

CL-7642

@TheGreatAxios
TheGreatAxios force-pushed the cl-7642-detect-verbatim-tool-markup branch from 4a695dc to 3e213d3 Compare September 11, 2026 01:04

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review · Comment

One verbatim-markup nudge per no-real-tool epoch. Markup check runs before complete-envelope stop policy.

Findings

  • src/subagent/nudge-director.ts:314-329hasVerbatimToolCallMarkup returns before evaluateSubAgentStop. A valid four-heading envelope that also quotes <tool_call><function=…> becomes a nudge (subagent-verbatim-tool-call-nudge) instead of complete. A later clean envelope still completes.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critic · Comment

Epoch flag does not increment toolLessNarrationCycles. Thinking/XML stay on wrap-up. Flag clears on real tool_call and parent follow-up.

Findings

  • Completeness is already owned by hasReportEnvelope in stop-policy.ts:156-167. Markup-first intercept can reopen a finished worker.

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.
Document recovery of verbatim tool markup in fleet stop policy.
@TheGreatAxios
TheGreatAxios force-pushed the cl-7642-detect-verbatim-tool-markup branch from cdb3776 to d172cd8 Compare September 11, 2026 03:11
@TheGreatAxios
TheGreatAxios merged commit 22d53b4 into main Sep 11, 2026
9 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7642-detect-verbatim-tool-markup branch September 11, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant