Repository navigation
fix(ai): accept responses calls without item ids - #45081
Merged
Merged
Conversation
3 of 6 tasks
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
function_calloutput items that include requiredcall_idbut omit optional provider itemidcall_idotherwisecall_idwithout inventing provider item metadataitem_idvalidation and existing WebSocket incremental continuationBefore and after
The Responses API permits a completed function call without an item ID:
{ "type": "response.output_item.done", "item": { "type": "function_call", "call_id": "call_1", "name": "lookup", "arguments": "{\"query\":\"weather\"}" } }Before: OpenCode ignored the call because
item.idwas absent.After: OpenCode emits the normal tool call with ID
call_1, parses its arguments, and replays the subsequent history without fabricating a provider item ID:[ { "type": "function_call", "call_id": "call_1", "name": "lookup", "arguments": "{\"query\":\"weather\"}" }, { "type": "function_call_output", "call_id": "call_1", "output": "{\"forecast\":\"sunny\"}" } ]Argument-stream events still require their own protocol-level
item_id; when it differs fromcall_id, registeredoutput_indexroutes the event to the correct pending call.Verification
bun test test/partial-json.test.ts test/tool-stream.test.ts test/provider/openai-responses.test.ts test/provider/openai-compatible-responses.test.ts test/provider/openai-responses-images.recorded.test.ts test/provider/openai-responses-websocket.recorded.test.ts test/provider/openai-chat.test.ts test/provider/anthropic-messages.test.ts test/provider/bedrock-converse.test.ts test/provider/xai-responses.test.ts test/response.test.ts test/tool-runtime.test.ts --timeout 30000 --only-failures(379 passing)RECORDED_PREFIX=openai-responses bun test test/provider/golden.recorded.test.ts --timeout 30000 --only-failuresbun typecheckfrompackages/aibunx prettier --check packages/ai/src/protocols/open-responses.ts packages/ai/test/provider/openai-responses.test.ts packages/ai/test/provider/openai-compatible-responses.test.ts