fix: pick up ai-title entries so session names display#42
Merged
Conversation
Claude Code writes auto-generated titles as type:"ai-title"/aiTitle entries, but readSessionFile only parsed type:"custom-title". Sessions with an AI title but no user-set title fell back to the raw first prompt. User-set customTitle still takes precedence. Fixes #33 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
navedr
added a commit
to navedr/switchboard
that referenced
this pull request
May 13, 2026
…y#42) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
abasiri
pushed a commit
that referenced
this pull request
May 20, 2026
PR #42 (b88b19f) wired ai-title entries into the customTitle field returned by readSessionFile via `customTitle: customTitle || aiTitle`. session-cache.js then calls setName(sessionId, customTitle) on every index pass, which writes to session_meta.name — the same column that stores user renames done via the Switchboard UI (rename-session in main.js). So every re-index of a file that contains an ai-title entry clobbers the user's manual rename. The PR description claimed "User-set customTitle still takes precedence", but that only holds for JSONL custom-title entries (Claude `/title`), not for in-app UI renames. Fix: separate the two title sources end-to-end. - read-session-file.js now returns customTitle and aiTitle as separate fields. - session_cache table gains an aiTitle column; v3 migration adds the column and clears the cache so a fresh index repopulates it. - session-cache.js carries aiTitle through to the API output. setName is now only ever called with a JSONL customTitle — ai-title never touches the DB. - Sidebar/grid/dialog/jsonl-viewer display priority is now: user rename (session.name) > AI title (session.aiTitle) > raw first prompt. #33's original intent (AI titles displayed in the sidebar instead of raw prompts) is preserved through session.aiTitle, but the DB session_meta.name column reverts to being user-only — manual renames are now durable. Note: pre-fix DB pollution (existing rows where ai-title was already written into session_meta.name) is not auto-cleaned — those sessions will keep their AI-title-as-name until renamed manually.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{"type":"ai-title","aiTitle":"…"}jsonl entries, butreadSessionFileonly parsedtype:"custom-title", so AI titles were ignored and the sidebar fell back to the raw first prompt.ai-title/aiTitle. User-setcustomTitlestill wins;aiTitleis the fallback. Last-wins within each type, since Claude updates the AI title as the conversation evolves.Fixes #33
Test plan
ai-titleentries in its jsonl but no user rename — sidebar shows the AI-generated title instead of the raw first promptcustomTitlecontinues to take precedence over any laterai-title🤖 Generated with Claude Code