Repository navigation
fix(ai): serialize undefined historical tool input - #48863
Merged
Merged
Conversation
rekram1-node
force-pushed
the
missing-tool-input
branch
from
September 14, 2026 00:36
9e78d4e to
884edc4
Compare
rekram1-node
force-pushed
the
missing-tool-input
branch
from
September 14, 2026 04:26
44f7ada to
0a6f879
Compare
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.
Summary
{}in OpenAI Chat and shared Responses tool-call lowering.Schema and failure verification
ToolCallPart.inputisSchema.Unknown. An explicitinput: undefinedpasses both the part schema and decoding into the canonicalMessageclass. Omitting the requiredinputproperty entirely is rejected by the part schema.Before this change, an otherwise schema-valid message containing undefined input failed synchronously in JSON encoding, before making an HTTP request. The new tests decode the message through the real schema, compile it successfully, assert
arguments: "{}", and verify the canonical input remains unchanged.Live verification
Requests containing undefined historical input plus a matching error result were sent through the actual native compiler and
LLMClient.generatestreaming path usinggpt-4.1-minion both OpenAI Chat and Responses. Both completed normally and returned the exact fixture error codeINPUT_MISSING, with no generated tool calls. No model-requested tools were executed.Checks
bun test test/provider/missing-tool-input.test.ts test/provider/openai-chat.test.ts test/provider/openai-responses.test.ts --timeout 30000 --only-failures— 215 passed.bun typecheckfrompackages/ai— passed.git diff --check— passed.