{{ message }}
Repository navigation
fix(core): skip native compaction windows that no longer decode - #57280
Merged
Merged
Conversation
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.

Problem
When history loaded a provider compaction whose
native.messagesdidn't decode as@opencode/aimessages, the whole read failed withMessageDecodeError. That made the session unusable. Since #57241, a compaction hook'sresult.nativeis stored as-is, so one malformed plugin result could break a session for good.Change
A window that doesn't decode is now treated like another model's window: it's skipped, and history falls back to the messages before it.
decodeMessageRowno longer validates the window, so model-neutral readers such asstore.contextand the UI don't fail on it.replayable). Replay already decoded it, so the cost is the same as the validation it replaces.Verification
bun typecheckbun testv2.1)packages/core/test/session-native.test.ts"skips a malformed native window and replays the history before it" replaces the test that expectedMessageDecodeError. With a malformed window stored between two prompts:store.contextloads.