fix(agents): transform tool call output text#97765
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this PR is a partial same-root-cause fix, while #97769 is open, mergeable, proof-positive, and covers the missing final-result tool-call path for the same linked issue. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Land one canonical implementation for #97761, preferably the proof-positive narrow candidate in #97769 unless maintainers choose the broader alternative, then close the remaining duplicate branches. So I’m closing this here and keeping the remaining discussion on #97761 and #97769. Review detailsBest possible solution: Land one canonical implementation for #97761, preferably the proof-positive narrow candidate in #97769 unless maintainers choose the broader alternative, then close the remaining duplicate branches. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main does not transform Is this the best way to solve the issue? No. This PR is a plausible partial fix, but the best fix must also transform final assistant-message Security review: Security review cleared: The diff only changes the agent text-transform helper and its focused test; no dependency, CI, permission, package, downloaded-code, or secret-handling surface changed. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 6cb82eaab865. |
|
Ensured the PR body has explicit real-behavior proof sections for the proof gate. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
Fixes #97761.
Plugin
textTransforms.outputcurrently rewrites streamed assistant text and final messages, but skips structured tool-call output boundaries. Providers that emit masked or placeholder strings throughtoolcall_deltaor parsedtoolCall.argumentscan therefore pass stale values into later tool execution even though normal text output is transformed.Why This Change Was Made
The stream wrapper already owns output replacement at the provider boundary. This change extends that same boundary to tool-call deltas and the string leaves inside tool-call argument objects, while leaving tool names, ids, numeric values, and other metadata untouched.
User Impact
Users relying on plugin output replacements get consistent behavior for tool-call payloads as well as regular assistant text, reducing the chance that masked placeholders reach external tools.
Evidence
node scripts/run-vitest.mjs src/agents/plugin-text-transforms.test.tspnpm format:check src/agents/plugin-text-transforms.ts src/agents/plugin-text-transforms.test.tsgit diff --checkRefs/Fixes: #97761