[GH-ISSUE #69] Bug: OpenCode Backend cli seems to be missing the run subcommand #27

Closed
opened 2026-02-27 10:21:50 +03:00 by kerem · 2 comments
Owner

Originally created by @maafk on GitHub (Jan 18, 2026).
Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/69

When using backend: "opencode" in ralph.yml, ralph invokes opencode but appears to be missing the run subcommand. This causes OpenCode to print its help menu instead of executing the prompt.

Environment

  • ralph-orchestrator version: 2.0.9
  • opencode version: 1.1.25
  • OS: macOS

Steps to Reproduce

  1. Configure ralph.yml with:
cli:
  backend: "opencode"
  1. Ensure opencode is properly authenticated:
opencode
# /connect -> select Provider
# /models -> select a model
# /exit
  1. Verify opencode works directly:
opencode run "say hello"
# This works correctly
  1. Run ralph:
ralph run

Expected Behavior

Ralph should invoke OpenCode with the run subcommand and pass the prompt as positional arguments:

opencode run "prompt text here"

Or with model selection:

opencode run -m provider/model "prompt text here"

Actual Behavior

Ralph appears to invoke just opencode without the run subcommand, causing OpenCode to print its help menu 5 times before failing:

═══════════════════════════════════════════════════════════════════════════════
 ITERATION 1 │ 🎭 ralph │ 0s elapsed │ 1/50
═══════════════════════════════════════════════════════════════════════════════

Commands:
  opencode completion          generate shell completion script
  opencode run [message..]     run opencode with a message

...

2026-01-18T15:35:49.467033Z  INFO ralph_core::event_loop: Wrapping up: consecutive_failures. 5 iterations in 3s. reason=consecutive_failures iterations=5 duration=3s

┌──────────────────────────────────────────────────────────┐
│ ✗ Loop terminated: Too many consecutive failures
├──────────────────────────────────────────────────────────┤
│   Iterations:  5
│   Elapsed:     3.1s
└──────────────────────────────────────────────────────────┘

OpenCode CLI Reference

From opencode run --help:

opencode run [message..]

run opencode with a message

Positionals:
  message  message to send                                    [array] [default: []]

Options:
  -m, --model       model to use in the format of provider/model    [string]
  --agent           agent to use                                    [string]
  --format          format: default (formatted) or json             [string]
  -f, --file        file(s) to attach to message                    [array]
  -c, --continue    continue the last session                       [boolean]
  -s, --session     session id to continue                          [string]

Root Cause

The opencode adapter seems to not include the run subcommand when constructing the command. The correct invocation should be:

opencode run "the prompt message"

Not:

opencode "the prompt message"

Suggested Fix

The command construction needs to:

  1. Include the run subcommand
  2. Pass the prompt as a positional argument

Example of correct invocation:

# Basic
opencode run "prompt text here"

# With model selection
opencode run -m groq/llama-3.3-70b-versatile "prompt text here"

# With file attachments
opencode run -f context.md "prompt text here"
Originally created by @maafk on GitHub (Jan 18, 2026). Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/69 When using `backend: "opencode"` in ralph.yml, ralph invokes `opencode` but appears to be missing the `run` subcommand. This causes OpenCode to print its help menu instead of executing the prompt. ## Environment - ralph-orchestrator version: 2.0.9 - opencode version: 1.1.25 - OS: macOS ## Steps to Reproduce 1. Configure `ralph.yml` with: ```yaml cli: backend: "opencode" ``` 2. Ensure opencode is properly authenticated: ```bash opencode # /connect -> select Provider # /models -> select a model # /exit ``` 3. Verify opencode works directly: ```bash opencode run "say hello" # This works correctly ``` 4. Run ralph: ```bash ralph run ``` ## Expected Behavior Ralph should invoke OpenCode with the `run` subcommand and pass the prompt as positional arguments: ```bash opencode run "prompt text here" ``` Or with model selection: ```bash opencode run -m provider/model "prompt text here" ``` ## Actual Behavior Ralph appears to invoke just `opencode` without the `run` subcommand, causing OpenCode to print its help menu 5 times before failing: ``` ═══════════════════════════════════════════════════════════════════════════════ ITERATION 1 │ 🎭 ralph │ 0s elapsed │ 1/50 ═══════════════════════════════════════════════════════════════════════════════ Commands: opencode completion generate shell completion script opencode run [message..] run opencode with a message ... 2026-01-18T15:35:49.467033Z INFO ralph_core::event_loop: Wrapping up: consecutive_failures. 5 iterations in 3s. reason=consecutive_failures iterations=5 duration=3s ┌──────────────────────────────────────────────────────────┐ │ ✗ Loop terminated: Too many consecutive failures ├──────────────────────────────────────────────────────────┤ │ Iterations: 5 │ Elapsed: 3.1s └──────────────────────────────────────────────────────────┘ ``` ## OpenCode CLI Reference From `opencode run --help`: ``` opencode run [message..] run opencode with a message Positionals: message message to send [array] [default: []] Options: -m, --model model to use in the format of provider/model [string] --agent agent to use [string] --format format: default (formatted) or json [string] -f, --file file(s) to attach to message [array] -c, --continue continue the last session [boolean] -s, --session session id to continue [string] ``` ## Root Cause The opencode adapter seems to not include the `run` subcommand when constructing the command. The correct invocation should be: ```bash opencode run "the prompt message" ``` Not: ```bash opencode "the prompt message" ``` ## Suggested Fix The command construction needs to: 1. Include the `run` subcommand 2. Pass the prompt as a positional argument Example of correct invocation: ```bash # Basic opencode run "prompt text here" # With model selection opencode run -m groq/llama-3.3-70b-versatile "prompt text here" # With file attachments opencode run -f context.md "prompt text here" ```
kerem closed this issue 2026-02-27 10:21:50 +03:00
Author
Owner

@mikeyobrien commented on GitHub (Jan 19, 2026):

@maafk Should be fixed with: https://github.com/mikeyobrien/ralph-orchestrator/pull/72. I manually verified, albeit on a very trivial prompt.

<!-- gh-comment-id:3769063037 --> @mikeyobrien commented on GitHub (Jan 19, 2026): @maafk Should be fixed with: https://github.com/mikeyobrien/ralph-orchestrator/pull/72. I manually verified, albeit on a very trivial prompt.
Author
Owner

@maafk commented on GitHub (Jan 19, 2026):

Works great @mikeyobrien ! Thanks so much for this awesome project!

<!-- gh-comment-id:3769344128 --> @maafk commented on GitHub (Jan 19, 2026): Works great @mikeyobrien ! Thanks so much for this awesome project!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#27
No description provided.