Skip to content

fix(sidebar): keep each host's activity, PR lane and retention apart for a same-id workspace (dark) - #31517

Merged
Jinwoo-H merged 11 commits into
mainfrom
sidebar-p1-host-keys
Oct 21, 2026
Merged

Jinwoo-H merged 11 commits into
mainfrom
sidebar-p1-host-keys

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​356 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​317
Prod 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​295 $\color{#cf222e}{\Huge{\mathbf{−}}}$​148 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147

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):

  • A busy workspace on a paired server kept an idle same-id workspace on this computer visible under "Hide sleeping", and the other way round. Two servers with the same workspace shared one copy's activity.
  • Grouping by PR status put both copies in the lane of whichever copy's PR was read last.
  • A workspace row, its host filter and its header counts could use the other machine's registration of the project, so a local row could be counted under a paired server.

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:

  • The activity and review data the host publishes are keyed by 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.
  • PR facts for this computer's rows are read with each row's own project registration.
  • The "keep it on screen" sweep tracks each listed row's key instead of each id. Its activity check still looks up the bare id, so this computer's local and SSH copies of one id get the same answer (see the limit below).
  • The shared list builder looks everything up by 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.
  • If this computer's workspace listing fails, activity keeps using the last rows listed instead of stalling. A slower, older listing never overwrites a newer one's rows.
  • The reader types these keys, so a bare id no longer fits where a host and id are needed. Entries keyed by a bare id are ignored.
  • The feed's meaning version goes from 2 to 3, since the same data now means something different. A phone page open across a desktop update shows the existing "Reopen" prompt, as for any meaning change. No new wire fields or message types.

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 from sidebar-inputs-feed-domains.ts), and retention's activity check (isActive in sidebar-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, over src/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 over src/shared and src/main/runtime had 3 failures that are local-machine only and fail the same way without this change (a fish shell profile, and macOS /private/var temp 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 tc pass; 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):

    Build Passed Failed Skipped Did not run
    main 8174208 902 59 160 5
    this PR 909 53 160 4

    50 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-list skips 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: a server out of contact still reports its terminals as unverifiable, now under its own key.
  • Mixed versions: a host and page on different meaning versions show "Reopen" (existing behaviour). The window always reads its own host, so it never mixes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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
@Jinwoo-H
Jinwoo-H changed the base branch from sidebar-p0 to main October 21, 2026 17:34
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5bdd528c-d2d1-4db9-bc10-6ad0cb39a12d
📥 Commits

Reviewing files that changed from the base of the PR and between 3e55ec7 and 823730b.

📒 Files selected for processing: 1
  • src/renderer/src/store/slices/repo-host-identity.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Sidebar feed domains, retention, and row rendering now use host-qualified worktree identities. Activity and review facts, repository lookup, and retained rows distinguish same-ID worktrees across hosts. Tests and fixtures construct and verify host-qualified keys.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 82373

No actionable merge-blocking risk was identified in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 37 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: separating activity, pull-request lanes, and retention by host for same-ID workspaces. The “(dark)” suffix is minor noise but does not obscure the change.
Description check Passed The description follows the required template and clearly explains the user impact, mechanism, rationale, scope, testing, visual proof, compatibility considerations, and checklist status. The linked i…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description follows the required template and clearly explains the user impact, mechanism, rationale, scope, testing, visual proof, compatibility considerations, and checklist status. The linked issue is marked N/A with an internal-refactor explanation, which is consistent with the template’s maintainer exception.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

# Conflicts:
#	src/shared/repo-host-identity.ts
Claude-Session: e1fdb3d9-6985-4693-84aa-9a9fad732103

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟡 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 win

Retain active state across a delayed initial listing

noteActivityChange() can run before the asynchronous listRowKeys() call completes. If the workspace becomes inactive before its first host|id row 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 win

Restrict 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. repoOfWorktree then passes that repository to the row builder, which can expose the wrong path or connection metadata. Restrict the bare-ID fallback to worktree.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
📥 Commits

Reviewing files that changed from the base of the PR and between f1fe28b and 3e55ec7.

📒 Files selected for processing: 2
  • src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts
  • src/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.

@Jinwoo-H
Jinwoo-H merged commit 7df3ff7 into main Oct 21, 2026
47 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