Skip to content

opencode run (headless) exits 0 mid-pipeline after a parallel subagent fan-out, before the model's next turn #37548

Closed as not planned

Description

@lance2k

Summary

In headless mode, opencode run sometimes ends the session (exit code 0) immediately after a parallel task-tool subagent fan-out returns, before the primary model gets its next turn. The run looks successful but the output stops mid-pipeline — the model never processes the subagents' results.

Environment

  • opencode 1.16.2 and 1.18.2 (reproduced on both)
  • Linux (Ubuntu, kernel 6.17), zsh
  • Primary model opencode-go/glm-5.2 (build agent), custom subagents on opencode-go/* models

Repro shape

A custom command (/deep-research) loads a skill that instructs the model to run a multi-phase pipeline, dispatching parallel task-tool subagents at several phases (search → fetch → verify → synthesize).

opencode run "/deep-research <question>"

Observed three times across the two versions:

  1. (1.16.2) All 10 parallel verify subagents completed (stderr progress shows every ✓) — the process exited 0 without the model's tally/synthesis turn ever running.
  2. (1.16.2) Same run earlier needed a resume mid-pipeline as well.
  3. (1.18.2) The run printed the model's Phase-1 text ("Dispatching 6 search agents in parallel"), dispatched them, and exited 0 — no Phase 2 onward.

When it happens, stdout ends mid-pipeline and the exit code is still 0, so scripts can't tell the run failed.

Expected

The session should continue until the primary model ends a turn with no pending subagent results to process.

Workaround

Resuming the same session continues correctly every time:

opencode run -s <session-id> "Continue exactly where you left off…"

(Note: must be run from the same working directory, since sessions are per-project.)

Happy to provide session exports for the affected runs if useful.

Activity

  1. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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