Repository navigation
Keep a started message in hand while a command its turn left runs in the background - #6940
Merged
Merged
Conversation
…the background A message the agent starts now stays in hand after its turn ends while a command that turn left running in the background still runs, as it already does while a background agent works: the page reads it Working and no reminder names it until the command exits or the session's next turn opens. Before, Claude Code's `shell` status, which it reports when no turn or agent runs but a command does, read as plain `idle`, so the message dropped to Stopped and the watch woke the session to remind it of work its command was still doing. Mapping `shell` to `busy` doesn't fix it: Claude Code dates each status by its last change, so `shell` is dated from the turn's end, after the start, and the date test that keeps a start under `busy` fails. `Harness.live_turn` now reads `shell` as `idle`, which interrupt detection relies on, with `command: true`. `activity.start_holds` reads a start from the claimant's current turn as held while the record says the session works, an `idle` with `command` or a `busy` that began before the turn's end, since every agent and command the session runs starts in one of its turns. That also keeps such a start through a dialog after it, such as approving the command, which re-dates `busy` past the start; a start from an earlier turn still needs a `busy` dated before it. What this leaves: - A command alone doesn't make the page read Working "in the background", as a background agent does (`Turn.busy`): a dev server or a Monitor reports the same `shell`, and would read as work while the agent waits on the user. - A later turn opened while the command runs is reminded of the message, since that turn's `busy` hides the command; the agent starts it again. - A start the agent leaves while an unrelated server runs is reminded at the next turn rather than at once; the page shows it Working, then Gone quiet after 15 minutes. The Stop and prompt reminder's restart line no longer says a start lapsed "when its turn ended", which a command now outlasts, and `conversation-loop.md` corrects what holds a start; neither changes a rule. Tests: a new hook test against Claude Code registry records fails on the old code and covers the dialog, the command's exit and a later turn's command; the activity tests cover `shell` after a background agent ends and an Escape that leaves a command running. The claude-code journey passes all 14 steps. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
previously approved these changes
Nov 24, 2026
The `start_holds` header said the user asked that a command the session leaves running hold a start as a background agent does. Nobody chose that; this change extends the user's decision for background agents to commands, so the header now says so, with the reason: the command carries on the start's turn as an agent does, and without the hold the agent is reminded of a message while the command answering it still runs. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A message the agent starts now stays in hand after its turn ends while a command that turn left running in the background still runs, as it already does while a background agent works: the page reads it Working and no reminder names it until the command exits or the session's next turn opens. Before, Claude Code's
shellstatus (no turn or agent running, a command still running) read as plainidle, so the message dropped to Stopped and the watch woke the session to remind it of work its command was still doing.Mapping
shelltobusydoesn't fix it: Claude Code dates each status by its last change, soshellis dated from the turn's end, after the start.Harness.live_turnnow readsshellasidle(which interrupt detection relies on) withcommand: true, andactivity.start_holdsholds a start from the claimant's current turn while the record says the session works:idlewithcommand, or abusythat began before the turn's end. The second half also keeps the start through a dialog after it, such as approving the command, which re-datesbusy.To weigh:
shell.busyhides the command; the agent starts it again.leaf-dev preview, say) is reminded at the next turn rather than at once; the page shows it Working, then Gone quiet after 15 minutes.The restart line in Leaf's reminder and
conversation-loop.mdnow say what holds a start; neither changes a rule.This extends Max's decision for background agents (#6593) to commands; nobody chose the difference, and Max hasn't decided the command case himself. Tests: a new hook test against Claude Code registry records fails on
main; activity tests covershellafter a background agent and an Escape that leaves a command running. The claude-code journey passes all 14 steps.