Skip to content

Conversation

@zxch3n
Copy link
Member

@zxch3n zxch3n commented Dec 5, 2025

Upgrade the protocol to v1

  • v1 appends an 8-byte Update Batch ID to every DocUpdate so peers can correlate acknowledgments.
  • v1 introduces Ack (0x08) to positively confirm or reject updates; v0 relied on UpdateError messages and had no explicit success signal.
  • v1 repurposes 0x06 from UpdateError to RoomError, which evicts the peer from the room until it rejoins.
  • v1 shifts update status codes: ok is now 0x00, unknown moves to 0x01, and the remaining codes keep their numeric values from v0.
  • v1 clarifies that a RoomError means the peer will stop receiving room traffic unless it performs a new join handshake.

Why these changes (v1)

  • Reliable delivery semantics: explicit Ack for each update batch (or fragment batch) lets applications know whether a change was accepted instead of inferring success from silence.
  • Clear eviction signal: RoomError distinguishes "your update failed" from "you are no longer in the room", enabling clients to stop syncing and prompt rejoin or escalation.
  • Better error mapping: moving ok to 0x00 and unknown to 0x01 aligns status bytes with common success/failure conventions and leaves room for app-specific errors.
  • Debuggability: 64-bit batch IDs make ACK correlation collision-resistant even on long-lived, multiplexed connections while adding negligible overhead versus the 256 KiB frame limit.

@zxch3n zxch3n marked this pull request as ready for review December 5, 2025 10:11
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zxch3n zxch3n changed the title feat: protocol v1 feat!: protocol v1 Dec 7, 2025
@zxch3n zxch3n merged commit 6570a2e into main Dec 7, 2025
2 checks passed
@zxch3n zxch3n deleted the feat-protocol-v1 branch December 7, 2025 13:27
@github-actions github-actions bot mentioned this pull request Dec 7, 2025
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.

2 participants