Repository navigation
fix(wework): restore background task plans - #2281
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesTurn reconciliation and restoration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Workbench
participant useWorkbenchPaneSession
participant Transcript
Workbench->>useWorkbenchPaneSession: reconcile cached and transcript messages
useWorkbenchPaneSession->>Transcript: check matching settled turn identity
Transcript-->>useWorkbenchPaneSession: settlement status
useWorkbenchPaneSession-->>Workbench: selected conversation messages
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
…ration # Conflicts: # wework/e2e/desktop/task-flow.e2e.mjs # wework/src/components/layout/useWorkbenchPaneSession.test.ts # wework/src/components/layout/useWorkbenchPaneSession.ts
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/task-flow.e2e.mjs`:
- Around line 597-604: Update verifyBackgroundTaskPlanRestoration to begin with
a snapshot and assert the expected initial UI state using visible text or stable
elements before clicking add-context-button or set-plan-mode-button. Preserve
the existing plan-mode verification flow after this precondition check.
In `@wework/src/components/layout/useWorkbenchPaneSession.ts`:
- Around line 2899-2902: The latestRuntimeTurnIdentity function must inspect
only the newest message, rather than reverse-searching for an older message with
an identity. Return that latest message’s runtimeMessageTurnIdentity when it has
a turnId or subtaskId, otherwise return null so the documented transcript
fallback applies; add coverage for an identified older turn followed by an
identity-less latest response.
- Around line 2905-2910: Update runtimeMessageTurnIdentity to normalize each
non-null turnId and subtaskId with String(value) before constructing the set,
preserving only the subtaskId field and adding no subtask_id alias. Add coverage
verifying numeric and string identities match equivalently.
🪄 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: 149ecd88-0db0-4ee6-9f89-14d085954f0f
📒 Files selected for processing (5)
docs/en/wework/developer-guide/wework-chat-state-sources.mddocs/zh/wework/developer-guide/wework-chat-state-sources.mdwework/e2e/desktop/task-flow.e2e.mjswework/src/components/layout/useWorkbenchPaneSession.test.tswework/src/components/layout/useWorkbenchPaneSession.ts
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/components/layout/useWorkbenchPaneSession.test.ts`:
- Around line 110-117: Update the identity fixtures in the test “does not borrow
an older cached turn identity for an identity-less latest response” to use
subtaskId instead of turnId for both cached and transcript messages. Treat
subtaskId as the sole canonical transcript identity field and preserve the
test’s identity-less latest-response scenario.
🪄 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: c796986e-14f9-4f0b-aa83-b72ede4ec919
📒 Files selected for processing (3)
wework/e2e/desktop/task-flow.e2e.mjswework/src/components/layout/useWorkbenchPaneSession.test.tswework/src/components/layout/useWorkbenchPaneSession.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- wework/src/components/layout/useWorkbenchPaneSession.ts
- wework/e2e/desktop/task-flow.e2e.mjs
Summary
turnIdRoot cause
When a task finished in the background, returning to it could load a transcript that only covered an older turn. Because the lifecycle already reported the task as stopped, that stale transcript replaced the newer cached stream state and removed the generated plan from the pane.
The reconciliation now uses turn identity as the boundary between the two sources. It does not merge messages or compare content size.
User impact
Plans generated while another task is open remain visible when users return to the completed task.
Validation
pnpm exec vitest run src/components/layout/useWorkbenchPaneSession.test.tspnpm exec eslint src/components/layout/useWorkbenchPaneSession.ts src/components/layout/useWorkbenchPaneSession.test.ts e2e/desktop/task-flow.e2e.mjspnpm typecheckpnpm e2e:desktop -- --task-plan-onlySummary by CodeRabbit