Add background mode for shell commands so long runs don't hold steers - #836
Merged
TheGreatAxios merged 1 commit intoSep 10, 2026
Conversation
run_shell accepts background:true: shell-guard starts the command in a detached process group via a bounded registry and returns a shell_id at once, so the turn ends, tool.boundary fires, and queued steers land while the process runs. On exit the host delivers the exit status and output preview on a later turn through the existing continuation channel (TUI, exec, and sub-agent loops); truncated output spills to a tool-output URI. A new shell_collect tool collects or cancels by id. Timeout kills the group with exit 124 and a timed-out marker; a background run never mutates the retained shell cwd; unwired sessions fail closed; foreground behavior is unchanged when background is unset.
TheGreatAxios
force-pushed
the
cl-7517-background-mode-for-shell-commands-so-long-runs-dont-hold
branch
from
September 10, 2026 01:11
f2a94f5 to
c356bda
Compare
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.
Summary
run_shellacceptsbackground: true: shell-guard starts the command in a detached process group via a bounded registry (8 running, 8 completed ring) and returns{shell_id, status: "running"}immediately, so the turn ends and queued steers land while builds, test suites, and dev servers runtool-output:///spill URI when truncated) is delivered to the orchestrator on a later turn via the existing continuation channel, wired in all three loop hosts (TUI, exec, sub-agent); the message is system-originated and never counts as operator inputshell_collecttool ({shell_id, action: "collect"|"cancel", wait_ms?}) retrieves status/output or kills the process group; timeout kills the group with exit 124 +timed_out; background runs never mutate the retained shell cwd; the permission chain still evaluates the start call, so a denied command spawns nothing; unwired sessions fail closed; foreground behavior is unchanged whenbackgroundis unsetshell_collect; toolset dispose kills every live background process group before the posix teardown (/clear, interrupt, reload)docs/ARCHITECTURE.md, anddocs/IMPLEMENTATION.mdupdatedVerification
bun run checkpasses (lint, typecheck, build, full test suite under the projects-dir guard: 6302 pass, 0 fail)cdnot retainedFixes CL-7517