Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

Explicit rating capture fails when message content is delivered via parts #28

Description

@wojteksbt

Problem

User ratings like 8 - super, 9/10, or 7: needs work are not persisted to:

  • ~/.opencode/MEMORY/LEARNING/SIGNALS/ratings.jsonl

The file is never created, and the system reports 0 signals.

Actual behavior

  • Sending a rating message does not create/update ratings.jsonl.
  • Plugin logs show the user message arrives with message.content missing/undefined.
  • The extracted user text is empty, so detectRating() does not match and captureRating() is never called.

Expected behavior

  • Any message starting with a valid 1-10 rating (e.g. 8 - super) is detected.
  • The rating is appended as a JSONL entry to ~/.opencode/MEMORY/LEARNING/SIGNALS/ratings.jsonl.
  • Rating detection works whether the text is provided in message.content or in structured parts.

Steps to reproduce

  1. Start OpenCode with the PAI unified plugin enabled.
  2. Send: 8 - super.
  3. Check: ~/.opencode/MEMORY/LEARNING/SIGNALS/ratings.jsonl (missing or no new line).
  4. Check plugin log: /tmp/pai-opencode-debug.log.

Evidence / logs

/tmp/pai-opencode-debug.log includes lines like:

  • [chat.message] message.content type: undefined
  • [chat.message] User: ... (empty)

Suspected root cause

  • The unified plugin extracts message text only from message.content.
  • In some OpenCode message shapes, the text is carried in output.parts (for chat.message) and/or event.properties.parts (for message.updated), while message.content is undefined.
  • As a result, detectRating(content) receives an empty string and does not trigger persistence.

I think it might be caused be the changes performed for #17. It fixed one issue, but created the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions