[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier capture

Open Beginner friendly
#8,354 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@jianyx1 is already working on this.

Since Nov 24, 2026.

  • #8355 by @jianyx1 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
backend

Research direction

Start in the OpenCode v2 plugin's context capture entry point, where the cursor map is persisted as the last message ID of the snapshot; that persisted cursor is what slices the second snapshot. Reproduce with two fixtures — a snapshot whose trailing assistant message is empty, then the same IDs with text, captured with a fresh in-memory cursor map — and check the events handed to the session manager. Done means the second capture emits the assistant message and its text without resending the user message, with the cursor kept at the newest event-producing message.

Written by the indexing model from the issue text.

Description

Issue Origin

Reproduced locally through the OpenCode v2 context capture entry point with fixture snapshots.

Bug Description

The OpenCode v2 capture cursor is persisted at the last message ID in the context snapshot, even if that message did not emit any capture events. When a trailing assistant message gains visible text under the same ID after the first snapshot, the later capture skips it.

Steps to Reproduce
  1. Capture an OpenCode v2 context snapshot with a user message followed by an assistant message whose content is still empty.
  2. Capture the snapshot again with the same message IDs and text in the assistant message. A second capture may use a fresh in-memory cursor map to exercise the persisted cursor.
  3. Check the events passed to the session manager.
Expected Behavior

The second capture emits the assistant message and its text, without resending the user message.

Actual Behavior

The second capture emits no events. The first capture saved the ID of the empty assistant message, so the second snapshot is sliced after that ID.

OpenViking Version

Current main at 39db38ac3c7f726f87b7f08e5488739ff6c24313, OpenCode plugin 0.5.30, macOS and Node 22.22.3.

Additional Context

Keep the cursor at the newest message that produced capture events. This retains progress for normal turns and lets an uncaptured trailing message be reconsidered. The local test uses the plugin's context capture path and does not require a model or a running OpenCode host. Codex assisted with the investigation and reproduction.

Dominant language
Python
Stars
42.6k
Forks
3.6k
Avg merge
15h 44m
Merged PRs (30d)
558

Getting set up

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.

More from volcengine/OpenViking

All issues in volcengine/OpenViking

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.