Skip to content

agent-trace-plugin: Switch agent-trace plugin from session.diff to message.updated event capture#42

Draft
ivke995 wants to merge 6 commits into
mainfrom
fix/use-message-updated
Draft

agent-trace-plugin: Switch agent-trace plugin from session.diff to message.updated event capture#42
ivke995 wants to merge 6 commits into
mainfrom
fix/use-message-updated

Conversation

@ivke995
Copy link
Copy Markdown
Contributor

@ivke995 ivke995 commented May 15, 2026

No description provided.

….updated

The agent-trace plugin previously captured session.diff events, but the
upstream OpenCode API no longer emits this event reliably. Switch to
message.updated events, which carry the same diff information per user
message.

Key changes:
- Listen for message.updated instead of session.diff
- Extract diffs from properties.info.summary?.diffs[].patch instead of
  properties.diff[]
- Filter to user messages only (info.role === user)
- Fall back sessionID to unknown when info.sessionID is absent
- Use patch-only extraction (no diff field fallback needed for FileDiff)
- Bump @opencode-ai/plugin from 1.3.0 to 1.14.28 for message.updated support

Generated plugin outputs regenerated via Pkl; context documentation updated
to reflect the new event contract.

Plan: agent-trace-plugin-message-updated (T01, T02, T03)

Co-authored-by: SCE <sce@crocoder.dev>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c22ded13-4a77-4991-a62c-6069e21a5a1f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/use-message-updated

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

ivke995 and others added 5 commits May 15, 2026 16:43
Capture the OpenCode model identifier in emitted diff-trace payloads and add the nullable diff_traces.model_id migration so later Rust hook wiring can persist it without changing recent-patch reads.

Plan: add-diff-traces-model-id

Updated tasks: T01, T02

Co-authored-by: SCE <sce@crocoder.dev>
Register the model_id migration and extend DiffTraceInsert plus the diff_traces INSERT statement so AgentTraceDb writes nullable model identifiers with captured diff traces.

This is the DB-layer slice; hook payload parsing remains in the next task.

Plan: add-diff-traces-model-id

Task: T03

Co-authored-by: SCE <sce@crocoder.dev>
Parse the OpenCode-provided model_id from diff-trace payloads and pass it through to AgentTraceDb inserts so stored diff_traces retain model attribution.

Plan: add-diff-traces-model-id

Task: T04

Co-authored-by: SCE <sce@crocoder.dev>
…plan

- Mark T05 (Validation and cleanup) as done with evidence

- Add execution record: pkl-check-generated passed, nix flake check passed

- Append validation report confirming all 6 success criteria met

- Clean stale context/tmp/ artifacts (157 files removed)

- Confirm no new test files remain from this plan

Plan: add-diff-traces-model-id

Task: T05

Co-authored-by: SCE <sce@crocoder.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant