Skip to content

Fork: a background Bash counts as running work until it ends - #16

Merged
jbutton merged 4 commits into
mainfrom
work/11-fork-a-background-bash-counts-
Nov 13, 2026
Merged

jbutton merged 4 commits into
mainfrom
work/11-fork-a-background-bash-counts-

Conversation

@jbutton

@jbutton jbutton commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Nothing is still running in the background: the full check ended and passed, I started no servers, and no test processes from this worktree are left. Everything is committed, and the closing note is written.

Task: PRJ-11 (herdr-projects/11)

jbutton and others added 3 commits November 12, 2026 20:10
Claude Code's background commands (a Bash with run_in_background, or one moved
to the background when its timeout ran out) now hold the agent's turn like a
background agent does: crates/core/src/agents/helpers.rs counts one from the
result that names it (toolUseResult.backgroundTaskId, or the words the result
starts with) until its <task-notification> (completed, failed or killed) or
TaskStop's result, which is all a stop writes. Before, only "Async agent
launched" counted, so the check, the review and the ready alert started while
the command still ran, on what the agent said before it ended.

The shapes are taken from real transcripts (Claude Code 2.1.308 to 2.1.322).
Tests: tests/helpers/shells.rs (failed on main: the task reached approval with
the check and the review run while the command ran). Docs: how-work-gets-done
and troubleshooting.

Ported from upstream Shepherdr 54a65b23 (SHEP-148, #865), rewritten in Rust.
MIT, same notice as this fork's LICENSE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fix: a foreground Bash whose own output began with "Command running in
background with ID: ..." was read as a background start that no notification
would ever end, holding a finished task at Finishing. Claude Code's result
names a background command in toolUseResult.backgroundTaskId (every one
recorded, 2.1.308 to 2.1.322), so that alone counts now; the words of a
result never do. tests/helpers/shells.rs has the reviewer's case.

Upstream Shepherdr 54a65b23 (SHEP-148, #865).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jbutton
jbutton marked this pull request as ready for review November 13, 2026 06:22
Brings in the CI fix (#17) so the pull request's checks run on a base that passes on GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jbutton
jbutton merged commit 4aee8ed into main Nov 13, 2026
4 checks passed
@jbutton
jbutton deleted the work/11-fork-a-background-bash-counts- branch November 13, 2026 09:37
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.

1 participant