Skip to content

fix(web-ui): promote re-added workspaces within their device - #3938

Merged
bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:bob/promote-existing-workspace
Nov 16, 2026
Merged

bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:bob/promote-existing-workspace

Conversation

@bobleer

@bobleer bobleer commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Re-adding an already opened workspace now moves it to the first position within its device's workspace list (e.g. adding B again changes A/B/C to B/A/C). Device sections keep their order, and ordinary workspace activation retains the existing stable-order behavior.

Type and Areas

Bug fix — Desktop Web UI workspace management and sidebar.

Motivation / Impact

Previously, adding an existing workspace could appear to do nothing because the sidebar preserved its old position. Local and SSH workspace opening now explicitly promote existing entries and use the existing host reorder API to persist the order. If persistence is unsupported or fails, the current window still shows the promoted order and logs the failure.

Details:

  • "Already opened" is decided from the list held before the host call, so a concurrent list refresh cannot make a brand-new workspace look re-added.
  • Promotion happens within the workspace's sidebar section (projects / assistants), like a drag reorder, so the pinned assistant's stored slot is untouched; nothing is persisted when it is already the first project.
  • The promoted order is shown immediately and persisted afterwards (no extra host round trip before the sidebar updates).
  • Background SSH restore opts out (promoteIfOpened: false); only explicit adds move a row. The flag is manager-only and is not sent to the host.
  • The sidebar reuses the drop animation to slide rows into place and scrolls the promoted row into view (block: 'nearest'), so the move is visible when the list is scrolled.
  • Device-switch races: a switch during persistence leaves the promotion on its own device and the open rejects with a surface-changed error; the newly rendered device is untouched.

Verification

  • pnpm run check:web
  • pnpm --dir src/web-ui run test:run on workspaceManager.test.ts, workspaceDisplayOrder.test.ts, WorkspaceListSection.test.tsx, DeviceWorkspaceSections.test.tsx, SSHRemoteProvider.test.tsx, createProject.test.ts, MainNav.projectCreation.test.tsx — 7 files, 203 tests passed.
  • New regressions: concurrent-refresh race (new workspace not promoted), assistant slot preserved, restore does not promote, promoted order shown before persistence resolves, local/remote device switch during persistence, sidebar reveal on promotion.
  • git diff --check

Remote coverage is simulated: SSH workspace opening/restore, Peer Device surface isolation, and unsupported host persistence. No live SSH, Peer Device, Remote Control, or Detached Dispatch run was performed. No wire protocol or persisted shape changes.

Reviewer Notes

AI-assisted; testing level: lightly tested (focused automated coverage and Web UI checks, no native desktop/manual remote verification). Manual acceptance: with a scrolled sidebar, add an already listed local or SSH workspace and confirm it slides to first within its device and is scrolled into view; switch devices and confirm each device's workspace order and device-section order remain intact; restart with SSH workspaces and confirm restore does not reorder them.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable (no copy changes).

@bobleer
bobleer merged commit 8cd6f3f into openBitFun:main Nov 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant