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 --format json --session writes assistant text to DB but emits empty stdout for an existing session #31482
opencode run --format json --session <sessionID> can complete successfully and persist the assistant response into ~/.local/share/opencode/opencode.db,
but emit no JSON events to stdout.
This only happens for a specific existing session that has prior tool-call / multi-step history. A fresh session and a simple resumed session both stream JSON
correctly.
Environment
OpenCode version: 1.16.2
OS: macOS 15.5, arm64
Model: volcengine-plan/kimi-k2.6
Command mode: opencode run --format json
Working Case
Fresh session works:
opencode -m volcengine-plan/kimi-k2.6 run --format json "只输出 OK"
stdout includes step_start, text, and step_finish.
Resuming that fresh session also works:
opencode -m volcengine-plan/kimi-k2.6 run --format json \
--session ses_154ab1ebdfferuLfjWKE1REEOy \
"只输出 OK111"
stdout includes:
{"type":"text", "...": "...", "part":{"type":"text","text":"OK111"}}
## Failing Case
For an existing session with prior tool calls and multiple assistant steps:
opencode -m volcengine-plan/kimi-k2.6 run --format json \
--dir /Users/www/dev-task-20260609-1023 \
--dangerously-skip-permissions \
--session ses_154eb250dffe9uo50Bn1S51wOu \
"只输出 OK_BAD"
Actual behavior:
- stdout is empty
- process exits successfully
- OpenCode DB contains the assistant response and step finish
DB evidence:
selectid, message_id, json_extract(data,'$.type') as type, json_extract(data,'$.text') as text
from part
where session_id='ses_154eb250dffe9uo50Bn1S51wOu'
order by time_created desc
limit 4;
Result includes:
step-finish
text OK_BAD
step-start
text "只输出 OK_BAD"
So the model ran, OpenCode persisted the result, but run --format json did not emit the expected stdout JSON events.
## Expected Behavior
opencode run --format json --session ... should emit the new run's JSON events to stdout, at minimum:- step_start- text- step_finishThis should be consistent with fresh sessions and simple resumed sessions.## Additional ContextThe failing session has prior tool-call history and several assistant steps. Earlier integrations that spawned the same command also saw only step_start orempty stdout, while the same final assistant text appeared in OpenCode DB.This looks related to existing opencode run non-interactive / tool-call session issues, but I could not find an exact duplicate where the result is written toDB while stdout is empty.### Plugins_No response_### OpenCode version_No response_### Steps to reproduce_No response_### Screenshot and/or share link_No response_### Operating System_No response_### Terminal_No response_
If your issue is specifically triggered by sessions with prior tool-call history (rather than container latency or buffering), it may be a distinct root cause — please mention this in your issue if so.
Activity
github-actions commentedon Jun 9, 2026
This issue might be a duplicate of existing issues. Please check:
opencode run --format jsondropstextandstep-finishevents, though that issue attributes it to event ordering in containerized environmentsIf your issue is specifically triggered by sessions with prior tool-call history (rather than container latency or buffering), it may be a distinct root cause — please mention this in your issue if so.
github-actions commentedon Aug 9, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.