Skip to content

fix: restore OpenCode user messages after app restart#46

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

fix: restore OpenCode user messages after app restart#46
cursor[bot] wants to merge 1 commit into
devfrom
cursor/critical-bug-investigation-50da

Conversation

@cursor

@cursor cursor Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

OpenCode sessions lost all user messages (initial prompt and follow-ups) after restarting Orbit or reopening a session. Assistant replies and tool output were still restored from the database, but the chat feed showed only agent-side content — a significant data-loss regression for OpenCode users.

Trigger scenario:

  1. Create an OpenCode session and send one or more prompts
  2. Restart Orbit (or reload the session from DB)
  3. Open the session — user messages are missing from the chat

Root cause

Commit 7cc5ce2 added "user" => {} in process_line_opencode to prevent duplicate first messages when OpenCode echoes user JSONL on stdout during live sessions. That blanket ignore also applied when replaying session_outputs from SQLite on restore, where user lines are the only source of user history.

Claude/Codex sessions were unaffected because they use different line processors that still handle user JSONL.

Fix

  • Added replay_opencode_user_line() to parse Orbit-persisted user JSONL (message.content as string) during journal restore
  • Skip only immediate duplicates (last journal entry is the same user text) to suppress live OpenCode echoes without dropping distinct follow-ups
  • Added unit/integration tests for restore, echo dedup, and follow-up after assistant reply
  • Minor clippy fix in process_util.rs (unused cmd on non-Windows)

Validation

  • cargo test --manifest-path tauri/Cargo.toml --lib — 183 passed
  • cargo clippy --manifest-path tauri/Cargo.toml -- -D warnings — clean
Open in Web View Automation 

OpenCode journal replay ignored all user JSONL lines to suppress live
echoes, which also dropped persisted prompts and follow-ups on restore.
Replay Orbit-format user lines and skip only immediate duplicates.

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