Skip to content

Sidebar: land the switch-on fixes from the flip branch on main, switch still off - #31466

Merged
Jinwoo-H merged 2 commits into
mainfrom
sidebar-p0
Oct 21, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
sidebar-p0

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1648 $\color{#cf222e}{\Huge{\mathbf{−}}}$​171 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1477
Prod 29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​754 $\color{#cf222e}{\Huge{\mathbf{−}}}$​126 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​628

ELI5

We have a not-yet-switched-on version of the sidebar where the app's background process (main) owns the workspace list, and both the desktop window and the phone just draw what main publishes. While testing that version with the switch on, we found and fixed a set of bugs on a test branch (#30790, "flip-a"). This PR brings those fixes to main without turning the switch on and without the temporary stop-gaps that branch used. Shipped builds behave as before.

What Changed

Nothing changes for users of a normal build: ORCA_SIDEBAR_INPUTS_IS_MAIN stays false. Every product change below is either behind that switch or is a main-side fix that is correct either way. With the switch on (a ORCA_SIDEBAR_INPUTS=main build):

  • Closing a workspace's last terminal tab takes the row out of the "Hide sleeping" list right away. Before, it stayed for about 300-500 ms until the terminal's exit arrived. Main now stops counting a terminal once it has been asked to stop and no pane shows it. If the stop fails or is refused, the request is taken back, so the terminal counts as running again. A terminal whose host is out of contact stays unverifiable, never gone.
  • Paired server slower than 5 s: its workspaces now list. Before, they stayed empty. Main fetches a paired server's rows with the transport's normal timeout instead of its own 5 s timeout.
  • Unread on folder workspaces: a delayed "mark unread" now flips the folder row it was decided for, not whichever same-id row is on screen when the host check answers. A "mark as read" made while that check is still out cancels the raise.
  • Phone list:
    • It no longer flashes the plain worktree.ps list before the feed arrives. A host's last installed feed stands in while a fresh read is out.
    • It highlights only the workspace this phone last opened on that host. The desktop's selection never stands in, so a hidden or never-opened row leaves nothing lit. Folding a group never scrolls the list.
    • Projects are filed under their project group, with the desktop's per-level indent.
    • The collapse spinner shows only if the desktop has not answered within 500 ms.
    • "Reopen to update" keeps the rows on screen instead of blanking the list.
  • e2e helpers and journeys for the switch-on suite (setup-prompt dismissal, DOM-change sampling, phone platform matching).

Runs with the switch off

Three changes are not behind the switch:

  1. A failed, refused or thrown stop takes back its stop request, in every build (kill.ts stopAndWaitPtyFromRuntimeController, renderer-kill.ts). So if the terminal exits on its own later, the exit is labeled by its real cause, not "operator closed". One exception: a final stop the legacy relay still owes keeps its request, because the relay retries it.
  2. The phone list no longer scrolls to the desktop's selection when a group unfolds or a hidden row comes back (use-active-worktree-scroll.ts). It follows the same rule as the highlight: the phone tracks only its own last-opened workspace.
  3. The phone's last-visited storage gains a byHost entry, written by read-merge-write. Older readers ignore the new field and are unaffected.

Keep / drop, by flip-a commit (git log --first-parent origin/main..origin/sidebar-flip-a)

flip-a commit Outcome
f672603 flip 1/3 Split. Dropped: the flip line, removing the switch from the dark-build guards, deleting the window goldens (window goldens stay), and rewriting switch-off unit tests for switch-on. Kept: the owner-host check (owner-host-sidebar-inputs.ts) and phone "Reopen" keeps rows on screen
42bdbc5 / fa1b102 / c8ebb50 / e60f563 Mark as read drops a pending raise Kept: product change and new host-raises test. Dropped: deletions of switch-off tests (still meaningful with the switch off)
b9433f9, 804975c, 4f80b8c, a88afdd, 28ff1f7, f4d5563, 758ba01, d71745b, ec08840 e2e Kept
d4b5c4f, 2bb9162 drag hold release on dragend Already on main, identical
e219e6d creations the window draws Already on main, identical
be74ac4 folder unread raise Kept
6c7bb44 paired-server fetch bound Kept
8bf4c22 file projects under group; 21b6c22 indent Kept (the rest of 8bf4c22 already reached main via #31102). Its parity fixture is kept and runs under main's switch-off parity test
77a82b9, 24fb57c spinner spacing and 500 ms delay Kept
2fe4926 typecheck phone feed tests Kept
8dd366f use-sort-order switch-on keys; 746e214 switch-on fixtures; 01a6b9e pin switch off Dropped: switch-on test rewrites, not needed with the switch off
d94cc40 #31081, 8989273 #31296 phone highlight Kept
e696ff6 #31301 no flash Kept; its first-frame test now mocks the switch on, the same way other mobile feed tests do
a0e6cd8 #31249 window slept set (sidebarSession.sleptWorkspaces) Dropped (bridge). Its tests go too. The closed-tab tests from #31306 that shared its test file move to orca-runtime-closed-tab-retention.test.ts
d8444d9 #31309 feed gave-up fallback Dropped (bridge)
8465608 #31306 Split. Kept: main half (stop-request activity facts, clearPtyStopRequest, failed-stop handling, and tests). Dropped: renderer removal hold and the sidebar-pending-overlay.ts split, which existed only for that hold
b7c061e startup hold (via merge 8b0e04e) and use-startup-ready-feed.ts (via merge e320b7e) Dropped (bridge), with its parity test
#31369 Not in flip-a; not included

Why

The sidebar design ("one owner per fact", P0) lands each piece on main on its own and inert. Bridges never land on main; each one is replaced in the later PR that removes its need. Reconstructing from flip-a's net diff, minus the dropped pieces, gives one reviewable change instead of replaying merge history. The flip itself stays a one-line PR at the end.

Linked Issue

N/A (internal sidebar refactor; follows the approved design).

Visual Proof

N/A. Shipped builds are unchanged (switch off). The switch-on behaviour is covered by the e2e suite below.

Testing

  • pnpm tc: pass (rerun after the review fixes; touched unit tests 147 files / 1455 tests and 11 files / 109 tests pass).

  • Unit, node project, --maxWorkers=2: 63 files / 597 tests touched by this diff or by flip-a's diff, all pass. These include main's restored switch-off tests and the window goldens.

  • Mobile vitest run: 1074 files / 11063 tests pass.

  • Static gate (all pr.yml static-analysis steps, mobile typecheck and ratchet): 39/39 pass.

  • Switch-on e2e, full suite (ORCA_SIDEBAR_INPUTS=main, ORCA_BACKGROUND_LAUNCH=1, 2 workers, hidden windows, shared busy Mac):

    Build Passed Failed Skipped Did not run
    sidebar-flip-a head 6dbe87e 882 71 157 7
    this PR 888 69 159 7

    65 failures are shared by both runs (load-sensitive terminal, perf and timing specs). Four failed only on this PR: file-explorer IME, golden core flow, manual worktree order persistence, and markdown find. All four pass on rerun, 30/30 (--workers=1 --repeat-each=2). Six failed only on flip-a. No test was tied to a dropped bridge, so the pass count does not drop.

  • 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: an out-of-contact host's terminal stays unverifiable even after a stop request.
  • Mixed versions: an older paired server is still detected by capability.
  • No wire changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A visual proof with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • typecheck, tests, lint pass locally

…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.
@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: 8fc6a495-12b6-40ee-a6c5-288dc4c31b9d
📥 Commits

Reviewing files that changed from the base of the PR and between 97d3487 and dbcd6fa.

📒 Files selected for processing: 5
  • src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts
  • src/main/ipc/pty/runtime/kill.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts
  • src/renderer/src/store/slices/workspace-attention/workspace-unread-flag.ts
  • src/renderer/src/store/slices/worktrees/listing/owner-host-sidebar-inputs.ts
🚧 Files skipped from review as they are similar to previous changes: 4
  • src/renderer/src/store/slices/worktrees/listing/owner-host-sidebar-inputs.ts
  • src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts
  • src/main/ipc/pty/runtime/kill.ts

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

📝 Walkthrough

The PR updates mobile host sidebar grouping, per-host last-visited highlighting, feed restoration, and row behavior. It also changes PTY stop-request cleanup, paired-server fetch timeouts, and host ownership checks for workspace unread flags. The remaining changes add and update tests and E2E support for these behaviors.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to dbcd6

A folder’s unread indicator can be missed when a read switches hosts during a pending ownership check. The case is narrow, but it remains a known switch-on behavior to address or accept before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 53.49% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 86 functions across 50 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 identifies the main change: bringing switch-on sidebar fixes from the flip branch to main while keeping the switch disabled.
Description check Passed The description is detailed and covers the required explanation, changes, rationale, testing, visual proof, review notes, and checklist. It uses “N/A” for the linked issue, which differs from the temp…
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 is detailed and covers the required explanation, changes, rationale, testing, visual proof, review notes, and checklist. It uses “N/A” for the linked issue, which differs from the template, but the PR identifies this as an internal refactor and otherwise provides sufficient context.

✨ 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.

@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.

Actionable comments posted: 3

🧹 Nitpick comments: 1
src/renderer/src/store/slices/workspace-attention/workspace-unread-flag.ts: 1

49-56: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

The readsByWorkspace map grows without bound.

The map gets one entry per workspace ID and never removes entries. Workspaces are deleted over a long session, so stale IDs stay in the map. Each entry is small, so the impact is low. Delete the entry when the workspace is removed, or when no raise is pending.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f49b5482-f517-479a-801f-eaa572dbf0ab
📥 Commits

Reviewing files that changed from the base of the PR and between a58789d and 97d3487.

📒 Files selected for processing: 53
  • mobile/src/components/WorktreeListRow.tsx
  • mobile/src/hooks/use-active-worktree-scroll.test.tsx
  • mobile/src/hooks/use-active-worktree-scroll.ts
  • mobile/src/host-screen/host-list-first-frame.test.tsx
  • mobile/src/host-screen/host-screen-secondary-styles.ts
  • mobile/src/host-screen/host-sidebar-feed-sections.test.ts
  • mobile/src/host-screen/host-sidebar-feed-sections.ts
  • mobile/src/host-screen/host-workspace-list-reopen.test.tsx
  • mobile/src/host-screen/host-workspace-list.tsx
  • mobile/src/host-screen/use-host-list-sections.ts
  • mobile/src/host-screen/use-host-screen-controller.ts
  • mobile/src/host-screen/use-host-sidebar-feed.ts
  • mobile/src/host-screen/use-host-worktree-actions.ts
  • mobile/src/host-screen/use-slow-pending-keys.test.tsx
  • mobile/src/host-screen/use-slow-pending-keys.ts
  • mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx
  • mobile/src/session/use-mobile-session-keyboard-state.test.tsx
  • mobile/src/session/use-mobile-session-keyboard-state.ts
  • mobile/src/storage/mirrored-storage-keys.ts
  • mobile/src/worktree/host-list-highlight.ts
  • mobile/src/worktree/host-workspace-list-states.tsx
  • mobile/src/worktree/last-visited-worktree-by-host.test.ts
  • mobile/src/worktree/last-visited-worktree-by-host.ts
  • mobile/src/worktree/last-visited-worktree-repo.test.ts
  • mobile/src/worktree/last-visited-worktree-repo.ts
  • mobile/src/worktree/project-group-indent.test.ts
  • mobile/src/worktree/project-group-indent.ts
  • mobile/src/worktree/use-last-visited-worktree-on-host.test.tsx
  • mobile/src/worktree/use-last-visited-worktree-on-host.ts
  • mobile/src/worktree/workspace-list-types.ts
  • src/main/ipc/pty/ipc/renderer-kill.ts
  • src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts
  • src/main/ipc/pty/runtime/kill.ts
  • src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts
  • src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts
  • src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
  • src/main/runtime/terminal/layout/terminal-input-floor.ts
  • src/renderer/src/components/sidebar/sidebar-list-parity-catalog.test-fixture.ts
  • src/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.ts
  • src/renderer/src/store/slices/workspace-attention/workspace-attention-slice.ts
  • src/renderer/src/store/slices/workspace-attention/workspace-unread-flag-host-raises.test.ts
  • src/renderer/src/store/slices/workspace-attention/workspace-unread-flag.ts
  • src/renderer/src/store/slices/worktrees/listing/owner-host-sidebar-inputs.ts
  • tests/e2e/helpers/phone-feed-list.ts
  • tests/e2e/helpers/sidebar-setup-prompt.ts
  • tests/e2e/helpers/slept-workspace-probe.ts
  • tests/e2e/sidebar-desktop-reads-main.spec.ts
  • tests/e2e/sidebar-phone-feed-list.spec.ts
  • tests/e2e/sidebar-sort-stamps.spec.ts
  • tests/e2e/ssh-orcad-phone-feed-list.spec.ts
  • tests/e2e/worktree-lineage-toggle-shortcut.spec.ts
💤 Files with no reviewable changes: 1
  • mobile/src/worktree/last-visited-worktree-repo.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.

Comment thread src/main/ipc/pty/runtime/kill.ts Resolved
Comment thread src/main/ipc/pty/runtime/kill.ts Resolved
…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.
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