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
Subagent-bound command: prompt to freshly-created child session can be silently dropped (no error, no log) #59135
When a custom command is bound to a subagent-mode agent (agent: <subagent> frontmatter), the command plugin creates the child session and prompts it immediately — with no delivery verification and no error surfacing if the prompt is dropped:
In a fraction of runs the prompt never materializes in the child session: the session sits with zero messages, the subagent never executes, the parent never receives a synthetic completion, and nothing is logged (no WARN/ERROR lines in the service log). The command silently no-ops.
Reproduction
Observed on OpenCode 2.1.4 (desktop app background service, macOS 15 arm64) with a global command in ~/.config/opencode/commands/ bound via agent: to a subagent agent in ~/.config/opencode/agents/:
POST /api/session (create a session at some directory)
POST /api/session/{id}/command with {"name": "<cmd>", "text": ""}
Poll GET /api/session?parentID={id} and export the child
Over ~10 dispatches in one evening, 1 left the child with 0 messages indefinitely. The same drop reproduces on the direct path: POST /api/session immediately followed by POST /api/session/{id}/prompt can silently lose the message — the session shows no user message, no error is returned, and re-POSTing the identical body seconds later delivers instantly (the message materializes immediately). This suggests the inbox delivery races the session/location becoming ready, and a lost prompt is never retried or surfaced.
Expected
Either the prompt is reliably queued for the new session, or a drop surfaces as an error (to the command executor and the logs).
Additional note
Passing "text": "." to a command breaks template delivery entirely: the child session is created but the template never arrives (and the command falls through to the parent session in some code paths). Empty string or a real argument works.
Thanks for the detailed report. I tried this on OpenCode 2.1.4 (opencode serve on Linux) with a global subagent (mode: subagent) and a global command bound to it with agent:, then sent the same API calls you describe:
POST /api/session, then right away POST /api/session/{id}/prompt: the user message was saved every time (0 lost out of 25 runs in a row, 25 runs with a new directory each time, and 20 runs sent at once).
POST /api/session, then right away POST /api/session/{id}/command with {"name": "<cmd>", "text": ""}: a child session was always created and always had the template message (0 empty out of 70 runs in total).
"text": ".": the child got the template with . as the argument, and nothing went to the parent session.
I couldn't see the drop, so a few details would help:
Does it also happen with opencode serve (or the CLI's background service), or only with the desktop app's bundled service?
When a child stays at 0 messages, what does GET /api/session/{childID}/inbox return for it? Is the prompt still in the inbox, or gone completely?
Roughly how long had the service been running, and were other sessions or subagents busy at the time?
For a directly prompted session that lost its message, what did the POST .../prompt response contain (status code and body)?
Your command and agent frontmatter (without anything private), and the steps for the "." case that sent the command to the parent session.
Related: #59136 (your companion issue about empty child exports) and #52468 (a first-turn subtask command leaves the parent session empty, with an inbox row that never gets delivered).
Activity
opencode-agent commentedon Oct 26, 2026
Thanks for the detailed report. I tried this on OpenCode 2.1.4 (
opencode serveon Linux) with a global subagent (mode: subagent) and a global command bound to it withagent:, then sent the same API calls you describe:POST /api/session, then right awayPOST /api/session/{id}/prompt: the user message was saved every time (0 lost out of 25 runs in a row, 25 runs with a new directory each time, and 20 runs sent at once).POST /api/session, then right awayPOST /api/session/{id}/commandwith{"name": "<cmd>", "text": ""}: a child session was always created and always had the template message (0 empty out of 70 runs in total)."text": ".": the child got the template with.as the argument, and nothing went to the parent session.I couldn't see the drop, so a few details would help:
opencode serve(or the CLI's background service), or only with the desktop app's bundled service?GET /api/session/{childID}/inboxreturn for it? Is the prompt still in the inbox, or gone completely?POST .../promptresponse contain (status code and body)?"."case that sent the command to the parent session.Related: #59136 (your companion issue about empty child exports) and #52468 (a first-turn subtask command leaves the parent session empty, with an inbox row that never gets delivered).