Repository navigation
Conversation
0e376cf to
53da532
Compare
|
Too many files changed for review (258 files, 100 file limit). Bypass the limit by tagging |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- FTS5/BM25 search index over agent session transcripts — new
src/main/ai-vault-search/subsystem: SQLite schema (role-weighted FTS5 columns,identifiersshadow column,fts5vocab), a transactional index writer with byte-offset/inode cursor lockstep, and a phrase→AND→repair→OR query layer with fork collapse via chained content hash. - Index feeding rides the existing parse funnel —
AsyncLocalStoragecapture scope emits rows fromaddPreviewMessage/addPreviewContent; incremental resumes append only new lines; Codex tool traffic and OpenCode worker rows are captured across the thread hop. - Backfill + freshness — a
SessionSearchServicein the scanner process/worker does newest-first backfill (yields every 8 files, load-backed pause) plus a per-query recent-file refresh and stale-mark drain. - Metadata enrichment — Codex
state_N.sqlitethread fallback, Cursorchats/**/meta.json, andtool_useblocks now read as text so "which session ran this command" is answerable. - Surface area —
orca search --agent-sessionCLI,aiVault.searchSessions/searchCoverageRPC behindaiVault.session-search.v1, preload/web APIs, and a search box + status row in the Agent Session History panel.
The core cursor-lockstep logic (append vs replace, inode identity, stale-mark clearing) and the FTS5 contract tests are rigorous and match the stated design; I traced the tricky paths and found no correctness or security issues.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds full-text search for local AI Vault sessions. The change introduces SQLite/FTS5 indexing, query operators, typo repair, redaction, coverage reporting, and background backfill. It exposes search through worker, service, IPC, preload, runtime, and CLI layers. The right sidebar adds debounced search, result grouping, evidence snippets, coverage status, and newest-first sorting. Scanner updates add Cursor and Codex metadata enrichment and search-content capture. Tests cover storage, providers, protocols, CLI behavior, and UI rendering. Merge Risk: 🟡 Moderate · up to Local transcript search adds background indexing and search coordination, but cancellation can be delayed during active searches or high-load backoff, affecting disable and clear-index responsiveness. Session metadata scanning, history retention, and backfill lifecycle concerns also remain unresolved, so these issues should be addressed before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives substantial technical detail, testing information, and scope. However, it omits required template sections and information, including a linked issue, visual proof or an explicit N/A statement, checklist confirmations, AI disclosure, review notes, and the agent skill upstream boundary section. Resolution Add the required template headings and complete each applicable section. Include a linked issue using ✨ 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: 16
🧹 Nitpick comments (1)
src/main/ai-vault-search/session-search-store.ts (1)
119-119: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCache the coverage aggregate instead of recomputing it per search.
searchcallscoverage()on every query.coverage()runsCOUNT(m.id)over the wholemessagestable grouped by agent. That is a full table scan per search. The panel issues debounced searches while the user types, so the scan repeats on the interactive path and competes with the query budget this file tracks indurationMs.Cache the per-agent counts and invalidate them in
applyandremoveFile.Also applies to: 124-130
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: fa6d97b1-a8d6-483b-aad6-f279f8d1cbab
📒 Files selected for processing (106)
.github/workflows/pr.ymlconfig/scripts/pr-code-change-scope.mjssrc/cli/agent-session-search-format.test.tssrc/cli/agent-session-search-format.tssrc/cli/agent-session-search-help.tssrc/cli/handler-group-manifest.tssrc/cli/handlers/search.test.tssrc/cli/handlers/search.tssrc/cli/help.tssrc/cli/root-help-text-secondary.tssrc/cli/specs/index.tssrc/cli/specs/search.tssrc/main/ai-vault-search/session-search-content-hash.tssrc/main/ai-vault-search/session-search-fork-dedup.test.tssrc/main/ai-vault-search/session-search-fts5-contract.test.tssrc/main/ai-vault-search/session-search-identifier-split.tssrc/main/ai-vault-search/session-search-index-writer.tssrc/main/ai-vault-search/session-search-opencode-freshness.test.tssrc/main/ai-vault-search/session-search-paths.tssrc/main/ai-vault-search/session-search-query-operators.test.tssrc/main/ai-vault-search/session-search-query-planner.tssrc/main/ai-vault-search/session-search-query.tssrc/main/ai-vault-search/session-search-redaction.test.tssrc/main/ai-vault-search/session-search-redaction.tssrc/main/ai-vault-search/session-search-row-filter.tssrc/main/ai-vault-search/session-search-schema.test.tssrc/main/ai-vault-search/session-search-schema.tssrc/main/ai-vault-search/session-search-service.tssrc/main/ai-vault-search/session-search-store-chunking.test.tssrc/main/ai-vault-search/session-search-store.test.tssrc/main/ai-vault-search/session-search-store.tssrc/main/ai-vault-search/session-search-transcript-fixtures.tssrc/main/ai-vault-search/session-search-typo-repair.tssrc/main/ai-vault/cached-session-list.tssrc/main/ai-vault/session-parse-cache-store.tssrc/main/ai-vault/session-scanner-accumulator.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-background.tssrc/main/ai-vault/session-scanner-candidates.tssrc/main/ai-vault/session-scanner-codex-cached-metadata.tssrc/main/ai-vault/session-scanner-codex-cached-title.tssrc/main/ai-vault/session-scanner-codex-parser.tssrc/main/ai-vault/session-scanner-codex-session-meta.tssrc/main/ai-vault/session-scanner-codex-state-threads.test.tssrc/main/ai-vault/session-scanner-codex-state-threads.tssrc/main/ai-vault/session-scanner-codex-token-count.tssrc/main/ai-vault/session-scanner-cursor-chat-meta.test.tssrc/main/ai-vault/session-scanner-cursor-chat-meta.tssrc/main/ai-vault/session-scanner-cursor-parser.tssrc/main/ai-vault/session-scanner-discovery.tssrc/main/ai-vault/session-scanner-jsonl-reader.tssrc/main/ai-vault/session-scanner-opencode-sqlite-fixtures.tssrc/main/ai-vault/session-scanner-opencode-sqlite-worker-client.test.tssrc/main/ai-vault/session-scanner-opencode-sqlite-worker-client.tssrc/main/ai-vault/session-scanner-opencode-sqlite-worker-entry.test.tssrc/main/ai-vault/session-scanner-opencode-sqlite-worker-entry.tssrc/main/ai-vault/session-scanner-opencode-sqlite-worker-protocol.tssrc/main/ai-vault/session-scanner-opencode-sqlite.test.tssrc/main/ai-vault/session-scanner-parse-cache.test.tssrc/main/ai-vault/session-scanner-parse-cache.tssrc/main/ai-vault/session-scanner-resume-point.tssrc/main/ai-vault/session-scanner-service-entry.tssrc/main/ai-vault/session-scanner-service-protocol.tssrc/main/ai-vault/session-scanner-service-spawn.tssrc/main/ai-vault/session-scanner-text-normalization.test.tssrc/main/ai-vault/session-scanner-text-normalization.tssrc/main/ai-vault/session-scanner-worker-client.tssrc/main/ai-vault/session-scanner-worker-entry.tssrc/main/ai-vault/session-scanner-worker-protocol.tssrc/main/ai-vault/session-scanner-worker-spawn.tssrc/main/ai-vault/session-scanner.tssrc/main/ai-vault/session-search-capture.tssrc/main/ai-vault/session-search-codex-tool-records.tssrc/main/ai-vault/session-search-content.tssrc/main/ipc/ai-vault-local-session-scan.tssrc/main/ipc/ai-vault.tssrc/main/observability/redactor.tssrc/main/runtime/rpc/methods/ai-vault-search.test.tssrc/main/runtime/rpc/methods/ai-vault.tssrc/main/runtime/runtime-ai-vault-commands.tssrc/main/runtime/runtime-service-command-surface.tssrc/main/startup/cli-command-names.tssrc/main/startup/main-process-preflight.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/AiVaultPanelHeader.tsxsrc/renderer/src/components/right-sidebar/AiVaultSearchSnippet.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultSearchSnippet.tsxsrc/renderer/src/components/right-sidebar/AiVaultSearchStatus.test.tssrc/renderer/src/components/right-sidebar/AiVaultSearchStatus.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionRow.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsxsrc/renderer/src/components/right-sidebar/ai-vault-search-hit-sessions.tssrc/renderer/src/components/right-sidebar/ai-vault-session-search-query-split.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-search-query-split.tssrc/renderer/src/components/right-sidebar/ai-vault-session-search-request.test.tssrc/renderer/src/components/right-sidebar/ai-vault-session-search-request.tssrc/renderer/src/components/right-sidebar/ai-vault-session-search-results.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/web/preload-api/web-ai-vault-api.tssrc/shared/ai-vault-search-coverage.tssrc/shared/ai-vault-search-query-operators.tssrc/shared/ai-vault-search-types.tssrc/shared/cli-argument-boundary.tssrc/shared/protocol-version.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| if (!chatsRoot || !chatId) { | ||
| return undefined | ||
| } | ||
| const index = await readCursorChatMetaIndex(chatsRoot) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
Cache Cursor metadata validation per discovery scan.
discoverFiles() invokes cursorChatMetaPath() for every transcript. Each call runs readCursorChatMetaIndex(), which rereads chatsRoot and stats every workspace before it checks cursorChatMetaIndexCache. The cache reuses only the built map, so a scan with N transcripts and W workspaces performs N root reads and N×W workspace stats. Cache the validated index at the scan boundary and reuse it for all dependency lookups. This can reduce scan cost on large Cursor homes.
There was a problem hiding this comment.
Deferred. The signature read is one stat per workspace and the built map is cached by that signature, so the per-transcript cost is N×W stats, not N×W directory reads. Worth caching at the scan boundary, but as a separate perf change.
There was a problem hiding this comment.
@Jinwoo-H, agreed. The repeated work is N × W workspace stat calls, not repeated workspace directory reads. A scan-boundary cache remains a valid separate performance improvement.
Would you like me to open a follow-up GitHub issue for it?
🐇
✏️ Learnings added
Learnt from: Jinwoo-H
Repo: stablyai/orca PR: 18112
File: src/main/ai-vault/session-scanner-cursor-chat-meta.ts:45-45
Timestamp: 2026-09-06T17:20:47.837Z
Learning: In `src/main/ai-vault/session-scanner-cursor-chat-meta.ts`, `readCursorChatMetaIndex()` caches the built Cursor chat metadata map by a workspace signature. During one discovery scan, each `cursorChatMetaPath()` lookup still performs signature validation with one stat per workspace. Cache validation at the discovery-scan boundary is a deferred, separate performance improvement.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
You are interacting with an AI system.
Phase 0: parse-cache resume guard checks inode; tool_use blocks render in previews. Phase 1: FTS5 index (node:sqlite) fed by the existing parse cache under an AsyncLocalStorage capture scope; identifier shadow column, 3 KB tool cap, fts5vocab typo repair, phrase-first, length prior; background backfill in the scanner process; aiVault.searchSessions / searchCoverage RPC; orca search CLI.
Claude --resume and Codex fork copy the parent transcript into a new file under a new session id, so one conversation lands N times in results. Store a chained digest of a session's first 8 messages and fold sessions sharing it into one hit at roll-up time (newest updated_at wins, duplicateCount reports the fold). Rows stay per file so cursors and deletes are unchanged. The digest is chained rather than computed over a joined string so an append can finish a prefix a short replace started; once 8 messages are folded it is frozen and later appends leave it alone.
Tool output and pasted prompts carry API keys, bearer tokens and PEM blocks; once indexed they are searchable and land in snippets. Scrub them in the one funnel every row passes through (captureIndexableText), before the cap, so neither the index nor a snippet can hold one. Reuses the observability redactor's provider fingerprints rather than redactString itself: its labeled-kv and .env-line rules are tuned for stack traces and would eat ordinary transcript content (a pasted `MAX_RETRIES = 3` loses its value, `token: ...` prose loses the word). A single anchor scan skips the fingerprint passes for text that cannot match. Schema version bumps so already-indexed secrets are dropped on rebuild.
… coverage Pins the three things the index quietly depends on: a 30 KB assistant message splits into four rows on one session and its tail stays reachable, a 100 KB tool output stops at the 3 KB cap (a term at 4000 is gone, one at 2000 is not), and coverage() counts a Claude and a Codex transcript separately with the rendered CommandExecution argv and output indexed as tool rows.
Phase 2 of full-text agent session search: the panel's search box now queries the index instead of only filtering the sessions already listed. - desktop IPC `aiVault:searchSessions` / `aiVault:searchCoverage` (local host only), the preload bridge methods, and the paired web client's runtime-RPC counterparts, all on the existing Args -> Result shapes - two-tier as-you-type: the conversation index at 120ms with no transcript refresh, the full index at 400ms; a request sequence drops anything a newer keystroke or tier has already superseded - `repo:` / `path:` keep working: their terms are stripped from the text sent to the index and resolved to scopePaths from the repos and worktrees the panel already knows - hits render through the list's own row with one evidence line under it (role glyph plus the snippet's `[term]` markers highlighted), so resume, worktree jumps and the context menu are unchanged - coverage status line and a keyboard-accessible "Newest first" toggle sit under the input while a search is active Local-leg scanning moves to ai-vault-local-session-scan.ts to keep the IPC module under its line budget; it is a verbatim move.
Codex mirrors every rollout into <CODEX_HOME>/state_<n>.sqlite, while session_index.jsonl names only a fraction of them. Read the threads table read-only with a bounded busy timeout, signature-cached on the db + -wal stat, and fill title/cwd/branch/updatedAt only where the rollout recorded none. A locked, missing or unreadable db degrades to "no fallback". Splits the session_meta field readers and the token_count usage fold out of the parser to stay under max-lines.
Cursor splits a chat across two trees: the transcript under <cursor>/projects/<slug>/agent-transcripts/<uuid>/, and cwd/title/ createdAtMs/updatedAtMs in <cursor>/chats/<md5 of cwd>/<uuid>/meta.json. The hash is over the cwd we are looking for, so cross the gap with a signature-cached chat-id index over the chats tree, fill only fields the transcript left empty, and stat the meta.json as a content dependency so a rewrite invalidates the parse cache. Remote content parses opt out.
… of dropping tables DROP TABLE on the 3.3 GB messages_fts took 18 s on this machine, inside the scanner service's init, past its 5 s ready timeout; every search then failed with 'did not become ready' until the restart circuit opened. Unlinking the file and its sidecars is instant and the index is a cache, never a source.
…rage Silence was indistinguishable from an empty index: a provider whose transcripts were discovered but never parsed simply had no GROUP BY row. The backfill now records discovered files, parse failures and non-notice scan issues per agent, coverage merges that map over the SQL result, and both the sidebar status and the CLI footer name a provider that indexed nothing once the backfill is complete.
Aux functions reject an aliased table, a `rowid = ?` or `rowid IN (?)` constraint beside MATCH is dropped by the planner so only the subselect form selects a row, and sessions.file_path stays non-unique because OpenCode and Cursor share one store path. A store-level test proves each hit's snippet comes from that hit's own best message; reverting the subselect to `rowid = ?` fails it.
The renderer stripped `repo:` and `path:` before calling aiVault.searchSessions, so a raw RPC caller (or the CLI with an operator typed into --agent-session) sent them as FTS text and got typo-repaired garbage. Split the query with the shared tokenizer inside the index query instead, and turn the operators into ANDed cwd constraints on the session rows. An operator-only query answers with the newest sessions in scope. The split moves to src/shared so the renderer, the index, and any raw caller read one spelling of the operators; the renderer module re-exports it and keeps the scope-path resolution it owns.
Share the OpenCode DB fixture builders instead of keeping them inline in the SQLite scanner suite, then drive discovery + a required-mode parse over a session that gains a message: the synthetic candidate's mtime follows time_updated, so the cache re-parses and the sink replaces the indexed rows. An unchanged session still reuses the cached parse and leaves the index alone.
OpenCode 1.17+ sessions parse on a worker thread, and the search capture scope is an AsyncLocalStorage store that cannot cross threads, so every captured row was dropped and the index held those sessions with no searchable text. The parse request now carries a capture flag, the worker parses inside its own capture scope and returns the rows with the session, and the client replays them into the caller's scope.
…exes it List scans queue every not-yet-indexed file as stale while the backfill runs; nothing cleared the mark when the backfill reached the file, so the first search after a backfill re-parsed the whole queue (8.4 s on 4,000 sessions).
Every FTS5 claim so far was measured on macOS and Linux; the Windows job is the only place the Electron-bundled SQLite runs on Windows in PR CI.
…rdown ratchets after rebase main now requires concrete return types on every bridge key and refuses raw recursive rm in tests that run on the Windows package job.
…resh inode ext4 on the CI runner reused the freed inode, so the assertion was false on Linux while true on APFS. The planted stale WAL being gone and the row count resetting are the portable proof; skipping the unlink still fails the test.
main added a parity test between COMMAND_SPECS and CLI_COMMAND_NAMES; without this, 'orca search' launched from a packaged app would open the desktop window instead of redirecting to the CLI.
458d5db to
1615334
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Batched, resumable retention cleanup — a
search_pending_deletestombstone (schema 7→8) hides an expired session the moment it is swept, thendeleteExpiredSearchFilesremoves its messages in 256-row batches that survive a reopen; the row filter andcoverage()both exclude tombstoned sessions so a partial delete is never visible. - Streaming discovery —
SessionNewestFileskeeps only the newestlimitfiles during the directory walk, so a 100k-candidate scan no longer retains every path (the old path collected, stat'd, sorted, then sliced);Infinityand0are handled. - Shared refresh lane —
SessionSearchRefreshLanededupes concurrent query refreshes by scan-root key and only aborts the shared run when its last user drops, so one caller's cancel cannot poison a sibling. - Execution-host ownership —
useAiVaultSessionSearchRequestanduseAiVaultSearchCoveragePollnow key their retained snapshots by the execution host, retiring stale results and coverage the moment the runtime changes; a web compatibility test pins the legacyexecutionHostIdfallback and the old-host/disconnected error paths.
The retention delete's tombstone/hide-then-batch semantics, the refresh lane's abort bookkeeping, and the host-switch gating are each correct and backed by a test that fails against the pre-change behavior. I also re-checked the prior match() newest-sort concern and confirmed it is not a bug (SQLite's single-max() bare-column special case selects the max-score row), and resolved that thread.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit since the prior review (66d9db8, "Bound session search writes with streaming capture and atomic publication") replaces the buffered write path with a streaming one and hardens publication against partial writes:
- Streamed capture —
captureIndexedSessionParseand a newSessionSearchMessageChannelfeed captured messages intoSessionSearchIndexWriter.apply()as the parser produces them; the JSONL reader checkpoints after each chunk, so a large transcript's read is bounded by the write rate instead of buffering the whole parse. - Atomic publication — rows are staged into
search_write_batches(apublishedflag) with the session flaggedindex_ready=0, then the final transaction flips both, so a search always sees the old generation or the new one, never a partial write. - Interrupted-write recovery —
recoverSearchWritestombstones orphaned unpublished batches/sessions on open, and the writer'sfinallydiscards a batch that never published (reject/cancel/close), so a crash or cancellation leaves no half-written rows. - WAL backpressure —
assertSearchWalBudget(wal_checkpoint(PASSIVE)) throwsSearchWalBackpressureErrorpast a 64 MB pending threshold; the store marks the file stale and retries, so a blocked reader cannot grow the WAL without bound. - Schema 8 → 9 — adds
search_write_batches,sessions.index_ready,messages.batch_id, andsearch_pending_deletes.batch_id, plusjournal_size_limit; rebuilt via unlink. - Query-side visibility —
match(),coverage(), and typo repair'svisiblePostingsall excludeindex_ready=0sessions and unpublished batches, andSessionSearchStore.applyis now async with anacceptingWritesgate and ascheduleCleanuptombstone drain.
I traced the streaming producer/consumer concurrency (channel checkpoint/drained handshake, stop() releasing a pending checkpoint, removeFile invalidating an in-flight write via activePath/invalidated), the atomic swap ordering, and the WAL-budget math, and confirmed each path is covered by a test that would fail against the pre-change behavior (session-search-staged-write.test.ts, session-search-streaming-write.test.ts, session-search-wal-budget.test.ts).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit since the prior review (2825e2b, "Simplify session search publication and flush ownership") removes the placeholder mutation from the streaming write path and the flush-signal indirection from the renderer search request:
- Publication without mutation — the streaming write now carries a
resultpromise (SessionSearchIndexResult) instead of a pre-seeded placeholdersessionthat the producer mutated after parsing;SessionSearchIndexWriteis the union of the synchronous update and the streaming form, andcaptureIndexedSessionParsepassesresult: parsedrather than rewiringupdate.session/update.byteOffset. - Staging-session split —
createStagingSessionsetsindex_ready = 0at insert, andupdateSessiontakes the concreteAiVaultSession; the parser-reject branch retires the prior session and records a null cursor, with tombstone cleanup unchanged. - Stale-append no-op — a cursor-mismatched
appendnow returnsfalse(so the store marks the file stale) instead of callingremoveFile, which had been deleting and retiring the live session's published index. - Flush ownership in the renderer —
useAiVaultSessionSearchRequestdrops theflushSignalprop/effect in favour of aflush()callback that cancels both armed timers and issues the full tier, anduseAiVaultSessionSearchResultsno longer owns aflushSignalstate. This also removes the old effect's re-flush on host switch. - Regression coverage — new tests pin the stale-append no-op, the no-mutation
resultcontract (via anObject.freezed write), and the Enter-flush path; the paired e2e spec now presses Enter.
I traced the three sites that must agree (the capture in captureIndexedSessionParse, the writer's stage and its finally cleanup, and the store's apply), verified the discarded/rejected staging sessions are still tombstoned via discardSearchBatch, and confirmed the flush callback reads the current argsKey.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Keep indexed conversations searchable while background indexing is paused. Persist pause through scanner and runtime restarts, fence cancelled writes, and resume the existing backfill using completed file records. Share progress and controls between Settings and the status-bar popover; keep short live writes quiet and preserve legacy-host compatibility.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit since the prior review (f6351026, "Add resumable session indexing controls and shared progress UI") adds a user-facing Pause/Resume control for transcript indexing and a shared progress surface:
- Pause/resume policy — a new
pausedflag onAiVaultSearchSettings(persisted, surfaced only when explicitlytrue) is carried throughSessionSearchService(this.policy = { ...options }, so it survives a scanner restart) and gatesensureBackfill, the per-search refresh lane, and the capture sink (setAcceptingWrites). Pausing aborts the in-flight backfill viastop({ keepStore: true }), which also cancels the refresh lane. - Write-invalidation epoch —
SessionSearchStorebumps awriteEpochonsetAcceptingWrites(false), so a streaming write mid-flight at pause time stops accepting rows instead of writing past a quick resume. - Progress observer —
SessionSearchIndexingProgressowns no work or timers, just tracks phase/files/failures fromdiscover/discovered/processed/finishandbeginWrite/finish;coverage()embeds the optionalindexingsnapshot. - Backfill trigger broadened — list scans now also kick
ensureBackfill(service and worker entry), with discovery onlimitPerAgent: Infinityso a scan'slimit/scopePathsnever truncate it;parseSearchCandidateswas extracted out of the service. - Shared renderer surface — a per-host
searchCoverageStore(singleuseSyncExternalStoresubscription + visibility-interval poll shared by the settings pane, status-bar segment, and search flow) feeds a newSessionSearchIndexingPaneland aSessionSearchStatusSegment; dropping the no-op re-forward guard on unchangedpaused:falseis what lets Retry reach a backfill inerrorphase.
I traced the pause/resume state machine (configure → stop/ensureBackfill/open), the writeEpoch invalidation of in-flight streaming writes, and the backfill-from-list-scan path, and confirmed the new tests each assert a specific outcome (phase, counts, hit presence) rather than passing vacuously.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The commit since the prior review (e8220c2c, "Merge main and preserve session search alongside chat resume") reconciles this branch with main:
- Chat-resume brought in from
main—AiVaultPanelthreadsgetSessionResumeInChatthroughAiVaultSessionVirtualList→AiVaultVirtualRow→VaultSessionRow, withcopyAiVaultSessionValueanduseAiVaultSessionResumeInChatextracted and newresumeInChat*i18n keys; the search-specific wiring (getSearchEvidence, projected hit sessions) is preserved. - Shared Codex-home source set —
configuredAdditionalCodexHomePaths()is extracted fromresolveAiVaultHostScanSourcesso resume-eligibility and scan discovery read the same set (a behavior-preservingsources.getAdditionalCodexHomePaths?.() ?? []). - Unrelated
mainchanges ride the merge —help.ts/formatFlagHelpflag text and thenativeChatSessionOptionssettings field.
The session-search engine (session-search-*, ai-vault-search-coverage-*, ai-vault-search-coverage-store) is untouched by the merge, and the one PR-authored reconciliation is a pure extraction with no behavior change.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit since the prior review (98c48add, "Add host-owned remote session search and harden indexing lifecycle") extends search across hosts and hardens the indexing lifecycle end to end:
- Host-owned remote search —
--host ssh:<target>and--host allroute through new targeted RPCs (aiVault.sshSearchSessions/sshSearchIndexStatus/sshSearchConfigure) to aRelaySessionSearchOwnerin the relay scanner process, which holds an exclusive SQLite lock on~/.orca/session-search-relayand atomically persists policy under it, so one relay owns the index and a crash releases it. - Bounded cross-host aggregation —
searchAllHostsqueries at most 16 routes at concurrency 3 with a 15 s per-host budget and 30 s overall deadline, projects each reply to 512 KiB / 4 MiB aggregate, and reports distinctsearched/disabled/unsupported/policy-unknown/omittedoutcomes. - End-to-end cancellation —
AbortSignalthreads through the CLI transport, WebSocket request socket, RPC dispatcher, providerrequestHostRpc, OpenCode worker client, and streaming capture, with socket teardown and abort-listener cleanup verified. - Streaming OpenCode capture — the worker emits acknowledged
captureBatchframes with bounded backpressure that suspends the producer deadline while the sink drains, and retires the worker on consumer failure. - Durable enable / lifecycle — policy application waits on the settings-store flush before acknowledging, index status surfaces
available/applied/reason, corrupt indexes are recoverable without leaking the SQLite handle, and deleted or archived OpenCode rows are filtered per session with bounded refill.
I traced the ownership lock/timer/yield handoff, the presence-check refill loop, the streaming capture ack protocol, and the wire-boundary schemas, and confirmed each is backed by a test that fails against the pre-change behavior — including a real forked-scanner SIGKILL crash test and an esbuild-bundled process-exclusion test.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…r per rule Second pass over the session-search delta. Keeps the staged-write, streaming capture, consent-gate and SQL-side filtering designs; removes the layers that had accumulated around them. Store and schema (schema 10): row visibility is two SQL views instead of four hand-written predicates; publish nulls messages.batch_id and drops the batch row, so the messages view is `batch_id IS NULL` and a recycled batch id can no longer hide published rows; `published` column and its index removed; WAL checkpoint guard taken off every read path and sampled on the write loop only; maintenance class split into three plain functions; cwd_key indexed and the scope filter switched to a range seek with an EXPLAIN plan assertion. Service and capture: one write shape (streamingCapture flag and the dead array branch deleted); configure applies policy to the store once; one shutdown path (dispose removed) with an ownership guard so a late close cannot unregister a replacement service's sink; unverifiable sources are returned with a caveat instead of filtered like deletions; a transient write failure no longer pins the indexing badge at error; refresh lane reuses stableInFlightKey; message channel handles concurrent checkpoints. Query: relevance sort now groups by session before the candidate limit (the must-fix was only applied to newest); one operator parser shared by panel and backend with the apostrophe bug fixed; OR within a key, AND across keys; one documented case rule; received enums tolerate unknown values; result type derived from the schema; projection applied on the desktop IPC path; tokenizer contract pinned against fts5vocab. Remote and CLI: SSH and local ids rejected at the RPC boundary for all four methods; method-name regex sniffing removed from both transports; CommandSpec gained booleanFlags/repeatableFlags so args.ts carries no command vocabulary; settings update no longer blocks or fails on scanner reconfiguration; relay owner keeps its lease through caller cancellation and answers index-status on an unreadable policy; one SESSION_SEARCH_METHODS record feeds every caller. Renderer: coverage polling stops once the index settles and re-arms on focus; search results feed the coverage store instead of re-fetching; the `updating` state and header line are deleted in favour of the list's own loading state; local-only notice only when a remote host is in scope; status-bar segment is read-only and opens settings; ownerKey folded into the args key. Providers: OpenCode capture resets (not clears) the parse deadline; capture and preview reads degrade to a scan issue instead of dropping the session; a consumer write failure is not counted as a worker death; response union discriminated on `kind`; worker host split out of the client. Every behavioural fix carries a test that fails when the fix is reverted.
…emp dir is removed The EXPLAIN QUERY PLAN test left its connection open, so Windows refused to unlink the WAL sidecar during afterEach cleanup.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
One commit since the prior review (e028199, "consolidate the review fixes into one owner per rule"), a broad hardening/refactor pass over the search subsystem. I traced the riskiest seams — the SQL roll-up, transport framing, cwd range bounds, the worker lifecycle, and the presence-refill loop — and found them correct and well-tested:
- Scoped per-command flag vocabulary onto
CommandSpec(booleanFlags/repeatableFlags), so--agentrepeats undersearchbut stays single-valued underworktree create; the boundary scanner (findCliCommandIndex/findCliCommandPathAt) and the parser now read one widened set. - Removed the per-method 4 MiB search response cap from both transports in favor of the shared 8 MiB frame; the host's 512 KiB projection bound is the real cap, so search responses can no longer be rejected at a lower limit than other methods.
- Consolidated row visibility into
visible_sessions/visible_messagesviews (schema 9→10) and indexedsessions_cwd_key;sessionRowFilternow seeks via a half-open range (insideCondition) instead of asubstrscan, andsearch_write_batchesdropped itspublishedcolumn (publish clears thebatch_idpointer and deletes the row). - Extracted
rankSessionHits/resolveLimit/sessionFieldsintosession-search-hit-ranking.tsand collapsedmatchto one best row per session on both sort orders before the 600-row candidate limit, so a long session cannot crowd the page. - Kept unreadable sources as flagged hits (
sourceUnavailableFiles) rather than dropping them, invalidating only proven deletions — aligned with the SSH execution boundary. - Retagged the OpenCode worker protocol to
kind: 'batch'|'result'|'error', extractedOpenCodeSqliteWorkerHostfor lifecycle, reset (not cleared) the producer deadline under backpressure, capped respawn atMAX_CONSECUTIVE_DEATHS, and degraded a corrupt part blob to an empty preview instead of dropping the session. - Hardened the relay owner to persist the policy before applying it, keep
--index-statusanswering for an unvouchable policy (clear-only recovery), and hold the lease through an invalid query. - Reworked the renderer coverage store to stop polling once settled (focus re-read +
observe()of search-carried coverage), made the status segment read-only, and replaced the desktop-onlylocalOnlynotice withremoteHostsTitleOnly. - Made the wire schema forward-compatible via
.catch()fallbacks onSessionSearchResultSchema, and rewrotesplitAiVaultSearchQueryto anchor operators at token starts.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…ound Second adversarial review of the consolidation pass, six areas, and the fixes for what it turned up. Providers: a degraded OpenCode capture read no longer publishes the file cursor. The read marks the capture scope incomplete, the flag rides back across the worker hop, the writer takes the not-applied path so the store marks the candidate stale and the next scan re-parses; no red badge for a retryable read. The parse deadline no longer counts time queued behind unrelated index writes (separate worker and consumer bounds). Codex metadata refresh returns the same reference whenever nothing changed. The OpenCode worker host is generalised to LazyWorkerThreadHost and the port scanner adopts it, dropping its duplicate lifecycle. Renderer: the poll latch is gone. Main emits aiVault:searchIndexingChanged after every apply, and the store does one read, subscribes to the push, and polls only while a phase genuinely advances; a failed read is an unconfirmed reading that keeps polling with a 4/8/16/32 s backoff, cleared by success or push. The web client, which has no push channel, keeps its visibility-gated interval. Coverage is observed only from a current result and never overwrites a newer run. idle is a resting phase. Unverified sources surface in the panel status line. Service and store: a store that is transiently null during clear no longer answers "search is off"; coverage falls back to consent. A superseded transient write failure rebuilds the progress batch so a stale failure count does not linger. Consent is persisted before it is applied. The WAL sampling comment names the real second connection. messages_batch is a partial index (schema 11). The benchmarks drive the real store. Database removal uses the shared Windows retry loop. Query: operator-only pages go through the ranking owner, so forks collapse the same way for `repo:app` and `needle repo:app`. Typo repair falls through to the best visible candidate instead of abandoning the prefix. The grouped CTE's measured cost is recorded next to it. The outbound projection validates against strict enums while the received schema keeps its fallbacks, and the result type is pinned by equality rather than mutual extension. Remote and CLI: search operations share one relay lane again, so a status or configure issued during a query waits unsent and survives a sidecar fault. A query gets the scan budget rather than the title budget. A rejected backfill releases the owner lease. The configure path no longer refuses on an in-flight `applied`. The search boolean vocabulary has one owner in the spec. The method record moves into the contract module and gains searchCoverage. The CLI status formatter treats applied:false as a caveat, not as unavailable. An aggregate is not partial merely because a host reported unverifiable sources. Every fix carries a test that fails when it is reverted.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit since the prior review (0f93c6d, "close the regressions the second review round found") is a broad hardening pass with no regressions. What changed:
- Consent flush ordering —
applyAiVaultSearchSettingsnow persists the policy store beforeconfigureAiVaultSearch(was after), so a crash can only leave "persisted but not applied" (retried next start), never an index built under a consent record that still reads disabled. A newsetSessionSearchIndexingChangeNotifierpush tells every renderer window to re-read coverage after any apply — success or failure. - Strict-out / lenient-in wire schemas — the contract splits into
OutboundSessionSearchResultSchema(producer validates its own output, so enum drift throws rather than shipping as a plausible fallback) andReceivedSessionSearchResultSchema(per-field fallbacks so a newer host never costs an older client the response).SESSION_SEARCH_METHODS/SESSION_SEARCH_OPERATIONSconsolidate intoai-vault-search-contract.ts; the oldai-vault-search-rpc-methods.tsis deleted with no dangling references. - Relay lane + deadline — every search op routes onto the one
searchlane (matchingRelaySessionSearchOwner's serialization), deadlines arm only once a call is actually sent, and a query gets the scan budget while controls stay on the title budget.yieldBackfillnow hands the lease over when a waited-on backfill pass rejects instead of holding it forever. - Shared worker host —
LazyWorkerThreadHost<TResponse>is extracted from the OpenCode SQLite client and reused byPortScanCommandClient; both fail closed with no main-thread fallback. - Degraded capture read — a mid-session read degradation marks the capture incomplete, the flag rides the parse value back across the worker hop, and the index writer refuses the file cursor without flagging a failure, so the session still lists but re-parses on the next scan.
- Query correctness — operator-only
recent()now folds forks throughrankSessionHits; typo repair probes up to 8 ranked candidates per prefix so a staged term no longer loses a repair; schema bumps to 11 with a partialmessages_batchindex andremoveTreeSyncWindows retry. - Renderer coverage poll — backoff doubling to a 32 s ceiling,
controlFailedsplit fromfailed, a stale-run guard inobserve(), and acurrentflag so a retained older answer never republishes its stale coverage.
I verified the persist-before-apply ordering, the strict/lenient schema split (route values, type-equality, missing-field coverage objects), the relay send-time deadline, the lease handoff, the LazyWorkerThreadHost extraction in both consumers, and the capture-incomplete flow across the thread hop — all correct.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
… spec The segment no longer opens a popover with controls; it names the resting phase and opens the settings pane. The spec now clicks through to the pane's own Resume button. Also merges a duplicate import that failed the focused code-quality plugins.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior Pullfrog review (0f93c6d), the branch synced origin/main and re-synced the i18n runtime catalog — no session-search code changed:
- Merged
origin/main— brings in main's unrelated work (terminal contrast settings, PTY I/O failure cleanup, Cmd-J tab ownership, native-chat journal paging, plus assorted perf and dependency commits). The net PR diff is confined to the two shared files both sides touch. - i18n catalog re-sync — the follow-up
chore(i18n)adds theminimumContrastblock and a missing comma toen-runtime-required.json, matching the mergeden.json.
I verified both i18n files still parse, the search keys under AgentSessionHistoryPane coexist with the merged contrast block, the session-search reliability-gate entries are intact, and no merge-conflict markers remain under src/ or config/.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior Pullfrog review (fb56ee4), the branch synced origin/main and regenerated the i18n runtime catalog — no session-search code changed:
- Merged
origin/main— brings in main's unrelated work (orchestration federation / sleeping-agent lifecycle, PI titlebar extension, terminal contrast rework). The PR-visible net delta is confined toconfig/reliability-gates.jsonc(one added orchestration test command) and the two i18n files. - i18n catalog regeneration —
b15d6f0regeneratesen-runtime-required.jsonafter main'sea102a9eb8dropped the orphanTerminalPane.minimumContrastentries; the block and itsd78fc4fdefduplicate are removed from both files, while the correctly placedminimumContrast("Color Contrast") block under the settings pane remains.
I verified both i18n files parse, have no duplicate keys, and contain no merge-conflict markers, and that no session-search file appears in the delta.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Superseded by the merged split implementation of this work: #20029 (query engine), #20277 (public contract/transports), #20516 (scanner lifecycle), #20514 (CLI), #20580 (panel and opt-in), #20582 (settings), and #20887 (computer controls). Current main The shipped surface differs from this proposal: the CLI is |

Summary
Local, programmatic search over coding-agent session transcripts:
orca search --agent-session "<query>",aiVault.searchSessionsRPC, and a search box in the Agent Session History panel.BM25 over per-message FTS5 rows in
node:sqlite(Electron's bundled SQLite 3.53). Role-weighted columns (user 3 / assistant 2 / tool 1), identifier shadow column soTerminalPathfindsresolveTerminalPath,fts5vocabtypo repair, phrase-first routing for literal-looking queries, tool output capped at 3 KB. No models, no network, no native modules.Chosen from a 403-query retrieval shoot-out over ~1M real messages; dense vectors, RRF fusion, and a reranker all lost to this on realistic queries. Design and evidence:
docs/reference/agent-session-search-proposal.html(local, gitignored underdocs/**).How it feeds
The index rides the existing parse. Every parser already funnels through one accumulator; a parse runs inside an
AsyncLocalStoragecapture scope and the preview funnel also emits full-text rows. Incremental resumes emit only appended lines. List scans never pay for the index (opportunisticmode queues the file); the backfill and per-query refresh runrequired. Cursor lockstep: the index stores byte offset + inode per file; a mismatch forces a whole-file re-parse.Backfill runs in the scanner service process, newest-first, yields every 8 files, backs off on load. On this machine: 3,979 sessions / 1.16M messages in ~10 min.
Measured
Also fixed along the way
\nskipped records silently. Now checks dev/ino.DROP TABLEfor 18 s inside the service's 5 s ready window and opened the restart circuit. The file is unlinked instead.contentItemTextnow readstool_useblocks, so "which session ran this command" is answerable.Wire compatibility
Additive only: two new RPC methods behind capability
aiVault.session-search.v1, optional fields on coverage. Remote hosts search on their own runtime;executionHostIdnames the host and never redirects.Verification
pnpm tc, changed-code quality + React Doctor gates, ~20k tests across the affected suites, mobile typecheck + tests (no client change).bm25/snippetneed the table name;rowid = ?besideMATCHis dropped;file_pathnot unique) verified on macOS and in a Debian 12 Electron container, and added to the Windows package job's test list.Consent
Transcript indexing is off until the user turns it on. The panel's existing title/metadata search keeps working; a one-time card under the box offers Enable / Not now, and after Not now a query shows "Titles only · Search inside conversations". Settings > Agent Session History has the switch, a history-range bound (all / 90 / 30 days), index size, and Clear index.
orca search --agent-sessionprints an actionable off message and gains--enable.The policy is enforced in the scanner service: disabled means no database, no capture sink (so list scans stop writing rows), no backfill.
coverage()never starts the backfill; asearchConfigureoperation reaches the running service so toggling needs no restart. Coverage gains an optionalenabledfield; absent means an older host that was always on.Not in this PR
Watcher (query-time refresh covers freshness; a watcher only moves ~120 ms off the query path), per-provider exclusion and pause/resume, deep-scan fallback, optional reranker (gated on the real query log now being collected in
search_log). OpenCode SQLite sessions index only the parser's 5-message preview window.