Docs: session_name in statusline JSON silently falls back to auto-generated AI title, contradicting documented behavior
Summary
The statusline docs state:
session_name— Custom session name set with the--nameflag or/rename. Absent if no custom name has been set
This was the behavior discussed and closed in #15029 (session_name added, explicit-only). However, in the currently installed version (2.1.197), session_name is not absent when no explicit name is set — it silently falls back to the auto-generated conversation title instead.
Evidence
Disassembling the installed CLI binary (2.1.197) shows the statusline payload builder does:
E = Gh(S) ?? GK(S)
...E && {session_name: E}
where:
Gh(S)returnsKc().currentSessionTitle— the explicit name set via/renameor--nameGK(S)returnsKc().currentSessionAiTitle— the auto-generated title derived from conversation content
So when no explicit title exists, session_name is populated with the auto-generated title instead of being omitted.
Repro
- Start a fresh session, do not use
--nameor/rename. - Configure a statusline script that echoes the raw JSON received on stdin (e.g.
cat > /tmp/statusline-debug.json). - Observe
session_nameis present and contains a human-readable auto-generated title, not the session UUID, and not absent as documented.
Why this matters
Scripts written against the documented contract (e.g. "show session_name if present, otherwise fall back to session_id") can't reliably distinguish an explicit, user-chosen name from an auto-generated one — both arrive in the same field. This is surprising when the auto-generated title happens to be confusing or overly long, and there's no way to detect that it wasn't intentionally set.
Request
Either:
- Update the docs to reflect that
session_namemay contain an auto-generated title, and document the fallback behavior, or - Split the fields — keep
session_namestrictly for explicit names (per current docs) and expose the auto-generated title separately (e.g.session_ai_title), so scripts can choose which to use.
Related: #15029, #49913 (which requested exposing the auto-generated title — this issue reports that it appears to already be exposed, just undocumented and merged into the same field as explicit names).
🤖 Generated with Claude Code