Repository navigation
fix(mobile): refresh chat file suggestions when the desktop connection changes - #31702
Conversation
Modern search caches and late replies survive authority migration on the same client object. Own cache, capability decision and inventory by logical generation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
32c4477f-b67d-4da6-b1f5-cd626b18b5be
📒 Files selected for processing: 5
mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.jsonmobile/src/session/use-mobile-native-chat-file-search.test.tsmobile/src/session/use-mobile-native-chat-file-search.tsmobile/src/test-support/rpc-recording/derived-goldens.tsmobile/src/test-support/rpc-recording/inventory-lifecycle-derivation.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| if (queryCacheGenerationRef.current !== generation) { | ||
| queryCacheGenerationRef.current = generation | ||
| queryCacheRef.current.clear() | ||
| searchSupportedRef.current = null | ||
| inventory.reset() | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect search callers and migration handling without running repository code.
rg -n -C 4 'loadNativeChatFiles\s*\(|nativeChatFilePaths\b|migrateTo\s*\(' mobile/srcRepository: stablyai/orca
Length of output: 41797
🏁 Script executed:
set -u
printf '%s\n' '--- hook ---'
nl -ba mobile/src/session/use-mobile-native-chat-file-search.ts | sed -n '1,230p'
printf '%s\n' '--- overlay ---'
nl -ba mobile/src/session/MobileNativeChatOverlay.tsx | sed -n '130,230p'
printf '%s\n' '--- file UI consumers ---'
rg -n -C 8 -F -- 'onNeedFiles' mobile/src/session mobile/src/components || test "$?" -eq 1
printf '%s\n' '--- client generation declarations and uses ---'
rg -n -C 6 -e 'getGeneration' -e 'generation' -e 'authority' mobile/src/transport mobile/src/session | head -n 260Repository: stablyai/orca
Length of output: 42214
Clear displayed paths when authority changes.
The hook resets displayed paths only when client or worktreeId changes, or when loadNativeChatFiles runs. A migration that keeps the same client object and worktree changes only client.getGeneration(), so existing nativeChatFilePaths can remain displayed if no new file query runs. Clear the paths on logical-generation changes or trigger a fresh search.
# Conflicts: # src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.tsx
ELI5
After Orca replaces the desktop connection behind the scenes, file suggestions in chat can still come from an earlier file list. Even a search you repeat can show those old results. This fix reloads the list for the new connection and ignores replies still arriving from the old one.
What Changed
Why
File suggestions should describe the files available through the current connection.
Linked Issue
Maintainer-discovered regression. Bounded GitHub symptom and exact-file searches found no exact duplicate. Related merged #20914 and #24792 cover inventory/owner cleanup; this covers logical authority generation changes.
Visual Proof
Captured with the visual-proof skill. Before uses base
15246eb4a45; after uses this PR's standalone commitc37567a9d40. The scenario passed asserted capture runs 3 times per version before representative screenshots were selected. The captures were visually inspected.Evidence scope: explicitly labeled production React hook diagnostic harness. Synthetic deterministic async transport. No full mobile app or native simulator validation. Drawer container and icon/native seams replaced for QuickCommandsSheet. Hook harness controls and outputs are instrumentation, not product UI.
The hook/transport boundary harnesses are labeled in the captures. These are browser evidence where stated; they do not establish native keyboard, gesture, permission dialog, safe-area or real-network behavior. Full code regressions cover additional cases described above.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/session/use-mobile-native-chat-file-search.test.tsThe combined mobile change set passed 410 suites / 3,626 tests, production typecheck, the tests-typecheck ratchet, formatting, the changed-code quality gate, and the mobile-web build/asset verifier on macOS. These aggregate results are not a claim that the entire suite was rerun on this isolated branch. PR CI validates the branch against current main.
Recording follow-up
Commit
1b8461cb8a1updates test recordings only; production captures above still show the exact production code on this branch. The lifecycle recording now preserves all checkpoints while omitting only the inventory request and reply that a retired search no longer admits after reset. Focused inventory derivation and native/bridge recording replays pass.CI follow-up
Updated with main
f47f632bd7d, retaining main's address-bar refactor. Includes two formatting-only object-argument simplifications in ClientHostedBrowserPagePane to satisfy its file-length limit, plus removal of two unused Portuguese default-zoom entries whose English keys were retired on main. Repository-wide lint and full localization-catalog verification pass locally. The mobile production source used by the attached proof is unchanged.Review
Merge risk: Low. A small change to reusing file-search results and ignoring replies from an earlier connection.
Previously reviewed by a separate agent team; reported issues were fixed and checked again.
Agent skill upstream boundary
Notes
Existing RPC methods and wire compatibility are retained. Review considered desktop host changes, remote execution authority, folder workspaces, and native/web consumers. Native simulator follow-up was limited after the three owned simulators became stuck shutting down; no unrelated simulator/process was reset.
Checklist