entireio / entireio/cli

[OpenCode] Preserve user prompts when message events arrive in sequence

Open
#2,001 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. message.updated stores the user message, adds its ID to seenUserMessages, and calls fireTurnStart with prompt: "".
  2. OpenCode then emits message.part.updated for the text part.
  3. The text-part handler requires !seenUserMessages.has(msg.id), so it does not call fireTurnStart with part.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.