Skip to content

feat(session-search): enable indexing on paired servers from a client - #20727

Merged
Jinwoo-H merged 1 commit into
session-search-verifyfrom
session-search-remote-enable
Sep 14, 2026
Merged

Jinwoo-H merged 1 commit into
session-search-verifyfrom
session-search-remote-enable

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​257 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​255
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​206 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​183

What and why

A desktop client can now turn Agent Session History indexing on or off on a paired Orca server (runtime host), and the server applies the change immediately without a restart. Before this, consent for a remote host's index could only be set by someone sitting at that host.

SSH hosts are out of scope here and are refused client-side.

Contract

Shared — AiVaultSetSearchEnabledParamsSchema = z.object({ enabled: z.boolean() }) in src/shared/ai-vault-search-contract.ts, with AiVaultSetSearchEnabledParams inferred in ai-vault-search-types.ts. The response is the existing AiVaultSearchStatus.

Runtime RPC — aiVault.setSearchEnabled in src/main/runtime/rpc/methods/ai-vault.ts. It is registered through the generated params catalog (pnpm run generate:rpc-params-catalog), deliberately not added to runtime-rpc-mobile-method-allowlist.ts, and aiVaultSearch is not added to the paired settings projection.

Runtime service — setSessionSearchEnabled(enabled): Promise<void>, owned by the new RuntimeSessionSearchSettingsController and exposed on OrcaRuntimeService through the existing service command surface. It reads the current settings, writes aiVaultSearch: { ...resolveAiVaultSearchSettings(current), enabled } so retention rides along untouched, then hands (before, after) to a host-supplied hook.

Desktop IPC + preload — aiVault:setSearchEnabled in src/main/ipc/ai-vault-search.ts, reached from setSearchEnabled(executionHostId, enabled) on the preload bridge, the preload type, and the web preload (which rejects with unsupported).

Gating decision

The method refuses unless context.pairedDeviceId is set. In-process and undefined callers get a structured forbidden error, which required adding 'forbidden' to the runtime error passthrough set so a method-level refusal reads the same as the transport-level mobile-allowlist refusal. The server logs one line naming the paired device id and the new value as an audit trail.

Note that pairedDeviceId only reaches a handler through dispatchStreaming, which is the path the WebSocket transport a paired client connects over actually uses. The unary dispatch path is the local Unix socket, which has no paired device and is therefore correctly refused.

One deviation from the brief, deliberate. The brief specified sessionSearchServiceStatus({}, 'runtime'). This ships clientKind ? 'relay' : 'runtime', matching aiVault.searchStatus exactly. Because pairedDeviceId and clientKind are always set together by the WebSocket dispatcher, the 'runtime' transport would have returned unredacted degradedRoots[].root host filesystem paths to every remote caller, while searchStatus on the same surface redacts them. The response type is identical either way, so the preload contract the settings UI is being built against is unaffected. A test covers the redaction.

Host wiring

  • Desktop and headless serve (main-process-runtime-service.ts) pass applySessionSearchSettingsChange itself, so a paired client's write and a local settings write reconcile the scanner child through one code path.
  • orcad (orcad-entry.ts) reaches its in-process index through the new apply(settings) on installInProcessSessionSearchService. Because SessionSearchInstance.apply closes and reconstructs unconditionally, orcad dedupes with the new shared changedAiVaultSearchSettings helper, which applySessionSearchSettingsChange now also uses.
  • The relay (relay-runtime-services.ts) is unchanged and registers no such method.

Wire compatibility

Rule 1: a new optional method, no protocol bump. A server that predates it answers method-not-found, and the desktop maps it through the same -32601 / method_not_found predicate the search client uses to an error whose message is exactly host-too-old, so the UI can map it to its own copy. Old clients never call it. callRuntimeSessionSearch does not restrict method names, so no change was needed there.

No case was added to the cross-version wire suite: nothing in tests/e2e/cross-version-wire/ covers aiVault.searchStatus or any other aiVault.* search method today, so there was no existing case to extend.

Tests

  • Runtime method (rpc/methods/ai-vault-search.test.ts): refuses an unpaired caller with forbidden and never touches the setting; a paired call applies once and answers with this host's status; host roots are withheld from a paired client; a runtime with no settings store answers runtime_unavailable, which also proves the command surface really installed the method; a non-boolean is rejected before reaching the runtime.
  • Runtime service (runtime-session-search-settings.test.ts): writes the whole policy with retention preserved and hands the host before/after exactly once; normalizes an absent stored policy; an unchanged value still writes but hands the host an unchanged pair; no store means runtime_unavailable.
  • IPC handler (ipc/ai-vault-search.test.ts): a runtime host forwards {enabled} and returns the parsed status without touching the local index; unknown-method maps to host-too-old while every other failure is preserved; a non-status answer is rejected; local, SSH, unroutable hosts and a non-boolean are all refused; no injected runtime transport reports host-too-old.
  • orcad in-process service (session-search-host-registration.test.ts): apply flips a live service between disabled and answering without reinstalling it, plus a wiring assertion that orcad's runtime hook reaches it.

Gate output

$ pnpm tc
(exit 0)

$ pnpm run typecheck:node / typecheck:cli / typecheck:web
(no `error TS` output)

$ pnpm test <4 changed test files>
 Test Files  4 passed (4)
      Tests  40 passed (40)

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

Also green: verify:rpc-params-catalog, check:max-lines-ratchet, check:ts-nocheck-ratchet, check:reliability-gates, and the four localization verifiers.

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

pullfrog Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
  • Read existing PR summary snapshot
  • Checkout PR and read full diff
  • Triage: identify domain, seams, contracts
  • Investigate related code and callers
  • Dispatch specialists for unresolved questions
  • Aggregate findings and draft review
  • Update PR summary snapshot
  • Submit review

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 640c715 into session-search-verify Sep 14, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant