Skip to content

fix: pick up ai-title entries so session names display#42

Merged
abasiri merged 1 commit into
mainfrom
fix/ai-title-session-name
May 5, 2026
Merged

fix: pick up ai-title entries so session names display#42
abasiri merged 1 commit into
mainfrom
fix/ai-title-session-name

Conversation

@abasiri

@abasiri abasiri commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Claude Code writes auto-generated session titles as {"type":"ai-title","aiTitle":"…"} jsonl entries, but readSessionFile only parsed type:"custom-title", so AI titles were ignored and the sidebar fell back to the raw first prompt.
  • Now also reads ai-title/aiTitle. User-set customTitle still wins; aiTitle is the fallback. Last-wins within each type, since Claude updates the AI title as the conversation evolves.

Fixes #33

Test plan

  • Open a session that has ai-title entries in its jsonl but no user rename — sidebar shows the AI-generated title instead of the raw first prompt
  • Rename a session manually — customTitle continues to take precedence over any later ai-title
  • Existing sessions named via rename still display correctly

🤖 Generated with Claude Code

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>
@abasiri abasiri merged commit b88b19f into main May 5, 2026
5 checks passed
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>
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.
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.

Why not show the session name?

1 participant