Repository navigation
fix(tool-call-repair): preserve visible suffix when XML tool text is incomplete - #102240
qingminglong wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 12:35 PM ET / 16:35 UTC. Summary PR surface: Source +86, Tests +44. Total +130 across 3 files. Reproducibility: yes. Source inspection shows current main accepts the plain Review metrics: 1 noteworthy metric.
Stored data model 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
Maintainer decision needed
Security Review detailsBest possible solution: Land the shared repair after maintainer acceptance of the message-scrubbing risk and fresh exact-head checks; avoid duplicating this behavior in individual providers or channels. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main accepts the plain Is this the best way to solve the issue? Yes. The shared tool-call-repair grammar and stream normalizer own this provider-visible repair before channel delivery, while provider- or channel-specific fixes would duplicate the invariant. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 534ace4d8a49. Label changesLabel justifications:
Evidence reviewedPR surface: Source +86, Tests +44. Total +130 across 3 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
Review history (3 earlier review cycles) |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #104100, landed as The landed canonical scanner preserves visible suffix text after incomplete or oversized XML-ish tool syntax while bounding buffered events/bytes and keeping recognized incomplete syntax fail-closed. The exact malformed-stream cases, content-index preservation, terminal scrubbing, and live gateway behavior were covered in the 315-test focused matrix and exact-head proof on #104100. Thanks @wuqxuan for the original fix and regression evidence. |
What Problem This Solves
Fixes an issue where users could lose visible assistant text when a streamed response began with an oversized incomplete bracketed XML parameter block such as
[read]and then continued with a normal visible answer.Why This Change Was Made
The repair grammar now keeps optional missing
</function>handling scoped to legacy[tool:name]XML blocks, while the stream normalizer recovers the visible suffix after incomplete plain[name]XML parameter text without leaking XML closing markers.User Impact
Users now see the assistant's visible answer instead of receiving an empty completion when this malformed stream shape appears.
Evidence
[read]XML parameter prefix followed by visible text streams and finishes with only the visible suffix preserved.1c9b82504a814992df8db26011f42648b13f7206:node --import tsx --input-type=moduleran a redacted provider-returned stream through the real xAI provider wrapper path, importingwrapXaiProviderStreamfromextensions/xai/stream.tsandcreateAssistantMessageEventStreamfromsrc/llm/utils/event-stream.ts.{ "proof": "xai provider wrapper real path with local redacted provider stream", "eventTypes": ["text_delta", "done"], "textDelta": "Visible answer after an incomplete bracketed XML parameter block.", "finalContent": [ { "type": "text", "text": "Visible answer after an incomplete bracketed XML parameter block." } ], "containsVisibleSuffix": true, "containsXmlParameterClose": false, "containsPlainToolPrefix": false }1c9b82504a814992df8db26011f42648b13f7206:node scripts/run-vitest.mjs src/plugin-sdk/provider-stream-shared.test.tspassed with 67 tests passing.git diff --check HEAD~1..HEADpassed.python .agents\skills\autoreview\scripts\autoreview --mode localpassed with no accepted/actionable findings.text_deltaanddonecontainingVisible answer after an incomplete bracketed XML parameter block.and do not include</parameter>or[read].