Repository navigation
fix: prefer Claude-generated titles in AI Vault - #7369
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 72afc1467bfebb4ac6bc04fdd8254e1805201520 and b92685e. 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughThis PR adds directory filtering support to AI vault session file discovery, uses it to exclude Claude subagent transcript files, and updates Claude title fallback handling to prefer generated titles, then the first user prompt, then meta-injected titles. It also extracts shared test fixture helpers into a new module and adds tests for title precedence and subagent exclusion. Related issues: None provided 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
Agent Session History labeled Claude Code sessions with a truncated first prompt even when the session already had a Claude-generated name (the ai-title shown in /status and the tab title). Reserve the top title slot for a user-set custom-title and rank the generated ai-title above the first prompt: custom-title > ai-title > first prompt > meta. New sessions still fall back to the first prompt until the ai-title is written. Also prune <session>/subagents/ during discovery via an injected directoryPredicate so Task subagent transcripts, which share the parent sessionId and are not independently resumable, stop appearing as separate untitled history rows. Pruning at the directory level avoids readdir'ing the excluded subtree and is cross-platform safe.
Ensure the scanner updates the generated session title when Claude revises it, rather than only keeping the first parsed 'ai-title' record.
97a08f8 to
72afc14
Compare
72afc14 to
b92685e
Compare
* fix: prefer Claude-generated titles in AI Vault Agent Session History labeled Claude Code sessions with a truncated first prompt even when the session already had a Claude-generated name (the ai-title shown in /status and the tab title). Reserve the top title slot for a user-set custom-title and rank the generated ai-title above the first prompt: custom-title > ai-title > first prompt > meta. New sessions still fall back to the first prompt until the ai-title is written. Also prune <session>/subagents/ during discovery via an injected directoryPredicate so Task subagent transcripts, which share the parent sessionId and are not independently resumable, stop appearing as separate untitled history rows. Pruning at the directory level avoids readdir'ing the excluded subtree and is cross-platform safe. * Use latest generated Claude title in session scanner Ensure the scanner updates the generated session title when Claude revises it, rather than only keeping the first parsed 'ai-title' record. --------- Co-authored-by: Jinjing <[email protected]>
Summary
I fixed Agent Session History so Claude Code sessions use the Claude-generated
ai-titlewhen one exists, matching/statusand the terminal tab title.The title priority is now: user-set
custom-title> Claude-generatedai-title> first user prompt > injected/meta text > agent/id default. New sessions still fall back to the first prompt until Claude writes the generated title.I also stopped indexing Claude Task subagent transcripts as separate history rows by pruning
<session>/subagents/during discovery.Screenshots
Same session, before and after (a Claude session with 350 messages).
Before — the AI Vault side panel labeled the session with a truncated copy of the first user prompt (

in orc can see that they are not actually using the session generate…), even though Claude had already generated a name for it.After — the session shows its generated name,

Investigate Orca session title generation bug, matching what/statusand the tab title show. Other sessions likewise show their generated names (e.g.Understanding karma and moral accountability).Testing
pnpm test, 53 tests across 13 files passing on Node 24, including the two new Claude title/subagent tests.tsgo -p config/tsconfig.node.json; there is one pre-existing unrelated error insrc/main/browser/cdp-ws-proxy.test.ts.oxlintis clean on the changed files.pnpm devand confirmed Agent Session History now shows Claude-generated titles and no longer shows subagent noise rows.pnpm testnot yet run end to end in this environment.pnpm buildnot yet run end to end in this environment.AI Review Report
Before finalizing, I ran a layered AI review. Three Opus high-reasoning agents first codified Orca's actual codebase conventions for production TypeScript, vitest scanner tests, and scanner performance contracts. I then handed that context to a separate Codex/GPT-class reviewer focused on correctness and optimization.
The main review catch was that my first cut filtered subagents per file, which still walked and allocated over the full
subagents/subtree. I changed that to a directory-leveldirectoryPredicateprune, so the subtree is neverreaddir'd. I also added the requested mapped-array assertions and the explicit test provingcustom-titlebeatsai-title.The review explicitly checked cross-platform behavior for macOS, Linux, and Windows: path handling uses Node path APIs and directory entry name comparison, not separator-dependent string matching. There are no keyboard shortcuts, shortcut labels, shell invocations, or Electron platform differences introduced by this change. It also covered SSH/remote behavior since the scanner can index remote and WSL homes, and the performance angle because this path can scan thousands of JSONL transcript files.
Security Audit
No new input parsing was added beyond records the scanner already reads.
ai-titleandcustom-titlevalues continue through the existingnormalizeTitleTextpath.Path handling is limited to comparing a directory entry name against
subagents; it does not construct or trust paths from transcript input, so this does not introduce traversal risk.There is no command execution, no new IPC surface, no secrets handling, no auth change, no network calls, and no new dependencies. This remains read-only session-history indexing.
Notes
All changed code is in the main process scanner path. There are no renderer or UI code changes, though the result is visible in the AI Vault side panel.
The subagent filtering is Claude-specific and scoped to Claude discovery. It does not change generic scanner behavior or other agent providers. The filter is intentionally applied during directory traversal for performance and for Windows-safe path handling.
CI should still confirm the full repo-wide test and build jobs.