Repository navigation
fix(llm): preserve non-array tool result replay - #98863
momothemage wants to merge 1 commit into
Conversation
|
Codex review: found issues before merge. Reviewed July 1, 2026, 11:03 PM ET / 03:03 UTC. Summary PR surface: Source +67, Tests +85. Total +152 across 14 files. Reproducibility: yes. Source inspection shows current main iterates raw helper input as array-shaped content, so a plain string or single object can be dropped before replay text is produced. 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 findings
Review detailsBest possible solution: Settle the Plugin SDK contract before merge: either regenerate and commit the API baseline for Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main iterates raw helper input as array-shaped content, so a plain string or single object can be dropped before replay text is produced. Is this the best way to solve the issue? No, not merge-ready yet. Shared normalization is the right layer and this branch covers sibling providers, but the public SDK export needs baseline/contract handling or a private seam before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4a2a97777e35. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +67, Tests +85. Total +152 across 14 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
|
|
Closing: the underlying bug (#98825) is fixed on We took a different approach than this PR: instead of widening the shared replay helpers to tolerate non-array Thanks for digging into this — the character-by-character iteration analysis in #98825 was exactly right. If you hit a path where non-array tool-result content still reaches the extractors after e095dc8 (i.e. one that doesn't enter via session-file load), please open a fresh issue with the repro and we'll extend the boundary normalization there. |
Closes #98825.
What Problem This Solves
Fixes an issue where users could lose successful tool output on the next model turn when stored tool-result content reached provider replay as a plain string or single object instead of the canonical content-block array.
This is the same canonical bug targeted by #98838 and #98826, but this PR also covers the provider and transport replay callers that continue doing media/image checks after text extraction.
Why This Change Was Made
Tool-result replay now normalizes non-array content at the shared replay boundary and reuses that normalized view for text extraction, media placeholders, validated image blocks, non-vision image downgrade, provider payload construction, transport payload construction, and Copilot vision-header detection.
The fix keeps structured single-object content on the existing redacted/truncated structured fallback path instead of special-casing text-like fields in a way that could bypass existing replay safeguards.
User Impact
Tool results that were successfully produced as plain text, structured objects, or single image objects are preserved during provider replay instead of becoming
(no output)or failing when callers attempt.some()/.filter()on non-array content.Evidence
node scripts/run-vitest.mjs src/llm/providers/tool-result-text.test.ts src/llm/providers/openai-completions.test.tsnode scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfonode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfonode scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfonode scripts/run-oxlint.mjs extensions/google/transport-stream.ts src/agents/anthropic-transport-stream.ts src/agents/openai-transport-stream.ts src/llm/providers/anthropic.ts src/llm/providers/github-copilot-headers.ts src/llm/providers/google-shared.ts src/llm/providers/mistral.ts src/llm/providers/openai-completions.test.ts src/llm/providers/openai-completions.ts src/llm/providers/openai-responses-shared.ts src/llm/providers/tool-result-text.test.ts src/llm/providers/tool-result-text.ts src/llm/providers/transform-messages.ts src/plugin-sdk/provider-transport-runtime.tsnode scripts/check-plugin-sdk-subpath-exports.mjsgit diff --checkRuntime payload proof:
[ { "role": "tool", "content": "plain status output", "tool_call_id": "call_1" } ]That payload was produced locally by calling the real OpenAI Completions
convertMessages()path with atoolResultwhosecontentwas the plain string"plain status output".