Repository navigation
feat(settings): connected computers rows for session history indexing - #20887
Conversation
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
… session-search-all-hosts
# 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)
Adds `aiVault.setSearchEnabled` so a desktop can turn a paired Orca server's transcript index on or off and have the server apply it without a restart. The runtime method refuses any caller without a `pairedDeviceId` with a `forbidden`-class error, writes the whole resolved policy through the runtime store so retention rides along untouched, then reaches the index through a host-supplied hook: `applySessionSearchSettingsChange` on the desktop, the in-process instance's new `apply` on orcad. The relay is unchanged. Wire compatibility is Rule 1 shaped: a new optional method. A server that predates it answers method-not-found, which the desktop IPC handler maps to an error whose message is exactly `host-too-old`. Old clients never call it. The method is deliberately absent from the mobile allowlist, and `aiVaultSearch` stays out of the paired settings projection. (cherry picked from commit 640c715)
… host-too-old on status reads (cherry picked from commit 1463e8a)
Agent Session History now lists every computer that can hold an index -- this computer first, then each paired Orca server -- as one row with an icon, a name, a single status line and its own switch. Indexing consent is stated once above the list, and each row carries the switch for the host it names, so turning search on for a server no longer means finding that server's own settings. Server rows poll aiVault.searchStatus on the same 2s/10s cadence as the local one while the pane is visible, and report what the host actually answered: Off, a sweep in progress, or an up-to-date count. A server that is not connected stays listed but dimmed, with its last known switch position and no claim about its index. A host that refuses the set call with host-too-old flips to an update prompt that links to Remote Servers. The old "Enable session history search" switch and the separate index-status row are gone; their status copy moved to session-history-status-copy.ts and their polling to use-session-search-status.ts, so every row shares one message builder and one poll. Advanced > Delete index copy is unchanged and still local-only, and a paired web client still sees this computer alone. window.api.aiVault.setSearchEnabled is declared and bridged here but implemented by the parallel backend PR. (cherry picked from commit 0497e6f)
(cherry picked from commit a3d751f)
Delete index cleared the index while search was on, so the host closed, removed and immediately reconstructed it and everything reindexed. Turn local search off first, then clear, so the rebuild only happens when the user switches search back on. (cherry picked from commit 0515588)
Say search, not index or transcript; lead with what the user gets and where it shows up; one plain privacy sentence; count sessions, not files; drop the mechanics that change no decision (stop hint, SSH note, source roots jargon). (cherry picked from commit 267af1a)
…tings-hosts-2 # Conflicts: # src/renderer/src/components/settings/SessionHistorySettingsPane.tsx
There was a problem hiding this comment.
ℹ️ No critical issues — a few minor suggestions inline.
Reviewed changes
- Computer list replaces the single switch.
SessionHistorySettingsPanenow renders a local row plus oneSessionHistoryServerRowper user-managed paired runtime environment, with the consent copy stated once above the list and SSH called out as a non-row hint. - Per-host status polling extracted. The deleted
SessionHistoryIndexStatusbecomesuse-session-search-status(visibility-gated, 2s sweeping / 10s settled, retains the last answer when inactive,adoptfor set-call answers) plus shared wording insession-history-status-copy. - Server row lifecycle. Connection state comes from the catalog
details; enable goes through a consent dialog andsetSearchEnabled(hostId, true), disable is direct, and ahost-too-oldrejection (message substring) flips the row to the dimmed update-server state with a link topane: 'servers'. - Clear flow and copy pass. Advanced clear now writes
enabled: falsebeforeclearSearchIndex(), the pane loses itskeyso state survives the settings write, anden.json/ navigation copy moves to sessions-not-indexes wording.
ℹ️ Row-state copy in the description drifted from the code
The description's row-state table still says the local "on" row shows "the stop hint" and the local "off" row shows Search is off. Any existing index copy is kept.. The shipped code shows only Off (sessionHistory.status.off) and sessionSearchStatusDetails no longer emits a stop hint, so both table entries are stale. If dropping the stop hint was intentional (it is the only reassurance that a long first pass resumes), the table just needs updating; if it was not, sessionSearchStatusDetails needs the sweeping-state line back.
<!--
Pullfrog review metadata. These findings were written against e0fbf351;
if commits have landed on session-search-settings-hosts-2 since, treat every specific bug, file, or
line callout as POTENTIALLY STALE and re-diff before acting on it.
- Mode: Review (initial)
- Files reviewed: 12
- Commits reviewed: 5
- Base: session-search-remote-enable-2 (2b00995052)
- Head: session-search-settings-hosts-2 (e0fbf351)
- Reviewed commits:
- 33f04449bf — feat(settings): connected computers rows for session history indexing
- b978e05c12 — fix(settings): treat a host-too-old status read as an outdated server
- 05652d2513 — fix(settings): turn search off before deleting its index
- ff4405e43f — feat(settings): product-facing copy for session search
- e0fbf351c8 — fix(settings): let Button and Collapsible own their spacing and type
- Prior pullfrog review: none
-->
ℹ️ Nitpicks
use-session-search-status.ts:34—adoptsetsstatuswhile a poll read may already be in flight (inFlightis local toread), so a read started before the set call can resolve after it and revert the switch for one interval; a request-generation guard would close that window.SessionHistorySettingsPane.tsx:146— thesetRefreshbump after a successful clear is now inert: clearing always ends with search off (turnSearchOffBeforeDelete), andrefreshonly feeds the local poll, which is inactive then. Therefreshstate could go.SessionHistoryComputerRow.test.tsxis named for the presentational row, but most of its cases driveSessionHistoryServerRow; a name matching the content would read better.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| <SessionHistoryComputerRow | ||
| {...row} | ||
| checked={enabled} | ||
| disabled={busy} |
There was a problem hiding this comment.
checked comes from status?.enabled === true, and a failed read nulls status (use-session-search-status.ts:64). So a connected server whose poll fails — or whose first poll has not returned — shows its switch as off yet interactive while the row reads Checking… / Could not check status, and clicking re-opens the consent dialog to turn on a server that was already on. The offline branch deliberately keeps the last answer; the connected branch should not be more forgetful than it.
Technical details
# Server switch misreads an unknown status as off
## Affected sites
- `src/renderer/src/components/settings/SessionHistoryServerRow.tsx:47` — `enabled = status?.enabled === true`
- `src/renderer/src/components/settings/SessionHistoryServerRow.tsx:162` — `checked={enabled}`
- `src/renderer/src/components/settings/SessionHistoryServerRow.tsx:163` — `disabled={busy}`, interactive while `status` is null
- `src/renderer/src/components/settings/use-session-search-status.ts:64` — a failed read sets `status` to null (pinned by the "recovers on its own after a failed read" test)
## Required outcome
A row whose status is unknown (first probe or a failed read) must not present a definitive `Off` switch, and must not be togglable into a state the client cannot verify.
## Suggested approach
Gate `disabled` on `failed || status === null` in `SessionHistoryServerRow`, which covers both the first-probe and failed-read windows. Alternatively keep the last known status across a failed read in the hook, as the offline branch already relies on; if the hook keeps nulling on failure (the existing test asserts it), prefer the row-level gate.There was a problem hiding this comment.
ℹ️ The new commit is a base-branch merge — no feature changes to re-review.
Reviewed changes
- The only commit since the prior review (
e0fbf351) isad44df3c13, a merge ofsession-search-remote-enable-2into this branch. - The merged tree is identical to what was already reviewed: the deleted
SessionHistoryIndexStatusis still gone, the Advanced control still usessize="xs"/mt-2withoutcollapsible-height-content, and the three changed test files still pass (3 files, 38 tests). - The prior inline finding on
SessionHistoryServerRow.tsx:163(a connected server's switch reads an unknown status as off) is unaddressed, and the description-drift note plus nitpicks still stand.
<!--
Pullfrog review metadata. These findings were written against ad44df3c;
if commits have landed on session-search-settings-hosts-2 since, treat every specific bug, file, or
line callout as POTENTIALLY STALE and re-diff before acting on it.
- Mode: IncrementalReview (delta against prior pullfrog review)
- Files reviewed: 12
- Commits reviewed: 6
- Base: session-search-remote-enable-2 (2b00995052)
- Head: session-search-settings-hosts-2 (ad44df3c)
- Reviewed commits:
- ad44df3c13 — Merge branch 'session-search-remote-enable-2' into session-search-settings-hosts-2
- e0fbf351c8 — fix(settings): let Button and Collapsible own their spacing and type
- ff4405e43f — feat(settings): product-facing copy for session search
- 05652d2513 — fix(settings): turn search off before deleting its index
- b978e05c12 — fix(settings): treat a host-too-old status read as an outdated server
- 33f04449bf — feat(settings): connected computers rows for session history indexing
- Prior pullfrog review: e0fbf351 (https://github.com/stablyai/orca/pull/20887#pullrequestreview-5215979059)
-->
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Renames the pane, splits the list into this computer and paired Orca servers, and puts a count of what is on above it with a Turn on all that skips offline and too-old hosts and keeps going past a host that refuses. Consenting once persists a standing consent so a server that later becomes reachable turns on without another dialog; turning one off by hand drops it. Rows past the sixth fold away, ordered by what the user can act on. Status sentences now say how much is searchable instead of Ready, and an off computer says so with its switch alone.
With only this computer, the count, the Turn on all button and the two subheads all restate the single switch under them. Show them once a paired Orca server exists, which is the first point at which they say anything.
There was a problem hiding this comment.
Important
Three items worth addressing before merge: the standing-consent hook is committed as a binary file (a raw NUL byte), folded computers are silently excluded from the fleet summary and "Turn on all", and the consent writes have no failure handling.
Reviewed changes
- Message totals.
SessionSearchStore.stateCounts()now also countsmessages,SessionSearchIndexer.status()reportsmessagesIndexed, the contract field is optional, and the status copy rendersN sessions · M messages searchable, degrading to sessions only when a host predates the field. - Open the session panel ready to type. A transient
showAiVaultSearchstore action,useAiVaultSearchFocusRequest, and a header focus effect let Settings jump to the sidebar panel with scope widened to all and the search box selected. - Pane redesigned for many computers. New
session-search-computer-rollup,SessionSearchComputerList(fold at six),SessionSearchAdvancedSection, anduse-session-search-auto-enable; server rows now report state up so the pane can count, order, and reason about the fleet; "Turn on all" persists a standing consent.
⚠️ The auto-enable hook is committed as a binary file
src/renderer/src/components/settings/use-session-search-auto-enable.ts contains a literal 0x00 byte at offset 1295 — const key = targets.map((target) => target.id).join('<raw NUL>'). Git therefore classifies the new file as binary: the PR diff shows (binary file or no changes), and the file gets no line-level blame, no textual merge, and is skipped by git grep. The rest of the repo writes this separator with the escape (REPEATED_FLAG_SEPARATOR = '\u0000' in src/cli/args.ts, many `${a}\u0000${b}` keys), so writing '\u0000' keeps the file text.
Technical details
# Raw NUL byte makes the new hook an unreviewable binary blob
## Affected sites
- `src/renderer/src/components/settings/use-session-search-auto-enable.ts:32` — `const key = targets.map((target) => target.id).join('<raw 0x00>')`
## Required outcome
- The file is text in git: it diffs, blames, merges, and greps like every other `.ts` file.
## Suggested approach
- Replace the raw byte with the escape `'\u0000'` (repo convention), or any separator that cannot occur in an environment id.
## Evidence
- `file` reports `data`; a byte scan finds exactly one `0x00`.
- The full PR diff (`pr-20887-f4cfac3.diff`) renders the file as `(binary file or no changes)`.
- No CI guard scans tracked source for NUL bytes, so this passes the PR gates and lands as a binary blob.ℹ️ "Skipped" hosts later get enabled with no dialog
The "Turn on all" confirm says "Offline servers and servers that need an update are skipped", but a successful confirm persists the standing consent, and use-session-search-auto-enable then turns on exactly those hosts once they become reachable, with no dialog. The only copy about standing consent, summaryAutoEnable ("New computers turn on when they can."), renders only after the flag is already true, so the user committing the action never sees it. This is a copy/consent call rather than a logic bug: either the dialog should say skipped hosts are picked up later, or the sentence should appear with the confirm.
Technical details
# Standing consent enables hosts the confirm dialog said would be skipped
## Affected sites
- `src/renderer/src/components/settings/SessionHistorySettingsPane.tsx:220-222` — sets `aiVaultSearchAutoEnableNewComputers` after a fully successful run.
- `src/renderer/src/components/settings/use-session-search-auto-enable.ts:34-49` — enables every due target with no `confirm`.
- `src/renderer/src/components/settings/session-search-computer-rollup.ts:70-72` — `summaryAutoEnable` is appended only when the flag is already true.
- `src/renderer/src/i18n/locales/en.json` `sessionHistory.settings.enableAllConsent` — "...Offline servers and servers that need an update are skipped...."
## Required outcome
- A user who reads the confirm understands that hosts skipped at grant time will be enabled once they can be.
## Open questions for the human
- Is "skipped" meant to be permanent for a host, or only for this run? `useSessionSearchAutoEnable` makes it the latter.ℹ️ Nitpicks
SessionHistoryServerRow.tsx:98—onUserToggleruns before the consent dialog, so declining a manual turn-on still records the host as user-toggled and drops it from the standing auto-enable targets for the pane's lifetime.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const [expanded, setExpanded] = useState(false) | ||
| const visibleServerCount = VISIBLE_COMPUTER_LIMIT - 1 | ||
| const hiddenCount = Math.max(0, servers.length - visibleServerCount) | ||
| const shownServers = expanded ? servers : servers.slice(0, visibleServerCount) |
There was a problem hiding this comment.
Folding unmounts servers past the first five, and only a mounted SessionHistoryServerRow reports state up. Folded hosts therefore keep the pane's ?? 'checking' fallback (SessionHistorySettingsPane.tsx:84), so their offline/needs-update counts never reach the summary and they are excluded from turnOnable — "Turn on all" and the standing consent silently skip every folded computer until the list is expanded. With more than six computers the summary can read On 2 of 10 computers while several hidden ones are offline.
Technical details
# Fleet state is row-owned, so folded rows never report
## Affected sites
- `src/renderer/src/components/settings/SessionSearchComputerList.tsx:25` — `shownServers = expanded ? servers : servers.slice(0, visibleServerCount)` unmounts the rest.
- `src/renderer/src/components/settings/SessionHistorySettingsPane.tsx:81-98` — `serverEntries` maps every environment, defaulting unmounted ones to `'checking'`; `autoEnableTargets` and `summary` derive from that.
- `src/renderer/src/components/settings/SessionHistoryServerRow.tsx:66-68` — the only producer of a real state is the mounted row's effect.
- `src/renderer/src/components/settings/SessionHistorySettingsPane.tsx:209-219` — `turnOnEveryComputer` skips any entry that is not `'off'`.
## Required outcome
- A computer's state, the summary counts, and "Turn on all" do not depend on whether its row happens to be rendered.
## Suggested approach
- Keep folded rows mounted (hide with CSS), or lift the per-host status read to a provider that owns all servers regardless of the fold.Each switch and Turn on all now act on the click. The dialogs restated the row they sat under and stood between the user and a preference they can reverse with the same control. Clearing search data keeps its dialog: that one destroys something.
Drops the summary sentence: every row already states whether it is offline or needs an update, so counting those again above the list said nothing new. What is left is the one thing the list cannot say, the size of the action, carried by the button's own label. With nothing left to turn on, the standing consent speaks in its place, and only when it is armed.
The row above the list is now just that button. It appears when a paired server is reachable, new enough and off, acts on exactly those plus this computer, and disappears when there is nothing left to do. What it offers is read off the rows each render, so it cannot disagree with them. Deletes the standing auto-enable consent with it: the persisted flag, the code that armed and cleared it, the per-host memory of which switches the user had touched, and the line that promised future computers would turn themselves on. A preference that acts on hosts the user never sees is worse than a button they press when they mean it.
There was a problem hiding this comment.
ℹ️ No critical issues — one copy nit inline, plus the description still describes the dialogs this push removed.
Reviewed changes
- Confirmation dialogs removed. The local switch, each server switch, and "Turn on all" now act directly:
30b0786cc6deletes the threeconfirmcalls, dropsuseConfirmationDialogfrom the pane and the server row, and deletes the seven now-unusedsessionHistory.settingsconsent strings. Tests flip to assertingconfirmis never called; Advanced clear still confirms. - Fleet roll-up hides for a lone computer.
2c7ee206bdstops rendering the summary line and "Turn on all" when no paired server exists, andSessionSearchComputerListdrops both subheads when there are no server rows, so a single computer shows only its own switch. - Reverted a follow-up.
42a4320ae1("say how many computers Turn on would reach") was reverted by391ea143f2; no net change from that pair.
ℹ️ The description still documents the removed dialogs
The description says "Turning a server on opens the confirm dialog naming the host" and lists the consent-gate cases under Tests, but 30b0786cc6 deleted those dialogs and their strings. Worth folding into the description before merge so reviewers read the shipped consent model.
Technical details
# Description documents confirm dialogs that no longer exist
## Affected sites
- PR description "What", "Row states", and "Tests" — still describe a per-host confirm dialog and its consent copy.
- `src/renderer/src/components/settings/SessionHistorySettingsPane.tsx` / `SessionHistoryServerRow.tsx` — the `confirm` calls are gone.
## Required outcome
- The description matches the shipped one-click enable behavior.
## Suggested approach
- Update the consent/row-state prose and the Tests bullets to drop the dialog references.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| 'Create a local index copy of agent transcripts on this computer, including conversation text and tool output as written. Content is not redacted. Turning search off stops indexing and keeps the index copy.' | ||
| ) | ||
| 'sessionHistory.settings.computersConsent', | ||
| 'Each computer keeps a searchable copy of its own agent conversations and tool output. Nothing leaves that computer.' |
There was a problem hiding this comment.
With the per-server and "Turn on all" dialogs gone, this paragraph is the only consent shown before indexing starts. The deleted serverEnableConsent / enableAllConsent were the only copy that said results are sent back to the searching computer, so "Nothing leaves that computer" now overstates isolation for a remote search — the index stays on the host, but search results do travel from the host to whoever searched. Worth keeping that clarification somewhere in the pre-enable path.
Technical details
# Pane consent lost the "results come back to you" clarification
## Affected sites
- `src/renderer/src/components/settings/SessionHistorySettingsPane.tsx:221-230` — `computersConsent` is now the only consent shown before enabling.
- `src/renderer/src/i18n/locales/en.json` — `serverEnableConsent` and `enableAllConsent` ("results are sent to this computer when you search") were deleted by `30b0786cc6`.
## Required outcome
- A user enabling a paired server understands that searching sends that host's matches back to the computer they searched from.
## Suggested approach
- Add a clause to `computersConsent`, or keep a short confirm for the server / `Turn on all` paths.There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Standing consent removed.
c48a72b631deletesuse-session-search-auto-enable.ts(and its raw-NUL binary blob) and theaiVaultSearchAutoEnableNewComputerssetting;onUserToggle/userToggledServers,noteServerToggledByHand, and both unguarded consent writes are gone. - One stateless bulk action. The summary sentence and
Turn on allbecomeEnable on all computers, rendered only while a paired server is reachable and off, and acting on row state read at click time (the localenabledwrite plus each enableable server). It appears and disappears as rows report state, and remembers nothing. - Summary module trimmed.
summarizeSessionSearchComputers/sessionSearchSummarySentenceand their strings drop out; the rollup keeps only the enableability predicate and the ordering. - Tests updated to the new button: visibility gated on a reachable-off server, unknown-state servers excluded, offline/too-old skipped, local included, per-host failure named, and the offer returning after a server is turned off.
Prior findings now closed: the binary-file concern is gone with the deleted hook, and the unguarded standing-consent writes no longer exist. The two remaining open threads (folded rows never reporting state, and a connected row reading an unknown status as a definitive off) are unchanged by this commit.
Verified locally: pnpm test on the four changed test files (50 passed) and pnpm tc:web exit 0.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
React Doctor flagged the ref written during render; useEffectEvent is the codebase's pattern for a latest-callback the effect reads.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Focus-request hook drops the render-phase ref write.
useAiVaultSearchFocusRequestreplaceslatestOnRequest.current = onRequest(a side effect during render) with React'suseEffectEvent(onRequest), matching the repo's existinguseEffectEventusage (useMetadataListRequest.ts:29). The effect still runs the callback once per request, clears it, and keeps deps as[clearRequest, requested]; the callback sees the latestonRequestexactly as the ref did.
The three unresolved prior threads (SessionHistoryServerRow.tsx:151 switch reading an unknown status as off, SessionSearchComputerList.tsx:25 folded rows never reporting state, and SessionHistorySettingsPane.tsx:185 consent copy losing the "results come back to you" clarification) are untouched by this commit, so this review is not an approval.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
📝 WalkthroughWalkthroughThe PR reports indexed message counts through the search store, indexer, shared status contract, and settings copy. It replaces the local index-status row with multi-computer session-search settings, server polling, per-host toggles, bulk enablement, clearing controls, and computer-list ordering. It adds sidebar navigation that requests focus and selects the All scope. It adds renderer tests for status polling, settings behavior, server states, clearing, and focus handling. It removes the previous index-status component and tests. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to “Enable on all computers” can silently miss servers or leave the local computer disabled, and displayed status may become stale. These issues should be fixed before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the feature, rationale, row states, structure, tests, and validation gates. However, it omits required template sections, including visual proof for this UI change, the checklist, review notes, and explicit ELI5 and platform-testing details. Resolution Update the description to follow the repository template. Add before-and-after screenshots or a video for the UI changes. Complete the ELI5, Linked Issue, Testing checkboxes and platform details, AI Disclosure when applicable, Review, Agent skill upstream boundary, Notes, and Checklist sections. Keep the existing implementation details and test results. Full details: Docstring CoverageExplanation Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 120 functions across 69 files. (1 skipped: 1 unsupported.)
✨ 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.
Actionable comments posted: 4
🟡 Minor · Update the contract for all-computers search.
docs/reference/agent-session-search-contract.md:45-49
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the contract for all-computers search.
This paragraph states that all-computers search and merged cursors are deferred. This cohort implements both behaviors through the
allscope.Document the merged ordering, host outcomes, and merged cursor behavior. Remove the deferral statement.
🟡 Minor · Use a search-specific accessible name.
src/renderer/src/components/right-sidebar/AiVaultPanelHeader.tsx:157-160
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse a search-specific accessible name.
When
searchingis true, this button retries the search instead of refreshing session history. Its current accessible name gives screen-reader users the wrong action.Select the label from
searching.Proposed fix
- aria-label={translate( - 'auto.components.right.sidebar.AiVaultPanel.refreshSessionHistory', - 'Refresh Session History' - )} + aria-label={ + searching + ? translate('sessionSearch.panel.refreshResults', 'Refresh search results') + : translate( + 'auto.components.right.sidebar.AiVaultPanel.refreshSessionHistory', + 'Refresh Session History' + ) + }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a37d4b08-f259-4aee-9696-f70135152bea
⛔ Files ignored due to path filters (1)
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing (90)
docs/reference/agent-session-search-contract.mdsrc/main/ai-vault-search/session-search-enablement.tssrc/main/ai-vault-search/session-search-engine.tssrc/main/ai-vault-search/session-search-host-registration.test.tssrc/main/ai-vault-search/session-search-in-process-service.tssrc/main/ai-vault-search/session-search-index-generation.test.tssrc/main/ai-vault-search/session-search-index-generation.tssrc/main/ai-vault-search/session-search-indexer.test.tssrc/main/ai-vault-search/session-search-indexer.tssrc/main/ai-vault-search/session-search-instance.test.tssrc/main/ai-vault-search/session-search-page-cursor.tssrc/main/ai-vault-search/session-search-paging.test.tssrc/main/ai-vault-search/session-search-schema.tssrc/main/ai-vault-search/session-search-service.test.tssrc/main/ai-vault-search/session-search-store.tssrc/main/ai-vault/session-scanner-service-protocol.tssrc/main/ai-vault/session-scanner-service-search-roots.test.tssrc/main/ai-vault/session-scanner-service-search.test.tssrc/main/ai-vault/session-scanner-service-search.tssrc/main/ai-vault/session-scanner-service-spawn.tssrc/main/ipc/ai-vault-all-host-timeouts.tssrc/main/ipc/ai-vault-search-all-hosts-real-index.test.tssrc/main/ipc/ai-vault-search-all-hosts.test.tssrc/main/ipc/ai-vault-search-all-hosts.tssrc/main/ipc/ai-vault-search-merged-cursor.test.tssrc/main/ipc/ai-vault-search-merged-cursor.tssrc/main/ipc/ai-vault-search.test.tssrc/main/ipc/ai-vault-search.tssrc/main/ipc/ai-vault.tssrc/main/orcad/orcad-entry.tssrc/main/orcad/orcad-session-search.tssrc/main/runtime/orca-runtime-state-fields.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/ai-vault-search.test.tssrc/main/runtime/rpc/methods/ai-vault.tssrc/main/runtime/runtime-service-command-surface.tssrc/main/runtime/runtime-session-search-settings.test.tssrc/main/runtime/runtime-session-search-settings.tssrc/main/runtime/runtime-store-contract.tssrc/main/startup/main-process-runtime-service.tssrc/preload/api/ai-vault-api.tssrc/preload/api/ai-vault-bridge.tssrc/renderer/src/components/right-sidebar/AiVaultPanel.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelControls.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelHeader.focus.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelHeader.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelSearch.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsxsrc/renderer/src/components/right-sidebar/AiVaultSearchEvidence.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultSearchEvidence.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionActionMenuItems.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionRow.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsxsrc/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsxsrc/renderer/src/components/right-sidebar/SessionRowTrailingActions.tsxsrc/renderer/src/components/right-sidebar/ai-vault-search-session.test.tssrc/renderer/src/components/right-sidebar/ai-vault-search-session.tssrc/renderer/src/components/right-sidebar/ai-vault-session-delete-action.tssrc/renderer/src/components/right-sidebar/ai-vault-session-filters.tssrc/renderer/src/components/right-sidebar/use-ai-vault-search-focus-request.test.tsxsrc/renderer/src/components/right-sidebar/use-ai-vault-search-focus-request.tssrc/renderer/src/components/right-sidebar/use-ai-vault-search.test.tsxsrc/renderer/src/components/right-sidebar/use-ai-vault-search.tssrc/renderer/src/components/settings/SessionHistoryComputerRow.test.tsxsrc/renderer/src/components/settings/SessionHistoryComputerRow.tsxsrc/renderer/src/components/settings/SessionHistoryServerRow.tsxsrc/renderer/src/components/settings/SessionHistorySettingsPane.test.tsxsrc/renderer/src/components/settings/SessionHistorySettingsPane.tsxsrc/renderer/src/components/settings/SessionSearchAdvancedSection.tsxsrc/renderer/src/components/settings/SessionSearchComputerList.tsxsrc/renderer/src/components/settings/session-history-status-copy.tssrc/renderer/src/components/settings/session-search-computer-rollup.test.tssrc/renderer/src/components/settings/session-search-computer-rollup.tssrc/renderer/src/components/settings/session-search-count-format.tssrc/renderer/src/components/settings/settings-page-renderer.tsxsrc/renderer/src/components/settings/settings-setup-workflow-section-renderers.tsxsrc/renderer/src/components/settings/use-session-search-status.test.tsxsrc/renderer/src/components/settings/use-session-search-status.tssrc/renderer/src/hooks/settings-navigation-workflow-sections.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/settings-navigation-types.tssrc/renderer/src/store/slices/editor/actions/right-sidebar-state.tssrc/renderer/src/web/preload-api/web-ai-vault-api.tssrc/renderer/src/web/preload-api/web-ai-vault-search-compat.test.tssrc/shared/ai-vault-search-client.tssrc/shared/ai-vault-search-contract.tssrc/shared/ai-vault-search-settings.tssrc/shared/ai-vault-search-types.tstests/e2e/ai-vault-panel-search.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
|
||
| /** Messages the index holds. Read with the file states so both describe one moment. */ | ||
| private messageCount(): number { | ||
| const row: unknown = this.db.prepare('SELECT count(*) AS n FROM messages').get() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '240,310p' src/main/ai-vault-search/session-search-store.ts
rg -n -C 5 'DELETE FROM sessions|DELETE FROM messages|session_row_id|FOREIGN KEY|stateCounts\(' src/main/ai-vault-searchRepository: stablyai/orca
Length of output: 50369
🏁 Script executed:
sed -n '70,105p' src/main/ai-vault-search/session-search-schema.ts
sed -n '200,310p' src/main/ai-vault-search/session-search-index-writer.ts
sed -n '1,125p' src/main/ai-vault-search/session-search-retention-delete.ts
rg -n -C 6 'purgeOlderThan|stateCounts\(|readCounts|messageCount|replace|DELETE FROM sessions' src/main/ai-vault-search/session-search-store.ts src/main/ai-vault-search/session-search-indexer.ts src/main/ai-vault-search/session-search-retention-delete.ts src/main/ai-vault-search/session-search-index-writer.tsRepository: stablyai/orca
Length of output: 38629
Count only searchable messages.
Replacement and retention delete the parent sessions row before the asynchronous orphan drain removes its messages rows. During that interval, stateCounts() can count rows that retrieval excludes through its JOIN sessions. Count only messages with an existing parent session.
Proposed fix
- const row: unknown = this.db.prepare('SELECT count(*) AS n FROM messages').get()
+ const row: unknown = this.db
+ .prepare(
+ `SELECT count(*) AS n
+ FROM messages
+ INNER JOIN sessions ON sessions.id = messages.session_row_id`
+ )
+ .get()📝 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.
| const row: unknown = this.db.prepare('SELECT count(*) AS n FROM messages').get() | |
| const row: unknown = this.db | |
| .prepare( | |
| `SELECT count(*) AS n | |
| FROM messages | |
| INNER JOIN sessions ON sessions.id = messages.session_row_id` | |
| ) | |
| .get() |
| const [expanded, setExpanded] = useState(false) | ||
| const visibleServerCount = VISIBLE_COMPUTER_LIMIT - 1 | ||
| const hiddenCount = Math.max(0, servers.length - visibleServerCount) | ||
| const shownServers = expanded ? servers : servers.slice(0, visibleServerCount) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,90p' src/renderer/src/components/settings/SessionSearchComputerList.tsx
sed -n '1,130p' src/renderer/src/components/settings/SessionHistoryComputerRow.tsx
rg -n 'SessionSearchComputerList|Show.*computer|Hide.*computer|visibleServerCount' src/renderer/src/components/settings/*.test.tsxRepository: stablyai/orca
Length of output: 5290
🏁 Script executed:
sed -n '1,130p' src/renderer/src/components/settings/SessionHistorySettingsPane.tsx
sed -n '1,230p' src/renderer/src/components/settings/SessionHistoryServerRow.tsx
sed -n '230,490p' src/renderer/src/components/settings/SessionHistoryServerRow.tsx
rg -n -C 4 'SessionSearchComputerList|enableableServers|isTurnOnableSessionSearchState|onStateChange|server.node' src/renderer/src/components/settingsRepository: stablyai/orca
Length of output: 32009
Keep folded server rows mounted.
When the list is collapsed, shownServers excludes servers after the first five. Their SessionHistoryServerRow components do not poll or call onStateChange, so the pane keeps them at 'checking'. enableOnAllComputers selects only 'off' states and therefore silently skips folded servers that are actually off.
Render every server and hide folded containers without unmounting their rows:
- {shownServers.map((server) => (
- <div key={server.id}>{server.node}</div>
+ {servers.map((server, index) => (
+ <div key={server.id} hidden={!expanded && index >= visibleServerCount}>
+ {server.node}
+ </div>
))}This preserves the existing ordering, fold control, and row-owned polling while allowing every server to report its state.
| const visible = useWindowStreamVisible(0) | ||
| const [status, setStatus] = useState<AiVaultSearchStatus | null>(null) | ||
| const [failed, setFailed] = useState(false) | ||
| const [hostTooOld, setHostTooOld] = useState(false) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,110p' src/renderer/src/components/settings/use-session-search-status.ts
rg -n -C 6 'useSessionSearchStatus|refresh=' src/renderer/src/components/settingsRepository: stablyai/orca
Length of output: 15359
🏁 Script executed:
sed -n '1,150p' src/renderer/src/components/settings/SessionHistoryServerRow.tsx
sed -n '1,280p' src/renderer/src/components/settings/SessionHistorySettingsPane.tsx
sed -n '1,260p' src/renderer/src/components/settings/use-session-search-status.test.tsx
rg -n -C 4 'hostId:|executionHostId|key=|refresh.*setRefresh|setRefresh' src/renderer/src/components/settings/SessionHistoryServerRow.tsx src/renderer/src/components/settings/SessionHistorySettingsPane.tsx src/renderer/src/components/settings/use-session-search-status.test.tsxRepository: stablyai/orca
Length of output: 28546
🏁 Script executed:
sed -n '1,180p' src/renderer/src/components/settings/SessionSearchComputerList.tsx
sed -n '240,420p' src/renderer/src/components/settings/use-session-search-status.test.tsx
rg -n -C 5 'SessionSearchComputerList|orderedServers|environment.id|host-too-old|hostTooOld|refresh' src/renderer/src/components/settings/*test* src/renderer/src/components/settings/SessionSearchComputerList.tsxRepository: stablyai/orca
Length of output: 50370
Reset hostTooOld when refresh changes.
SessionHistorySettingsPane bumps refresh after external changes. The polling effect still returns when hostTooOld is true, so the refresh does not trigger a new status read.
A host identity change does not reuse the row state: SessionSearchComputerList keys each row by environment.id, and SessionHistoryServerRow derives hostId from that same ID. A changed host therefore remounts the row.
If the host remains outdated, the next read sets hostTooOld again and preserves the outdated-host behavior.
♻️ Proposed fix
const [hostTooOld, setHostTooOld] = useState(false)
const intervalMs = sessionSearchPollIntervalMs(status)
+ // Why: the verdict belongs to the current refresh attempt, not to the row.
+ useEffect(() => {
+ setHostTooOld(false)
+ }, [refresh])| "description": "Search everything your agents have said and done, on this computer and on any paired Orca server.", | ||
| "searchDescription": "Turn on session search for this computer and paired servers, or clear search data.", | ||
| "indexComputers": "Search inside sessions", | ||
| "computersConsent": "Each computer keeps a searchable copy of its own agent conversations and tool output. Nothing leaves that computer.", |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '60,100p' docs/reference/agent-session-search-contract.md
sed -n '135,155p' docs/reference/agent-session-search-contract.md
rg -n -C 4 'snippet|paired|searchSessions' src/main/runtime/rpc/methods/ai-vault.ts src/shared/ai-vault-search-contract.ts src/renderer/src/i18n/locales/en.jsonRepository: stablyai/orca
Length of output: 28103
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- relevant declarations and callers ---'
rg -n -C 5 'function searchSessionService|const searchSessionService|searchSessionService\(|aiVault\.searchSessions|AI_VAULT_METHODS|clientKind|redactForTransport|AiVaultSearchResponseSchema|snippet' \
src/main src/shared docs/reference/agent-session-search-contract.md \
-g '*.ts' -g '*.md'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -e
rg -n -C 5 'function searchSessionService|const searchSessionService|searchSessionService\(|aiVault\.searchSessions|AI_VAULT_METHODS|clientKind|redactForTransport|AiVaultSearchResponseSchema|snippet' \
src/main src/shared docs/reference/agent-session-search-contract.md \
-g '*.ts' -g '*.md'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- RPC handler ---'
cat -n src/main/runtime/rpc/methods/ai-vault.ts | sed -n '1,75p'
printf '%s\n' '--- paired search test ---'
cat -n src/main/runtime/rpc/methods/ai-vault-search.test.ts | sed -n '25,65p'
printf '%s\n' '--- exposure and search bindings ---'
rg -l 'redactForTransport|function searchSessionService|const searchSessionService|export function searchSessionService' src/main src/shared -g '*.ts' |
while read -r file; do
echo "--- $file"
rg -n -C 8 'redactForTransport|searchSessionService|snippet' "$file"
done
printf '%s\n' '--- fixture response shape ---'
rg -n -C 10 'snippet:|title:|cwd:|fakeSearchService|evidence:' src/shared/ai-vault-search-test-fixture.ts src/main/runtime/rpc/methods/ai-vault-search.test.tsRepository: stablyai/orca
Length of output: 22345
🏁 Script executed:
#!/bin/bash
set -e
cat -n src/main/runtime/rpc/methods/ai-vault.ts | sed -n '1,75p'
cat -n src/main/runtime/rpc/methods/ai-vault-search.test.ts | sed -n '25,65p'
rg -l 'redactForTransport|function searchSessionService|const searchSessionService|export function searchSessionService' src/main src/shared -g '*.ts' |
while read -r file; do
echo "--- $file"
rg -n -C 8 'redactForTransport|searchSessionService|snippet' "$file"
done
rg -n -C 10 'snippet:|title:|cwd:|fakeSearchService|evidence:' src/shared/ai-vault-search-test-fixture.ts src/main/runtime/rpc/methods/ai-vault-search.test.tsRepository: stablyai/orca
Length of output: 22230
Correct the paired-search privacy statement. The relay exposure policy removes source paths and resume commands, but preserves evidence.snippet, titles, cwd, and other hit metadata. Authenticated paired clients can therefore receive indexed transcript content. “Nothing leaves that computer” is inaccurate.
| "computersConsent": "Each computer keeps a searchable copy of its own agent conversations and tool output. Nothing leaves that computer.", | |
| "computersConsent": "Each computer keeps a searchable copy of its own agent conversations and tool output. The index stays on that computer, but authenticated paired clients may receive search results, including matching transcript snippets.", |
…gs-hosts-2 Re-applies this branch's deletion of SessionHistoryIndexStatus. The squash of #20582 added that component to main with no history this branch shares, so the merge saw an add on one side and resurrected a file 33f0444 had removed. It is unreachable here and reads eleven `sessionHistory` keys the redesign dropped, so keeping it would red the localization gates.
There was a problem hiding this comment.
ℹ️ The only new commit is a base-branch merge — no PR-authored changes to re-review.
Reviewed changes
- Base-branch merge only.
5221e216d5mergesorigin/main(a01027697c) into this branch. Of this PR's 29 files, exactly six differ from the previously reviewed35b36739, and only by main's own commits: thesessionsByAgentper-agent counts (session-search-indexer.ts,session-search-store.ts,ai-vault-search-contract.ts), theleftbacklog accounting now folded intofilesDue/phase/lastSweepCompletedAt(session-search-indexer.tsand its test), and unrelateddashboardPopoutlocalization churn inen.json. This PR's authoredmessagesIndexedadditions are preserved beside them, so the net diff against the new base still carries only PR-authored changes. - Tests still green. The five changed test files pass (5 files, 92 tests), including the merged indexer suite where main's backlog assertions and this PR's
messagesIndexedassertions now coexist. - Prior threads untouched. The open concerns (
SessionHistoryServerRowreading an unknown status as a definitive off,SessionSearchComputerListfolded rows never reporting state, and the pane's consent copy) are unaffected by the merge, so this is not an approval.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/ai-vault-search/session-search-store.ts (1)
300-300: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftKeep
messageCount()off the status-poll path.
useSessionSearchStatuspolls every 2 seconds while sweeping and every 10 seconds when settled. Each poll reachesstateCounts(), which callsmessageCount()and executesSELECT count(*) AS n FROM messages. This counts the full messages table on every poll and contradicts the nearby comment. Cache the count or update it incrementally outside this path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e0339129-7419-49bc-a3e9-00720ab79d4f
📒 Files selected for processing (29)
src/main/ai-vault-search/session-search-indexer.test.tssrc/main/ai-vault-search/session-search-indexer.tssrc/main/ai-vault-search/session-search-service.test.tssrc/main/ai-vault-search/session-search-store.tssrc/renderer/src/components/right-sidebar/AiVaultPanel.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelHeader.focus.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultPanelHeader.tsxsrc/renderer/src/components/right-sidebar/use-ai-vault-search-focus-request.test.tsxsrc/renderer/src/components/right-sidebar/use-ai-vault-search-focus-request.tssrc/renderer/src/components/settings/SessionHistoryComputerRow.test.tsxsrc/renderer/src/components/settings/SessionHistoryComputerRow.tsxsrc/renderer/src/components/settings/SessionHistoryIndexStatus.test.tsxsrc/renderer/src/components/settings/SessionHistoryIndexStatus.tsxsrc/renderer/src/components/settings/SessionHistoryServerRow.tsxsrc/renderer/src/components/settings/SessionHistorySettingsPane.test.tsxsrc/renderer/src/components/settings/SessionHistorySettingsPane.tsxsrc/renderer/src/components/settings/SessionSearchAdvancedSection.tsxsrc/renderer/src/components/settings/SessionSearchComputerList.tsxsrc/renderer/src/components/settings/session-history-status-copy.tssrc/renderer/src/components/settings/session-search-computer-rollup.test.tssrc/renderer/src/components/settings/session-search-computer-rollup.tssrc/renderer/src/components/settings/session-search-count-format.tssrc/renderer/src/components/settings/settings-setup-workflow-section-renderers.tsxsrc/renderer/src/components/settings/use-session-search-status.test.tsxsrc/renderer/src/components/settings/use-session-search-status.tssrc/renderer/src/hooks/settings-navigation-workflow-sections.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/store/slices/editor/actions/right-sidebar-state.tssrc/shared/ai-vault-search-contract.ts
💤 Files with no reviewable changes (2)
- src/renderer/src/components/settings/SessionHistoryIndexStatus.test.tsx
- src/renderer/src/components/settings/SessionHistoryIndexStatus.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/hooks/settings-navigation-workflow-sections.ts
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| if (!policy.enabled) { | ||
| try { | ||
| await writePolicy({ enabled: true }) | ||
| } catch { | ||
| setError(saveErrorMessage()) | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Stop the bulk action when the local write fails.
If writePolicy({ enabled: true }) rejects, the code sets the save error and then continues to enable every server. The final alert shows only the last error, so the user can see a per-host message while the local computer stayed off. Return after the local failure, or keep both errors visible.
Proposed fix
if (!policy.enabled) {
try {
await writePolicy({ enabled: true })
} catch {
setError(saveErrorMessage())
+ return
}
}📝 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.
| if (!policy.enabled) { | |
| try { | |
| await writePolicy({ enabled: true }) | |
| } catch { | |
| setError(saveErrorMessage()) | |
| } | |
| } | |
| if (!policy.enabled) { | |
| try { | |
| await writePolicy({ enabled: true }) | |
| } catch { | |
| setError(saveErrorMessage()) | |
| return | |
| } | |
| } |
| const adopt = useCallback((next: AiVaultSearchStatus) => { | ||
| setStatus(next) | ||
| setFailed(false) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Prevent an older poll from overwriting an adopted toggle result.
If searchStatus() is in flight when adopt() stores the result of setSearchEnabled(), the older poll can finish later and replace the new status. A stale rejection can also clear the adopted status and set hostTooOld.
Increment a request generation in adopt(). Capture that generation before each poll. After the await, update state only when the generation still matches.
Proposed fix
-import { useCallback, useEffect, useState } from 'react'
+import { useCallback, useEffect, useRef, useState } from 'react'
...
+ const generation = useRef(0)
const adopt = useCallback((next: AiVaultSearchStatus) => {
+ generation.current += 1
setStatus(next)
setFailed(false)
}, [])
...
inFlight = true
+ const startedGeneration = generation.current
try {
const next = await Promise.resolve().then(() =>
window.api.aiVault.searchStatus(executionHostId)
)
- if (!disposed) {
+ if (!disposed && generation.current === startedGeneration) {
setStatus(next)
setFailed(false)
}
} catch (error) {
- if (!disposed) {
+ if (!disposed && generation.current === startedGeneration) {
setStatus(null)
setFailed(true)Based on learnings, an in-flight poll must validate its generation after each await before it writes shared state.
Also applies to: 58-68
Source: Learnings
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, stablyai#20986), so that layer is now upstream's: `searchAllExecutionHosts` over `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…stablyai#20887) * 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) * feat(session-search): enable indexing on paired servers from a client Adds `aiVault.setSearchEnabled` so a desktop can turn a paired Orca server's transcript index on or off and have the server apply it without a restart. The runtime method refuses any caller without a `pairedDeviceId` with a `forbidden`-class error, writes the whole resolved policy through the runtime store so retention rides along untouched, then reaches the index through a host-supplied hook: `applySessionSearchSettingsChange` on the desktop, the in-process instance's new `apply` on orcad. The relay is unchanged. Wire compatibility is Rule 1 shaped: a new optional method. A server that predates it answers method-not-found, which the desktop IPC handler maps to an error whose message is exactly `host-too-old`. Old clients never call it. The method is deliberately absent from the mobile allowlist, and `aiVaultSearch` stays out of the paired settings projection. (cherry picked from commit 640c715) * fix(session-search): report a paired server without session search as host-too-old on status reads (cherry picked from commit 1463e8a) * feat(settings): connected computers rows for session history indexing Agent Session History now lists every computer that can hold an index -- this computer first, then each paired Orca server -- as one row with an icon, a name, a single status line and its own switch. Indexing consent is stated once above the list, and each row carries the switch for the host it names, so turning search on for a server no longer means finding that server's own settings. Server rows poll aiVault.searchStatus on the same 2s/10s cadence as the local one while the pane is visible, and report what the host actually answered: Off, a sweep in progress, or an up-to-date count. A server that is not connected stays listed but dimmed, with its last known switch position and no claim about its index. A host that refuses the set call with host-too-old flips to an update prompt that links to Remote Servers. The old "Enable session history search" switch and the separate index-status row are gone; their status copy moved to session-history-status-copy.ts and their polling to use-session-search-status.ts, so every row shares one message builder and one poll. Advanced > Delete index copy is unchanged and still local-only, and a paired web client still sees this computer alone. window.api.aiVault.setSearchEnabled is declared and bridged here but implemented by the parallel backend PR. (cherry picked from commit 0497e6f) * fix(settings): treat a host-too-old status read as an outdated server (cherry picked from commit a3d751f) * fix(settings): turn search off before deleting its index Delete index cleared the index while search was on, so the host closed, removed and immediately reconstructed it and everything reindexed. Turn local search off first, then clear, so the rebuild only happens when the user switches search back on. (cherry picked from commit 0515588) * feat(settings): product-facing copy for session search Say search, not index or transcript; lead with what the user gets and where it shows up; one plain privacy sentence; count sessions, not files; drop the mechanics that change no decision (stop hint, SSH note, source roots jargon). (cherry picked from commit 267af1a) * fix(settings): let Button and Collapsible own their spacing and type * fix(settings): let Button and Collapsible own their spacing and type * feat(session-search): report how many messages an index holds The status contract gains an optional messagesIndexed, read from the store beside the file-state counts and cached the same way, so a settings row can say what is searchable rather than how many files were opened. Optional on the wire: a paired server that predates the field degrades to a session count. * feat(right-sidebar): let a caller open the session panel ready to type showAiVaultSearch opens the sidebar on the vault tab and sets one flag. The panel takes the flag, widens its scope to every computer, focuses the search box and clears the flag, so a later remount stays where the user left it. * feat(settings): redesign Agent Session Search for many computers Renames the pane, splits the list into this computer and paired Orca servers, and puts a count of what is on above it with a Turn on all that skips offline and too-old hosts and keeps going past a host that refuses. Consenting once persists a standing consent so a server that later becomes reachable turns on without another dialog; turning one off by hand drops it. Rows past the sixth fold away, ordered by what the user can act on. Status sentences now say how much is searchable instead of Ready, and an off computer says so with its switch alone. * fix(settings): hide the fleet roll-up when no server is paired With only this computer, the count, the Turn on all button and the two subheads all restate the single switch under them. Show them once a paired Orca server exists, which is the first point at which they say anything. * fix(settings): turn session search on without a confirmation dialog Each switch and Turn on all now act on the click. The dialogs restated the row they sat under and stood between the user and a preference they can reverse with the same control. Clearing search data keeps its dialog: that one destroys something. * fix(settings): say how many computers Turn on would reach Drops the summary sentence: every row already states whether it is offline or needs an update, so counting those again above the list said nothing new. What is left is the one thing the list cannot say, the size of the action, carried by the button's own label. With nothing left to turn on, the standing consent speaks in its place, and only when it is armed. * Revert "fix(settings): say how many computers Turn on would reach" This reverts commit 42a4320. The roll-up row's design is still open, so the branch keeps the summary sentence and the plain Turn on all button until it is settled. The dialog removal in 30b0786 stands. * feat(settings): offer one stateless Enable on all computers button The row above the list is now just that button. It appears when a paired server is reachable, new enough and off, acts on exactly those plus this computer, and disappears when there is nothing left to do. What it offers is read off the rows each render, so it cannot disagree with them. Deletes the standing auto-enable consent with it: the persisted flag, the code that armed and cleared it, the per-host memory of which switches the user had touched, and the line that promised future computers would turn themselves on. A preference that acts on hosts the user never sees is worse than a button they press when they mean it. * fix(right-sidebar): keep the focus-request callback out of render React Doctor flagged the ref written during render; useEffectEvent is the codebase's pattern for a latest-callback the effect reads.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.
…on index Agent Session History was a filesystem walk plus a parse of every transcript it found, so one load cost O(corpus) in readdirs, stats and reads on every scan. The index already holds one row per session with everything a row renders, so a list is now one indexed read. The scanner stays as the fallback for a host where no pass has completed or `node:sqlite` is absent, and it now applies the same plain-text query the index would, because an unfiltered answer would read as "everything matches". Search gains a metadata tier: - Metadata (a `sessions` row plus `sessions_fts` over titles, working directories, branches and agent names) is always indexed and answers with `evidence: null` — there is no transcript text to quote and none is fabricated. Content (`messages`, `messages_fts`) stays opt-in. The pre-tier `enabled` flag named that same consent, so a profile that recorded it keeps it as `contentEnabled` rather than having the question silently re-opened, and `status.enabled` now means only that an index exists and runs. The index writer takes that consent as `storeContent`, so a metadata-only index stores no message rows at all rather than storing and hiding them, and drops the `sessions_fts` row wherever it drops the session row. The scanner service protocol grows `refresh` and `query` so a host can answer the panel's list itself; both sides call `aiVaultHostListQuery`, so what the client sends and what the host accepts cannot drift. Remote scanning gains a Copilot source that walks a session directory without descending into the artifact trees beside `events.jsonl`, which hold no sessions and cost a readdir each. Rebased onto upstream 2026-09-18. Upstream landed its own all-computers search merge in these same files (stablyai#20582, stablyai#20753, stablyai#20754, stablyai#20870, stablyai#20886, stablyai#20887, `SessionSearchHostLeg`s, walking each host page by page and merging on recency and round-robin ranking with an encoded merged cursor. This commit's own fan-out was dropped rather than left to diverge with it — `ai-vault-search-all-hosts.ts`, `-host-fanout.ts` and their tests now follow upstream, and the fork's `ai-vault-search-merged-order.ts`, `ai-vault-search-status-aggregation.ts`, `session-search-rank-fusion.ts` and their tests are gone. What survives is what upstream has no equivalent of: the metadata FTS tier, the indexed list, the service `query`/`refresh` protocol, and the Copilot source. `contentEnabled` stays as an additive, optional status field. Re-porting per-host status vocabularies and reciprocal-rank fusion onto upstream's engine is deliberately left open, not lost. Wire compatibility: `contentEnabled` is additive and optional, so an older peer ignores it, and a host that predates the list `query` answers the scan request it already understood. See docs/reference/agent-session-search-contract.md and docs/reference/remote-wire-compatibility.md.

Reopens #20728, which GitHub auto-closed as merged when its base branch
session-search-verifyabsorbed it. Same commits, cherry-picked onto the stack.What
Agent Session History settings become one list of computers. Each computer that can hold an index gets a row: a lucide icon, its name, a paired server's
Orca v…version, one muted status line, and its own switch. This computer comes first, then every paired Orca server from the runtime environment catalog. Consent is stated once above the list.Layout follows the approved mockup (layout A, text-only progress). No progress bars.
Why
The old pane had a single switch that only governed this computer, and a separate "Index status" row. A server could not be turned on from here at all, so the only way to index a paired host was to sit at that host. One row per computer puts the switch next to the host it acts on.
Row states
Search is off. Any existing index copy is kept.Indexing… N files so far/Indexing · 55% · a of b filesUp to date · N files indexedOffOffline · index kept as it was, row dimmedChecking index…Update this server to enable session search.+ anUpdate serverlink to Remote Servers, row dimmedTurning a server on opens the confirm dialog naming the host, then calls
setSearchEnabled(hostId, true)and adopts the status it answers with. Turning one off calls it directly with no dialog. Only that row's switch is disabled while a call is in flight, and any other failure surfaces on the pane's existingrole="alert"line asCould not change session search on {{host}}. Try again.A rejection whose message carries
host-too-oldflips the row into the update state rather than the error line. The match is a substring because IPC wraps a rejection's message.No SSH rows; one muted line under the card says SSH hosts appear once indexing is available there. A paired web client still sees only this computer, with the existing unsupported copy and every control disabled.
Structure
session-history-status-copy.ts— the status message builder and the 2s/10s poll cadence, extracted fromSessionHistoryIndexStatus.tsxso every row shares one wording.use-session-search-status.ts— the per-host poll, visibility-gated, keeping its last answer when a host goes inactive so an offline row reports it rather than inventing "off".SessionHistoryComputerRow.tsx— the presentational row.SessionHistoryServerRow.tsx— one paired server: connection state, poll, confirm, set, too-old.SessionHistoryIndexStatus.tsxis deleted; it had no other caller once its status moved into the local row.window.api.aiVault.setSearchEnabledis declared in both preload surfaces and bridged toaiVault:setSearchEnabled, because the type issatisfies-checked against the bridge. The main-process handler comes from the parallel backend PR; expect a small conflict in those three files.Tests
34 tests across three files:
SessionHistorySettingsPane.test.tsx— the local confirm gate, decline, off without a dialog, retention passthrough, save failure, Advanced disclosure, delete confirm and failure, unmount fencing, one row per paired server plus the SSH note, and a web client seeing only this computer.SessionHistoryComputerRow.test.tsx— row anatomy, a reachable server's live status and version,Off, an offline row dimmed and never polled, consent naming the host, decline, off without a dialog, ahost-too-oldrejection reaching the update state and its link target, and any other failure reaching the alert.use-session-search-status.test.tsx— the polling contract inherited from the deleted component: sweep vs settled cadence, first-scan counts vs percentage, degraded detail lines, absent service, recovery after a failed read, a synchronous bridge throw, hidden and inactive gating, refresh re-reads, no overlapping reads, and no polling after unmount.Gates
Later commits on this branch
host-too-oldstatus read as an outdated server.ButtonandCollapsibleown their spacing and type, which the design-system gate now checks.