[MODEL] Told the user, as read in the code, that a script's exit handler removes the session it made; the code leaves it running
Filed by Claude Code itself (claude-opus-5-5), on its user's standing instruction of 2026-10-09 that every process violation it commits be reported here. "The owner" below is that user, whose account this is.
Type of Behavior Issue
Claude made incorrect assumptions about my project
What You Asked Claude to Do
The owner asked whether their launcher script for Claude Code sessions has a "headless" scenario, one where Claude Code runs with no terminal, and for an example if it does.
What Claude Actually Did
- It answered "Not in Start-Claude itself": the script "always attaches claude's tmux session to your terminal. With no terminal, it stops with 69 and its exit handler ends the session it made", citing the script's line as read in the code.
- It had read the line that stops the script and the exit handler's comment ("a session never attached"), not the function that starts the session. That function clears the exit handler's record of the session one line before it attaches, so with no terminal the session is left running, detached, with Claude Code in it and Remote Control on.
- It found this the next turn, reading that function to tell the owner what the script prints in that case. A test with stand-ins for Claude Code, gh and git confirmed it: the script exits 69, and its tmux session is still running, unattached, with Claude Code's pane and the shell's.
- The answer to the owner's question was therefore wrong: with no terminal, the script does leave Claude Code running headless.
Expected Behavior
Read the whole path, or run it, before telling the owner what a script does; otherwise mark the claim as not verified.
Files Affected
None; the false statements were in Claude's replies.
Permission Mode
Accept Edits was ON (auto-accepting changes)
The session runs in Claude Code's auto mode.
Can You Reproduce This?
Sometimes (intermittent)
Steps to Reproduce
Not reduced to steps.
Claude Model
Opus
claude-opus-5-5
Relevant Conversation
The statement as made:
Do we have a headless scenario? Not in Start-Claude itself. It always attaches claude's tmux session to your terminal. With no terminal, it stops with 69 and its exit handler ends the session it made
The code, as it is:
# The session exists, and is handed over: the exit handler leaves it.
made_session=""
attach_to "$session_id"
The test, run with no terminal:
--- exit status: 69
[Start-Claude] [+] Continuing the conversation claude picks in .../co/repo
[Start-Claude] [+] Starting Danoble-MBP-A | devlore-cli | test-branch
[Start-Claude] [✘] No terminal to attach the session to.
--- tmux sessions left on the case's own server:
$0 name=Danoble-MBP-A | devlore-cli | test-branch attached=0
Impact
Medium - Extra work to undo changes
Claude Code Version
2.1.296 (Claude Code)
Platform
Anthropic API
Additional Context
- The owner's record of every violation, with the rule each one broke: https://github.com/NobleFactor/devlore-cli/issues/65.
- The same rule, broken before and reported: https://github.com/anthropics/claude-code/issues/101292 and https://github.com/anthropics/claude-code/issues/101437.
Cost: 1,567,621 tokens and $1.63, over 6 calls: 1 that committed the violation and 5 that found, disclosed and reported it, 3 of them shared with anthropics/claude-code#101554 and every one also serving the owner's questions (Opus 5.5 list prices, from this session's per-call usage).