fix(core): recover malformed tool input#37669
Open
opencode-agent[bot] wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool-input-errorwith stable call identity, authoritative raw input, provider metadata, and hosted-tool identitySafety
Malformed input is never repaired or executed. Recovery is enabled only for a known, unexecuted tool proposal with stable call identity; generic invalid provider output remains terminal.
Already-started local siblings are awaited and retain their truthful results. Provider-executed identity is preserved from input start through settlement even when later events omit the optional flag, preventing hosted tools from being dispatched locally.
Interrupted streams never enter automatic recovery. Repeated malformed responses stop after five total requests: the initial request plus four recovery retries. Every malformed response remains a durably failed Step rather than being retried as the same physical attempt.
Anthropic hosted-tool recovery lowers synthetic failures to valid tool-specific
*_tool_result_errorpayloads. OpenAI Responses uses the authoritative final arguments even when they differ from streamed deltas oroutput_item.addedis absent.Tests
packages/aisuite: 344 passed, 29 recorded/live cases skippedpackages/core/test/session-runner.test.ts: 133 passedpackages/coresuite: 1,341 passed, 6 Mercurial cases skippedbun typecheckpassed inpackages/ai,packages/core,packages/schema,packages/client,packages/sdk/js,packages/protocol,packages/server,packages/cli,packages/tui,packages/app,packages/opencode, andpackages/sdk-nextpackages/clientandpackages/sdk/jsoutputs; repeated generation produced stable hashesgit diff --checkSource discussion: https://slack.com/archives/C0BE69AHCQP/p1784401085221000
Requested by: @StarpTech (Dustin Deus via Slack)