-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: handle missing tool identity in OpenAI Native streams #10719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Re-review complete. No new issues found in the latest commit; the existing request-tracking header concern is still open.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| defaultHeaders: { | ||
| originator: "roo-code", | ||
| session_id: this.sessionId, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small concerns with the new request-tracking headers: (1) "session_id" is set to taskId when present, so it is no longer a stable session identifier; consider using a separate "task_id" header to avoid confusing downstream logs. (2) Some clients/proxies treat "User-Agent" as restricted; if this causes failures, using the existing DEFAULT_HEADERS user-agent shape might be safer.
Fix it with Roo Code or mention @roomote and request a fix.
6028ee1 to
dcabbf9
Compare
- Remove unnecessary Accept: text/event-stream header from openai-native - Fix undefined extensionVersion variable in openai-codex completePrompt() - Update tests to match new header expectations
Summary
Some OpenAI-compatible providers (streaming via Responses API or similar) emit
tool_call_arguments.deltaevents without repeating thecall_idornamethat was provided in the initialoutput_item.added(oroutput_item.doneif it arrived earlier). This caused theOpenAiNativeHandlerto emit partial tool call chunks with undefined ID/name, which the downstream parser ignored or failed to handle correctly.This change ensures that we capture the tool identity from
output_itemevents and use it as a fallback for subsequent argument deltas that lack identity.Changes
pendingToolCallIdandpendingToolCallNametoOpenAiNativeHandlerstate.processEventto capture tool identity fromresponse.output_item.addedandresponse.output_item.doneevents.processEventto use the pending identity when processingresponse.tool_call_arguments.deltaorresponse.function_call_arguments.deltaif the event itself is missing the ID/name.src/api/providers/__tests__/openai-native-tools.spec.ts.Important
Fixes handling of missing tool identity in
OpenAiNativeHandlerby using pending tool identity as fallback for argument deltas.tool_call_arguments.deltaandfunction_call_arguments.deltaevents inOpenAiNativeHandlerby usingpendingToolCallIdandpendingToolCallNameas fallbacks when ID/name are missing.processEventto capture tool identity fromresponse.output_item.addedandresponse.output_item.doneevents.pendingToolCallIdandpendingToolCallNametoOpenAiNativeHandlerto track tool identity.openai-native-tools.spec.tsto verify handling of missing call ID/name in tool call argument deltas.User-Agentheader inopenai-codex.tsandopenai-native.tsto usePackage.version.This description was created by
for 511ea50. You can customize this summary. It will automatically update as commits are pushed.