Skip to content

feat(ai-vault): name remote hosts and suggest projects from agent session history - #23449

Open
thukabjj wants to merge 2 commits into
stablyai:mainfrom
thukabjj:pr/ai-vault-remote-hosts
Open

thukabjj wants to merge 2 commits into
stablyai:mainfrom
thukabjj:pr/ai-vault-remote-hosts

Conversation

@thukabjj

Copy link
Copy Markdown
Contributor

ELI5

Before: remote sessions are anonymous, and SSH-only projects can vanish. After: each remote session shows its host, and the project list stays stable.

What Changed

Host labels resolved from SSH target labels, including removed targets; footer naming; a shared ownership rule for refresh and prune; project suggestions from session history with review fixes.

Why

Reusing the existing target labels keeps names consistent everywhere, with no new state.

Linked Issue

Fixes #23448

Visual Proof

Before:

07-ai-vault-host-scope-before.png

(the SSH host shows as a raw target id). After:

07-ai-vault-host-scope-after.png

(the host by its name) and

06-ai-vault-project-suggestions.png

(project suggestions from agent history).

Host details, project names and the saved server name are replaced with generic values in these images; the UI is otherwise as rendered.

Testing

Linux x64 (Ubuntu runner): pnpm tc clean; 54 tests in the touched test files pass; the four localization verify scripts pass; the changed-code quality gate passes against main. macOS and Windows were not run locally; CI covers them.

  • I manually tested these changes locally
  • Automated tests added/updated

AI Disclosure

Written with Claude (Opus 5.5) and DeepSeek coding agents running in sandboxes, then reviewed, tested and verified by me, including an independent security review for the security-sensitive parts.

Review

Independent correctness review: PASS WITH FIXES, fix applied (a removed SSH host keeps its name in the scope picker, with a test).

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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)

https://claude.ai/code/session_018pGUpQCvtxZqFiLfJqyX6k

…sion history

Session search showed sessions from SSH hosts without saying which machine they came from,
and SSH-only projects could disappear when the local catalog refreshed. Sessions from other
machines are now badged with the host's name, which is kept while the host is disconnected.
The "Not searched" footer names unavailable hosts, and SSH-only projects follow the same
ownership rule on refresh and prune.

Session search also suggests adding git repositories where agents were run, grouped with
their session counts.

Claude-Session: https://claude.ai/code/session_018pGUpQCvtxZqFiLfJqyX6k

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

ℹ️ One minor suggestion inline.

Reviewed changes

  • SSH host naming — buildSshAiVaultHostScopeOptions / useAiVaultRemoteHostOptions list connected SSH targets by their saved label, and buildAiVaultHostScopeOptions keeps the active host named while it is disconnected or after its target was removed. aiVaultSessionHostLabel / useAiVaultHostLabeler power the new session-row badge and the search "Not searched" footer, so raw target ids no longer reach the UI.
  • Project suggestions — a new aiVault:suggestProjects IPC validates renderer input, then folds session folders to their main repo (--git-common-dir), excludes home/root/temp/cache roots, skips registered and dismissed paths, and returns checked-project candidates. AiVaultProjectSuggestions renders the list and pins adds to the local runtime.
  • SSH-only project regression fix — mergeFetchedProjectCompatibilityForHost now applies the same ownership rule to projects as to their setups, so a project living only on a direct-SSH host survives a local catalog refresh and is pruned with its setup. I traced the two producing callers; the local fetch's fetched catalog does include SSH-owned projects, so the fix holds.
  • i18n — remoteHostTitle and the project-suggestion keys added to en.json; the other locales intentionally fall back to English for the new keys.

Tests look like real coverage, not theatre: the main-process suite uses real git init/worktree add fixtures, and the component suite asserts the exact addRepoPath(path, 'git', { runtimeEnvironmentId: null }) call. I ran the touched suites (52 tests) and verify-localization-catalog — all pass.

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

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ad304968-144c-442b-98f0-65896be0a35b

📥 Commits

Reviewing files that changed from the base of the PR and between afda5ad and 9a344eb.

📒 Files selected for processing (6)
  • src/renderer/src/components/right-sidebar/AiVaultProjectSuggestions.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultProjectSuggestions.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-host-scope.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-host-scope.ts
  • src/renderer/src/store/projects/project-compatibility-host-merge.test.ts
  • src/renderer/src/store/projects/project-compatibility-host-merge.ts
📝 Walkthrough

Walkthrough

The change adds project suggestions based on local agent session history and exposes them through the AI Vault panel. It adds SSH host labels to session rows, host scopes, and skipped-host descriptions. It also updates project catalog refresh handling so local catalogs include direct-SSH-owned projects and setups.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to afda5

Added projects may briefly remain in the suggestions card, and a project with both SSH and runtime ownership may retain an obsolete repository reference after refresh. These bounded issues warrant owner follow-up but do not appear to block merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to afda5

Project suggestions are limited to local folders and require a user action to add a project. However, the new desktop request can inspect caller-supplied folders without verifying that they came from session history.

Retained concerns

  • Medium · security · inferred: The new main-process discovery endpoint trusts renderer-supplied folder provenance. A caller with access to the desktop bridge can request Git discovery for eligible local directories that did not come from a local session.
Security review details

Security Blast Radius

  • inferred — The added discovery capability reaches directories accessible to the desktop main process, not a remote runtime through this API. Exploitation of the unverified-source boundary requires access to the desktop IPC caller; the browser implementation returns no suggestions.

Security Findings and Attack Paths

  • inferred — A desktop renderer caller can replace history-derived sources with chosen cwd values. The handler can then test eligible folders for Git repositories and return their paths; ordinary UI filtering is not enforced at that boundary.

Trust Boundaries and Controls

  • observed — The handler ignores the IPC event, accepts at most 5,000 sources per call, limits cwd length, and checks known agents. Filesystem eligibility precedes Git resolution, which runs at concurrency four; no main-side check ties a source to a recorded local session.

Resilience and Maintainability Implications

  • observed — Suggestion requests discard late UI results after effect cleanup, and adding selected repositories continues past individual failures. The UI cleanup does not itself cancel a Git discovery already running in the main process.

Hardening Proposals

  • proposed — Consider enforcing caller authorization and local-session provenance at the main-process boundary, with request-level work limits or cancellation if repeated discovery is a concern.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 24 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies both primary changes: naming remote hosts and suggesting projects from agent session history.
Description check ✅ Passed The description covers the required user impact, changes, rationale, linked issue, visual proof, testing, AI disclosure, review status, scope boundary, and checklist. The optional Notes section is omi…
Linked Issues check ✅ Passed The PR meets the coding objectives in [#23448]. aiVaultSessionHostLabel uses current SSH labels, removed-target labels, and a fallback label. AiVaultSessionRow shows the host badge, and `AiVaultPa…
Out of Scope Changes check ✅ Passed The changed files support [#23448]. Host-label helpers, scope handling, catalog merge logic, project-suggestion IPC and UI, localization, web fallback behavior, and automated tests implement or verify…
Full details: Docstring Coverage

Explanation

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


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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6a533934-926c-43dc-96f5-408ccfe2d245

📥 Commits

Reviewing files that changed from the base of the PR and between d972bac and afda5ad.

📒 Files selected for processing (30)
  • src/main/ai-vault/session-project-suggestions.test.ts
  • src/main/ai-vault/session-project-suggestions.ts
  • src/main/ipc/ai-vault-project-suggestions.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/preload/api/ai-vault-api.ts
  • src/preload/api/ai-vault-bridge.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/AiVaultProjectSuggestions.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultProjectSuggestions.tsx
  • src/renderer/src/components/right-sidebar/AiVaultSessionRow.test.tsx
  • src/renderer/src/components/right-sidebar/ai-vault-host-scope.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-host-scope.ts
  • src/renderer/src/components/right-sidebar/ai-vault-project-suggestions-copy.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-host-label.test.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-host-label.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-row-display.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
  • src/renderer/src/store/projects/project-compatibility-host-merge.test.ts
  • src/renderer/src/store/projects/project-compatibility-host-merge.ts
  • src/renderer/src/web/preload-api/web-ai-vault-api.ts
  • src/shared/ai-vault-project-suggestions.ts
  • src/shared/global-settings-types.ts

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

Keep sourceRepoIds consistent with the setup ownership rule on a local refresh, hide SSH
targets owned by a paired Orca server from the host scope, and hide a suggestion as soon as it
is added until a refresh stops suggesting it.

Claude-Session: https://claude.ai/code/session_018pGUpQCvtxZqFiLfJqyX6k
@thukabjj

Copy link
Copy Markdown
Contributor Author

Thanks. Addressed in 9a344eb:

  • Preserved projects now filter sourceRepoIds with the same ownership rule as setups, so a local refresh no longer keeps a removed direct-SSH repo. The existing regression test was extended.
  • The host scope skips runtime-owned SSH targets (runtime-ssh- prefix), with a test.
  • A suggestion disappears as soon as it's added and stays hidden until a refresh stops suggesting it. If it's suggested again later (for example after the project is removed), it shows again. Tests cover both.

Linux runner: pnpm tc clean, 57 tests, localization checks and the changed-code gate pass.

https://claude.ai/code/session_018pGUpQCvtxZqFiLfJqyX6k

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

Reviewed changes

  • Added-project hiding — AiVaultProjectSuggestions tracks added paths in addedPaths, hides them immediately so a repeat click cannot re-add a project, and prunes that set against each refresh so a project that stops being suggested (and later returns) reappears. Two component tests cover the immediate drop and the re-suggest.
  • Runtime-owned SSH scope filtering — buildSshAiVaultHostScopeOptions skips runtime-ssh-* targets via isRuntimeOwnedSshTargetId, with a test asserting a runtime-owned target is excluded while a real SSH target is kept.
  • Source-repo ownership prune — the preserved-project cleanup in mergeFetchedProjectCompatibilityForHost now filters sourceRepoIds with hostBelongsToFetchedCatalog rather than getSourceRepoIdsOutsideHost, matching the setup/project ownership rule so a direct-SSH repo dropped by a local refresh no longer lingers in the project's identity. The mixed-owner test now asserts sourceRepoIds directly.

This delta addresses the prior Pullfrog thread (runtime-owned SSH targets) and both CodeRabbit threads. I traced the source-repo filter: for non-local refreshes hostBelongsToFetchedCatalog(h) === (h === hostId), so only the local-refresh semantics change (the intended fix). Ran the three touched suites (project-compatibility-host-merge, ai-vault-host-scope, AiVaultProjectSuggestions) — 25 tests pass.

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

This branch has not been deployed

No deployments
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.

[Feature]: Name remote hosts in session search and suggest projects from agent history

1 participant