Show multiplayer workspace presence in the right sidebar

Merged
AU
2mo ago
+2202-32

Cloud workspace rows show the profile heads of people currently viewing that workspace, on the right of the row. Names appear on hover and through VoiceOver; four heads fit in the stack, followed by an overflow count. Empty and local-only rows have no decoration. There is no additional tab, panel, or presence button.

Each mounted Cloud row receives its own roster even when another workspace is selected. Only the foreground selection announces viewing. The branch includes the latest git pull origin main. The Xcode project conflict was resolved by retaining both the profile-head tests and main's workspace-projection tests.

Impact map

  • Source of truth and owner: authenticated live leases in the per-workspace WorkspacePresence Durable Object. CmuxWorkspacePresence owns scope validation, snapshots, reconnects and shared row subscriptions. The Mac controller provides immutable roster values to native Cloud rows; profile identity comes from Stack.
  • Callers and lifecycle inspected: row configuration/reuse/hiding/detachment; trailing accessories and native hover/VoiceOver; shared workspace selection across UI/CLI entrypoints; late Cloud binding; main-window changes; app activity; account/team generations; iOS selection/sign-out/teardown; WebSocket close/reconnect and lease expiry; existing avatar rendering. Device heartbeat and registry paths remain separate.
  • Persistence/API/platform/localization/docs/release effects: adds /v1/workspace-presence and append-only DO migration v3. No Postgres schema, billing, CLI/socket methods, relay permissions, shortcuts, settings, or release metadata changes. Both UI keys have all 20 locales present in the app catalog. Documentation covers the protocol and row ownership. Minimal existing Worker import/nullability/fetch-seam errors were fixed so the service bundles and typechecks.
  • Focused behavior tests and risk: separate regression commits reproduce stale disconnect output and a delayed iOS identity lookup restoring cleared selection. Shared tests cover independent row rosters, passive versus selected viewing, selection switch, inactivity, disconnect, transient credential retry, account replacement, and teardown completion. Native tests exercise hover/VoiceOver updates, cell reuse and compact overflow. Worker tests cover scope isolation, expiry/coalescing and bounded identity.
  • Trade-off / residual risk: one connection per mounted workspace, shared across windows, plus the offscreen active selection; no machine-wide directory is exposed. Unexpected disconnects expire within the 45-second server lease. Missing images use initials/person icons. The shared dev presence endpoint still returns 404 and Wrangler is signed out locally: authenticated local Worker proof is complete, but cross-Mac dogfood needs an isolated Worker deployment. Cloud VM operations use the GCP backend independently.

Verification

  • swift test --package-path Packages/Shared/CmuxWorkspacePresence: 8 tests pass after merging main, with no new Swift warnings.
  • Presence Worker: typecheck passes; all 263 tests pass. Real dev-Stack auth against the local branch Worker passes join isolation, inactivity, switch, duplicate-device coalescing, clean close, and the actual 45-second DO expiry alarm.
  • Native CloudWorkspacePresenceHeadsTests: both tests passed on the previously verified head b2fabf77f9: https://github.com/manaflow-ai/cmux/actions/runs/36105031121. The app/test-target compile log has zero presence-source warnings or errors.
  • iOS authority tests: 2 tests pass in a focused SwiftPM harness compiling the checked-in announcer, token source, protocol and tests against the real shared package. This verifies those source paths; it is not a complete iOS app build or device installation.
  • Swift file lengths, PBX normalization/test wiring, package lockfile policy and workspace package grouping pass. Localization audit: the two active keys have all 20 catalog locales; the required 9-locale validator has 0 parity errors. The only localize-changes attention item is an unchanged AppDelegate interpolated default; its diff contains no copy change.
  • Current head: 340eb1739ed4128e433a509d4b47bf187691047f; merged origin/main at 7bc844f425. The merge preserves both Cloud workspace test suites and main's device-section controls. Eight focused Swift tests and 263 Worker tests pass after the merge, along with Worker typechecking, project normalization, package grouping and Swift file budgets. Current-head CI and the exact-tag build are being refreshed; prior green CI was https://github.com/manaflow-ai/cmux/actions/runs/36105026898.
  • GCP backend: https://cmux-dev-backend-1.tail137216.ts.net:4532/, healthy; authenticated /api/vm returns 200. The previously verified b2fabf77f9 artifact is published and launched as issue-13296-multiplayer-workspace-presence, authenticated with the personal dev account and both Cloud beta/feature-flag gates verified. Artifact SHA-256: 24e2405660fe542cf578874f1b05ba2ca819713bda94ee458085ea83a2054b5a. Receipts: artifacts/fleet/b2fabf77f971694bc2fbf6c30cc18a005294b9cf-{submit,terminal,publish,launch}.json.

Closes #13296

Nightly dogfood plan: once this PR and the presence Worker are deployed, have two people view one Cloud workspace, switch one person to a second workspace, then leave/background/disconnect. Confirm the profile head stays on the right of the workspace being viewed and names remain available on hover. This is the remaining cross-Mac live check; it is not claimed by the local Worker proof.