Skip to content

V2 beta: Transport error / hang when spawning multiple custom-agent subagents with large inline prompts #43594

Description

@planetf1

Description

V2 beta: spawning a custom agent as a subagent multiple times (parallel or sequential) with a large inline prompt kills the session with a bare Error: Transport, or hangs indefinitely. The same workflow completes reliably in OpenCode 1.18.15, so this is a v2 regression.

Impact: multi-agent review workflows (spawn N reviewers, synthesize) are a core v2 use case and are unusable when the session dies after 1-2 subagent spawns.

Plugins

None (reproduced with zero plugins and zero MCP servers).

OpenCode version

opencode2 v0.0.0-beta-17639 (npm @opencode-ai/cli@beta). Works in opencode 1.18.15.

Steps to reproduce

  1. Config: one OpenAI-compatible provider (any local vLLM/Ollama endpoint), one custom agent with a system prompt and mode: "all", subagent permission on the default agent:
{
  "$schema": "https://opencode.ai/config.json",
  "model": "local/my-model",
  "default_agent": "build",
  "providers": {
    "local": {
      "name": "local",
      "package": "@opencode-ai/ai/providers/openai-compatible",
      "settings": { "baseURL": "http://127.0.0.1:PORT/v1" },
      "models": { "my-model": { "name": "My Model" } } // replace with a model your endpoint serves
    }
  },
  "agents": {
    "repro_reviewer": {
      "description": "Custom reviewer agent",
      "mode": "all",
      "system": "You are a code reviewer. Review the provided diff for correctness, regressions, and missing tests.",
      "permissions": [
        { "action": "shell", "resource": "*", "effect": "allow" },
        { "action": "edit", "resource": "*", "effect": "allow" }
      ]
    },
    "build": {
      "permissions": [{ "action": "subagent", "resource": "*", "effect": "allow" }]
    }
  }
}
  1. Run: OPENCODE_CONFIG=opencode.json opencode2 run --standalone "Spawn repro_reviewer as a subagent THREE times IN PARALLEL. Each time pass this diff inline in the task prompt: <300-line diff> Wait for all three to complete. Report all three verdicts."

  2. Observed (8 runs):

    • Parallel: 2 of 3 subagents complete, then Error: Transport (2/3 runs); session hangs with no output (1/3 runs).
    • Sequential: completes ~4/5 runs, dies on the 2nd or 3rd spawn otherwise.

Screenshot and/or share link

Server log shows the session ending with InterruptError: All fibers interrupted without error at Session.wait, http.status=499 (client connection closed), ~44s into the run. The CLI prints only Error: Transport with no further detail.

Operating System

macOS 26.6.2 (arm64)

Terminal

Ghostty (also reproduced headless via opencode2 run --standalone)


Additional notes (ruled out): the endpoint is not the cause (10+ concurrent direct HTTP requests all succeed ~0.5s); MCP is not the cause (zero servers configured); the custom system prompt alone is not the cause (small-task spawns of the same agent complete reliably). The trigger is repeated custom-agent subagent spawns combined with a large inline prompt.

Related: #13715, #35073, #36868 (subagent permission hangs), #38683 (transport retry), #38960 (subagent fan-out), #42725 (task tool swallows subagent errors).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions