GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [FEATURE]: Preemption primitives for sub-agent orchestration — max-turns-per-dispatch, sub-agent cancellation, per-tool-call streaming · Issue #44748 · anomalyco/opencode

[FEATURE]: Preemption primitives for sub-agent orchestration — max-turns-per-dispatch, sub-agent cancellation, per-tool-call streaming #44748

New issue
Copy link
New issue
Copy link
Open
Open
[FEATURE]: Preemption primitives for sub-agent orchestration — max-turns-per-dispatch, sub-agent cancellation, per-tool-call streaming#44748
Copy link
Assignees
nexxeln

Description

@stephenstubbs
stephenstubbs
opened on Aug 24, 2026
Issue body actions

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

We run opencode as the agent harness for a production multi-phase batch pipeline (openroadmap — a repo-wide march: many phases, each a separate opencode session, orchestrated by a parent). A recent no-op-loop post-mortem across 604 sessions found 208 (≈34%) were class-b no-op loops — a sub-agent repeating the same tool call (a re-read, a re-grep, a re-run) with no forward progress until a gate or manual intervention broke the cycle. The loops are cross-persona (qa 102, integration 9, archive 8, implementation 5–6).

The harness-side guardrails exist; the platform-side primitives do not. We request three platform capabilities so a harness can bound, cancel, and observe its sub-agents.

1. max-turns-per-dispatch — a hard per-dispatch turn budget

A per-subagent-Task-call maximum number of LLM/tool turns. When reached, the dispatch terminates with a distinct reason (max-turns-reached) surfaced to the parent (SDK event), partial transcript retained. The ceiling is settable by the orchestrator per dispatch, with a provider/operator default guard. AC intent: maxTurns: <N> on a dispatch; stops a loop at the bound without manual intervention or process kill.

2. Sub-agent cancellation — an operator/orchestrator-invoked cancel signal

A first-class cancel API on a specific dispatch that marks it cancelled at runtime level, terminates the child's LLM loop + pending tool call, propagates a terminal cancelled reason to the parent, and is idempotent for an already-parked/blocked dispatch. Distinct from a single tool-call interruption. AC intent: orchestrator can cancel a specific running subagent; parent reliably observes cancelled; works even when the child is parked on a permission ask / dropped stream / dead retry — no zombie sessions that block a parent turn forever.

3. Per-tool-call streaming — the tool-call output visible in-flight

Tool/output events stream to the session's event stream as the tool executes (partial output, progress, per-line for shell/exec), not only a single completion event, so a stalled or long-running call is visible and interruptible in-flight rather than surfaced only at completion. AC intent: a harness starts a long call and sees intermediate output before it completes; can interrupt it mid-flight; a stalled call is observable within a bounded window.

The three are independent and each independently addressable. Related open items: #17471 (output-token auto-continue — adjacent), #40175 (unbounded research fan-out — the unbounded-dispatch class P1 bounds), #27110 (max parallel sub-agents — a complementary concurrency ceiling). No client-side workaround is proposed — these require runtime-level guarantees.

Activity

  1. github-actions
    assigned
    nexxeln
    on Aug 24, 2026
  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    Thanks for the detailed write-up and the loop statistics. You're asking for three separate runtime capabilities for orchestrating subagents: a hard turn budget per dispatch that ends with a distinct max-turns-reached reason, a reliable cancel signal for a specific running subagent that the parent sees as cancelled, and tool output that streams while the tool is still running. Maintainers will consider it.

    These existing issues are related, and some cover parts of this:

    • v2: subagent: no cancellation support for background subagents #36423: no way to cancel background subagents (overlaps ask 2)
    • [FEATURE]: agents: expose child-session observability and recovery tools (status/messages/context, fork+prompt, cancel) #59566: tools for orchestrators to check on, recover and cancel child sessions (overlaps ask 2)
    • subagent: infinite loop of identical tool calls for ~50min with no loop protection, uncontrollable token burn #45442: a subagent stuck repeating identical tool calls with no step limit (the problem ask 1 would bound)
    • [FEATURE]: Setting to limit max number of parallel subagents #27110 / feat(core): add subagent concurrency limit #55983: limits on how many subagents run at once (complements ask 1)
    • subagent: parent gets cancelled when an interrupt with resume=true continues a background subagent #54658 / subagent: background subagent's resumed turn completes but the parent session never receives the completion notification #50751: how subagent cancellation and completion are reported to the parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @nexxeln
    nexxeln

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.