Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Dec 22, 2025

Summary

The OpenAiHandler was not emitting tool_call_end events when the API stream ended with finish_reason === 'tool_calls'. This could cause the extension to appear stuck waiting for more stream data.

Changes

src/api/providers/openai.ts

  • Added tracking of active tool call IDs in both createMessage() and handleStreamResponse()
  • When finish_reason === 'tool_calls', emit tool_call_end events for all tracked tool calls
  • Matches the pattern used by other OpenAI-compatible providers (OpenRouter, LM Studio, xAI)

src/api/providers/__tests__/openai.spec.ts

  • Added test assertions to verify tool_call_end events are emitted when finish_reason === 'tool_calls'
  • Added coverage for both regular models and O3 family models

Related


Important

OpenAiHandler now emits tool_call_end events when streaming ends with finish_reason === 'tool_calls', ensuring proper event handling.

  • Behavior:
    • OpenAiHandler now emits tool_call_end events when finish_reason === 'tool_calls' in openai.ts.
    • Tracks active tool call IDs in createMessage() and handleStreamResponse().
  • Tests:
    • Added assertions in openai.spec.ts to verify tool_call_end events are emitted for both regular and O3 family models.
  • Misc:
    • Matches behavior with other OpenAI-compatible providers like OpenRouter, LM Studio, and xAI.

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

The OpenAiHandler was not emitting tool_call_end events when the API
stream ended with finish_reason === 'tool_calls'. This could cause the
extension to appear stuck waiting for more stream data.

Changes:
- Added tracking of active tool call IDs in createMessage() and handleStreamResponse()
- Emit tool_call_end events when finish_reason === 'tool_calls'
- Added test coverage for both regular and O3 family models

Closes: #10275
Linear: ROO-269
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 22, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 22, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The refactoring correctly extracts duplicate tool call processing logic into the new processToolCalls() helper method. The implementation maintains functional equivalence with the previous inline code, properly tracking active tool call IDs and emitting tool_call_end events when finish_reason === 'tool_calls'. Test coverage verifies the expected behavior for both regular models and O3 family models.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 22, 2025
Consolidates the duplicated tool call processing logic from createMessage()
and handleStreamResponse() into a single private helper method. This improves
maintainability and ensures consistent behavior across both code paths.
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 22, 2025
@daniel-lxs daniel-lxs merged commit 9b06a98 into main Dec 22, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Dec 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 22, 2025
@daniel-lxs daniel-lxs deleted the dan/roo-269 branch December 22, 2025 22:01
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 PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] API REQUEST STUCK!

4 participants