anomalyco / anomalyco/opencode

Feature: per-subagent timeout / tool-call budget — one stalled child hangs the parent indefinitely

Open
#46,461 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Problem

A task that spawns subagents has no per-child wall-clock timeout or budget: when one subagent stalls (e.g. its model backend stops responding mid-call), the parent waits forever with no error and no recovery.

Measured case (OpenCode 1.18.x, Windows 11, local Ollama models via an OpenAI-compatible provider): an unattended research task spawned several subagents; one child's backend stalled and the parent hung 20 minutes until manually killed. The identical task re-run with a prompt-level instruction ("at most N tool calls, then report") completed in 169 s with full results — so the work itself was fine; only the missing guardrail made the run unsafe.

Related open reports that look like the same missing guardrail from different angles: #33028 (subagents hang indefinitely, stream never times out), #13841 (Explore subagent hangs, no timeout or recovery), #44931 (background subagents hang silently on repeated upstream 429s).

Proposal

  • A configurable per-subagent wall-clock timeout (config default + per-agent override), after which the child is cancelled and the parent receives a structured "subagent timed out" result it can act on.
  • Optionally a tool-call budget per subagent as a second, cheaper guardrail (deterministic, model-independent).

Prompt discipline works as a workaround but shouldn't be the only line of defense for unattended runs — a stalled child currently converts into an unbounded parent hang.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.