Skip to content

fix: preserve streamed tool calls with reasoning content - #830

Merged
altic-dev merged 1 commit into
altic-dev:mainfrom
postoso:fix/command-mode-stream-tool-calls
Aug 11, 2026
Merged

altic-dev merged 1 commit into
altic-dev:mainfrom
postoso:fix/command-mode-stream-tool-calls

Conversation

@postoso

@postoso postoso commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Some chat-completions providers stream reasoning content, an empty content string, and tool calls in the same delta. The parser advanced to the next SSE event after handling content, so the sibling tool call was dropped. This keeps the reasoning/content paths mutually exclusive while still parsing tool calls from the same delta.

Type of Change

  • 🐞 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 🧹 Chore
  • 📝 Documentation update

Related Issue or Discussion

Fixes #445.

Testing

  • Tested on Intel Mac
  • Tested on Apple Silicon Mac
  • Tested on macOS version: 15.7.7
  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources
  • Ran formatter locally: swiftformat --config .swiftformat Sources (SwiftFormat is not installed locally)
  • Ran tests locally: xcodebuild test -project Fluid.xcodeproj -scheme Fluid -destination 'platform=macOS,arch=arm64' -only-testing:FluidDictationIntegrationTests/LLMClientStreamingTests CODE_SIGN_IDENTITY='' CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

The two focused regression tests pass. Reintroducing the skipped-event behavior makes the same-delta tool-call test fail, and restoring this patch makes both tests pass again.

Screenshots / Video

  • No UI/visual changes; screenshots/video are not applicable.

Notes

This intentionally addresses the streamed tool-call loss without changing provider-specific reasoning settings.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes chat-completions streaming so handling reasoning or content no longer skips sibling tool-call deltas.

  • Adds an injectable URLSession initializer for deterministic transport tests.
  • Adds regression coverage for separate-field and tag-based reasoning streams with chunked tool calls.

Confidence Score: 5/5

The PR appears safe to merge; the targeted control-flow fix preserves sibling tool calls and is covered by both relevant reasoning-stream formats.

The revised loop continues into tool-call parsing after processing content, while the new branch retains the existing separation between direct separate-field content handling and tag-based parsing.

Reviews (1): Last reviewed commit: "fix: preserve streamed tool calls with r..." | Re-trigger Greptile

@altic-dev

Copy link
Copy Markdown
Owner

merging without checking trusting you! hope this fixes the issue that's attached!!

@altic-dev
altic-dev merged commit a76736e into altic-dev:main Aug 11, 2026
6 checks passed
@postoso
postoso deleted the fix/command-mode-stream-tool-calls branch October 5, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞 BUG] Command Mode fails with reasoning models when streamed tool calls are dropped or reasoning settings are mismapped

2 participants