Problem
When the user closes/exits a Claude Code session (e.g., via /exit, closing the terminal tab, or Ctrl+C), the underlying tmux session managed by the gc controller remains alive. The user gets kicked out of the interactive session, but the claude process continues running in the tmux pane, consuming tokens on every re-prime or system reminder.
This compounds with #70 (gc handoff doesn't trigger controller restart) — the user has no way to cleanly end a session:
Expected behavior
When the user exits Claude Code:
- The claude process in the tmux session should terminate
- The controller should detect the session ended
- If work is pending, controller should restart the session (fresh context)
- If no work, session stays stopped until new work arrives
Observed behavior
- User closes Claude Code → gets disconnected from the session
- tmux session stays alive with the claude process still running
- Agent continues responding to system reminders and cron jobs
- Tokens are consumed with no user present
- User has to manually kill the tmux session or wait for it to die
Impact
Token waste. The mayor session was re-primed multiple times after the user tried to end it, each prime injecting the full context (~thousands of tokens) with no productive work being done.
Related
Problem
When the user closes/exits a Claude Code session (e.g., via
/exit, closing the terminal tab, or Ctrl+C), the underlying tmux session managed by the gc controller remains alive. The user gets kicked out of the interactive session, but the claude process continues running in the tmux pane, consuming tokens on every re-prime or system reminder.This compounds with #70 (gc handoff doesn't trigger controller restart) — the user has no way to cleanly end a session:
gc handoffsends mail but doesn't restart (bug bug: gc handoff requests restart but controller doesn't kill/restart the session #70)Expected behavior
When the user exits Claude Code:
Observed behavior
Impact
Token waste. The mayor session was re-primed multiple times after the user tried to end it, each prime injecting the full context (~thousands of tokens) with no productive work being done.
Related