Repository navigation
fix(mobile): surface worktree catalog failures instead of silent 0 worktrees (STA-3123) - #12235
Conversation
…orktrees (STA-3123) A connected host whose worktree.ps request fails now shows an explicit catalog-failure state (with the RPC error code) on the host page, and 'Worktree list unavailable' on the home host card, instead of silently rendering as a healthy host with zero workspaces.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe mobile worktree catalog client now returns structured response or failure results and preserves error codes. Shared host metadata marks unavailable catalog data separately from valid zero counts. Host workspace screens track catalog errors and use centralized loading, error, and empty-state rendering. Connected host cards display “Worktree list unavailable” when worktree retrieval fails. Tests cover catalog failures, cached data, loading, empty results, connection transitions, and snapshot token behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/worktree/host-workspace-list-states.tsx (1)
15-21: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueConsider adding an accessibility role to the loading indicator.
ActivityIndicatorhas noaccessibilityRoleoraccessibilityLabel. Screen reader users get no signal that the host workspace list is loading.♿ Optional accessibility improvement
- <View style={styles.centered}> + <View style={styles.centered} accessibilityRole="progressbar" accessibilityLabel="Loading workspaces"> <ActivityIndicator size="small" color={colors.textSecondary} /> </View>
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2e93b009-2c7d-47bc-9be4-dcc844933a9f
📒 Files selected for processing (8)
mobile/app/h/[hostId]/index.tsxmobile/app/index.tsxmobile/src/components/MobileHostCard.tsxmobile/src/worktree/host-workspace-list-state.test.tsmobile/src/worktree/host-workspace-list-state.tsmobile/src/worktree/host-workspace-list-states.tsxmobile/src/worktree/worktree-catalog-snapshot-client.test.tsmobile/src/worktree/worktree-catalog-snapshot-client.ts
|
Post-review QA on commit
Host-page RPC failure: Home-card unavailable state beside a healthy direct host: Healthy direct Recovered catalog after successful responses resumed: |
Completes the 0.0.37 release attempted on 2026-08-03 (run 30791649691 failed on the version assertion). Ships the post-0.0.36 transport fixes: relay session recovery when the LAN endpoint is unreachable (#12344, #11368, #11465, #11690) and honest worktree-catalog failure states (#12235) — the released-app defect class verified live tonight. Co-authored-by: OrcaWin <[email protected]>
…rktrees (STA-3123) (stablyai#12235) * fix(mobile): surface worktree catalog failures instead of showing 0 worktrees (STA-3123) A connected host whose worktree.ps request fails now shows an explicit catalog-failure state (with the RPC error code) on the host page, and 'Worktree list unavailable' on the home host card, instead of silently rendering as a healthy host with zero workspaces. * fix(mobile): mark cached worktree catalogs unavailable
Completes the 0.0.37 release attempted on 2026-08-03 (run 30791649691 failed on the version assertion). Ships the post-0.0.36 transport fixes: relay session recovery when the LAN endpoint is unreachable (stablyai#12344, stablyai#11368, stablyai#11465, stablyai#11690) and honest worktree-catalog failure states (stablyai#12235) — the released-app defect class verified live tonight. Co-authored-by: OrcaWin <[email protected]>




Summary
Fixes the "remote Orca server shows 0 worktrees" presentation from STA-3123 (synced GitHub issue #11869): a connected host whose
worktree.psrequest fails is no longer indistinguishable from a genuinely empty host./h/[hostId]): when the catalog RPC fails (RPC error, invalid payload, or transport throw) and there are no cached rows, the screen now shows "Could not load workspaces from this host —worktree.ps failed (<code>) — retrying automatically" instead of an eternal spinner or a "No worktrees" empty state. The existing 3s poll / reconnect / pull-to-refresh paths clear the state on the next success; cached rows still win when present.worktree.psno longer seeds a fabricated0 worktreescount. With no prior data the card now says "Worktree list unavailable"; cached counts are still kept through transient failures.WorktreeCatalogSnapshotClient.fetchnow returns a discriminated result (responsevsrequest_failedwith the server error code) instead of collapsing failures tonull, and preserves the snapshot token across failures.Investigation notes: on current code the direct-pair catalog path is healthy end-to-end — verified via a fake mobile E2EE client (exact app params:
{limit: 10000, afterSnapshotId: null}) against an isolated branch-builtorca serveand against the installed production serve, plus a live iOS-sim pairing (screenshots below). The field "0 worktrees while CLI shows dozens" therefore reaches users through this silent-failure masking, which also made the original report undiagnosable — after this PR the failing host displays the actual RPC error code.Screenshots
Host page, paired to a connected mock host whose
worktree.psreturns an RPC error (previously rendered as an empty host):Home screen: failing host (Host 4) says "Worktree list unavailable"; healthy host (Host 3) keeps real counts:
Healthy path unchanged — iOS sim paired directly to an isolated
orca servebuilt from this branch lists its catalog:Testing
pnpm lint(root, plus mobileoxlint— clean)pnpm typecheck(root, plus mobiletsc --noEmit— clean)pnpm test— targeted: mobile vitestsrc/worktree/(113 tests passing, includes new failure-path and state-precedence tests); changed-code quality gate (check-changed-code-quality.mjs): 0 new findings incl. React Doctorpnpm build— not run in full;build:cli+build:electron-vitewere built and exercised for the QA serve rig (change is mobile-only)worktree-catalog-snapshot-client.test.ts(error-code surfacing, token preservation across failures) and newhost-workspace-list-state.test.ts(loading/failure/empty precedence — a failed fetch can never render as "No worktrees")AI Review Report
Reviewed for: (1) failure-state vs cached-rows interplay — cached rows always win; the failure state only replaces the empty presentation; (2) snapshot-token semantics — a
request_failedfetch does not clear the admitted token (server never answered), while an invalid success payload still resets it, covered by tests; (3) staleness — error state is guarded by the same client/host staleness checks as row application and is reset when the route re-seeds for a new hostId; (4) live QA on the iOS simulator confirmed both the failure state and the untouched healthy path. Cross-platform: the change is React Native (iOS/Android) only — no desktop/Electron, shortcut, path, or shell behavior touched; nometaKey/path separators involved; text-only UI additions render identically on both mobile platforms.Security Audit
The only new input surface is the RPC error
codestring rendered into the failure caption. It is rendered via React NativeText(no HTML/markup interpretation) and is only ever produced by an already-authenticated paired host; non-string/empty codes are normalized torequest_failed. No command execution, path handling, secret handling, IPC, or dependency changes. Device tokens and pairing payloads are never logged by the new code.Notes
worktree.psnever merges environment runtimes; sessions for such rows would also need proxying) and is intentionally not attempted here — this PR makes the failing-catalog case visible and diagnosable, which is the P0 observable, and gives field users the actual error code to report.computeResolvedWorktreescaches a scan-timeout-degraded (possibly empty) snapshot for the TTL without distinguishing it from an authoritative result.References: STA-3123, #11869