fix(sdk): stop handing out "asdasd" as a message id - #41058
Open
Mute-404 wants to merge 1 commit into
Open
Conversation
data.message.user() set the id to the literal "asdasd" on the message and on every part, so anything built with it collided immediately. Looks like leftover scaffolding that never got replaced. Generates msg_/prt_ ids in the same monotonic format the server uses so builder output still sorts next to server records. The generator is inlined because the SDK has no runtime dependency on the schema package and I didn't want to add one for this.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced Aug 7, 2026
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.
Issue for this PR
Closes #41051
Type of change
What does this PR do?
data.message.user()inpackages/sdk/js/src/v2/data.tsset the id to the literal string"asdasd"on the message and again on every part it built. So every message and every part produced by that builder came out with the same id.It's exported (
export * as data from "./data.js"insrc/v2/index.ts, and./v2is in the package exports), so this is public API.grep -rn "asdasd" packages/finds only those two lines and nothing that reads the value, so it looks like scaffolding that never got replaced rather than a sentinel anyone depends on.The fix generates
msg_/prt_ids in the same monotonic, time-ordered format the server uses, so builder output still sorts next to server records instead of clustering at one point in the ordering.I inlined the generator rather than importing it. The SDK's only runtime dependency is
cross-spawn, and pulling in@opencode-ai/schemafor one function felt like the wrong trade. If you'd rather share the implementation, say so and I'll rework it — it's the part of this PR I'm least sure about.How did you verify your code works?
Ran the generator 5000 times:
The counter resets per millisecond and increments within one, so ids stay ordered even when several are created in the same tick.
Screenshots / recordings
n/a.
Checklist