Skip to content

fix: OpenCode follow-up restore and duplicate user message echoes#45

Draft
cursor[bot] wants to merge 1 commit into
devfrom
cursor/critical-bug-investigation-a4c2
Draft

fix: OpenCode follow-up restore and duplicate user message echoes#45
cursor[bot] wants to merge 1 commit into
devfrom
cursor/critical-bug-investigation-a4c2

Conversation

@cursor

@cursor cursor Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

The recent follow-up message persistence fix (#44) saved user prompts as Claude-compatible JSONL. OpenCode sessions still lost follow-up messages after restart because process_line_opencode ignored all type: user lines. Claude sessions could show duplicate follow-up messages when the CLI echoed the same plain-text user line that Orbit had already injected.

Root cause

  • OpenCode’s native stream does not emit user events; Orbit injects prompts in Claude JSONL format, but the OpenCode processor explicitly no-op’d every user line.
  • reader_loop persisted and re-processed CLI echoes without checking whether the same plain-text user entry was already in the journal.

Fix

  • Restore Orbit-injected plain-text user lines on OpenCode replay (push_injected_user_line).
  • Skip duplicate plain-text user JSONL in reader_loop when the journal already has the same prompt (tool_result user lines are unchanged).

Validation

  • cargo test --lib (183 tests)
  • cargo clippy -- -D warnings
Open in Web View Automation 

Follow-up persistence wrote Claude-format user JSONL that OpenCode's
line processor ignored on DB replay, so prompts vanished after restart.
Skip echoing plain-text user lines in reader_loop when Orbit already
injected the same prompt (Claude stream-json).

Co-authored-by: José Fernando <xinnaider@users.noreply.github.com>
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