opencode icon indicating copy to clipboard operation
opencode copied to clipboard

tui: automation-delivered prompts look like messages typed by the user

Open 521ox opened this issue 2 days ago • 1 comments

Description

A subagent used a one-shot automation to send a progress update to its parent. In the parent TUI, the update looked like a message I had typed. The delivered message’s metadata.automation matched the sending task, but the transcript showed no source label.

Steps to reproduce

  1. In a TUI session, ask OpenCode to schedule a one-time reminder named Timer check that sends Timer fired. to the current session after 10 seconds.
  2. Wait without typing anything. Compare the incoming Timer fired. row with a manually entered message.

Expected: Show a label such as Automation · Timer check on the delivered message, both live and after reopening the session. Keep the stored user type and the model payload unchanged.

OpenCode version

Observed on 2.4.1-custom-lite.20261128.2 (downstream). The upstream TUI in v2.4.2 and current dev renders the text without showing the origin metadata recorded at delivery.

Operating system

Windows x64 (10.0.26300), TUI. No TUI plugins configured.

521ox avatar Nov 29 '26 16:11 521ox

Thanks for the clear write-up. You're asking for prompts delivered by an automation to carry a visible source label in the transcript, such as Automation · Timer check, both live and after reopening the session, while the stored user type and the model payload stay unchanged.

From the code I read, this is a gap in the UI rather than something broken. When an automation delivers its prompt, the message's metadata records which automation sent it (metadata.automation with its id and name). The TUI reads source labels only from synthetic messages, such as subagent results, so an automation's user message shows up like any other. I didn't find any client that reads metadata.automation on a message yet. I'm filing this as a feature request, and the maintainers will consider it.

I looked at whether a TUI plugin could add the label for now. The plugin slots I found (for example session.composer.top, session.panel and the sidebar slots) don't include one for a single transcript message, so a plugin can't add this today. I didn't find an existing issue or open pull request for it.

opencodejr[bot] avatar Nov 29 '26 16:11 opencodejr[bot]

Confirmed, this is real. I traced it on dev. The automation delivery records the origin on the message (packages/core/src/automation.ts, metadata.automation carries the task id, name, and run number), and that metadata is stored with the user message when it is delivered, so it survives reopening the session. But the TUI user message component never reads it. It just renders the text, files, and skills, which is why a delivered timer message looks exactly like one you typed.

The fix looks small: read metadata.automation in the user message component and show a label like Automation, Timer check. The stored type and payload stay untouched. Synthetic messages already do something similar, they show a Subagent or Shell label from their metadata.

fanyzp avatar Nov 29 '26 16:11 fanyzp