Open
Conversation
|
Checked and it works. |
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.
Title: Fix synthetic chat.message part IDs to use valid
prt_formatBody:
Summary
This fixes a compatibility issue with recent OpenCode versions where the plugin injects synthetic
chat.messageparts with IDs likesupermemory-nudge-*andsupermemory-context-*.OpenCode validates part IDs and expects them to start with
prt_. Because of that, any prompt could fail before sending with:ZodError: Invalid string: must start with "prt"What changed
generatePartId()fromsrc/services/compaction.tsgeneratePartId()for the synthetic nudge part insrc/index.tsgeneratePartId()for the synthetic context part insrc/index.tsWhy this approach
The plugin already has a canonical helper for generating valid part IDs. Reusing that helper keeps ID generation consistent across hook-injected and storage-injected parts, and avoids duplicating format knowledge in multiple places.
Verification
bun run typecheckbun run buildRepro
Before this patch, enabling
opencode-supermemorycould cause a prompt like"你好"to fail during message creation in OpenCode with a schema validation error onparts[].id.After this patch, the same prompt succeeds and the plugin continues to inject memory context normally.