WIP: Route inline reasoning streams#3446
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration option, reasoning_stream_style, which allows users to customize how streaming reasoning content is handled and separated from the main answer text. It supports separate fields, inline tags (e.g., <think>...</think>), or treating reasoning content as standard text. The changes include updates to client initialization, SSE chunk parsing, configuration loading, documentation, and comprehensive unit tests. The reviewer suggested using fully qualified paths for SystemTime and UNIX_EPOCH in the new configuration test to avoid potential compilation issues if they are not imported.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let nanos = SystemTime::now() | ||
| .duration_since(UNIX_EPOCH) | ||
| .unwrap() | ||
| .as_nanos(); |
There was a problem hiding this comment.
To prevent potential compilation errors if SystemTime and UNIX_EPOCH are not imported in this test module, it is safer to use their fully qualified paths from std::time.
| let nanos = SystemTime::now() | |
| .duration_since(UNIX_EPOCH) | |
| .unwrap() | |
| .as_nanos(); | |
| let nanos = std::time::SystemTime::now() | |
| .duration_since(std::time::UNIX_EPOCH) | |
| .unwrap() | |
| .as_nanos(); |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Add provider-scoped reasoning_stream_style handling for chat-completion streams so OpenAI-compatible routes can choose separate_field, inline_tags, or none without a new provider enum variant. Inline <think> blocks are streamed into Thinking content blocks, including tags split across SSE chunks, while none preserves raw visible text and existing separate-field reasoning keeps its default behavior. Refs #3222.
Limit the legacy parse_sse_chunk wrapper to test builds so release and clippy builds use only the style-aware stream parser path. Refs #3222.
53ef812 to
3636629
Compare
|
Claude finished @Hmbown's task in 5m 19s —— View job PR Review: Route inline reasoning streams
SummaryThe routing logic is sound and the state machine for split-chunk tag parsing is correct. A few issues worth addressing before this ships, in priority order: 1. Silent fallback on unrecognized config value —
|
Summary
reasoning_stream_styleconfig forseparate_field,inline_tags, andnonestream behavior<think>...</think>content into Thinking blocks, including tags split across SSE chunksTests
cargo fmt --all -- --checkcargo test -p codewhale-tui --bin codewhale-tui --locked reasoning_stylecargo test -p codewhale-tui --bin codewhale-tui --locked provider_config_loads_reasoning_stream_stylecargo test -p codewhale-tui --bin codewhale-tui --locked stream_decoder_testscargo test -p codewhale-tui --bin codewhale-tui --locked stream_reasoning(0 matching tests)git diff --checkRefs #3222.
Reported with detailed route-shape examples by @buko.