Repository navigation
fix(sidebar): keep each host's activity, PR lane and retention apart for a same-id workspace (dark) - #31517
Conversation
…lip) The fixes found while the sidebar ran from main's feed, without turning that on: ORCA_SIDEBAR_INPUTS_IS_MAIN stays false, and none of flip-a's stop-gaps come along. - Main stops counting a closed tab's terminal once it was asked to stop and no pane shows it; a failed or refused stop takes the request back, and a host out of contact stays unverifiable. - Main fetches a paired server's rows with the transport's normal bound, so a server slower than 5 s still lists. - A deferred unread raise flips the folder row it was decided for, and a read while the owner check is out cancels it. - Phone: no worktree.ps flash before the feed; a host's last installed feed stands in while a fresh read is out; it highlights its own last-opened workspace and a fold never scrolls; projects file under their project group with the desktop's indent; the collapse spinner shows only after 500 ms; "Reopen to update" keeps the rows on screen. - e2e helpers and journeys for the switch-on suite.
…d prune pending unread raises - A stop-and-wait that throws takes its stop request back, like one that fails. - A final stop the legacy relay still owes stays marked, since the relay retries it. - Pending unread raises are tracked only while one waits, so the map no longer grows. - The paired-server fallback poll test gives its third fetch a reply and asserts live.
…t, not bare id The feed published activity and PR facts by bare workspace id, so a same-id workspace on two hosts (a paired server and this desktop, or two servers) shared one host's facts. Activity and review are now keyed by row identity, retention sweeps per listed row, and the builder resolves each row's repo by its own host's registration. Bumps the feed semantics version to 3. Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
…ep activity keyed through a failed listing Host header counts and mixed-host labels read the row's own registration, as the host filter and row now do, so one render cannot file a row under one host and count it under another. A failed listing keys activity by the last rows. Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
# Conflicts: # mobile/src/host-screen/host-sidebar-feed-sections.test.ts # src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
# Conflicts: # src/shared/repo-host-identity.ts
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Retain active state across a delayed initial listing · sidebar-retention-owner.ts:135-143
src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts:135-143
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRetain active state across a delayed initial listing
noteActivityChange()can run before the asynchronouslistRowKeys()call completes. If the workspace becomes inactive before its firsthost|idrow arrives,updateSleepingSweepRetention()has never recorded that row as active. The row can therefore be removed during an unverifiable gap instead of receiving the grace window.Preserve active bare-ID bookkeeping across the pre-listing interval, then seed matching listed host-qualified rows. Do not publish bare IDs as retention values.
🟡 Minor · Restrict the bare-ID fallback to unqualified rows. · sidebar-feed-index.ts:97-102
src/shared/sidebar-list/sidebar-feed-index.ts:97-102
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRestrict the bare-ID fallback to unqualified rows.
When an explicitly hosted worktree has no host-qualified registration,
repoMap.get(worktree.repoId)can return the same-ID repository from another host.repoOfWorktreethen passes that repository to the row builder, which can expose the wrong path or connection metadata. Restrict the bare-ID fallback toworktree.hostId === undefined.Suggested fix
return ( reposByKey.get(getRepoHostIdentityForParts(worktree.repoId, hostId)) ?? - repoMap.get(worktree.repoId) + (worktree.hostId === undefined ? repoMap.get(worktree.repoId) : undefined) )
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d94f494d-e5ca-437c-997b-2aeec936f6f0
📒 Files selected for processing: 2
src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.tssrc/shared/repo-host-identity.ts
💤 Files with no reviewable changes: 1
- src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
ELI5
The same workspace can exist on two machines at once: on this computer and on a paired server, on two paired servers, or locally and over SSH. They share an id, because the id is just "project + folder path". The new sidebar data path looked up a workspace's activity and its pull request by that id alone, so one machine's copy could borrow the other copy's facts. This PR makes every one of those lookups say which machine it means.
What Changed
Before (only in builds with the new sidebar path switched on):
After: a paired server's copy keeps its own activity and PR lane, and every copy uses its own project registration. Two copies this computer lists itself (locally and over SSH) still share activity and the "keep it on screen through a reconnect" grace window; see the limit below.
Mechanism:
host|id(the same key the workspace rows already use), not by id. A paired server's facts are keyed by that server. This computer's own activity is keyed by the rows it lists; the workspaces data and the activity keys come from one listing per change, so they never disagree.host|id. For a row's project it uses that host's registration, for the row itself, the host filter, and the host counts and labels on headers, so one list can no longer file a row under one machine and count it under another. Where a host lists a copy without its own registration, it falls back to the project id, as the window does today.One limit stays, on purpose: this computer's own terminals, browser tabs and agents are recorded by id only (the window's session is keyed that way). When this computer itself lists the same id locally and over SSH, a bare-id fact still fans out to both copies in two places: the activity data (
keyWorkspaceActivityByRow,workspace-activity-facts.ts:46-59, called fromsidebar-inputs-feed-domains.ts), and retention's activity check (isActiveinsidebar-retention-owner.ts:141). So those two copies share activity and grace window. Fixing it needs host-keyed tabs and sessions in the window graph, which the design assigns to P5b-2. Paired-server copies are fully separate.Why
The design's identity audit (step P1) found these as the places where a bare id stood in for "this host's workspace". Typing the key fixes all of them and makes the compiler catch the next one. Alternatives considered: preferring one host on a collision (what the code did, which is the bug), or keying activity by owner host instead of row identity (that would need a second key convention beside the one the workspace rows and retention already publish).
Inert on main: everything changed here runs only with the new sidebar path switched on (
ORCA_SIDEBAR_INPUTS=main). The one shared piece that also runs with it off is the row planner, which gained an optional "find this row's project" input; the window's list does not pass it and gets exactly the old lookup.Linked Issue
N/A (internal sidebar refactor; follows the approved design, step P1).
Visual Proof
N/A. Shipped builds are unchanged (switch off). Switch-on behaviour is covered by the tests below.
Testing
pnpm tc: pass.Unit, node project,
--maxWorkers=2, oversrc/shared/sidebar-list,src/main/runtime/sidebar-inputs,src/renderer/src/lib,src/renderer/src/components/sidebar: 1144 files / 10876 tests pass. A wider run oversrc/sharedandsrc/main/runtimehad 3 failures that are local-machine only and fail the same way without this change (a fish shell profile, and macOS/private/vartemp paths).Mobile
vitest run: 1074 files / 11063 tests pass. Mobile tests typecheck ratchet passes.Static gate (every pr.yml static-analysis step, mobile typecheck and ratchet): 39/39 pass.
New tests: the same workspace id on two hosts keeps its own activity, PR lane, retention and project registration (shared builder); a server's activity never reaches this computer's same-id rows, and one listing feeds both the workspaces and activity data (main); a twin listed only after its id went idle earns no grace (retention, which tracks listed keys); twin PR facts read with each host's own registration (review). The old builder test that expected both servers' same-id rows to wake together now expects only the busy server's.
Merged onto main (P0 and P2 in);
pnpm tcpass; node unit tests over the touched areas 1175 files / 11226 tests pass (after updating one P2 test to read the PR fact by its row key); mobile 1082 files / 11199 tests pass; static gate 39/39.Switch-on e2e, full suite (
ORCA_SIDEBAR_INPUTS=main,ORCA_BACKGROUND_LAUNCH=1, 2 workers, hidden windows, shared busy Mac, run one after the other):817420850 failures are shared by both runs (load-sensitive terminal, paired-host and preview specs). Three failed only on this PR, all terminal and tab-strip specs (tab dock, inline TUI reveal, tab-switch restore); all three pass on rerun, 6/6 (
--workers=1 --repeat-each=2). Nine failed only on main. The sidebar and phone parity specs pass on both.ssh-orcad-phone-feed-listskips locally (needs a Docker SSH host and a Linux server template; CI's managed-SSH job runs it).I manually tested these changes locally (switch-on e2e, hidden launch)
Automated tests added/updated
Review
Agent skill upstream boundary
Notes
unverifiable, now under its own key.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)