[BUG] Exit hint prints `claude --resume "<title>"` for sessions the resume list hides (first user message is a slash command)
What happened
On exit, Claude Code printed:
Resume this session with:
claude --resume "product - new"
Running that exact command does not resume. It opens the session picker with product - new pre-filled in the search box and no match. The same session is also missing from claude -r's list entirely. Resuming it by UUID works fine.
So the exit hint emits a command that can never succeed for this class of session.
Root cause (bisected)
The session list that backs both claude -r and title-based --resume excludes sessions whose first user message is a slash-command invocation. The exit hint, however, is generated from the custom title without checking that the title is resolvable.
The session in question was started with /loop (args /ap), so its first type:"user" record is:
{"role":"user","content":"<command-message>loop</command-message>\n<command-name>/loop</command-name>\n<command-args>/ap</command-args>"}
A/B that isolates it
Copied the same 65 MB transcript twice into a throwaway project directory, rewriting only sessionId and cwd so both are valid for that project:
| fixture | first user message | appears in claude -r |
|---|---|---|
| unmodified copy | <command-name>/loop</command-name> | no |
| identical copy, only that one record's content replaced with plain text | plain text | yes — product - new · 65.5MB |
Controls that rule out size / record count (both synthetic, plain-text first message, both listed fine):
| fixture | size | records | appears |
|---|---|---|---|
| few huge records | 76.3 MB | 81 | yes |
| many small records | 11.4 MB | 25,001 | yes |
An unrelated control also confirms title resume itself works: a fixture with custom-title.json = ZZZ-custom-name and a plain first message resumes correctly via claude --resume "ZZZ-custom-name", while claude --resume "<its auto-generated title>" returns No sessions match.
Repro
- Start a session whose first user message is a slash command (e.g.
claudethen/loop <something>as the very first prompt). - Give it a custom title (Ctrl+R in the resume picker, or rename in-session).
- Exit — note the printed
claude --resume "<title>"hint. - Run that exact command → picker opens with the title pre-filled and no match. The session is also absent from
claude -r. claude --resume <uuid>works.
Expected
Either:
- the session list should not exclude sessions whose first message is a slash command (they are ordinary user-started sessions), or
- the exit hint should print
claude --resume <uuid>when the title is not resolvable.
The current combination is the worst case: the product tells you a command and the same product then cannot act on it.
Environment
- Claude Code 2.1.277 (native install), macOS 15.6 / Darwin 25.6.0
- Session was created by 2.1.273; transcript 23,389 records, 68 MB
- The
custom-title.jsonsidecar existed and contained the exact string that was printed