fix(wework): prevent sidebar title refresh rollback - #2548
Conversation
|
Warning Review limit reached
Next review available in: 30 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 (2)
📝 WalkthroughWalkthroughRuntime stream events now update addressed tasks in memory. Runtime-work refreshes no longer run for stream lifecycle events. Local task titles remain visible until matching executor titles confirm them. ChangesRuntime task synchronization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 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: 1
🤖 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/src/features/workbench/WorkbenchProvider.test.tsx`:
- Around line 2728-2735: Update the deferred cloud response in the relevant
WorkbenchProvider test to include runtime-a with the same device and workspace
identity and the stale task title “解决冲突” instead of an empty projects list. Keep
the assertion that “解决分支冲突” remains visible, so the test exercises the
title-conflict handling and stale-response protection.
🪄 Autofix
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: c10e62cb-e0a1-4f03-95e6-a9faabe6df78
📒 Files selected for processing (9)
wework/DESIGN.mdwework/src/features/workbench/WorkbenchProvider.test.tsxwework/src/features/workbench/WorkbenchProvider.tsxwework/src/features/workbench/runtimePaneMessages.test.tswework/src/features/workbench/runtimePaneMessages.tswework/src/features/workbench/useWorkbenchDataRefresh.tswework/src/features/workbench/workbenchReducer.tswework/src/features/workbench/workbenchRuntimeHelpers.test.tswework/src/features/workbench/workbenchRuntimeHelpers.ts
💤 Files with no reviewable changes (1)
- wework/src/features/workbench/runtimePaneMessages.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts (1)
17-36: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSettle execution when the task status is terminal.
If a snapshot has
running: trueandstatus: 'complete', Line 17 accepts it because terminal status bypasses stale rejection. Lines 19-36 then setexecutionPhaseto'running'and clearexpectedExecutorRunning. Later identical snapshots keep the completed task running.Treat a terminal
statusas idle regardless ofrunning. Clear the turn state in the same branch. Add a regression test for a terminal snapshot that reportsrunning: true.Proposed fix
+ const isTerminal = isTerminalTaskStatus(event.task.status) const shouldIgnoreStaleSnapshot = snapshotRunning !== null && expectedRunning !== null && snapshotRunning !== expectedRunning && - (!isTerminalTaskStatus(event.task.status) || hasIdentifiedActiveTurn) + (!isTerminal || hasIdentifiedActiveTurn) if (shouldIgnoreStaleSnapshot) return state const executionPhase = - snapshotRunning === null ? state.executionPhase : snapshotRunning ? 'running' : 'idle' - const turnPhase = snapshotRunning === false ? 'idle' : state.turnPhase - const activeTurnId = snapshotRunning === false ? null : state.activeTurnId + isTerminal || snapshotRunning === false + ? 'idle' + : snapshotRunning === true + ? 'running' + : state.executionPhase + const turnPhase = isTerminal || snapshotRunning === false ? 'idle' : state.turnPhase + const activeTurnId = isTerminal || snapshotRunning === false ? null : state.activeTurnId🤖 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/runtimeTaskLifecycle/reducer.ts` around lines 17 - 36, Update the snapshot handling logic in the reducer branch containing shouldIgnoreStaleSnapshot so terminal task statuses force executionPhase to 'idle' regardless of snapshotRunning. In the same terminal-status branch, clear turn state by setting turnPhase to 'idle' and activeTurnId to null, and ensure repeated terminal snapshots remain settled. Add a regression test covering a terminal snapshot with running: true.
🤖 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.
Outside diff comments:
In `@wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts`:
- Around line 17-36: Update the snapshot handling logic in the reducer branch
containing shouldIgnoreStaleSnapshot so terminal task statuses force
executionPhase to 'idle' regardless of snapshotRunning. In the same
terminal-status branch, clear turn state by setting turnPhase to 'idle' and
activeTurnId to null, and ensure repeated terminal snapshots remain settled. Add
a regression test covering a terminal snapshot with running: true.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c91786ae-a75f-4114-bbbf-10dad0b1a2d4
📒 Files selected for processing (7)
wework/src/features/workbench/WorkbenchProvider.test.tsxwework/src/features/workbench/WorkbenchProvider.tsxwework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.tswework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.tswework/src/features/workbench/runtimeTaskLifecycle/reducer.tswework/src/features/workbench/useWorkbenchDataRefresh.tswework/src/features/workbench/workbenchReducer.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- wework/src/features/workbench/WorkbenchProvider.tsx
- wework/src/features/workbench/WorkbenchProvider.test.tsx
What changed
Root cause
The generated title updated reducer state, but the local runtime-work ref retained the original title. A cloud background request that started earlier later merged from that stale ref and dispatched the full list, temporarily restoring the old title. Start and terminal stream events also triggered extra full-list refreshes, creating more opportunities for the stale snapshot to win.
Validation
pnpm --dir wework typecheckpnpm --dir wework lintpnpm --dir wework test(335 files, 3245 tests)Summary by CodeRabbit
Improvements
Bug Fixes