Skip to content

OpenCode 2.4: last-message review falls back to terminal output after text moved to session_part #209

Done

Description

@oleksandrh-gh

Description

Plannotator TUI cannot read assistant replies from OpenCode 2.4.1. When launched through Herdr Annotate’s “agent’s last message” action, it falls back to terminal output containing multiple conversation turns and loses the original Markdown formatting.

Previously, the same shortcut opened assistant replies correctly.

Steps to reproduce

  1. Run OpenCode 2.4.1 in a Herdr pane.
  2. Send a prompt and wait for an assistant reply.
  3. Trigger annotate.last (prefix+shift+o).
  4. Review the content opened in Plannotator TUI.

Expected: Assistant replies from the active session, with their original Markdown.

Actual: Recent terminal output containing multiple conversation turns, with broken formatting.

Diagnosis

OpenCode now stores assistant content in session_part, keyed by message_id and ordered by ordinal. The corresponding session_message.data.content arrays are empty.

Plannotator’s OpenCode V2 reader still extracts text exclusively from session_message.data.content. Consequently, it finds no assistant replies.

This diagnostic command reproduces the reader failure for an active session that already contains replies:

plannotator-tui last \
  --host opencode \
  --session-id <active-session-id> \
  --print

It reports:

plannotator-tui last: transcript …/opencode.db has no assistant messages yet

Inside Herdr, last::run catches this failure and invokes screen_fallback, explaining why the review shows terminal scrollback instead.

The [current OpenCode reader](https://github.com/plannotator/plannotator-tui/blob/main/crates/plannotator-tui-hosts/src/opencode.rs) still uses the same extraction logic. The failure was reproduced with the installed version below; newer releases were not tested.

Environment

  • OpenCode: 2.4.1
  • Plannotator TUI: 0.9.9
  • Herdr Annotate: 0.9.9
  • OS: macOS

Suggested fix

Support text parts from session_part in the OpenCode V2 reader, preserving their ordinal order and excluding reasoning and tool parts. Retain compatibility with older databases that store content inline.

Related: [#40](#40), which addressed an earlier OpenCode database compatibility problem.


This issue was drafted with AI assistance based on local diagnostic results.

Activity

  1. backnotprop commented on Nov 25, 2026

    @backnotprop
    Contributor

    Fixed in 0.11.8, thanks to #203 from @mxl. Replies are now read from OpenCode 2.4's session_part rows; older OpenCode databases read as before.

    To update: brew upgrade plannotator/tap/plannotator-tui, and for the Herdr plugin herdr plugin update annotate.

    Thanks for the precise diagnosis. If the last-reply action still shows scrollback after updating, please reopen with the output of plannotator-tui last --host opencode --session-id <id> --print.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions