Skip to content

feat(session-search): search every computer from the history panel - #20885

Merged
Jinwoo-H merged 26 commits into
mainfrom
session-search-panel-all-hosts-2
Sep 16, 2026
Merged

Jinwoo-H merged 26 commits into
mainfrom
session-search-panel-all-hosts-2

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​72 $\color{#cf222e}{\Huge{\mathbf{−}}}$​33 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

Reopens #20680, which GitHub auto-closed as merged when its base branch session-search-verify absorbed it. Same commits, cherry-picked onto the stack.

The Agent Session History panel's "All computers" scope produced no search at all: the hook parsed the scope down to a single execution host id and bailed when that was null, so the panel answered "Choose one computer to search its sessions."

  • The panel hook now passes the all scope straight to window.api.aiVault.searchSessions, which the desktop already merges across every enumerated host.
  • Each hit is stamped with the host it came back on, falling back to local when a host omitted attribution; single-host behaviour is byte-for-byte unchanged.
  • The choose-host message and its sessionSearch.panel.chooseHost string are gone.
  • Hosts the merge could not search are named under the results header in one muted line, e.g. Not searched: Build box (search off) · Laptop (unreachable), from the new sessionSearch.panel.hostsSkipped string.
  • The preload searchSessions type and the web client's own-runtime check widen from ExecutionHostId to ExecutionHostScope; the browser still answers no-service for all, which is now expressible instead of a @ts-expect-error.

Validation

ORCA_BACKGROUND_LAUNCH=1 pnpm tc
  (no output; exit 0)

ORCA_BACKGROUND_LAUNCH=1 pnpm test src/renderer/src/components/right-sidebar
   Test Files  234 passed (234)
        Tests  2050 passed (2050)

ORCA_BACKGROUND_LAUNCH=1 pnpm test src/renderer/src/web/preload-api
   Test Files  2 passed (2)
        Tests  5 passed (5)

ORCA_BACKGROUND_LAUNCH=1 pnpm run check:code-quality:changed
  code quality: 0 new finding(s) across 74 changed file(s).
  casting code quality: 0 new finding(s) across 74 changed file(s).
  type-aware code quality: 0 new finding(s) across 74 changed file(s).
  React Doctor: 0 new finding(s) across 74 changed file(s).
  casting SAFETY: rationale: 0 new finding(s) across 74 changed file(s).
  Changed-code quality gate passed since 875b86d1688f.

ORCA_BACKGROUND_LAUNCH=1 pnpm run check:react-doctor:changed
  (exit 0; the 5 reported issues are pre-existing on the integration branch, none new)

ORCA_BACKGROUND_LAUNCH=1 pnpm run verify:localization-catalog
  Verified 14543 localization key references against en.json.

ORCA_BACKGROUND_LAUNCH=1 pnpm run verify:localization-runtime-catalog
  en-runtime-required.json covers en.json: 1680 of 14331 English entries must ship in the boot bundle.

ORCA_BACKGROUND_LAUNCH=1 pnpm run verify:localization-extraction
  Extracted 12781 keys; 36 dynamic defaults are report-only, 1550 existing English entries are not statically referenced, and 52 inline defaults differ.

ORCA_BACKGROUND_LAUNCH=1 pnpm run verify:localization-coverage
  Localization coverage check passed with 13 allowlisted candidates.

No Electron e2e case was added. tests/e2e/ai-vault-panel-search.spec.ts cannot take a two-line addition for this: exercising the merge needs the host menu switched to "All hosts" and a stubbed aiVault:searchSessions returning a hosts array, which is a new test block rather than two lines.

Base

This targets the session-search-verify integration branch, which is main plus PR 6, PR 7, PR 8 and #20670. It will be rebased onto main once those merge.

The `all` scope on `aiVault:searchSessions` now fans out from the desktop
to every host the session list enumerates and merges the pages into one.
Legs run in parallel: the local index through the search service, SSH and
runtime hosts through the existing remote search client.

Two fixed orders, because relevance scores from independent indexes are
not comparable. `newest` asks every leg for recency and k-way merges on
`updatedAt`, nulls last, ties broken on execution host id. `relevance`
rotates hosts in host-id order by their own rank.

The merged cursor is an opaque base64url payload holding each host's
cursor, how many of its current page were already emitted, and the
generation that offset counts into, plus the page size and sort the
cursor belongs to. A host whose index moved is fenced to `stale` and
stops contributing; the rest keep paging. Per-host outcomes ride back on
one new optional `hosts` field on the results response.

`aiVault:searchStatus` with `all` stays refused, and neither the runtime
RPC nor the CLI gains the scope, so a fan-out is never two hops.
…gs-ui

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
# Conflicts:
#	src/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsx
#	src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx
#	src/renderer/src/i18n/locales/en.json
…ession-search-panel-all-hosts-2

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
The panel's "All computers" scope produced no request: the hook parsed the
scope into a single host id and stopped when that was null, so the panel
answered "Choose one computer to search its sessions." The desktop already
merges every enumerated host behind `aiVault:searchSessions`, so pass the
scope straight through and stamp each hit with the host it came back on.

Hosts the merge could not search are named under the results header with a
short reason, since a silent partial answer reads as "no such session".

(cherry picked from commit c6b9179)

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

Important

The merged cursor is missing the index-incarnation fence this PR adds for single-host cursors. A merged search resumed mid-host-page ({c: null, e > 0}) re-queries the host with no cursor, so a rebuilt index whose numeric generation repeats can silently drop or duplicate hits. Details inline.

Reviewed changes — all 41 files against session-search-panel-ui at 3a35869.

  • All-computers merge (ai-vault-search-all-hosts.ts, ai-vault-search-merged-cursor.ts, ai-vault-search.ts): one query fans out to the local service plus every enumerated SSH/runtime host, merged by recency or round-robin, with an opaque per-host {c,e,g} cursor and a new optional hosts outcome array on the response.
  • Cursor incarnation (session-search-page-cursor.ts, session-search-schema.ts, session-search-index-generation.ts, session-search-engine.ts): opaque cursors carry a persisted index_incarnation so a clear or rebuild invalidates them even when the generation counter collides.
  • Panel scope widening (use-ai-vault-search.ts, AiVaultPanelSearch.tsx, preload and web searchSessions): the all scope now reaches the desktop merge, hits are stamped with the host that returned them, and unsearched hosts are named under the results header.
  • Desktop index controls (SessionHistoryIndexStatus.tsx, SessionHistorySettingsPane.tsx, settings navigation, en.json): live index status, an opt-in confirmation, and an Advanced delete-index action.
  • Tests: new suites for the merge (real indexes and stubs), merged-cursor round-trip, clear fencing, panel attribution, and settings polling/clear.

ℹ️ A merged walk never terminates while a host stays unreachable

A leg that fails sets carry: true (ai-vault-search-all-hosts.ts:136) and nextCursorEntry re-emits that entry on every request (:278); hasMore is simply "any cursor entry exists" (:257). If one host is permanently down, every page returns hasMore: true and a client that pages until hasMore === false never stops. The manual "Load more" UI makes this tolerable, but it is worth deciding whether indefinite retry is intended or a retry bound / terminal outcome is wanted.

Technical details
# Persistent unreachable host keeps the merged walk open

## Affected sites
- `src/main/ipc/ai-vault-search-all-hosts.ts:132-136` — every leg failure becomes `endHostWalk(walk, 'unreachable', true)`.
- `src/main/ipc/ai-vault-search-all-hosts.ts:270-279` — the `carry` entry is re-emitted indefinitely.
- `src/main/ipc/ai-vault-search-all-hosts.ts:257` — `hasMore` ignores `walk.outcome`.

## Required outcome
Either bound the retries for a host that never answers (a terminal outcome after N attempts) or document explicitly that a merged walk does not terminate while a host is unreachable.

ℹ️ Nitpicks

  • The disabled-clear branch the settings UI advertises ("Search stays off", button enabled) is untested below the UI: session-scanner-service-search.test.ts clears only while enabled, session-scanner-service-search-roots.test.ts:78-82 asserts the throw but never calls apply(), and SessionHistorySettingsPane.test.tsx mocks clearSearchIndex. A service test that applies {enabled: false} and then clears would pin session-scanner-service-search.ts:52.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

}
// `e` is an offset into one generation's ranked page, so it is only
// meaningful while that generation stands. Nothing emitted, nothing to fence.
if (walk.emitted > 0 && walk.generation !== response.generation) {

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.

When c === null and e > 0 (a host's first page was only partially drained), the resume at nextCursorEntry (:273) stores no cursor string, so the host is queried with no cursor and decodeSessionSearchCursor's incarnation check never runs. The only fence left is this numeric g comparison, and session-search-instance.test.ts:184 asserts a clear/rebuild can reproduce the same generation — so a rebuild here is accepted and slice(e) silently drops or duplicates hits.

Technical details
# Merged cursor lacks the index incarnation fence

## Affected sites
- `src/main/ipc/ai-vault-search-all-hosts.ts:150` — only fence on a resumed partial host page is numeric `g`; a rebuilt index can repeat it.
- `src/main/ipc/ai-vault-search-all-hosts.ts:271-278` — `nextCursorEntry` stores `{c: walk.cursor, e, g}` with `c === null` for a host's first page.
- `src/main/ipc/ai-vault-search-all-hosts.ts:120-129` — with `c === null` no cursor is sent, so `session-search-page-cursor.ts:107-110` cannot fire.
- `src/main/ipc/ai-vault-search-merged-cursor.ts:9-13` — `MergedSearchCursorEntry` has no field for a host index identity.

## Required outcome
A resume that skips `e` hits inside a host page must be treated as stale when that host's index database identity changed, even when the numeric generation is unchanged. The `carry` entry at `:278` needs the same treatment.

## Suggested approach
Carry a per-host database identity in the merged cursor entry and compare it alongside `g`. The host already computes it (`readIndexIncarnation`); expose it additively on the host results response (an optional field is wire-compatible) or fold it into the opaque host cursor, and record it next to `g`.

## Open questions for the human
Is settings `Delete index` the only way the incarnation changes while a panel search can stay mounted? `openSessionSearchDatabase` also recreates the database on a corrupt/stale open, so the window is not purely settings-driven.


Disabling closes the indexer and keeps the index copy; clearing deletes the copy.
Changing retention reuses the existing close-and-construct policy application.
The settings pane reads status only while enabled and visible, polls only an

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.

This paragraph describes the opposite of the shipped SessionHistoryIndexStatus: it polls a settled index at SETTLED_POLL_MS (10 s) and recovers after a failed read (SessionHistoryIndexStatus.test.tsx pins both), and the pane has no Refresh control. Please drop the "stops on completion or error" and "pressing Refresh" claims.

@Jinwoo-H
Jinwoo-H changed the base branch from session-search-panel-ui to main September 16, 2026 16:29
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The AI Vault search API now accepts ExecutionHostScope, including the desktop all-host scope. Renderer hooks pass this scope through, preserve host ownership for merged hits, and recover stale all-host cursors. The search panel displays skipped hosts and their reasons, while browser searches continue to target one runtime. Tests cover scope propagation, host attribution, pagination recovery, and panel status rendering.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to bf9d6

Non-English users will see English skipped-host reasons in the search status. Localize these labels before merge to keep the panel consistently translated.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, motivation, linked issue, implementation, testing, and the reason no E2E test was added. However, it omits the required Visual Proof section for this UI behavior c… Add a Visual Proof section with before-and-after screenshots or videos, or write N/A with a brief reason if visual proof is not applicable. Add the required checklist sections and mark the applicable testing, review, cross-platform, and bui…
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 12 functions across 7 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: enabling session search across every computer from the history panel.
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 explains the change, motivation, linked issue, implementation, testing, and the reason no E2E test was added. However, it omits the required Visual Proof section for this UI behavior change and does not include the template checklist or explicit manual-testing status.

Resolution

Add a Visual Proof section with before-and-after screenshots or videos, or write N/A with a brief reason if visual proof is not applicable. Add the required checklist sections and mark the applicable testing, review, cross-platform, and build-validation items.

Full details: Docstring Coverage

Explanation

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 12 functions across 7 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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: 7ea70ee8-6697-4486-879b-93addcab9ee0

📥 Commits

Reviewing files that changed from the base of the PR and between 3631a1e and bf9d6f0.

📒 Files selected for processing (8)
  • src/preload/api/ai-vault-api.ts
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
  • src/renderer/src/components/right-sidebar/use-ai-vault-search.test.tsx
  • src/renderer/src/components/right-sidebar/use-ai-vault-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/preload-api/web-ai-vault-api.ts
  • src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +16 to +24
return 'index changed'
case 'disabled':
return 'search off'
case 'not-ready':
return 'not ready'
case 'no-service':
return 'unavailable'
case 'unreachable':
return 'unreachable'

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:

sed -n '1,190p' src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
sed -n '17845,17870p' src/renderer/src/i18n/locales/en.json
rg -n "value0|hostsSkipped|search off|index changed|not ready|unreachable|chooseHost" src/renderer/src/i18n src/renderer/src/components
find .. -name AGENTS.md -o -name CONTRIBUTING.md | head -30

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

sed -n '1,120p' src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
printf '\n--- i18n implementation candidates ---\n'
rg -n --glob '*.ts' --glob '*.tsx' "function translate|const translate|export .*translate|useTranslation|i18next|fallbackLng|fallbackLocale|currentLocale|getLocale" src/renderer/src/i18n src/renderer/src | head -120
printf '\n--- locale files and focused keys ---\n'
find src/renderer/src/i18n -maxdepth 3 -type f | sort | head -80
rg -n --glob '*.json' '"hostsSkipped"|'"'"'not searched'"'"'|'"'"'search off'"'"'|'"'"'index changed'"'"'|'"'"'not ready'"'"'|'"'"'unavailable'"'"'|'"'"'unreachable'"'"' src/renderer/src/i18n
printf '\n--- instructions ---\n'
find . -name AGENTS.md -o -name CONTRIBUTING.md | head -30

Repository: stablyai/orca

Length of output: 19283


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings

Length of output: 30068


🏁 Script executed:

printf '%s\n' '--- component render branch ---'
sed -n '110,190p' src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
printf '%s\n' '--- i18n implementation ---'
sed -n '1,115p' src/renderer/src/i18n/i18n.ts
printf '%s\n' '--- focused locale entries ---'
for f in src/renderer/src/i18n/locales/*.json; do
  printf '%s: ' "$f"
  rg -n --max-count 2 '"hostsSkipped"' "$f" || true
done
printf '%s\n' '--- localization rules/tests ---'
rg -n --glob '*.md' --glob '*.json' --glob '*.ts' --glob '*.tsx' \
  'intent[- ]named|named interpolation|placeholder|localization.*key|key.*local|translate\(.*value0|value0.*placeholder|localization catalog' \
  AGENTS.md CONTRIBUTING.md src/renderer/src/i18n config scripts 2>/dev/null | head -240
printf '%s\n' '--- applicable instruction files ---'
find . -name AGENTS.md -o -name CONTRIBUTING.md | head -30

Repository: stablyai/orca

Length of output: 50369


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4

Length of output: 527


🏁 Script executed:

sed -n '180,215p' config/i18n-translation-source.md
sed -n '50,70p' config/localization-audit.md

Repository: stablyai/orca

Length of output: 2415


Localize skipped-host reasons and use a named placeholder.

When results contain skipped hosts, AiVaultPanelSearch renders describeSkippedHosts. hostSkipReason inserts English labels such as index changed and search off, so non-English users receive English reason text. A translated hostsSkipped template would also produce mixed-language output.

The repository policy requires new localization keys to use intent-named IDs and named interpolation placeholders. Translate each reason with its own key, change {{value0}}/value0 to {{hosts}}/hosts, and update the English catalog entries.

@Jinwoo-H
Jinwoo-H merged commit 8153ec2 into main Sep 16, 2026
28 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…tablyai#20885)

* feat(session-search): add ranked history panel search and consent

* test: wait for initial session indexing before refreshing results

* feat(session-history): add local search settings and index controls

* Use shared local host identifier for session index status

* feat(session-search): merge all-computers search across hosts

The `all` scope on `aiVault:searchSessions` now fans out from the desktop
to every host the session list enumerates and merges the pages into one.
Legs run in parallel: the local index through the search service, SSH and
runtime hosts through the existing remote search client.

Two fixed orders, because relevance scores from independent indexes are
not comparable. `newest` asks every leg for recency and k-way merges on
`updatedAt`, nulls last, ties broken on execution host id. `relevance`
rotates hosts in host-id order by their own rank.

The merged cursor is an opaque base64url payload holding each host's
cursor, how many of its current page were already emitted, and the
generation that offset counts into, plus the page size and sort the
cursor belongs to. A host whose index moved is fenced to `stale` and
stops contributing; the rest keep paging. Per-host outcomes ride back on
one new optional `hosts` field on the results response.

`aiVault:searchStatus` with `all` stays refused, and neither the runtime
RPC nor the CLI gains the scope, so a fan-out is never two hops.

* fix(preload): let the search bridge address the all-computers scope

* feat(settings): live index status, enable confirm, advanced delete

* feat(session-search): search every computer from the history panel

The panel's "All computers" scope produced no request: the hook parsed the
scope into a single host id and stopped when that was null, so the panel
answered "Choose one computer to search its sessions." The desktop already
merges every enumerated host behind `aiVault:searchSessions`, so pass the
scope straight through and stamp each hit with the host it came back on.

Hosts the merge could not search are named under the results header with a
short reason, since a silent partial answer reads as "no such session".

(cherry picked from commit c6b9179)

* fix(settings): let Button and Collapsible own their spacing and type
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