Repository navigation
fix(agents): recover thinking errors from provider body - #98411
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 1:01 AM ET / 05:01 UTC. Summary PR surface: Source +1, Tests +12. Total +13 across 2 files. Reproducibility: yes. Current main's detector does not traverse errorBody, while ProviderHttpError stores bounded provider response body text there and the wrapper uses that detector for request and stream recovery. 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. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one narrow ProviderHttpError.errorBody recovery fix with the adjacent wrapper regression test, then close the linked issue and duplicate candidate PRs after merge. Do we have a high-confidence way to reproduce the issue? Yes. Current main's detector does not traverse errorBody, while ProviderHttpError stores bounded provider response body text there and the wrapper uses that detector for request and stream recovery. Is this the best way to solve the issue? Yes. Adding the existing ProviderHttpError.errorBody carrier to the existing detector and table test is the narrowest maintainable fix; broader carrier support is already separated into a follow-up issue. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d68ba5edc598. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1, Tests +12. Total +13 across 2 files. View PR surface stats
Acceptance criteria:
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
|
What Problem This Solves
Fixes an issue where Claude native-thinking sessions could stay stuck after Anthropic rejected a replayed thinking block signature. The recovery wrapper already knows how to retry without thinking blocks, but the production
ProviderHttpErrorshape kept the provider detail inerrorBody, which the detector did not inspect.Fixes #98308
Why This Change Was Made
The recovery detector now includes the existing
ProviderHttpError.errorBodycarrier in its error graph traversal. The result shape, retry count, and existing recovery behavior are unchanged.User Impact
Users on affected Claude native-thinking models can recover from this provider rejection path without destructive manual session compaction.
Evidence
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/thinking.test.tsnode scripts/run-vitest.mjs src/agents/embedded-agent-runner/thinking.test.ts src/agents/embedded-agent-runner/thinking-replay-repair.test.tspnpm exec oxfmt --check --threads=1 src/agents/embedded-agent-runner/thinking.ts src/agents/embedded-agent-runner/thinking.test.tsnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json src/agents/embedded-agent-runner/thinking.ts src/agents/embedded-agent-runner/thinking.test.tsnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfogit diff --checkLive proof: a local runtime script constructed a real
ProviderHttpErrorwith generic.messageand matching Anthropic JSON in.errorBody, then passed it throughwrapAnthropicStreamWithRecovery.No secrets or external services were used.
AI-assisted: built with Codex