[PR #11869] fix: server-generated message IDs to prevent client/server clock skew #13961

Open
opened 2026-02-16 18:18:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11869

State: open
Merged: No


What does this PR do?

How did you verify your code works?

  • Local testing with separate backend (bun run serve) and app dev server (bun dev)
  • Artificially skewed the Web UI's timestamp generation to produce IDs that sort incorrectly relative to server IDs. Confirmed the optimistic message gets reconciled to the correct server ID without duplicates or misplacement
  • Delayed server response to observe the optimistic message persisting, then verified it swaps cleanly when the message.updated event arrives
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11869 **State:** open **Merged:** No --- ### What does this PR do? - fix #11863 - Server always generates the message ID, the client-provided `messageID` is stored as `clientMessageID` for correlation only - Web UI swaps the optimistic message, when the `message.updated` SSE event arrives with a `clientMessageID` that differs from id, the optimistic entry is updated in-place via reconcile and parts are migrated to the new ID ### How did you verify your code works? - Local testing with separate backend (bun run serve) and app dev server (bun dev) - Artificially skewed the Web UI's timestamp generation to produce IDs that sort incorrectly relative to server IDs. Confirmed the optimistic message gets reconciled to the correct server ID without duplicates or misplacement - Delayed server response to observe the optimistic message persisting, then verified it swaps cleanly when the `message.updated` event arrives
yindo added the pull-request label 2026-02-16 18:18:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13961