Skip to content

fix(mobile): refresh chat file suggestions when the desktop connection changes - #31702

Merged
nwparker merged 7 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-chat-file-authority
Oct 22, 2026
Merged

nwparker merged 7 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-chat-file-authority

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Clear saved search results when the underlying desktop connection is replaced.
  • Recheck which file-search method the current desktop supports.
  • Reload the full file list when needed for an older desktop version.

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 commit c37567a9d40. 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.

01-before.png 02-after.png
01-before.png 02-after.png

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

  • Regression tests added or updated.
  • Full native device verification for every race.
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/session/use-mobile-native-chat-file-search.test.ts

The 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 1b8461cb8a1 updates 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

  • Not applicable; this change copies no upstream skill-installer implementation.

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

  • Focused change with a root-cause explanation.
  • Automated regression coverage and independent review.
  • Before/after proof attached with exact evidence scope.
  • Cross-platform and remote compatibility considered.
  • Required PR CI checks have passed.

Modern search caches and late replies survive authority migration on the same client object. Own cache, capability decision and inventory by logical generation.
@nwparker
nwparker marked this pull request as ready for review October 21, 2026 23:34
@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: b4804ef3-30ef-4ac8-ad56-4ae63adb499f
📥 Commits

Reviewing files that changed from the base of the PR and between 1b8461c and 62e388a.

📒 Files selected for processing: 2
  • src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
  • src/renderer/src/i18n/locales/pt.json
💤 Files with no reviewable changes: 1
  • src/renderer/src/i18n/locales/pt.json

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

📝 Walkthrough

The file-search hook now tracks the client generation associated with its query cache. It clears stale cache and capability state after a generation change and ignores results from stale requests. Tests cover modern and legacy search paths. Inventory lifecycle derivation now applies retired-owner filtering to reset and unmount scenarios, and the reset scenario’s expected sender list is updated.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 62e38

Users may briefly see file paths from the retired authority after migration, although a subsequent search refreshes them.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description covers the change, rationale, testing, visual evidence, review, compatibility, and checklist. However, the required Linked Issue section does not include an actual issue reference or a… Add the actual related GitHub issue reference in the Linked Issue section, using Fixes #<issue-number> or the repository-approved issue-link format.
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: invalidating mobile chat file-search state after authority migration.
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 covers the change, rationale, testing, visual evidence, review, compatibility, and checklist. However, the required Linked Issue section does not include an actual issue reference or a Fixes #... entry.

Resolution

Add the actual related GitHub issue reference in the Linked Issue section, using Fixes #&lt;issue-number&gt; or the repository-approved issue-link format.

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 32c4477f-b67d-4da6-b1f5-cd626b18b5be
📥 Commits

Reviewing files that changed from the base of the PR and between 10d4104 and 1b8461c.

📒 Files selected for processing: 5
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/src/session/use-mobile-native-chat-file-search.test.ts
  • mobile/src/session/use-mobile-native-chat-file-search.ts
  • mobile/src/test-support/rpc-recording/derived-goldens.ts
  • mobile/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.

Comment on lines +69 to +74
if (queryCacheGenerationRef.current !== generation) {
queryCacheGenerationRef.current = generation
queryCacheRef.current.clear()
searchSupportedRef.current = null
inventory.reset()
}

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

🔎 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/src

Repository: 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 260

Repository: 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
@nwparker
nwparker merged commit aad1fe0 into stablyai:main Oct 22, 2026
41 checks passed
@nwparker nwparker changed the title fix(mobile): invalidate chat file search on authority migration fix(mobile): refresh chat file suggestions when the desktop connection changes Oct 22, 2026
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