Switch the agent review canvas snapshot synchronously when the active workspace changes, so the review canvas follows the session when users move between workspaces. The existing session-owned browser-tab synchronization remains in place.
Type and Areas
Type: Bug fix, regression fix, UI/UX, test
Areas: Web UI, review canvas, workspace/session switching
Motivation / Impact
When two workspaces both had review content, switching the workspace changed the session view but could leave the previous workspace's review canvas visible. The previous React effect ran after workspace activation, so the target review tab could open before the target canvas snapshot was selected.
The change centralizes workspace snapshot switching in a guarded helper, handles synchronous workspace:switched and workspace:active-changed events before the target review tab opens, and keeps the context effect as a fallback. Repeated events for the same workspace are ignored.
Verification
pnpm --dir src/web-ui run test:run AuxPane.workspace-switch.test.tsx — passed (1 test) on the main, release/1.0.6, and release/1.0.5-based branches.
pnpm run type-check:web — passed on all three branches.
git diff HEAD^ HEAD --check — passed.
Reviewer Notes
No backend, protocol, or persisted-data shape changes. The focused test verifies synchronous canvas switching before the target review tab opens and suppresses duplicate swaps. HarmonyOS device behavior and remote workspace, remote control, Peer Device Mode, and Detached Dispatch scenarios were not exercised end to end.
Summary
Fixes OpenBitFun/bitfun_ade#133.
Switch the agent review canvas snapshot synchronously when the active workspace changes, so the review canvas follows the session when users move between workspaces. The existing session-owned browser-tab synchronization remains in place.
Type and Areas
Type: Bug fix, regression fix, UI/UX, test
Areas: Web UI, review canvas, workspace/session switching
Motivation / Impact
When two workspaces both had review content, switching the workspace changed the session view but could leave the previous workspace's review canvas visible. The previous React effect ran after workspace activation, so the target review tab could open before the target canvas snapshot was selected.
The change centralizes workspace snapshot switching in a guarded helper, handles synchronous
workspace:switchedandworkspace:active-changedevents before the target review tab opens, and keeps the context effect as a fallback. Repeated events for the same workspace are ignored.Verification
pnpm --dir src/web-ui run test:run AuxPane.workspace-switch.test.tsx— passed (1 test) on the main, release/1.0.6, and release/1.0.5-based branches.pnpm run type-check:web— passed on all three branches.git diff HEAD^ HEAD --check— passed.Reviewer Notes
No backend, protocol, or persisted-data shape changes. The focused test verifies synchronous canvas switching before the target review tab opens and suppresses duplicate swaps. HarmonyOS device behavior and remote workspace, remote control, Peer Device Mode, and Detached Dispatch scenarios were not exercised end to end.
Checklist