Skip to content

Bug: opencode adapter wrapper exits immediately while opencode process continues running #86

Closed

Description

@c-h-

What happened

When launching opencode via agentctl, the wrapper process exits almost immediately (0s duration) even though the underlying opencode process is still running. This makes agentctl list unable to track the session — it shows as stopped while the real work continues.

Evidence

$ agentctl launch opencode --model 'openrouter/qwen/qwen3.5-35b-a3b' --cwd ~/code/mono-v5-8460-qwen35 -p '...'
Launched session pending-95449 (PID: 95449)

# Immediately after:
$ agentctl list -a | grep 95449
# Nothing — already gone

# But the actual opencode process was still running:
$ ps aux | grep opencode | grep qwen
ms  94142  opencode run --model openrouter/qwen/qwen3.5-35b-a3b ...

Workaround

Launch opencode directly with nohup:

nohup opencode run --model '...' 'prompt' > /tmp/log.log 2>&1 &

This works but bypasses agentctl's session tracking entirely.

Root cause guess

The adapter spawns opencode detached but the wrapper process doesn't wait long enough to capture the session ID or confirm the child is running. The child outlives the wrapper.

Impact

  • Can't use agentctl list to monitor opencode sessions
  • Can't use agentctl logs to read output
  • Matrix sweep launches appear to fail when they're actually running
  • Session metadata never gets written so recovery is impossible

Activity

  1. added a commit that references this issue on Feb 28, 2026
    cb13386
  2. added a commit that references this issue on Feb 28, 2026
    3d83271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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