Skip to content

feat(delegation): live orchestration of running subagents via delegate_task action param - #85232

Merged
teknium1 merged 1 commit into
mainfrom
feat/delegate-live-orchestration
Aug 13, 2026
Merged

feat(delegation): live orchestration of running subagents via delegate_task action param#85232
teknium1 merged 1 commit into
mainfrom
feat/delegate-live-orchestration

Conversation

@teknium1

@teknium1 teknium1 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

delegate_task can now orchestrate its own running subagents live: action='list' shows this conversation's children, action='steer' redirects one mid-run without stopping it, and action='stop' ends one early — the model-facing counterpart of the TUI's kill/steer RPCs, in the same tool with zero new tools added.

Changes

  • tools/delegate_tool.py: action/subagent_id/message params + _handle_control_action() (synchronous, never backgrounded); ownership enforced by a _delegate_parent_ref weakref chain so a conversation can only control its own spawn tree; spawn dispatch response now returns subagent_ids + control hint; tasks=[] alongside goal no longer trips the "Batch mode requires at least 2 tasks" gate (live small-model failure)
  • run_agent.py: _dispatch_delegate_task forwards the control params (single choke point for all invocation paths)
  • agent/tool_guardrails.py: control actions never consume the per-turn subagent spawn cap and stay usable once the cap is hit — that's when stop matters most
  • agent/tool_executor.py, agent/display.py: control calls render as steer sa-… / list instead of an empty goal
  • tests/tools/test_delegate_control_actions.py: 20 tests — ownership chain, per-action success/refusal shapes, guardrail exemption, entrypoint routing, empty-tasks coercion

Validation

Check Result
New + sibling delegation/guardrail tests 186 passed
Live E2E (Nous Portal, claude-fable-5) spawn → list (id, running, accepting_steer) → steer (queued) → list → stop (interrupt_requested), full cycle in one session
Live steer efficacy (fable-5) child echoed STEER-ACK mid-essay and switched topics (12 desert-plant → 4 penguin paragraphs), completed normally
Small model (gpt-5.4-mini, Nous Portal) before: hallucinated tasks:[placeholder] batches / "no action parameter"; after: clean spawn→list→steer→stop run quoting every status field
Ruff + Windows footguns clean

Steering rides the existing steer_subagent() registry path (delivered at the child's next tool boundary; missed steers surface as missed_steer in the completion entry). Stop rides interrupt_subagent() — the child halts at its next iteration boundary and its partial result still re-enters as a normal completion message. Live transcripts under cache/delegation/live/ remain the observation channel; this PR adds the actuation half.

Infographic

Subagent Orchestra — spawn, list, steer, stop

…e_task action param

delegate_task gains a control plane: action='list' / 'steer' / 'stop'
let the parent agent see, redirect, and early-stop its own running
subagents mid-flight — the model-facing counterpart of the TUI's
delegation.pause / subagent.interrupt / subagent.steer RPCs.

- action='list': live children of this conversation's spawn tree
  (ids, goal, status, running_seconds, accepting_steer, live
  transcript path). Ownership is enforced via a _delegate_parent_ref
  weakref chain stamped at child build time, so a conversation can
  only control its own descendants, never a sibling tree.
- action='steer': queues text into a running child via the existing
  steer_subagent() registry path (delivered at the child's next tool
  boundary; missed steers surface as missed_steer in the completion).
- action='stop': interrupt_subagent() — child stops at its next
  iteration boundary, partial result still re-enters as a completion.
- Spawn dispatch response now includes subagent_ids + control hint.
- Control actions run synchronously (never backgrounded) and bypass
  the spawn pause gate and depth limit; they also never consume the
  per-turn subagent spawn cap, and remain usable once the cap is hit
  (that is when stop matters most).
- Small-model robustness (found live with gpt-5.4-mini on Nous
  Portal): tasks=[] alongside goal no longer trips the "Batch mode
  requires at least 2 tasks" gate — treated as single-goal.
- CLI display: control calls render as "steer sa-…" / "list" instead
  of an empty goal.

Live-tested E2E on Nous Portal (fable-5 + gpt-5.4-mini): full
spawn→list→steer→stop cycle, plus a steer-efficacy run where the
child acked the steer mid-essay and switched topics before finishing.
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 5c705ae — feat(delegation): live orchestration of running subagents vi

⚠️ Warnings

OSV vulnerability scan · View job

3 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m37s vs 6m31s (-44.5%). 13 job(s) slower, 8 faster, 3 unchanged.

  • Python tests / Run tests slice 3/12: -29.0s
  • Python tests / Run tests slice 4/12: +18.0s
  • Python tests / Run tests slice 7/12: -11.0s
  • Python tests / Run tests slice 11/12: +10.0s
  • Python tests / Run tests slice 8/12: -9.0s

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/delegate Subagent delegation P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 13, 2026
@teknium1
teknium1 merged commit 2a26693 into main Aug 13, 2026
49 checks passed
@teknium1
teknium1 deleted the feat/delegate-live-orchestration branch August 13, 2026 16:34
teknium1 added a commit that referenced this pull request Aug 13, 2026
… live orchestration

Companion docs for #85232 — adds the model-facing control section
(list/steer/stop, ownership scoping, spawn-cap exemption) above the
existing TUI/gateway subagent.steer RPC docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants