Skip to content

fix(claude-tty): keep the idle timeout from stopping Claude while its background work runs - #170

Merged
sleeyax merged 1 commit into
mainfrom
fix/claude-tty-idle-background-work
Nov 1, 2026
Merged

sleeyax merged 1 commit into
mainfrom
fix/claude-tty-idle-background-work

Conversation

@sleeyax

@sleeyax sleeyax commented Nov 1, 2026

Copy link
Copy Markdown
Owner

What happened

Closes #164.

A session whose background agents were waiting on hours-long runs was suspended for being idle, and the suspension killed Claude along with everything it had started.
When a turn gives up waiting on quiet background work, it stops counting that work.
The idle check only looked at the turn, open cards and recent activity, so an hour after the session went quiet it stopped Claude with the work still running.

What this does

  • A background command stays marked as running until it reports, Claude stops it, or Claude's process ends, whether or not a turn still waits on it.
  • An agent a turn gave up on counts as running the same way, until it reports.
  • suspendIfStillIdle() waits while any of that work is unreported. It checks again within the idle timeout, so the session suspends one timeout after the work reports and it goes quiet.
  • The settings note and the README's settings row say that unfinished background work keeps Claude running.

#168 only stopped Paseo's own idle cleanup. This covers the adapter's Suspend idle Claude timer.

Tests

  • New translator test: work a turn gave up on stays counted until it reports or the process ends.
  • New runtime test for the issue's sequence: a turn gives up on a quiet background command, twice the idle timeout passes and Claude is still running, then the report arrives and the session suspends.
  • "closes a background agent's card when the session it ran in is suspended" relied on the old behaviour. It now makes Claude's process exit, which still checks that the agent's card closes.
  • The adapter's 258 tests pass, and the adapter and plugin typecheck.
  • Not checked live, which needs an idle timeout of at least 15 minutes to run out with background work outstanding.

Merge Danger

Door: two-way

Blast Radius: claude-tty idle suspension

A background command that never finishes, such as a dev server, now keeps Claude running until it is stopped or the session is closed.
Before, the idle timeout killed it.

… background work runs

A turn that waits its bound out on a quiet background command or agent stops counting it, and the idle check never counted it at all, so an hour after the last activity the suspension killed Claude with the work still running.
A background command now stays marked as running until it reports, Claude stops it, or the process ends, independently of whether a turn still waits on it.
An agent a turn gave up on counts the same way until it reports.
The idle check waits while any such work is unreported, and checks again within the idle timeout, so a session suspends one timeout after the work reports and it goes quiet.
A background command that never finishes, such as a dev server, now keeps Claude running until it is stopped or the session is closed.
The test that closed an unreported agent's card through an idle suspension now gets there through Claude exiting.

Closes #164

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sleeyax
sleeyax merged commit 3a2c1c7 into main Nov 1, 2026
1 check passed
@sleeyax
sleeyax deleted the fix/claude-tty-idle-background-work branch November 1, 2026 14:58
@github-actions github-actions Bot mentioned this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-tty: idle suspension kills a session's still-running background shells and subagents

1 participant