Skip to content

feat(ai-vault): name the host each search hit came from when hits span several hosts - #31261

Merged
nwparker merged 2 commits into
mainfrom
nwparker/ai-vault-search-hit-host
Oct 20, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/ai-vault-search-hit-host

Conversation

@nwparker

@nwparker nwparker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58

ELI5

When you search your agent history across All hosts, the same session title often shows up from two machines. Nothing told you which machine each result came from, so you could resume the wrong copy. Now each result names its machine with a small chip. This only happens when the results really come from more than one machine.

What Changed

  • Before: an All hosts full-text search showed one flat list in match order, and two hits titled "Fix flaky API retry test" looked identical even when one ran on devbox and the other on this Mac.
  • After: when the hits span two or more hosts, each row shows the host it came from next to the agent name.
    • The chip is the same one the sidebar uses to name a workspace's machine.
    • It uses the same name the host menu shows (an Orca server's saved name, "Local Mac", ...).
    • Hovering it reads "Found on devbox".
    • Hit order is unchanged. With every hit from one host there is no chip.

Mechanism:

  • aiVaultSearchHitHostLabels (new, ai-vault-search-hit-hosts.ts) runs over the search's hit sessions in AiVaultPanel. It returns a host -> label map only when there are 2+ distinct executionHostIds, and takes labels from the panel's existing hostScopeOptions, falling back to getExecutionHostLabel.
  • The map is passed down to the row, and SessionMetadata renders WorktreeHostContextBadge.
  • That badge gains an optional title, plus min-w-0 shrink at this call site, so a long host name truncates in a narrow sidebar instead of pushing the row wider.
  • New string aiVault.searchHitSourceHost in all six locales (en, es, fr, ja, ko, zh).

Why

  • I reused the existing host chip and the host menu's names rather than a new badge style or a new naming source, so a host reads the same everywhere.
  • Showing the chip only when hits span hosts follows @quzard's proposal: a single-host search gains nothing from it.
  • I didn't regroup hits by host, because search is ranked and the issue asks to keep rank order.

Linked Issue

Part of #31139 (item 3, "Telling search hits apart by host"). Reported, with this approach, by @quzard. The issue stays open: host-then-directory grouping, a shorter host menu and collapsed-by-default groups are deferred follow-ups.

Overlap: #23449 (open, external) names SSH hosts in search by their SSH target labels. All hosts search currently fans out to this computer and Orca servers only, so there's no conflict today. If SSH hosts join the search later, the SSH entries should take their labels from the store's SSH target names; this helper is the one place to change.

Visual Proof

These show real AiVaultVirtualRow components rendered inside a hidden Orca dev renderer (ORCA_BACKGROUND_LAUNCH=1, CDP screenshot). They were mounted with three search-hit sessions from three hosts, because pairing two real Orca servers just for a screenshot wasn't practical.

Light:

pr3-light.png

Dark:

pr3-dark.png

Before: the same rows without the devbox / Local Mac / build-host chips.

Testing

  • ai-vault-search-hit-hosts.test.ts:

    • no labels while every hit is from one host;
    • menu labels with the id fallback.
  • AiVaultVirtualRow.test.tsx:

    • the row shows "Local Mac" with the "Found on Local Mac" tooltip when given a label (fails on main, where the row has no such prop);
    • no chip otherwise.
  • Full static-analysis job run locally on this head. All steps passed except check-e2e-typecheck-ratchet on tests/e2e/helpers/phone-feed-list.ts. This PR doesn't touch that file, and the same step passed in CI on my other branches, so it appears to be specific to my local install.

  • Unit tests in src/renderer/src/components/right-sidebar and the sidebar badge users.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Renderer-only: no wire change, and nothing new is read from hosts.
  • The label map is memoized on the hit list and host options.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…n several hosts (#31139)

An All hosts full-text search returned one flat list, and the same title or
path often came up on two machines, so you could resume the wrong copy. When
hits come from two or more hosts, each row now carries the same host chip the
sidebar uses, labelled the way the host menu names that host. Hit order is
unchanged; a single-host result shows no chip.

Reported, with the proposed approach, by @quzard in #31139.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 672090bb-1cd9-42a5-a08e-4ebc9ba4bc7b
📥 Commits

Reviewing files that changed from the base of the PR and between 9693204 and 81c6fcc.

📒 Files selected for processing: 15
  • src/renderer/src/components/right-sidebar/AiVaultPanel.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx
  • src/renderer/src/components/right-sidebar/AiVaultVirtualRow.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultVirtualRow.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-search-hit-hosts.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-search-hit-hosts.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-row-display.tsx
  • src/renderer/src/components/sidebar/WorktreeHostContextBadge.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The AI Vault now identifies the source host for search results when those results span multiple hosts. It maps execution hosts to configured labels, with a fallback when no configured label exists, and passes the labels through the virtual list to session metadata. Session metadata displays a localized host-context badge when a source host label is available. Tests cover host-label resolution and badge display.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 81c6f

This adds host chips to multi-host AI Vault search results and leaves single-host results unchanged. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 9 files. (6 skipped: 6… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: showing the source host for AI Vault search hits spanning multiple hosts.
Description check Passed The description is complete and closely follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and closely follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, and checklist status.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 9 files. (6 skipped: 6 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit 6d7e542 into main Oct 20, 2026
32 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