Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Jan 14, 2026

Summary

Some OpenAI-compatible providers (streaming via Responses API or similar) emit tool_call_arguments.delta events without repeating the call_id or name that was provided in the initial output_item.added (or output_item.done if it arrived earlier). This caused the OpenAiNativeHandler to 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_item events and use it as a fallback for subsequent argument deltas that lack identity.

Changes

  • Added pendingToolCallId and pendingToolCallName to OpenAiNativeHandler state.
  • Updated processEvent to capture tool identity from response.output_item.added and response.output_item.done events.
  • Updated processEvent to use the pending identity when processing response.tool_call_arguments.delta or response.function_call_arguments.delta if the event itself is missing the ID/name.
  • Added a regression test case in src/api/providers/__tests__/openai-native-tools.spec.ts.

Important

Fixes handling of missing tool identity in OpenAiNativeHandler by using pending tool identity as fallback for argument deltas.

  • Behavior:
    • Fixes handling of tool_call_arguments.delta and function_call_arguments.delta events in OpenAiNativeHandler by using pendingToolCallId and pendingToolCallName as fallbacks when ID/name are missing.
    • Updates processEvent to capture tool identity from response.output_item.added and response.output_item.done events.
  • State Management:
    • Adds pendingToolCallId and pendingToolCallName to OpenAiNativeHandler to track tool identity.
  • Testing:
    • Adds regression test in openai-native-tools.spec.ts to verify handling of missing call ID/name in tool call argument deltas.
  • Misc:
    • Updates User-Agent header in openai-codex.ts and openai-native.ts to use Package.version.

This description was created by Ellipsis for 511ea50. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jan 14, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 14, 2026

Oroocle Clock   See task on Roo Cloud

Re-review complete. No new issues found in the latest commit; the existing request-tracking header concern is still open.

  • Clarify request-tracking headers for OpenAI Native (session_id stability vs taskId, and potential User-Agent restrictions)
Previous reviews

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,
},
Copy link
Contributor

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.

@hannesrudolph hannesrudolph force-pushed the fix/openai-native-tool-identity branch from 6028ee1 to dcabbf9 Compare January 15, 2026 15:50
- 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
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 15, 2026
@hannesrudolph hannesrudolph merged commit f2b16d4 into main Jan 15, 2026
12 of 13 checks passed
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 15, 2026
@hannesrudolph hannesrudolph deleted the fix/openai-native-tool-identity branch January 15, 2026 18:42
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 15, 2026
@mrubens mrubens mentioned this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants