[OpenCode] Preserve user prompts when message events arrive in sequence
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.1k
- Forks
- 475
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 178
Description
Summary
The generated OpenCode plugin can start user turns with an empty prompt and then skip the event containing the actual prompt text.
Environment
- Entire CLI:
0.10.0 - OpenCode:
1.18.18 - OS: macOS (Apple Silicon)
What appears to happen
In the generated .opencode/plugins/entire.ts:
message.updatedstores the user message, adds its ID toseenUserMessages, and callsfireTurnStartwithprompt: "".- OpenCode then emits
message.part.updatedfor the text part. - The text-part handler requires
!seenUserMessages.has(msg.id), so it does not callfireTurnStartwithpart.text.
When these events arrive in that order, Entire records an empty prompt instead of the user's prompt.
Relevant generated-plugin code:
if (msg.role === "user" && !seenUserMessages.has(msg.id)) {
seenUserMessages.add(msg.id)
fireTurnStart({
session_id: sessionID,
prompt: "",
model: currentModel ?? "",
})
}
The later message.part.updated path is guarded by the same seenUserMessages set.
Expected behavior
The user's text should be captured when the text part becomes available. The fallback path should either avoid marking the message as fully seen or update the existing turn when message.part.updated provides part.text.
This was identified while reviewing the generated plugin in tonal PR #15209.
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.
Research direction
Start with the generated .opencode/plugins/entire.ts and trace the message.updated and message.part.updated handlers, including their use of seenUserMessages. Reproduce the reported event order and ensure the resulting turn records the text from part.text rather than an empty prompt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100