Skip to content

refactor(ai-vault, native-chat): one per-call agent root table - #27079

Merged
OrcaWin merged 2 commits into
mainfrom
np/p395-agent-roots
Oct 10, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
np/p395-agent-roots

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​34
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​86 $\color{#cf222e}{\Huge{\mathbf{−}}}$​66 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

ELI5

Orca looks for an agent's chat history in two places: the Session History list, and the chat view that reads one session by ID. Each kept its own list of folders to search, and the two lists had drifted apart. This puts both on one list.

What Changed

  • Before: if you set CLAUDE_CONFIG_DIR, the Claude CLI writes its sessions there and the chat view could read them, but Session History never listed them.
  • After: Session History lists sessions under CLAUDE_CONFIG_DIR first, then ~/.claude, the same order the chat view already uses.

Mechanism: ai-vault/session-scanner-roots.ts now owns the host roots for Claude (CLAUDE_CONFIG_DIR, then ~/.claude) and Codex (CODEX_HOME, then ~/.codex), computed on each call, plus one table of where each agent's session tree sits under a home folder (host or WSL). The transcript resolver and the AI Vault source table both read it, and the copied constants are deleted (including a hard-coded copy of Orca's WSL Codex home path).

Why

The next PR gives the resolver a WSL fallback for Claude, Grok and omp. Building it on a third copy of the roots would have made the drift worse. One per-call module keeps root order (an earlier root wins, which keeps one account's transcript from resolving to another's) and lets the resolver keep its lazy WSL tier.

CLAUDE_CONFIG_DIR and CODEX_HOME now go through the existing resolveAbsoluteDirOverride in both places, so a relative value is ignored everywhere instead of only in AI Vault (#13082).

Linked Issue

Refactor for the Phase 3.95 transcript-resolution stack; no issue is closed by this PR alone.

Visual Proof

N/A: no UI change. Session History may list more Claude sessions for users who set CLAUDE_CONFIG_DIR.

Testing

  • New test in session-scanner-roots.test.ts (fails on main): the Claude source lists the CLAUDE_CONFIG_DIR root ahead of ~/.claude, and an explicit scan root stays the only host root.

  • Existing session-file-resolver*.test.ts pass unchanged, including "prefers the config-dir root when both hold the session".

  • pnpm test for resolver, host-readable path, AI Vault scanner, search and subagent lister: 151 files pass. pnpm tc:node, oxlint and check:code-quality:changed pass.

  • I manually tested these changes locally

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

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

Windows/WSL: WSL roots still come only from running distros' homes; no new WSL calls. SSH: unchanged (the relay scanner has its own table). Mobile: unchanged.

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)

The native-chat transcript resolver kept its own copy of each agent's
session roots, and it had drifted from the AI Vault source table. Both now
read session-scanner-roots: host roots computed per call, and one table of
where each agent's tree sits under a home dir (host or WSL guest).

AI Vault now lists Claude sessions under CLAUDE_CONFIG_DIR, which the CLI
writes to and native chat already read.
@coderabbitai

coderabbitai Bot commented Oct 10, 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: b17fb70b-318a-41cc-b35b-605f74269940

📥 Commits

Reviewing files that changed from the base of the PR and between 3895d32 and 8419459.


📒 Files selected for processing (2)
  • src/main/ai-vault/session-scanner-service-env.test.ts
  • src/main/ai-vault/session-scanner-service-env.ts

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



📝 Walkthrough

Walkthrough

Shared helpers now define host and WSL session roots for Claude, Codex, Grok, and OMP, and deduplicate root paths. AI Vault and native chat use these helpers to select session directories. The desktop environment allowlist includes CLAUDE_CONFIG_DIR. Tests cover Claude root selection for configured, default, WSL, and explicit projects directories.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 84194

The change centralizes session-root lookup and passes CLAUDE_CONFIG_DIR to the scanner. The inspected paths preserve their configured and default roots, with no actionable merge risk identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the refactor across AI Vault and native chat and accurately summarizes the shared per-call agent root table.
Description check Passed The description provides a clear ELI5 summary, detailed changes, rationale, testing results, compatibility notes, and checklist status. It is mostly complete, although it does not link a specific issu…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 7 files.
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.


✨ Finishing Touches
📝 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.

The desktop scanner runs with an allowlisted env, so the new config-dir
root was resolved in the parent but stripped in the child that lists
History.
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