Repository navigation
fix(wework): restore history after rapid conversation switching - #2333
Conversation
📝 WalkthroughWalkthroughRuntime transcript restoration now requires both transcript key and displayed identity matches. Component and desktop coverage exercise rapid switching and late-response isolation. CI path classification now uses merge-base diff ranges, with validation ensuring all relevant workflows use the updated syntax. ChangesTranscript restoration and desktop flow validation
CI changed-path classification
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 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 |
d43c5c9 to
5a1030f
Compare
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/e2e/desktop/task-flow.e2e.mjs`:
- Around line 1597-1618: Move or repeat the active-pane snapshot assertions
after releaseConcurrentMemoryResponses() and the running-task settlement in the
rapid-switch flow. Verify the active A conversation still contains both expected
user and assistant history messages and excludes
CONVERSATION_SWITCH_RACE_PROMPT, using the existing snapshot and assertion
helpers around restoredAfterRace.
🪄 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: 68b54652-ef18-48bf-b408-fb985c05452a
📒 Files selected for processing (6)
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.tswework/src/e2e/automation.tswework/src/features/workbench/WorkbenchProvider.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- docs/zh/wework/developer-guide/wework-chat-state-sources.md
- docs/en/wework/developer-guide/wework-chat-state-sources.md
5a1030f to
e406de4
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
wework/e2e/desktop/task-flow.e2e.mjs (1)
1562-1566: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRepeated task-row snapshot boilerplate.
taskRowsBeforeRaceduplicates the same "snapshot body → filterruntime-local-task-row-ids" pattern already used fortaskRowsBeforeConversation(line 1442) and elsewhere in this file (taskRowsBeforeInitialTask,projectRowsBeforeComposerCreate). Extracting a small helper (e.g.captureExistingTaskRowIds(control)) would remove this recurring duplication.As per coding guidelines: "Before adding code, search for and reuse existing components, services, utilities, and patterns; extract shared logic instead of duplicating it."
♻️ Suggested helper
+async function captureExistingTaskRowIds(control) { + return new Set( + JSON.parse(await control.command('snapshot', 'body')).testIds.filter(testId => + testId.startsWith('runtime-local-task-row-') + ) + ) +}- const taskRowsBeforeRace = new Set( - JSON.parse(await control.command('snapshot', 'body')).testIds.filter(testId => - testId.startsWith('runtime-local-task-row-') - ) - ) + const taskRowsBeforeRace = await captureExistingTaskRowIds(control)🤖 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/e2e/desktop/task-flow.e2e.mjs` around lines 1562 - 1566, Extract the repeated snapshot-and-filter logic into a shared helper such as captureExistingTaskRowIds(control), then replace taskRowsBeforeRace and the equivalent task-row collection sites including taskRowsBeforeConversation and taskRowsBeforeInitialTask with calls to that helper. Preserve the existing snapshot command and runtime-local-task-row- ID filtering behavior.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 1562-1566: Extract the repeated snapshot-and-filter logic into a
shared helper such as captureExistingTaskRowIds(control), then replace
taskRowsBeforeRace and the equivalent task-row collection sites including
taskRowsBeforeConversation and taskRowsBeforeInitialTask with calls to that
helper. Preserve the existing snapshot command and runtime-local-task-row- ID
filtering behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 186a9547-7bdf-4686-8200-92da388a9a44
📒 Files selected for processing (11)
.github/scripts/test-classify-ci-changes.sh.github/workflows/e2e-tests.yml.github/workflows/lint.yml.github/workflows/test.yml.github/workflows/wework-e2e.ymldocs/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.tswework/src/e2e/automation.tswework/src/features/workbench/WorkbenchProvider.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/en/wework/developer-guide/wework-chat-state-sources.md
Summary
Root cause
loadedRuntimeTranscriptKeyReftracked only the last successfully loaded task. During a rapid switch, task B could replace the displayed messages while its transcript was still pending. Switching back to task A then returned early because A was still the last loaded key, even though the pane was displaying B.The pane now skips transcript restoration only when both the loaded key and the displayed transcript identity match the target task.
Verification
pnpm --filter wework exec vitest run src/components/layout/useWorkbenchPaneSession.test.ts src/features/workbench/WorkbenchProvider.test.tsx— 142 passedorigin/main— passedwework/test-results/desktop-e2e/2026-07-30T08-06-18-113Z-11406Summary by CodeRabbit
Bug Fixes
Tests
Additional CI fix
mainafter a branch diverges from incorrectly enabling backend, CLI, frontend, or platform E2E jobsAdditional verification
bash .github/scripts/test-classify-ci-changes.sh— passedactionlint -shellcheck=for all changed workflows — passed