fix(agent-core): ignore truncated tool calls#97140
Conversation
Co-authored-by: Galin Iliev <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 10:13 PM ET / 02:13 UTC. Summary PR surface: Source +26, Tests +382. Total +408 across 12 files. Reproducibility: yes. Source inspection gives a high-confidence reproduction path: return a final assistant message with Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this PR after maintainers accept the Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence reproduction path: return a final assistant message with Is this the best way to solve the issue? Yes. Agent-core is the correct final authorization boundary for tool execution and replay, and the PR also updates sibling provider normalization so the fix is not one-provider-only. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 552ec2b49d4a. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +26, Tests +382. Total +408 across 12 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready proof for
Behavioral proof covers completed tool-use dispatch, length/error/abort suppression, provider stop-reason preservation, EOF without a finish reason, Known proof gaps: none. |
|
Merged via squash.
|
* fix(agent-core): ignore truncated tool calls Co-authored-by: Galin Iliev <[email protected]> * fix(agent-core): require explicit tool-call terminals --------- Co-authored-by: Galin Iliev <[email protected]>
* fix(agent-core): ignore truncated tool calls Co-authored-by: Galin Iliev <[email protected]> * fix(agent-core): require explicit tool-call terminals --------- Co-authored-by: Galin Iliev <[email protected]>
* fix(agent-core): ignore truncated tool calls Co-authored-by: Galin Iliev <[email protected]> * fix(agent-core): require explicit tool-call terminals --------- Co-authored-by: Galin Iliev <[email protected]>
* fix(agent-core): ignore truncated tool calls Co-authored-by: Galin Iliev <[email protected]> * fix(agent-core): require explicit tool-call terminals --------- Co-authored-by: Galin Iliev <[email protected]>
* fix(agent-core): ignore truncated tool calls Co-authored-by: Galin Iliev <[email protected]> * fix(agent-core): require explicit tool-call terminals --------- Co-authored-by: Galin Iliev <[email protected]> (cherry picked from commit 5625960)
What Problem This Solves
Closes #97091. A model response that reaches a length, error, or aborted terminal while still emitting tool calls can contain incomplete calls. Those calls must not execute, persist, or replay as valid tool use.
This supersedes #97092. The contributor fork cannot accept maintainer pushes, so this branch preserves @galiniliev's work and coauthor credit while carrying the review fixes.
Why This Change Was Made
toolUsethe final agent-loop authorization gate for tool dispatch.lengthanderrorterminals across Google, Ollama, shared OpenAI-compatible, and DeepSeek DSML normalization instead of reclassifying them from parsed calls.errorterminal path rather than a successfuldoneevent.User Impact
Truncated or failed generations no longer execute partial tool calls, including unintended child-session spawns. Complete tool calls still execute normally.
Evidence
node scripts/run-vitest.mjs packages/agent-core/src/agent-loop.test.ts src/plugin-sdk/provider-stream-shared.test.ts src/llm/providers/google-shared.test.ts src/agents/openai-transport-stream.test.ts extensions/google/transport-stream.test.ts extensions/ollama/src/stream.test.ts— 451 tests passed across four shards.oxfmt --checkandoxlint --deny-warningspassed for all 12 changed files.git diff --check origin/main...HEADpassed.