Skip to content

feat(sidebar): the phone reads its workspace list from the sidebar inputs (dark) - #30462

Merged
Jinwoo-H merged 8 commits into
mainfrom
jinwoo/sidebar-phone-reads-feed
Oct 19, 2026
Merged

Jinwoo-H merged 8 commits into
mainfrom
jinwoo/sidebar-phone-reads-feed

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1054 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1045
Prod 41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1605 $\color{#cf222e}{\Huge{\mathbf{−}}}$​163 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1442

ELI5

Today the phone works out its own workspace list from several separate reads, so it can disagree with the desktop sidebar. With this change (only in builds that turn on the sidebar inputs switch), the phone builds its list from the same inputs and the same list builder the desktop uses, so the two match row for row. Normal builds are unchanged.

What Changed

Everything below is behind the build switch ORCA_SIDEBAR_INPUTS=main. With the switch off, the phone page and the desktop behave as before.

With the switch on, the phone page:

  • Reads the host's sidebar inputs (sidebarInputs.read). It reads again when the event stream is ready, when the app comes to the foreground, and on every change notice. Older answers are ignored.
  • Builds its list with the shared list builder (buildSidebarFeedRows): the same groups, order, labels, pinned section, nesting, and a single highlight.
  • Collapses one section at a time with ui.setCollapsed. If the host does not have that method, it falls back to writing the whole collapsed list.
  • Shows a pending state for the phone's own option changes ("Saving to the desktop", then "Still waiting for the desktop"). A slow answer is not treated as a refusal.
  • Gets repo icons from sidebarInputs.repoIcons (a new repoIcons input lists each repo's icon id). Paired-server repos keep the phone's badge.
  • Shows "Reopen to update" when the host does not serve the inputs, or serves a version the page does not understand.
  • Stops the 3 second polling, the phone's own pin cache and its guessed highlight.

On the host side:

  • The desktop facts input now also carries the focused host, host label overrides and the "show pinned in groups" setting. The phone could not read these before, because client settings never included them.
  • Paired-server project groups come from the catalog the window publishes.

Old pages that are already open, or that were reopened from cache after a failed download, keep using worktree.ps and the other existing reads, unchanged.

The phone's own list code is switched off, not deleted. Deleting it is left for when the switch becomes the default (see Notes).

Why

The design asks for one list builder and one set of inputs for every reader, so the phone cannot drift from the desktop. The alternative, patching the phone's own list logic to match each desktop rule, is what led to drift in the first place. Keeping the work behind the build switch lets it land with no visible change while the rest of the sidebar work finishes.

Linked Issue

N/A (maintainer, part of the sidebar list series)

Visual Proof

There is no visible change in normal builds.

Switch-on Android emulator next to a desktop screenshot taken over the debugging protocol:

  • Pinned main (highlighted), then the repo section with feed-c, feed-b, feed-a and e2e-secondary, in the same order on both.
  • Collapsing the repo section on the phone folds it on the desktop too.

These screenshots are kept locally rather than attached.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

What I ran:

  • Unit tests:
    • The phone's section mapping (including SSH rows and paired-server rows).
    • The feed reader against the real main feed.
    • Pending option changes, including a refused change that a later change replaced.
    • Refresh triggers, repo icon ids and desktop facts.
    • The allowlist with the switch on.
  • End to end, switch on: sidebar-phone-feed-list.spec.ts compares the phone list to the desktop sidebar for these cases, each with zero shadow mismatches:
    • Pin, then show pinned in groups (two highlights).
    • Collapse and expand from the phone.
    • Unpin.
    • A paired server's workspaces.
    • An old page's reads.
  • paired-server-rows-shadow.spec.ts also passes.
  • A positive control (forcing the highlight off) failed as expected.
  • Switch off: the full mobile suite passes.
  • Platforms: macOS, plus the Android emulator. I did not run the SSH end to end test because this machine has no container or SSH server. SSH rows are covered by unit fixtures.

Review

I ran an elegance and bug review on the change and on each round of fixes, and applied the findings that held up.

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

Left for when the switch becomes the default:

  • Delete the phone list code that is now switched off: workspace-list-sections, workspace-list-ordering, use-workspace-sections, mobile-workspace-lineage, project-section-catalog, the pin cache and the guessed highlight. workspace-filter-repos and use-host-project-sections are still used for the options sheet.
  • Show the cached list offline before the first read.
  • Draw pending creations on the phone.
  • Mark switch-on phone page bundles in packaging.

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)

…ries the desktop's focused host and host names (dark)
…mpares the phone list to the desktop sidebar (dark)
A collapsed or worktree.ps-failing feed list no longer shows an empty or error state; a queued worktree read uses the latest client; a superseded option change does not report a refusal; the window shadow leaves the focused host to main's test (focus-read ratchet).
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The mobile sidebar can now consume desktop-published feed data, including host facts, project groups, repository icons, rows, sections, counts, and search results. The host feed supports revisions, unavailable methods, reconnects, and queued refreshes. Mobile view and collapse changes now track pending operations, reconcile desktop state, retry after reconnects, and show pending or reopen states. Tests cover unit, integration, and end-to-end behavior.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 83063

Some phone sidebar changes can show stale state, and failed test setup can leave clients running. These bounded issues warrant owner follow-up before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.74% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 81 functions across 57 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description is complete and relevant. It covers the user impact, implementation, rationale, testing, platform scope, compatibility, and checklist items. The maintainer exception explains why no is…
Title check Passed The title clearly and concisely identifies the main change: enabling the phone to read its workspace list from sidebar inputs behind the dark build.
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 complete and relevant. It covers the user impact, implementation, rationale, testing, platform scope, compatibility, and checklist items. The maintainer exception explains why no issue link is provided.

  • Fix all pre-merge checks with AI
✨ 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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 115a3ea3-afe6-4ac0-b8e0-0c81252fb1bf
📥 Commits

Reviewing files that changed from the base of the PR and between d4dfcf2 and 578dcd3.

📒 Files selected for processing: 55
  • config/scripts/build-mobile-web-app-bundle.mjs
  • mobile/src/host-screen/host-screen-secondary-styles.ts
  • mobile/src/host-screen/host-sidebar-feed-inputs.ts
  • mobile/src/host-screen/host-sidebar-feed-operations.ts
  • mobile/src/host-screen/host-sidebar-feed-reader.test.ts
  • mobile/src/host-screen/host-sidebar-feed-reader.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-sidebar-feed.test-fixture.ts
  • mobile/src/host-screen/host-view-pending-changes.ts
  • mobile/src/host-screen/host-workspace-list-action-error.test.tsx
  • mobile/src/host-screen/host-workspace-list-row-memo.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-pending-view-changes.test.ts
  • mobile/src/host-screen/use-host-pending-view-changes.ts
  • mobile/src/host-screen/use-host-project-sections.ts
  • mobile/src/host-screen/use-host-repo-icon-data-urls.ts
  • mobile/src/host-screen/use-host-screen-controller.ts
  • mobile/src/host-screen/use-host-screen-identity.ts
  • mobile/src/host-screen/use-host-screen-state.ts
  • mobile/src/host-screen/use-host-sidebar-feed.ts
  • mobile/src/host-screen/use-host-view-settings.ts
  • mobile/src/host-screen/use-host-worktree-actions.ts
  • mobile/src/host-screen/use-host-worktree-catalog.ts
  • mobile/src/host-screen/workspace-options-sheet.test.tsx
  • mobile/src/host-screen/workspace-options-sheet.tsx
  • mobile/src/worktree/host-workspace-list-states.tsx
  • mobile/src/worktree/host-worktree-refresh.test.ts
  • mobile/src/worktree/host-worktree-refresh.ts
  • mobile/src/worktree/project-sections-operations.ts
  • mobile/src/worktree/workspace-list-types.ts
  • src/main/runtime/mobile-rpc-allowlist.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-paired-desktop-methods.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts
  • src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts
  • src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts
  • src/main/runtime/sidebar-inputs/repo-icon-data-urls.ts
  • src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
  • src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.test.ts
  • src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts
  • src/renderer/src/runtime/sync-runtime-graph/project-section-catalog.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/project-section-catalog.ts
  • src/shared/mobile-project-sections-contract.ts
  • src/shared/sidebar-list/desktop-sidebar-facts.ts
  • src/shared/sidebar-list/repo-icon-data-urls-contract.ts
  • src/shared/sidebar-list/section-order.ts
  • src/shared/sidebar-list/sidebar-feed-domains.ts
  • src/shared/sidebar-list/sidebar-feed-rows.ts
  • src/shared/sidebar-list/sidebar-row-plan.ts
  • src/shared/sidebar-list/worktree-group-keys.ts
  • tests/e2e/helpers/phone-feed-list.ts
  • tests/e2e/sidebar-phone-feed-list.spec.ts

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

Comment on lines +79 to +86
const reply = await setCollapsedWrite.request(client, {
key: change.key,
collapsed: change.collapsed,
opId: { writer, seq: change.opId }
})
const unavailable =
readHostMethodReply(reply, setCollapsedWrite.interpret).kind === 'unavailable'
outcome = unavailable ? 'unavailable' : reply.ok ? 'settled' : 'refused'

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C8 "applied\s*[:=]" --type=ts -g '!mobile/**' | rg -n -C8 -i "collaps" | head -150
rg -nP -C5 "'ui\.setCollapsed'" --type=ts -g '!**/*.test.ts' | head -80

Repository: stablyai/orca

Length of output: 20624


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- mobile hook ---'
nl -ba mobile/src/host-screen/use-host-pending-view-changes.ts | sed -n '1,180p'
printf '%s\n' '--- operation definition ---'
nl -ba mobile/src/host-screen/host-sidebar-feed-operations.ts | sed -n '1,90p'
printf '%s\n' '--- reply reader and relevant consumers ---'
rg -n -F --glob '*.ts' -e 'function readHostMethodReply' -e 'const readHostMethodReply' -e 'readHostMethodReply' -e 'outcome ===' -e "outcome === 'refused'" mobile/src/host-screen src/shared | head -120
printf '%s\n' '--- host handler and collapse writer ---'
nl -ba src/main/runtime/rpc/methods/sidebar-inputs.ts | sed -n '115,140p'
nl -ba src/main/runtime/workspace-view-collapse-writes.ts | sed -n '1,80p'

Repository: stablyai/orca

Length of output: 20013


🏁 Script executed:

#!/bin/bash
set -eu
nl -ba mobile/src/host-screen/use-host-view-settings.ts | sed -n '110,285p'
printf '%s\n' '--- collapse state update callers ---'
rg -n -F --glob '*.ts' -e 'toggleCollapsed' -e 'sendCollapse' -e 'refused' mobile/src/host-screen | head -120

Repository: stablyai/orca

Length of output: 11578


Treat a mismatched collapse reply as refused.

ui.setCollapsed can return ok: true with applied: false and a collapsed value that differs from the requested state. The current code checks only reply.ok, so it marks the change as settled. The phone then keeps its optimistic state and does not call refused() to resync.

Compare the returned collapsed value with the requested value. Do not require applied: true; an already-settled retry is valid when the returned state matches.

🐛 Suggested fix
-          const unavailable =
-            readHostMethodReply(reply, setCollapsedWrite.interpret).kind === 'unavailable'
-          outcome = unavailable ? 'unavailable' : reply.ok ? 'settled' : 'refused'
+          const read = readHostMethodReply(reply, setCollapsedWrite.interpret)
+          outcome =
+            read.kind === 'unavailable'
+              ? 'unavailable'
+              : read.kind === 'answered' && read.value.collapsed === change.collapsed
+                ? 'settled'
+                : 'refused'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const reply = await setCollapsedWrite.request(client, {
key: change.key,
collapsed: change.collapsed,
opId: { writer, seq: change.opId }
})
const unavailable =
readHostMethodReply(reply, setCollapsedWrite.interpret).kind === 'unavailable'
outcome = unavailable ? 'unavailable' : reply.ok ? 'settled' : 'refused'
const reply = await setCollapsedWrite.request(client, {
key: change.key,
collapsed: change.collapsed,
opId: { writer, seq: change.opId }
})
const read = readHostMethodReply(reply, setCollapsedWrite.interpret)
outcome =
read.kind === 'unavailable'
? 'unavailable'
: read.kind === 'answered' && read.value.collapsed === change.collapsed
? 'settled'
: 'refused'

Comment on lines +41 to +42
// Switch point: a feed-built list takes pins from the host alone.
if (!hostId || ORCA_SIDEBAR_INPUTS_IS_MAIN) {

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Reset hostProjectGroups when the screen switches hosts.

The host-change effect clears every other per-host catalog field, such as setServedProjectSections(null) and setDesktopRepos([]). It does not clear the new hostProjectGroups state. Expo Router can reuse this screen for another hostId. If the new host serves no projectGroups and projectGroup.list fails or is unavailable, buildHostFeedCatalog keeps the previous host's groups. The feed-built list then files folder workspaces under the wrong host's groups. Add the reset to the reset effect (unchanged lines 63-77), next to the other per-host resets.

    setServedProjectSections(null)
    setDesktopRepos([])
    setHostProjectGroups([])

setHostProjectGroups must also be destructured from state.

Comment on lines +99 to +102
// Switch point: a feed-built list keeps no pin cache of its own.
if (ORCA_SIDEBAR_INPUTS_IS_MAIN) {
return
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the row's own isPinned once the pin cache stops updating.

With ORCA_SIDEBAR_INPUTS_IS_MAIN, three changed paths stop maintaining pinnedIds:

  • updateLocalPins returns early.
  • The load in use-host-screen-identity.ts is skipped.
  • The server sync in use-host-worktree-catalog.ts is skipped.

pinnedIds therefore stays an empty Set. togglePin (unchanged lines 139-144) still computes currentlyPinned from worktrees.find(...) and falls back to pinnedIds.has(worktreeId). A feed-only row is drawn from the feed before worktree.ps lists it. For such a pinned row, worktree is undefined, currentlyPinned is false, and the toggle sends isPinned: true again. The user cannot unpin that row until worktree.ps catches up. The feed row already has the authoritative value in item.isPinned, which buildHostFeedSections sets.

Proposed fix in togglePin
-      const currentlyPinned = worktree
-        ? isWorktreePinned(worktree, pinnedIds)
-        : pinnedIds.has(worktreeId)
+      const currentlyPinned = ORCA_SIDEBAR_INPUTS_IS_MAIN
+        ? item.isPinned
+        : worktree
+          ? isWorktreePinned(worktree, pinnedIds)
+          : pinnedIds.has(worktreeId)

…the native runtime types

Mobile test fixtures fill the fields the test project's types require; the feed trigger type lives with the feed reader, so the e2e helper's imports stop dragging react-native globals into the e2e program; React Doctor's two blocking findings.

@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 (1)

🟡 Minor · 🎯 Functional Correctness · sidebar-feed-rows.ts:137-145

src/shared/sidebar-list/sidebar-feed-rows.ts:137-145
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win



ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6110252c-5482-47fa-a8dd-25ce5d0aa2d8
📥 Commits

Reviewing files that changed from the base of the PR and between 578dcd3 and f4c9a20.

📒 Files selected for processing: 10
  • mobile/src/host-screen/host-server-workspaces-wiring.test.ts
  • mobile/src/host-screen/host-sidebar-feed-reader.ts
  • mobile/src/host-screen/host-sidebar-feed-sections.ts
  • mobile/src/host-screen/host-sidebar-feed.test-fixture.ts
  • mobile/src/host-screen/use-host-pending-view-changes.test.ts
  • mobile/src/host-screen/use-host-project-sections.test.tsx
  • mobile/src/host-screen/use-host-sidebar-feed.ts
  • mobile/src/host-screen/use-host-worktree-catalog.ts
  • mobile/src/worktree/host-worktree-refresh.ts
  • mobile/src/worktree/project-section-catalog.test.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • mobile/src/host-screen/use-host-pending-view-changes.test.ts

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

…reads-feed

# Conflicts:
#	src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts
#	src/shared/sidebar-list/sidebar-feed-domains.ts

@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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ef3196d-e7fd-4737-8142-8bb489f2721b
📥 Commits

Reviewing files that changed from the base of the PR and between f4c9a20 and 8306338.

📒 Files selected for processing: 6
  • src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-main-list-model.ts
  • src/renderer/src/lib/sidebar-pending-layer.test.ts
  • src/shared/sidebar-list/sidebar-feed-domains.ts
  • src/shared/sidebar-list/sidebar-feed-rows.ts
  • tests/e2e/sidebar-phone-feed-list.spec.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.

await waitForSessionReady(orcaPage)
const activeId = await waitForActiveWorktree(orcaPage)
const repoId = activeId.split('::')[0]
const phone = pairMobileClient(await createDesktopMobilePairingOffer(orcaPage))

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Start cleanup immediately after acquiring each client.

If either worktree RPC or openPhoneFeedList() fails in the first test, phone.dispose() is skipped. If openPhoneFeedList() fails in the paired-server test, dispose() is skipped and the host and desktop remain running. Move these setup calls inside cleanup scopes that begin immediately after acquisition.

Also applies to: 173-173

@Jinwoo-H
Jinwoo-H merged commit 88241bc into main Oct 19, 2026
46 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