fix: restore OpenCode user messages after app restart#46
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Root cause
Commit
7cc5ce2added"user" => {}inprocess_line_opencodeto prevent duplicate first messages when OpenCode echoes user JSONL on stdout during live sessions. That blanket ignore also applied when replayingsession_outputsfrom 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
replay_opencode_user_line()to parse Orbit-persisted user JSONL (message.contentas string) during journal restoreprocess_util.rs(unusedcmdon non-Windows)Validation
cargo test --manifest-path tauri/Cargo.toml --lib— 183 passedcargo clippy --manifest-path tauri/Cargo.toml -- -D warnings— clean