Repository navigation
refactor(ai-vault, native-chat): one per-call agent root table - #27079
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughShared 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 Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to 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 |
|
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.
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
CLAUDE_CONFIG_DIR, the Claude CLI writes its sessions there and the chat view could read them, but Session History never listed them.CLAUDE_CONFIG_DIRfirst, then~/.claude, the same order the chat view already uses.Mechanism:
ai-vault/session-scanner-roots.tsnow 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_DIRandCODEX_HOMEnow go through the existingresolveAbsoluteDirOverridein 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 theCLAUDE_CONFIG_DIRroot ahead of~/.claude, and an explicit scan root stays the only host root.Existing
session-file-resolver*.test.tspass unchanged, including "prefers the config-dir root when both hold the session".pnpm testfor resolver, host-readable path, AI Vault scanner, search and subagent lister: 151 files pass.pnpm tc:node, oxlint andcheck:code-quality:changedpass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)