Skip to content

Bug: --spec/--file flags crash opencode sessions on large prompts #98

Closed

Description

@c-h-

What happened

When using agentctl launch opencode --spec <file> --file <file1> --file <file2>, the opencode process launches but dies silently within seconds. PID shows as dead almost immediately. No error output.

This happens when the combined content of spec + files is large (~50KB+). The content gets inlined into the shell command arguments, likely exceeding argv limits or causing opencode to choke on the escaped content.

What was expected

The session should start and the agent should have access to the file contents.

How to reproduce

# These files total ~44KB
agentctl launch opencode --cwd ~/code/mono-sandbox-archive-hardpin \
  --spec docs/artifacts/2026-02/sandbox-archive-node-affinity/SPEC.md \
  --file packages/sandbox-k8s/src/archive.ts \
  --file backend/task-worker-ts/src/core/brain/workflows/sandbox-lifecycle-sweeper.ts \
  -p "Make changes to these files"

# Check PID — dies within 5 seconds
sleep 5 && ps -p <pid>  # DEAD

Workaround: omit --spec/--file, let the agent read files from the worktree itself.

Suggested fix

Write spec/file contents to a temp file and pass the path to opencode, rather than inlining into argv. Or use stdin/pipe.

Environment

agentctl from npm link (local build), opencode 1.2.11 (Homebrew), macOS arm64

Activity

  1. added 2 commits that reference this issue on Mar 5, 2026
    c54c490
    4f2c76f
  2. c-h- commented on Mar 5, 2026

    @c-h-
    CollaboratorAuthor

    Fixed in PR #101

  3. added 2 commits that reference this issue on Mar 5, 2026
    132871d
    6cf3976
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