Skip to content

fix(web-ui): show re-added workspace promotion immediately and keep it scoped - #3939

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

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

Conversation

@bobleer

@bobleer bobleer commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #3938 (merged before this review landed). Re-adding an already opened workspace still moves it to the first position within its device's workspace list; this tightens when that happens and makes the move visible.

Type and Areas

Bug fix — Desktop Web UI workspace management and sidebar.

Motivation / Impact

Review of #3938 found these gaps:

  • New workspace mistaken for a re-add. "Already opened" was read after the host call, so a concurrent list refresh (e.g. the background refresh of a previous setActiveWorkspace) could make a brand-new workspace look re-added, promote it, and persist that order. It is now decided from the list held before the host call.
  • Pinned assistant slot. Promotion moved the workspace to index 0 of the whole opened list, ahead of the assistant, while drag reorder only rewrites project positions. Promotion now stays within the workspace's sidebar section (projects / assistants); nothing is persisted when it is already the first project.
  • Latency. The sidebar did not update until an extra host reorder round trip finished (noticeable on Peer Device / SSH). The promoted order is now shown first and persisted afterwards; a failed persist keeps the shown order and logs a warning, as before.
  • Background SSH restore. Restore uses the same openRemoteWorkspace; it now passes promoteIfOpened: false, so only explicit adds move a row. The flag is manager-only and is not sent to the host.
  • Invisible move. With a scrolled sidebar the promoted row could jump out of view, so the add still looked like it did nothing. The sidebar now reuses the drop animation to slide rows into place and scrolls the promoted row into view (block: 'nearest'), driven by a new workspace:promoted event emitted before the reordered state is published.

A device 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 --dir src/web-ui run type-check
  • 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. Two fix(web-ui): promote re-added workspaces within their device #3938 race tests were rewritten because publishing no longer waits for persistence.
  • 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; restart with SSH workspaces open 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).

…t scoped

- Decide whether a workspace was already open from the list held before the
  host call, so a concurrent list refresh cannot make a new workspace look
  re-added and move it to the top.
- Promote within the workspace's sidebar section, like a drag reorder, so the
  pinned assistant's stored slot is untouched and no reorder is persisted when
  the workspace is already the first project.
- Publish the promoted order before persisting it instead of waiting for an
  extra host round trip.
- Background SSH restore opts out of promotion; only explicit adds move a row.
- The sidebar slides rows into place and scrolls the promoted row into view,
  so the move is visible when the list is scrolled.
@bobleer
bobleer merged commit b2d33ee 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