Skip to content

opencode run --format json never emits the user prompt message #29997

@Kurry

Description

@Kurry

Description

opencode run --format json doesn't include the user's prompt anywhere in the event stream. The stream starts at step_start, goes straight to the assistant's text / tool_use / step_finish events, and never emits anything carrying the message I sent. Anything that rebuilds a transcript from the JSON stream (logging, eval harnesses, ATIF exporters) loses the user turn entirely.

opencode export <sessionID> does contain the user message, so it's recorded internally — it just never reaches the run stream.

Looking at packages/opencode/src/cli/cmd/run.ts, the text handler in the event loop only emits parts gated on part.time?.end, and a user text part has no time field, so it's skipped. There's also no dedicated user/prompt event type in JSON mode, so even the assistant text events carry no role to distinguish them.

Plugins

No response

OpenCode version

1.15.10

Steps to reproduce

  1. opencode --model=openai/gpt-4o-mini run --format json -- "say hello"
  2. Read stdout — the first line is step_start; no event contains say hello.
  3. opencode export <sessionID> — the user message is present there, confirming it's stored but not streamed.

Screenshot and/or share link

No response

Operating System

macOS (Darwin 25.5.0)

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions