You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode run hangs indefinitely with no output when stdin is not at EOF (non-interactive usage broken) #52938
opencode run "<prompt>"hangs forever with no output unless stdin is already at EOF. In non-interactive/scripted usage this makes it unusable: you get no error, no timeout message, just a process that never exits.
Environment
opencode: 1.18.33
OS: Windows 11 24H2, Windows Terminal
invocation: opencode run --model glm/glm-5.3-flash "say hi"
Steps to reproduce
opencode run --model glm/glm-5.3-flash "reply with the single word PUNG"
Wait — it never prints anything and never exits.
Killed at 120 s, 75 s, 75 s → three consecutive timeouts, exit=124, zero bytes of output.
Fix / workaround
Redirect stdin from a closed stream and it works immediately:
opencode run --model glm/glm-5.3-flash "say hi" < /dev/null
exit=0, correct reply in about a second on a freshly reset DB.
This is the whole difference — the flag surface is identical, only stdin differs. So the hang is not the request path (a model call would have produced partial output or an error); opencode is blocking waiting for interactive input before it ever starts the turn.
Why this matters
Anything scripted — cron, a Makefile, a shell pipeline, a wrapper script — will hit this. opencode run is documented as the non-interactive form, and as documented it is simply broken for a piped/empty stdin.
Related note
--permission allow is not a valid flag on 1.18.33; passing it prints the help text and exits 1. Worth documenting either way.
Still the case in v2 (2.0.24, macOS). run.ts:76 reads stdin to EOF whenever stdin is not a TTY, even when a message argument is given. Fix: skip stdin when a message argument is given, unless - asks for it.
Re-opening with evidence: this is still reproducible on OpenCode 2.0.24 (macOS) — @Starefossen confirmed on 2026-10-08 that run.ts:76 still reads stdin to EOF whenever stdin is not a TTY, even when a - message argument is provided. The "upgrade to 2.0" closure rationale does not hold for this specific bug.
Minimal repro: an inherited open stdin pipe (e.g. piped input) combined with a - message argument causes opencode run to hang with no output, because stdin is read to EOF before the message is processed.
Requested fix: skip the stdin read when a message argument is given, unless stdin is explicitly asked for. This keeps non-interactive usage (CI, agent pipelines) working.
Activity
github-actions commentedon Oct 3, 2026
This issue might be a duplicate of existing issues. Please check:
opencode runblocks while reading an inherited stdin pipe that remains open; this issue requests an option to ignore that unused input.Starefossen commentedon Oct 8, 2026
Still the case in v2 (2.0.24, macOS).
run.ts:76reads stdin to EOF whenever stdin is not a TTY, even when a message argument is given. Fix: skip stdin when a message argument is given, unless-asks for it.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊
fix(agentops): spawn agents with stdin=DEVNULL so non-TTY agents cann…
YIbaikaishui commentedon Oct 26, 2026
Re-opening with evidence: this is still reproducible on OpenCode 2.0.24 (macOS) — @Starefossen confirmed on 2026-10-08 that run.ts:76 still reads stdin to EOF whenever stdin is not a TTY, even when a
- messageargument is provided. The "upgrade to 2.0" closure rationale does not hold for this specific bug.Minimal repro: an inherited open stdin pipe (e.g. piped input) combined with a
- messageargument causesopencode runto hang with no output, because stdin is read to EOF before the message is processed.Requested fix: skip the stdin read when a message argument is given, unless stdin is explicitly asked for. This keeps non-interactive usage (CI, agent pipelines) working.