Repository navigation
fix(core): settle malformed tool input on failure - #36477
Merged
Merged
Conversation
kitlangton
force-pushed
the
tool-input-settle
branch
from
July 12, 2026 01:38
a05550a to
0c161ee
Compare
kitlangton
force-pushed
the
tool-input-settle
branch
from
July 12, 2026 01:39
0c161ee to
3e3ac88
Compare
This was referenced Jul 12, 2026
This was referenced Jul 19, 2026
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
What
Malformed streamed tool JSON now produces one truthful failure at the point where it occurs. Previously, the malformed call remained unresolved until the next prompt, so the transcript made one provider failure look like two separate failures.
Before
1. The provider returns malformed tool input
The step reports the provider error, but the started tool remains unresolved.
2. The user continues the session
The next prompt discovers the stale tool and adds a second, misleading interruption.
After
1. The malformed call fails with the step
The tool is settled immediately with the original provider error.
2. The user continues normally
There is no stale tool left to repair and no delayed interruption appears.
Fixes #36421
How
packages/core/src/session/runner/publish-llm-event.tsflushes partial input, fails only started tools that never reachedtool-call, then publishes the terminal step failure.packages/core/test/session-runner.test.tscovers partial malformed input, anInvalidProviderOutputstream failure, durable event ordering, and a later resume with no second repair failure.Scope
This is limited to started-but-uncalled tool input at the provider failure boundary. It does not redesign general step settlement, running tool execution, or event architecture.
Testing
Red on
origin/v2(02e22770573078e346ccc573c4f784d5dc0054a9)Failed at
expect(terminal).toMatchObject(...): receivedsession.step.failed.1withInvalid JSON input for tool call echo, followed only after resume bysession.tool.failed.1withTool execution interrupted; expected the tool failure first with the original invalid-output message.Green
The push hook also completed the repository Turbo typecheck: 31 successful tasks.
Flow