anomalyco / anomalyco/opencode
BUG: `opencode run --agent plan` hangs at init, before any session is created
@rekram1-node is already working on this.
Since Aug 15, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
opencode run --agent plan hangs indefinitely. It never creates a session and never sends a request to the model, so it has to be killed.
This looks like a regression of #3828 ("Plan Agent gets stuck in run mode", closed as fixed in 0.15.31), but the failure is earlier and broader than the original report. #3828 needed a prompt that triggered a bash ask permission. This reproduces with a prompt that uses no tools at all, and it hangs before a session exists, so no permission could have been requested yet.
OpenCode version
1.18.18
Steps to reproduce
opencode run --agent plan -m <provider>/<model> "di solo OK"
# hangs forever, no output
Reproduced with a minimal config (provider + model only, no custom agents, no MCP servers, no instructions, no permission overrides), so it is not caused by user customisation.
What the logs show
With --print-logs --log-level DEBUG, it reaches init and stops there:
level=INFO message=bootstrapping directory=/home/macuartin/www/knowledge-base
level=INFO message="all LSPs are disabled"
level=INFO message="all formatters are disabled"
level=INFO message=init
level=INFO message=cleanup prune=7.days <- 60s later, this is my timeout killing it
A working run with the same config and the default agent gets past init immediately:
level=INFO message=init
level=INFO message=created id=ses_... agent=undefined model=undefined
permission="[{\"permission\":\"question\",...,\"action\":\"deny\"},
{\"permission\":\"plan_enter\",...,\"action\":\"deny\"},
{\"permission\":\"plan_exit\",...,\"action\":\"deny\"}]"
level=INFO message="event connected"
level=INFO message=loop session.id=ses_... step=0
So with --agent plan no created line is ever emitted. Note the plan_enter / plan_exit permissions present in the working session; I suspect the plan agent is waiting on one of those in a context where nothing can answer, but I have not read the source to confirm.
What I ruled out
| Hypothesis | Result |
|---|---|
ask permissions blocking on a non-interactive prompt |
No. --auto does not help |
User config (custom agents, MCPs, question: deny) |
No. Reproduces with a minimal config |
| Restricted/read-only agents in general | No. --agent explore (read-only) works fine |
| Server or model wedged | No. The default agent works immediately before and after, and the model endpoint answers directly |
Environment
- Provider: OpenAI-compatible local endpoint (llama.cpp router)
- Model: a local 30B; token counters on the server confirm zero prompt tokens ever arrive, so this is client-side
- OS: Linux
I could not test against a hosted provider, so I cannot rule out that this is specific to a custom OpenAI-compatible provider.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.