Repository navigation
TD-5299: a delegated child can run in the background, for the rest of the turn - #124
Merged
Merged
Conversation
… the turn delegate gains background: true (and label). The child starts as a task the session owns (worker_jobs.py, delegate_background.py) through the same run_child_task as a foreground child, and the call returns at once. A writer always gets its own worktree, opened at spawn; where there can be none the call is refused with a hint to run it in the foreground. The worker belongs to its turn. A settled worker's summary reaches the parent model as a note at the next tool-batch boundary (worker_turn.py); when the model stops calling tools with a worker alive, the turn waits with no model call for a worker to settle, a steer or Stop, then gives the note. _emit_turn_complete stops any worker still alive, so none outlives its turn. Stop, cancel, delegate_stop and the window's worker_stop end workers; queued past delegate.background.max_running, refused past max_per_turn, and refused from a child, autonomy, a scheduled run or a deny-and-continue run. Each worker has its own call, time and spend ceiling and honours the session caps even under skip-all. After a restart live workers are interrupted, their worktree is committed to its branch and removed, and nothing is re-run. New events worker_jobs and worker_result, verb worker_stop, Class A tools delegate_output and delegate_stop (rule delegate-job, plan mode allowed, never a child's). The Plan pane lists workers with Stop and their steps. Class B entry in DECISIONS.md revising TD-4602 and TD-5195 on two points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Milestone: background delegates scoped to the turn (owner decision row 17; design section 4.3 of the sub-tasks note).
delegatetakesbackground: true(andlabel). The child runs as a task the session owns, and the call returns at once._emit_turn_completestops any worker still alive, so none outlives its turn.delegate_stop, or the window'sworker_stop, ends one. A stopped writer leaves no worktree folder.max_running(2), workers wait in a queue. Beyondmax_per_turn(8), the call is refused. Each worker has its own ceilings: 24 calls, 30 minutes, and $5 but never more than its share of what the spend cap has left. Workers honour the session caps even under skip-all.interrupted. Each one's worktree is committed to its branch and the folder removed. Nothing is re-run.worker_jobsandworker_result, aworker_stopverb (open to a phone, since it only stops), and two Class A builtins:delegate_outputanddelegate_stop.Not in this story: the optional per-worker
check, and steering a running child (4.4).Checks
TST_REQUIRE_SANDBOX=1. ruff and mypy are clean.🤖 Generated with Claude Code