Skip to content

feat: kill a running bash call when a turn is stopped - #515

Merged
danczw merged 8 commits into
mainfrom
feat/26-cancel-bash-call
Nov 12, 2026
Merged

danczw merged 8 commits into
mainfrom
feat/26-cancel-bash-call

Conversation

@danczw

@danczw danczw commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

A tui stop now raises a per-turn Cancel that reaches kill_group for the running bash, waits for the call to settle, and starts none behind it.
#26 bash cancellation. The six in-process tools stay uncancellable, so #26 stays open for them.
SECURITY.md is updated in this PR: "A running tool call cannot be interrupted" becomes "Only a spawned command can be interrupted", with the session-store bullet to match.
Reviews: /code-review at 3c858bc read origin/main...HEAD (31 files, +577/−175) and its fixes landed in 1ed2f6b and 70129b1; /security-review at 70129b1 read origin/main...HEAD (31 files, +634/−175) and found nothing; the comment pass is ba0519c (31 files, +632/−175 on origin/main...HEAD), comment-only.

A raised Cancel kills the command's process group through the same
path as a timeout, and a token raised beforehand starts nothing.

Refs: #26
ExecutionContext carries a Cancel that every spawn it hands out
observes, and bash reports a killed command as ToolError::Cancelled.

Refs: #26
run_turn_until raises a per-turn Cancel when the stop resolves while
answering, waits for the running call to end, and starts none behind it.

Refs: #26
A stop now waits for the call it stood on, so that call settles and is
drawn like any other; the tracker that named it as finishing unseen had
nothing left to say. The stop line and the tui help now say a running
bash command is killed.

Refs: #26
SECURITY.md claims only a spawned command can be interrupted, and says
what the six in-process tools and a killed command leave behind.

Refs: #26
@danczw danczw added this to the v0.1.0-alpha.26 milestone Nov 12, 2026
@danczw danczw added enhancement New feature or request crate:tools the seven built-in tools, each confined by core crate:cli argv parsing and the five subcommand bodies crate:core sandboxing; the only crate allowed to spawn a subprocess crate:turn the turn loop labels Nov 12, 2026
@danczw danczw self-assigned this Nov 12, 2026
SECURITY.md says a stop kills what a timeout kills; this pins it for the
setsid escapee the timeout test already covers.

Refs: #26
A run cancelled before it starts leaves no record, the turn replaces a
caller's token with its own, and a cancelled round must be dropped.

Refs: #26
@danczw
danczw marked this pull request as ready for review November 12, 2026 12:37
@danczw
danczw merged commit 98c4c7d into main Nov 12, 2026
10 checks passed
@danczw
danczw deleted the feat/26-cancel-bash-call branch November 12, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crate:cli argv parsing and the five subcommand bodies crate:core sandboxing; the only crate allowed to spawn a subprocess crate:tools the seven built-in tools, each confined by core crate:turn the turn loop enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant