fix: recover leaked Claude XML tool calls#255
Merged
Conversation
# Conflicts: # packages/ai/CHANGELOG.md # packages/coding-agent/CHANGELOG.md # packages/coding-agent/src/changes.md # packages/coding-agent/src/core/extensions/changes.md
# Conflicts: # packages/coding-agent/src/changes.md # packages/coding-agent/src/core/extensions/changes.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
antml:Claude XML invokes from streamed assistant textrecoverTextToolCallsmodel configuration and wire bothModelRuntimestreaming entry pointsScope
packages/agent/src/agent-loop.tschangesstreamWith()body is byte-identical tomainVerification
Real CLI QA
All scenarios use localhost fake model servers and isolated sandboxes:
Evidence is retained locally under
local-ignore/qa-evidence/20260720-claude-xml-final-*.Independent review
Summary by cubic
Recover leaked Claude XML tool calls from streamed assistant text and emit them as native tool-call events without rewriting history. Wired into
ModelRuntimebehind arecoverTextToolCallsflag with strict ordering, metadata preservation, and fail-closed safety.New Features
antml:<invoke>calls from assistant text; eager streaming; excludes code, redacted thinking, and native blocks.recoverTextToolCalls(tri-state) on models; default on for Claude IDs and off when a native tool-call format exists; available inmodels.jsonand provider extensions.ModelRuntimestreaming entry points; add side-effect-free API registry and lazy stream cancellation; add mock-loop CLI modes for complete/truncated leaks onanthropic-messagesandopenai-completions.Bug Fixes
Written for commit 1ead3bb. Summary will update on new commits.