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
Loop doesn't exit after finish=stop — model re-invoked with no input until the session is quit #42576
When the agent finishes a turn with finish=stop and no tool calls, the session should go idle. Instead the loop keeps running and re-calls the model every ~10-20s with no new user message. The UI shows "busy" the whole time while the model just returns one-line filler ("Standing by", "Ready", "Idle").
From the logs:
Normal cycles end with an exiting loop event. The stuck cycle never emits one — it runs loop step=0..28+ over ~25 minutes.
The repeating pattern is loop step=N -> process (new message) -> stream (new model call), with nothing in between.
Every filler message is finish=stop and its step-finish reason=stop, so the model is correctly signaling "done" and the loop is ignoring it.
Esc fires cancel + error=Aborted (finish=None, 0 parts), then the loop restarts at step=0 and sticks again. Esc doesn't break it; only quitting the session does.
Also notable: the model's hidden reasoning in those filler turns literally says "I'm being repeatedly prompted with no user message — this is an artifact", so it's aware it's being re-called with nothing to do.
Version 1.17.18, model deepseek-v4-pro (opencode-go), Linux/WSL. Reproduced in one session, then again right after resuming it. Looks related to #42363 and #22329.
Plugins
No plugins
OpenCode version
1.17.18
Steps to reproduce
Run opencode (v1.17.18) with deepseek-v4-pro (opencode-go).
Do a normal multi-turn agent task — several tool calls, some reasoning, then a finish=stop (e.g. "implement X, run the tests, commit, summarize").
Let it reach a turn that ends with no tool calls. Instead of going idle, it keeps re-calling the model every ~10-20s with no new input — the UI stays "busy" and it appends one-line "Standing by" / "Ready" / "Idle" replies.
Press Esc: the current generation aborts, but the loop restarts at step=0 and sticks again.
Only quitting the session (Ctrl+C) stops it.
Note: not fully deterministic — I only hit it after long sessions with a lot of reasoning/tool history, so it may depend on context length.
Reproduced on v1.18.4 (Windows, PowerShell), model deepseek-v4-pro via opencode-go.
Details from my logs + opencode.db:
Loop ran 838 steps over ~3.5 hours; each cycle is loop step=N -> process -> stream
with no new user message.
Every filler turn had zero tool calls; step-finish reason=stop on 825/826 messages.
The very first loop message had reason=unknown (likely the trigger), after which
the loop ignored every subsequent finish=stop.
Model's hidden reasoning literally said: "I'm in an infinite loop being prompted
with no new user input".
The loop did NOT terminate on finish=stop; it stopped only when the provider returned
AI_APICallError: Weekly usage limit reached.
Esc/cancel fired error=Aborted but did not break the loop; only quitting the session did.
Consequence: it consumed my entire weekly API quota.
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.
Activity
yazonets-maker commentedon Aug 14, 2026
opencode_loop_issue42576_excerptX.txt
Reproduced on v1.18.4 (Windows, PowerShell), model deepseek-v4-pro via opencode-go.
Details from my logs + opencode.db:
with no new user message.
The very first loop message had reason=unknown (likely the trigger), after which
the loop ignored every subsequent finish=stop.
with no new user input".
AI_APICallError: Weekly usage limit reached.
Happy to attach a full log excerpt if useful.
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊