Skip to content

feat(session-search): resolve Workspace and Project scope on the host - #21509

Merged
Jinwoo-H merged 14 commits into
mainfrom
session-search-scope-identity
Sep 18, 2026
Merged

Jinwoo-H merged 14 commits into
mainfrom
session-search-scope-identity

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​820 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​813
Prod 28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​529 $\color{#cf222e}{\Huge{\mathbf{−}}}$​58 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​471

The bug

The Agent Session History panel's Project scope fails outright on any repo with more than 64 worktrees, showing "Could not search this computer. Check its connection and try again." The panel translated "this project" into one scope path per worktree and sent them as filters.scopePaths; AiVaultSearchRequestSchema refuses more than AI_VAULT_SCOPE_PATHS_MAX_COUNT (64). The reporting user's repo has 580 worktrees.

The design

The panel stops translating a scope into paths for search. It sends the scope's identity, and each execution host resolves that identity into its own paths.

  • Contract. The request gains an optional within (scope there already means the search tier). Two arms: { kind: 'workspace', worktreeId } and { kind: 'project', projectKey }, where the key is the same repo:<repoId> / project:<projectId> string the panel already computes — toAiVaultProjectKey moved to src/shared/ai-vault-project-key.ts so client and host share one spelling. filters.scopePaths stays as the explicit path filter the CLI's --path uses. A request carrying both is refused; a request carrying neither still searches everything.
  • One resolver on the host. Every entry point (native IPC, the runtime RPC method, the relay handler, SSH forwarding) already funnels into searchSessionService, so the identity becomes paths there, once. A project on a host is its repo checkout, plus the directories Orca creates that repo's worktrees in — present and historical, from the same buildKnownOrcaWorkspaceLayouts enumeration worktree ownership uses — plus every registered worktree living outside them, plus the prior paths of renamed worktrees. Both the scanner and the index match by prefix, so the resolver folds any path contained in another: 580 worktrees under one managed directory collapse to that one directory.
  • Resolved paths never enter the request. They are handed to the engine beside it. filters.scopePaths is a wire field capped at 64 for the clients that fill it in by hand, and the scanner child re-parses the request against that same schema, so a project whose worktrees do not share one managed directory would have been refused at 65 paths. A host's own answer about its own directories carries no cap.
  • A workspace identity is not a path. The id is resolved through this host's own worktree registry, or matched against the repo's own checkout. A directory this host has not registered is not searched.
  • The catalog is persisted state, never a git scan. Repos, projects, project host setups and worktree metadata come from the profile store, filtered to the execution host that is answering, so a desktop does not resolve a local search against a remote host's directories.
  • An unresolvable identity is an answer, but not the first one. The resolver's verdict is handed to the search service rather than answered at the entry point, so a host that is switched off or still starting replies disabled or not-ready for a scoped request exactly as for an unscoped one. Only a host that is on and ready answers unavailable / scope-unknown, and it never widens the search.

AI_VAULT_SCOPE_PATHS_MAX_COUNT is untouched: it still bounds the CLI's --path list and the session list request. aiVault.listSessions, deriveAiVaultScopeSessionPaths and the mobile app are untouched.

Supersedes

This supersedes #21496, the interim fix on session-search-project-scope that folded sibling paths on the client.

Tests

  • Contract: identity accepted under both key spellings, identity plus scopePaths refused, unknown arm refused, old shape still valid, scope-unknown on the response and as a per-host outcome.
  • Resolver: prior paths, a prior path another workspace now claims, folder workspaces, a custom worktreeBasePath, a workspace root the user has moved away from, flat placement where the global root belongs to every project and 100 worktrees each become their own path, a directory the host has not registered, an unknown project, a project set up only on another host, and the 580-worktree fold.
  • Entry points: IPC, runtime RPC, relay handler and the shared remote client each resolve the identity on the host that answers; the relay, which carries no repo catalog, reports the scope rather than widening.
  • Ordering: a switched-off host answers disabled and a starting one not-ready for a scoped request, and only an on-and-ready host answers scope-unknown.
  • Panel: identity sent for Workspace and Project, nothing for All, the scope banner quiet while any computer reached the scope, and no restart while the identity holds.

Gates: pnpm tc, pnpm run check:code-quality:changed, the four verify:localization-* scripts, react-doctor (no ref-mutation finding on the changed renderer files), and the Docker-backed tests/e2e/ssh-ai-vault-session-history.spec.ts all pass.

The host must spell a project key exactly as the client does, so the two
sides share one function instead of two copies that can drift.
The panel cannot keep translating a project into one path per worktree: a
repo with 580 of them exceeds the 64-path cap and the search fails outright.
The request now carries the scope's identity instead, and a host acknowledges
the scope it resolved so a client can tell a scoped answer from an old host's
unscoped one.
Every entry point already funnels into searchSessionService, so the identity
becomes paths there once: native, WSL, SSH and relay hosts cannot disagree.
A host that does not know the workspace or project answers scope-unknown
rather than widening the search to everything it has.
Covers prior paths, a workspace another now claims, folder workspaces, a
custom worktree base path, flat placement where the global root belongs to
every project, and the 580-worktree fold the panel's path list could not do.
A full Repo/Project/ProjectHostSetup requirement forced test stores to stand
up rows the catalog never looks at.
Workspace and Project name what to narrow to; All sends nothing. A host that
answers a scoped search without acknowledging it is reported as needing an
update, and none of its hits are shown, because they are not this scope's.
An old host strips the identity and answers with every session it has, and
the answer is well-formed. The missing acknowledgement is the only evidence,
so the merge drops those hits and names the host instead.
…ry entry point

IPC, the runtime RPC method, the relay handler and the shared remote client
each carry the identity out and the acknowledgement back, and the relay -- which
has no repo catalog -- reports the scope rather than widening the search.
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The search contract now carries workspace or project identities instead of client-generated path lists. Hosts build execution-host-specific catalogs, resolve identities into folded paths, and pass resolved or unknown scope verdicts through IPC, RPC, relay, and child-service boundaries. Unknown scopes return a dedicated unavailable result. Renderer search state no longer tracks acknowledgement failures and now displays scope-unknown status text. Shared project-key construction is centralized.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to c7860

Scoped searches can expose unrelated session results from an older host. This compatibility safeguard should be restored before merging.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.96% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 43 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description gives detailed bug, design, and testing context, but it omits most required template sections, including ELI5, What Changed, Why, Linked Issue with a Fixes reference, Visual Proof or N… Complete the required template sections. Add a plain-language ELI5 summary, structured What Changed and Why sections, a Linked Issue using the required Fixes # format, Visual Proof or N/A with a reason, AI Disclosure, Review, Agent skill up…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: host-side resolution of Workspace and Project scopes for session search.
Full details: Docstring Coverage

Explanation

Docstring coverage is 36.96% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 43 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description gives detailed bug, design, and testing context, but it omits most required template sections, including ELI5, What Changed, Why, Linked Issue with a Fixes reference, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist confirmations.

Resolution

Complete the required template sections. Add a plain-language ELI5 summary, structured What Changed and Why sections, a Linked Issue using the required Fixes # format, Visual Proof or N/A with a reason, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the applicable Checklist confirmations.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cc7be64d-92de-4d7d-a69f-7d356f01e58a

📥 Commits

Reviewing files that changed from the base of the PR and between f2f2c37 and f864bbc.

📒 Files selected for processing (29)
  • src/cli/agent-session-search-format.ts
  • src/main/ai-vault-search/session-search-enablement.ts
  • src/main/ai-vault-search/session-search-scope-catalog.ts
  • src/main/ai-vault-search/session-search-scope-entry-points.test.ts
  • src/main/ai-vault-search/session-search-scope-paths.ts
  • src/main/ai-vault-search/session-search-scope-resolution.test.ts
  • src/main/ai-vault-search/session-search-scope-resolution.ts
  • src/main/ai-vault-search/session-search-scope-service.test.ts
  • src/main/ai-vault-search/session-search-service-registry.ts
  • src/main/ai-vault-search/session-search-store-scope-catalog.test.ts
  • src/main/ai-vault-search/session-search-store-scope-catalog.ts
  • src/main/ipc/ai-vault-search-all-hosts.ts
  • src/main/startup/main-process-runtime-service.ts
  • src/renderer/src/components/right-sidebar/AiVaultPanel.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-project-key.ts
  • src/renderer/src/components/right-sidebar/ai-vault-scope-paths.ts
  • src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.test.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.ts
  • src/renderer/src/components/right-sidebar/use-ai-vault-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/ai-vault-project-key.ts
  • src/shared/ai-vault-search-contract.ts
  • src/shared/ai-vault-search-scope-acknowledgement.ts
  • src/shared/ai-vault-search-scope-contract.test.ts
  • src/shared/ai-vault-search-scope.ts
  • src/shared/ai-vault-search-types.ts
  • tests/e2e/cross-version-wire/cross-version-session-search-scope.unit.test.ts

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

The merge built its results without the acknowledgement, so the renderer read
it as an old host, dropped every hit and asked for an update. That is the
default path: the panel defaults to Workspace and the host scope falls back to
All. Per-host skew is still reported through `hosts`.

Host-resolved paths no longer travel in `filters.scopePaths`. That field is
capped at 64 for the clients that write it by hand, and the scanner child
re-parses the request with the same schema -- so a project whose worktrees do
not share one managed directory failed at 65 paths with "not ready". They ride
beside the request now, where no wire cap applies.

Managed directories come from buildKnownOrcaWorkspaceLayouts, so a workspace
root the user has since moved away from is covered too.

A workspace identity is resolved through this host's own worktree registry
rather than the directory embedded in the client-supplied id.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

All-computers searches scoped to a Workspace or Project are broken: the merge never acknowledges the scope, so the panel reports "This computer needs an Orca update" and shows no hits even when every host is current.

Reviewed changes — full diff through f864bbc (29 files, 8 commits).

  • Scope identity on the request — within: { kind:'workspace', worktreeId } | { kind:'project', projectKey }, with a .refine refusing it alongside filters.scopePaths; neither still means every session. toAiVaultProjectKey moved to src/shared so client and host share one spelling.
  • Host-side resolver — session-search-scope-resolution.ts turns the identity into paths once at searchSessionService: a project is its checkout, its managed worktree directory, external registered worktrees, and prior paths of renamed worktrees, folded by prefix so nested worktrees collapse. The catalog is a host-filtered snapshot of the persisted store, never a git scan.
  • Acknowledgement & version skew — resolvedWithin (kind + path count) on a results answer; a within request answered without it is read as an old host, and scope-unknown is a first-class answer instead of widening.
  • Panel wiring — the panel sends an identity instead of a path list, renders needs-update / scope-unknown copy, and lists per-host skip reasons in a merge.
  • Tests — contract, resolver, all four entry points, panel hook, and a new-client-against-old-host skew test.

Both issues below are confirmed by static tracing; I have not executed a runtime reproduction.

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the two prior findings are resolved by 38d705a. One question inline.

Reviewed changes — incremental against f864bbc (head now 38d705a, 41 files).

  • All-computers merge acknowledges the scope — searchAllExecutionHosts passes request.within !== undefined into mergedSearchResponse, which sets resolvedWithin: true, so the renderer no longer reads a fully current merge as an old host. New tests pin both the acknowledged and the unacknowledged case, and resolvedWithin became z.literal(true).
  • Resolved paths leave the request — hostScopePaths now rides beside the request through the scanner-child protocol and is merged into filters.scopePaths only at the engine, so a flat or external project with more than 64 worktrees no longer trips the child's re-parse. A test asserts 101 paths survive and the request still re-parses.
  • Managed directories enumerate history — managedWorktreeDirectories uses buildKnownOrcaWorkspaceLayouts, covering workspaceDirHistory and a configured base claimed as-is.
  • Workspace identity is verified against the host registry — registeredWorktreeId refuses a client-named directory the host has not registered (except the repo checkout), which closes the arbitrary-path hole.
  • Panel copy — scope-unknown hosts are listed only when no computer resolved the scope; needsUpdate moved into the page state.

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

Host-resolved paths are a second argument now, so the call-shape assertions
that pinned a one-argument call name it.
…cope

The registry short-circuited an unresolvable scope before current.search ran,
and current.search is where disabled and not-ready are decided. A host with
indexing off that lacks the project told the user it did not have the
workspace, which they cannot act on. The verdict now travels to the service
beside the request, and the service answers it after its own checks.
An unknown verdict is still a verdict, and it was being acknowledged as if the
host had narrowed. The skipped banner also counted only 'searched' as having
resolved the scope, so a host that resolved it and came back stale or timed out
let the scope lines reappear where they explain nothing.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Base resolvedWithin on a resolved host. · ai-vault-search-all-hosts.ts:280-283

src/main/ipc/ai-vault-search-all-hosts.ts:280-283
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Base resolvedWithin on a resolved host. When every leg returns scope-unknown or needs-update, fetchHostPage emits no hits, but mergedSearchResponse still sets resolvedWithin: true from the request alone. The panel then treats the scoped search as acknowledged and does not set needsUpdate. This produces an incorrect acknowledgement status. The existing filtering still prevents unscoped hits, so this does not widen results.

Set the acknowledgement only when at least one host has outcome searched.

Suggested fix
+  const resolvedWithin = scoped && walks.some((walk) => walk.outcome === 'searched')
   return {
     kind: 'results',
     hits,
@@
-    ...(scoped ? { resolvedWithin: true as const } : {}),
+    ...(resolvedWithin ? { resolvedWithin: true as const } : {}),

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 444a8796-3503-442f-b537-b1ae89dacc53

📥 Commits

Reviewing files that changed from the base of the PR and between 38d705a and 61356d8.

📒 Files selected for processing (18)
  • src/main/ai-vault-search/session-search-child-service.test.ts
  • src/main/ai-vault-search/session-search-child-service.ts
  • src/main/ai-vault-search/session-search-in-process-service.ts
  • src/main/ai-vault-search/session-search-instance.test.ts
  • src/main/ai-vault-search/session-search-instance.ts
  • src/main/ai-vault-search/session-search-scope-entry-points.test.ts
  • src/main/ai-vault-search/session-search-scope-resolution.ts
  • src/main/ai-vault-search/session-search-scope-service.test.ts
  • src/main/ai-vault-search/session-search-service-registry.ts
  • src/main/ai-vault-search/session-search-service.ts
  • src/main/ai-vault/session-scanner-service-protocol.ts
  • src/main/ai-vault/session-scanner-service-search.ts
  • src/main/ai-vault/session-scanner-service-spawn.ts
  • src/main/runtime/rpc/methods/ai-vault-search.test.ts
  • src/relay/session-search-transport.test.ts
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
  • src/shared/ai-vault-search-test-fixture.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/ai-vault-search/session-search-child-service.ts
  • src/main/ai-vault-search/session-search-in-process-service.ts

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — minor suggestions inline.

Reviewed changes — incremental against 7467c46 (head now 61356d8, 44 files, 12 commits; the two commits pushed since the prior pullfrog review).

  • Consent and readiness answer before an unknown scope — the registry hands its {kind:'resolved'|'unknown'} verdict to the service instead of answering scope-unknown itself, so SessionSearchInstance.search returns disabled/not-ready first and a switched-off host (the relay) no longer blames the scope.
  • Acknowledgement only for a resolved scope — the registry sets resolvedWithin only when the verdict is resolved, so a live host answering scope-unknown is not acknowledged as scoped.
  • Panel treats a stale leg as having resolved the scope — describeSkippedHosts now computes anyResolved as the complement of UNSETTLED_SCOPE_OUTCOMES rather than outcome === 'searched'.

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

Comment on lines +36 to +40
const UNSETTLED_SCOPE_OUTCOMES = new Set<AiVaultSearchHostOutcome['outcome']>([
'scope-unknown',
'needs-update',
'unreachable'
])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabled, not-ready, and no-service are treated as settled here, so a scope-unknown leg is dropped from the banner whenever any other leg is merely off or booting — even though that leg never applied the scope. The banner then reads as if the scope-unknown host was searched and found nothing, which contradicts the docstring's "got far enough to apply the scope" and the PR description's "scope-unknown is named ... only when no computer resolved the scope". If the broader behavior is intended, both should say so.

Technical details
# `disabled`/`not-ready`/`no-service` count as resolving the scope

## Affected sites
- `src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx:36-40` — `UNSETTLED_SCOPE_OUTCOMES` holds only `scope-unknown`/`needs-update`/`unreachable`; the complement (`searched`, `stale`, `disabled`, `not-ready`, `no-service`) counts as resolved.
- `src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx:50-54` — a `scope-unknown` leg is skipped whenever `anyResolved` is true.
- `src/main/ipc/ai-vault-search-all-hosts.ts:145-147` — a leg returning `{kind:'unavailable', reason}` ends as that reason, so `disabled`/`not-ready`/`no-service` are real per-host outcomes.
- `src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx:42-48` — docstring: "worth saying only when it explains an empty result ... when no computer resolved the scope".

## Required outcome
Decide whether an off or booting host counts as having resolved the scope. If it does not, `anyResolved` should be `searched || stale`. If it does, update the docstring and the PR description to state that any host named for its own reason also suppresses `scope-unknown`.

## Open questions for the human
- Under Project scope a user can scope across hosts where one is disabled and another simply lacks the project; suppressing the latter's line leaves the banner implying that host searched.

No stable release ships search, so the only hosts that have it and predate
`within` are dev and ad hoc builds. The acknowledgement, the needs-update
outcome and the copy behind it would be permanent dead weight from the first
stable release on. The scope-unknown outcome and the off / not-ready / unknown
ordering stay.

Also trims this PR's new docblocks to the repo's one-line why rule.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟠 Major · Restore the scoped-result acknowledgement contract. · ai-vault-search-contract.ts:79-113

src/shared/ai-vault-search-contract.ts:79-113
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Restore the scoped-result acknowledgement contract.

When a reachable development or ad hoc host predates within, it can ignore that field and return an ordinary results response. The single-host path accepts those hits, and the all-host merger marks the host as searched and includes its hits. No current response field lets callers identify or suppress those unscoped results.

Restore resolvedWithin and the needs-update host outcome. Suppress unacknowledged results for single-host searches and exclude them from all-host merges. Restore regression tests for both paths.

🟡 Minor · Guard the no-matches message by host outcomes. · AiVaultPanelSearch.tsx:141

src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx:141
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Guard the no-matches message by host outcomes.

When response.hosts contains only stale, scope-unknown, or unreachable entries, this condition still sets “No matching sessions”. The skipped-host logic then also renders “Not searched”, which gives conflicting status messages.

Accept omitted hosts for single-host results. When hosts is present, require a searched entry. Do not treat hosts: [] as evidence that a host searched.

Proposed fix
-  if (response?.kind === 'results' && search.hits.length === 0) {
+  if (
+    response?.kind === 'results' &&
+    search.hits.length === 0 &&
+    (response.hosts === undefined ||
+      response.hosts.some((entry) => entry.outcome === 'searched'))
+  ) {

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c794825d-0941-49ac-bcfe-8193ec80b6c3

📥 Commits

Reviewing files that changed from the base of the PR and between 58819d4 and c786042.

📒 Files selected for processing (18)
  • src/main/ai-vault-search/session-search-scope-catalog.ts
  • src/main/ai-vault-search/session-search-scope-entry-points.test.ts
  • src/main/ai-vault-search/session-search-scope-paths.ts
  • src/main/ai-vault-search/session-search-scope-resolution.ts
  • src/main/ai-vault-search/session-search-scope-service.test.ts
  • src/main/ai-vault-search/session-search-service-registry.ts
  • src/main/ai-vault-search/session-search-service.ts
  • src/main/ai-vault-search/session-search-store-scope-catalog.ts
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelSearch.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.test.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.ts
  • src/renderer/src/components/right-sidebar/use-ai-vault-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/ai-vault-project-key.ts
  • src/shared/ai-vault-search-contract.ts
  • src/shared/ai-vault-search-scope-contract.test.ts
  • src/shared/ai-vault-search-scope.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/main/ai-vault-search/session-search-service-registry.ts
  • src/shared/ai-vault-project-key.ts
  • src/renderer/src/i18n/locales/en.json
  • src/main/ai-vault-search/session-search-store-scope-catalog.ts
  • src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.ts
  • src/main/ai-vault-search/session-search-service.ts
  • src/main/ai-vault-search/session-search-scope-resolution.ts
  • src/main/ai-vault-search/session-search-scope-paths.ts
  • src/main/ai-vault-search/session-search-scope-catalog.ts

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

@Jinwoo-H
Jinwoo-H merged commit 73a58bd into main Sep 18, 2026
36 checks passed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this delta. Not approving only because an earlier minor panel-classification thread is still open on this PR.

Reviewed changes — incremental against 58819d4 (head now c786042, 41 files, 14 commits; the one commit pushed since the prior pullfrog review).

  • Dropped the version-mismatch receipt — resolvedWithin, the needs-update outcome, isUnacknowledgedScopedSearch, the cross-version skew test, and the all-hosts merge acknowledgement are gone. A within request answered by a host that predates the field is no longer detected or suppressed; the commit's premise is that no stable release ships search, so only dev/ad hoc hosts can predate it.
  • Kept scope-unknown and the ordering — the resolver verdict still rides beside the request, consent/readiness still answer before an unresolvable scope, and the panel still renders the scope-unknown copy plus per-host skip reasons.
  • Trimmed the new docblocks to the repo's one-line why rule across the scope modules.

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

Jinwoo-H added a commit that referenced this pull request Sep 19, 2026
…#21509)

* refactor(session-search): move the AI Vault project key to shared

The host must spell a project key exactly as the client does, so the two
sides share one function instead of two copies that can drift.

* feat(session-search): add a scope identity to the search request

The panel cannot keep translating a project into one path per worktree: a
repo with 580 of them exceeds the 64-path cap and the search fails outright.
The request now carries the scope's identity instead, and a host acknowledges
the scope it resolved so a client can tell a scoped answer from an old host's
unscoped one.

* feat(session-search): resolve a scope identity on the host that answers

Every entry point already funnels into searchSessionService, so the identity
becomes paths there once: native, WSL, SSH and relay hosts cannot disagree.
A host that does not know the workspace or project answers scope-unknown
rather than widening the search to everything it has.

* test(session-search): pin how a host resolves a scope identity

Covers prior paths, a workspace another now claims, folder workspaces, a
custom worktree base path, flat placement where the global root belongs to
every project, and the 580-worktree fold the panel's path list could not do.

* fix(session-search): type the scope store by what the catalog reads

A full Repo/Project/ProjectHostSetup requirement forced test stores to stand
up rows the catalog never looks at.

* feat(session-search): send the scope identity from the panel

Workspace and Project name what to narrow to; All sends nothing. A host that
answers a scoped search without acknowledging it is reported as needing an
update, and none of its hits are shown, because they are not this scope's.

* test(session-search): pin the new-client-against-old-host skew

An old host strips the identity and answers with every session it has, and
the answer is well-formed. The missing acknowledgement is the only evidence,
so the merge drops those hits and names the host instead.

* test(session-search): pin the identity and acknowledgement across every entry point

IPC, the runtime RPC method, the relay handler and the shared remote client
each carry the identity out and the acknowledgement back, and the relay -- which
has no repo catalog -- reports the scope rather than widening the search.

* fix(session-search): acknowledge the scope on an all-computers merge

The merge built its results without the acknowledgement, so the renderer read
it as an old host, dropped every hit and asked for an update. That is the
default path: the panel defaults to Workspace and the host scope falls back to
All. Per-host skew is still reported through `hosts`.

Host-resolved paths no longer travel in `filters.scopePaths`. That field is
capped at 64 for the clients that write it by hand, and the scanner child
re-parses the request with the same schema -- so a project whose worktrees do
not share one managed directory failed at 65 paths with "not ready". They ride
beside the request now, where no wire cap applies.

Managed directories come from buildKnownOrcaWorkspaceLayouts, so a workspace
root the user has since moved away from is covered too.

A workspace identity is resolved through this host's own worktree registry
rather than the directory embedded in the client-supplied id.

* test(session-search): follow the service search signature

Host-resolved paths are a second argument now, so the call-shape assertions
that pinned a one-argument call name it.

* fix(session-search): answer consent and readiness before an unknown scope

The registry short-circuited an unresolvable scope before current.search ran,
and current.search is where disabled and not-ready are decided. A host with
indexing off that lacks the project told the user it did not have the
workspace, which they cannot act on. The verdict now travels to the service
beside the request, and the service answers it after its own checks.

* fix(session-search): acknowledge only a scope that resolved

An unknown verdict is still a verdict, and it was being acknowledged as if the
host had narrowed. The skipped banner also counted only 'searched' as having
resolved the scope, so a host that resolved it and came back stale or timed out
let the scope lines reappear where they explain nothing.

* refactor(session-search): drop the version-mismatch receipt

No stable release ships search, so the only hosts that have it and predate
`within` are dev and ad hoc builds. The acknowledgement, the needs-update
outcome and the copy behind it would be permanent dead weight from the first
stable release on. The scope-unknown outcome and the off / not-ready / unknown
ordering stay.

Also trims this PR's new docblocks to the repo's one-line why rule.

(cherry picked from commit 73a58bd)
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