Repository navigation
fix(wework): keep live reasoning preview visible - #2390
Conversation
|
Warning Review limit reached
Next review available in: 8 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe chat now tracks streaming reasoning content across reducer and runtime state. ChangesStreaming reasoning preview
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ToolOutputHandler
participant VerificationFlow
participant AssistantThinkingIndicator
ToolOutputHandler->>VerificationFlow: signal tool follow-up receipt
VerificationFlow->>AssistantThinkingIndicator: validate reasoning preview
VerificationFlow->>ToolOutputHandler: release tool completion
ToolOutputHandler->>VerificationFlow: signal final text streaming
VerificationFlow->>ToolOutputHandler: release final completion
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wework/e2e/desktop/scenarios/streaming-text.scenario.mjs`:
- Line 702: Bound the tool follow-up wait at await toolFollowUpReceived by
reusing the existing Promise.race timeout pattern from requestReceived and the
shared 10-second step timeout. Ensure timeout rejection releases
toolCompletionRelease and produces a focused failure instead of waiting for the
outer CI timeout.
In `@wework/src/components/chat/AssistantThinkingIndicator.tsx`:
- Around line 39-41: Update the preview truncation logic in
AssistantThinkingIndicator so the returned string, including the ellipsis, never
exceeds THINKING_PREVIEW_MAX_LENGTH. When truncating, slice only up to the
maximum length minus the ellipsis length, while preserving the existing
untruncated behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a0d9f574-8bc4-494b-bc31-bc828956dcc9
📒 Files selected for processing (8)
wework/e2e/desktop/scenarios/streaming-text.scenario.mjswework/src/components/chat/AssistantThinkingIndicator.tsxwework/src/components/chat/MessageList.test.tsxwework/src/components/chat/MessageList.tsxwework/src/components/chat/blocks/ToolBlockItem.test.tsxwework/src/components/chat/blocks/ToolBlockItem.tsxwework/src/components/chat/blocks/ToolBlocksDisplay.test.tsxwework/src/components/chat/blocks/ToolBlocksDisplay.tsx
💤 Files with no reviewable changes (1)
- wework/src/components/chat/blocks/ToolBlockItem.test.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
wework/src/features/workbench/runtimeConversationTurns.ts (2)
94-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
assistant_cacheddoes not clearstreamingThinkingContent, unlike its counterpart.This handler updates
itemsand setsstatus: 'streaming', but it never resetsstreamingThinkingContent. The counterpartassistant_cachedcase inpackages/chat-core/src/workbench-message-reducer.ts(line 256) explicitly clears the equivalent field for the same action type, per that file's own change notes ("Cached assistant responses now clear any stale streaming thinking content"). Because the turn'sstatusstays'streaming'after this action, a thinking summary computed from an earlier phase of the turn can remain attached to the freshly cached content until the next chunk or completion event overwrites it.🐛 Proposed fix to clear the stale summary
case 'assistant_cached': return updateTurn(turns, action.subtaskId, turn => ({ ...turn, items: upsertBlocks(turn.items, action.blocks), status: 'streaming', + streamingThinkingContent: undefined, }))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/features/workbench/runtimeConversationTurns.ts` around lines 94 - 99, Update the assistant_cached handler in the runtime conversation turn reducer to clear streamingThinkingContent while preserving its existing items upsert and streaming status behavior. Match the equivalent assistant_cached handling in workbench-message-reducer.ts so stale thinking content is removed when cached assistant content is applied.
232-255: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winRecompute
streamingThinkingContentfrom the merged turn items.When
snapshot.statusisstreamingand assistant text has not changed, this merge can add newer blocks such as tools or thinking without changing assistant text. Keepinglocal.streamingThinkingContentcan surface an outdated summary whileitemsalready has the newer content, so derivestreamingThinkingContentfromitemsinstead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/features/workbench/runtimeConversationTurns.ts` around lines 232 - 255, Update mergeRuntimeConversationTurn so the preserveStreamingThinking branch derives streamingThinkingContent from the merged items value rather than reusing local.streamingThinkingContent; keep snapshot.streamingThinkingContent for the non-preserving branch.
🧹 Nitpick comments (1)
packages/chat-core/src/workbench-message-reducer.ts (1)
1020-1034: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsolidate the streamed thinking-content derivation.
packages/chat-core/src/workbench-message-reducer.tsandwework/src/features/workbench/runtimeConversationTurns.tskeep duplicateassistant_chunksummary logic that can diverge. Use one shared helper for the active thinking summary instead of maintaining both paths.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/chat-core/src/workbench-message-reducer.ts` around lines 1020 - 1034, Consolidate the duplicate assistant_chunk thinking-summary logic by extracting or reusing one shared helper for the active thinking content. Update getStreamingThinkingContent in packages/chat-core/src/workbench-message-reducer.ts and the corresponding logic at wework/src/features/workbench/runtimeConversationTurns.ts:621-630 to delegate to that helper, preserving the existing reasoningChunk, content, tool-block, and streaming fallback behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wework/e2e/desktop/scenarios/streaming-text.scenario.mjs`:
- Line 735: After releaseToolFinalCompletion() in the streaming scenario, wait
for the observable completed-turn state—specifically the enabled send button
used later—before taking the snapshot and performing the final-processing-toggle
click. Keep the existing final assertions unchanged once completion is
confirmed.
---
Outside diff comments:
In `@wework/src/features/workbench/runtimeConversationTurns.ts`:
- Around line 94-99: Update the assistant_cached handler in the runtime
conversation turn reducer to clear streamingThinkingContent while preserving its
existing items upsert and streaming status behavior. Match the equivalent
assistant_cached handling in workbench-message-reducer.ts so stale thinking
content is removed when cached assistant content is applied.
- Around line 232-255: Update mergeRuntimeConversationTurn so the
preserveStreamingThinking branch derives streamingThinkingContent from the
merged items value rather than reusing local.streamingThinkingContent; keep
snapshot.streamingThinkingContent for the non-preserving branch.
---
Nitpick comments:
In `@packages/chat-core/src/workbench-message-reducer.ts`:
- Around line 1020-1034: Consolidate the duplicate assistant_chunk
thinking-summary logic by extracting or reusing one shared helper for the active
thinking content. Update getStreamingThinkingContent in
packages/chat-core/src/workbench-message-reducer.ts and the corresponding logic
at wework/src/features/workbench/runtimeConversationTurns.ts:621-630 to delegate
to that helper, preserving the existing reasoningChunk, content, tool-block, and
streaming fallback behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 29926eb5-814c-4f3b-a0f4-7f7304de865a
📒 Files selected for processing (8)
packages/chat-core/src/workbench-message-reducer.test.tspackages/chat-core/src/workbench-message-reducer.tswework/e2e/desktop/scenarios/streaming-text.scenario.mjswework/src/components/chat/MessageList.test.tsxwework/src/components/chat/MessageList.tsxwework/src/features/workbench/runtimeConversationTurns.test.tswework/src/features/workbench/runtimeConversationTurns.tswework/src/types/workbench.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- wework/src/components/chat/MessageList.tsx
- wework/src/components/chat/MessageList.test.tsx
…reasoning-preview
…reasoning-preview # Conflicts: # wework/e2e/desktop/scenarios/streaming-text.scenario.mjs
What changed
Root cause
A reasoning item can finish before a tool call while the assistant turn remains active. The UI filtered the completed reasoning block immediately, so the later waiting row fell back to plain “正在思考” even though the latest reasoning summary was still the effective progress description.
The fix derives the latest reasoning summary from the running assistant message and passes it to the existing thinking status row. The turn lifecycle remains the visibility boundary: completion, failure, or cancellation removes the summary.
Impact
Validation
ai:verifydisplayed “正在思考 · Planning safe file and git inspection” during execution and removed it after completionSummary by CodeRabbit
New Features
Bug Fixes