Docs: session_name in statusline JSON silently falls back to auto-generated AI title, contradicting documented behavior

Open 💬 0 comments Opened Jul 13, 2026 by mll11

Summary

The statusline docs state:

session_name — Custom session name set with the --name flag 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) returns Kc().currentSessionTitle — the explicit name set via /rename or --name
  • GK(S) returns Kc().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

  1. Start a fresh session, do not use --name or /rename.
  2. Configure a statusline script that echoes the raw JSON received on stdin (e.g. cat > /tmp/statusline-debug.json).
  3. Observe session_name is 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:

  1. Update the docs to reflect that session_name may contain an auto-generated title, and document the fallback behavior, or
  2. Split the fields — keep session_name strictly 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

View original on GitHub ↗