Skip to content

fix(sdk): stop handing out "asdasd" as a message id - #41058

Open
Mute-404 wants to merge 1 commit into
anomalyco:devfrom
Mute-404:sdk-builder-ids
Open

fix(sdk): stop handing out "asdasd" as a message id#41058
Mute-404 wants to merge 1 commit into
anomalyco:devfrom
Mute-404:sdk-builder-ids

Conversation

@Mute-404

@Mute-404 Mute-404 commented Aug 7, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #41051

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

data.message.user() in packages/sdk/js/src/v2/data.ts set 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" in src/v2/index.ts, and ./v2 is 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/schema for 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:

sample: msg_fdc1cbb3a001QMCBv23rr5vLdS   (30 chars, matching msg_ + 26)
unique: 5000 of 5000
sorting the ids lexicographically matches creation order: true
prt sample: prt_fdc1cbba0001HNWs63e1JAbUhm

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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

v2 SDK message builder assigns the placeholder id "asdasd"

1 participant