Skip to content

opencode run produces no stdout output while running #22243

@Git-on-my-level

Description

@Git-on-my-level

Bug

opencode run '<prompt>' buffers all output until completion with no progress indication. If the underlying operation is slow (API latency, cache warming, retries) or fails silently (bad auth), the process sits at 0% CPU indefinitely with zero stdout/stderr output. There's no way to distinguish "working but slow" from "stuck" or "failed" without inspecting the process or the SQLite DB.

Steps to reproduce

  1. Run opencode run with a prompt that requires multiple tool calls:
    opencode run 'Read all files in .codex-autorunner/tickets/ and implement the changes described in TICKET-001.md'
  2. Observe: stdout is completely empty for the entire duration. No progress, no tool call indicators, nothing.

Expected behavior

Some form of progress output while running, e.g.:

  • Print each tool call as it happens (like the TUI does)
  • Print a spinner or status indicator
  • At minimum, print error output immediately when auth fails or API errors occur

Actual behavior

  • Zero output on stdout/stderr for the entire run duration
  • Silent auth failure: opencode run --model openrouter/anthropic/claude-sonnet-4 'test' with no OpenRouter credentials produces no error, no output, and the process just hangs at 0% CPU indefinitely
  • No session created in ~/.local/share/opencode/opencode.db for failed runs, making post-mortem diagnosis harder
  • Successful runs do buffer and eventually print, but for a multi-minute run this appears completely broken

Environment

  • opencode 1.4.3
  • macOS ARM64
  • Launched from bash via opencode run '...' (non-interactive, backgrounded with &)
  • Same behavior whether backgrounded or run in foreground

Evidence

Relevant opencode DB session showing the model DID process steps internally but nothing was printed to stdout:

session: gentle-meadow, duration: 51s (killed), 15 parts
  step 1 (t+19s): Glob .codex-autorunner/tickets/*.md → "No files found"  [gitignored]
  step 2 (t+30s): Glob .codex-autorunner/tickets/* → "No files found"    [gitignored]
  step 3 (t+42s): Read .codex-autorunner (directory listing)              [fallback worked]
  step 4 (t+51s): Read .codex-autorunner/tickets (found TICKET-001.md, TICKET-002.md)
  step 5 (t+51s): Read TICKET-001.md and TICKET-002.md                   [making progress]
  → Killed by user who assumed it was stuck

The process was making progress the entire time, but stdout was empty. Each step had ~10-11s latency from cache warming + API round-trips.

Suggestion

Add a --verbose or --progress flag (or make it the default for run mode) that streams tool calls and intermediate output to stderr, similar to how the TUI displays them. This would allow:

  1. Users to see the agent is working
  2. Errors to surface immediately
  3. Long runs to be monitored without killing and inspecting the DB

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions