Skip to content

id collab: split oversized step batches instead of blocking sync at the 1 MiB frame cap #4324

Closed

Description

@dezren39

Follow-up to #1833 / PR #4052 (Codex P2 thread 4437715494).

Context

PR #4052 caps server WebSocket messages at MAX_FRAME_BYTES (1 MiB). The client-side guard added in that PR (pkgs/id/web/src/collab.ts send()) never sends an over-cap message: the socket survives and local edits are preserved, but an edit whose packed STEPS message exceeds 1 MiB (e.g. a single paste over 1 MiB) cannot sync — the connection reports the error status and the unconfirmed steps stay local until the user shrinks them (e.g. undo).

Ask

Split oversized sendable step batches in handleEditorChange / the send path so large pastes sync in multiple in-cap messages:

  • Chunk by packed size (measure with msgpackr as send() does today), each chunk within MAX_FRAME_BYTES with margin.
  • Preserve the prosemirror-collab authority protocol: chunk N+1 must be based on the version advanced by chunk N (use the ACK [3, version] / UPDATE flow — do not fire chunks concurrently against the same base version, and do not resend steps already in flight on a later editor:change).
  • A single step that alone exceeds the cap needs an explicit outcome (visible rejection that preserves local state is acceptable there).

Acceptance

  • A paste over 1 MiB syncs to a second client intact, in order, with no disconnect.
  • No message the client sends ever exceeds MAX_FRAME_BYTES.
  • Existing collab tests pass; new tests cover multi-chunk ordering and the single-oversized-step outcome.

Acceptance criteria

  • A paste over 1 MiB syncs to a second client intact, in order, with no disconnect.
  • No message the client sends ever exceeds MAX_FRAME_BYTES (1 MiB).
  • Chunking preserves the prosemirror-collab authority protocol: chunk N+1 is based on the version advanced by chunk N (ACK/UPDATE flow), chunks are not fired concurrently against the same base version, and steps already in flight are not resent on a later editor:change.
  • A single step that alone exceeds the cap gets an explicit, visible outcome that preserves local state.
  • Existing collab tests pass; new tests cover multi-chunk ordering and the single-oversized-step outcome.

Activity

  1. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Intake review

    Follow-up to #1833 / PR #4052 (Codex P2 thread 4437715494 on the merged frame-cap work). The issue body already carries a detailed Ask and Acceptance list; this section formalises it as acceptance criteria without changing the original text. Still live: PR #4052 capped the frame but deliberately did not chunk — the unsyncable-large-paste behaviour is the current shipped behaviour. Risks: the version-advance protocol is the subtle part — concurrent chunks against one base version would corrupt collab state, so the sequential ACK-driven design in the Ask is load-bearing. Suggested approach: chunk in the send path by packed msgpackr size with margin, driving chunk N+1 from the ACK of chunk N.

    — fleet monitor intake enrichment (protocol §5), 2026-11-02 run. Original body preserved verbatim above the appended acceptance-criteria section.

  2. added
    effort/mMedium: expected under 1 day of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 2, 2026
  3. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    and removed on Nov 3, 2026
  4. 47 remaining items

  5. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-z
    • Session / ID: task 12151
    • Found via: queue claim
    • Task: Triage of the remainder of issue id collab: split oversized step batches instead of blocking sync at the 1 MiB frame cap #4324 (id collab: split oversized step batches instead of blocking sync at the 1 MiB frame limit) — execution-lane assignment for task 12151 is opencode, so per §1b this lane does not work it directly; the laptop opencode claimant launches the bound session.
    • Expectation: claimant launches the bound opencode session for task 12151 and drives it to a terminal state.
    • Links: task 12151
  6. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 8, 2026
  7. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged (real-and-current remainder) then blocked — escalated to user

    • Agent: queue worker (repo-worker-code), OpenChamber scheduled lane 8ac61616-3815-4e7b-b33d-840a3829154a
    • Task / ID: queue task 12151 (re-triage of the remainder after the 2026-11-07 done-task-only audit)
    • Found via: queue claim
    • Verdict: REAL remainder, but it is exactly the delta of an open, Drew-authored PR that has been conflicting for five days. It cannot be landed or duplicated from the queue lane, so this needs your decision.

    What already landed (verified on current main cfd7efd596, 2026-11-08)

    • 72a3897018 ("never send over-cap collab messages", in main): stepBatch() chunks by step count and encoded size, and a first step that alone exceeds MAX_STEPS_MESSAGE_BYTES is withheld rather than sent.
    • a5a8efe190 (id(web/collab): chunk oversized single-step insertions at dispatch time so >1MiB pastes sync #4119, in main): splitOversizedTextInsertion() in pkgs/id/web/src/editor.ts bounds a single oversized text insertion at dispatch — editor.test.ts proves a 500k-char paste splits into in-budget steps in one undoable transaction, and collab.test.ts "sends and confirms all bounded steps from a single oversized paste" drives it over a live fake socket, asserting every message ≤ 1 MiB, all steps confirmed once and in order, getSendableSteps() === null at the end.
    • ACK ordering: handleEditorChange() re-runs getSendableSteps() after each UPDATE, so batch N+1 carries the version advanced by batch N and no concurrent flush against one base version. Present on main.

    So these acceptance bullets are satisfied on main: no sent message exceeds MAX_FRAME_BYTES; chunk N+1 follows chunk N's ACK; a >1 MiB paste syncs intact and in order without disconnect (single-oversized-text-insertion form).

    The one remaining bullet

    "A single step that alone exceeds the cap gets an explicit, visible outcome that preserves local state." On main the withheld path still only writes to the console:

    • pkgs/id/web/src/collab.ts:263-272 — console.error("[collab] Pending step exceeds the …") then return;, with no updateStatus("error"). The edit is kept locally, but the UI shows nothing while sync has silently stopped — reachable for a non-text single step (node/mark structural replace), which splitOversizedTextInsertion deliberately leaves alone (editor.ts:536-541 returns the transaction untouched unless it is a single closed all-text ReplaceStep).
    • pkgs/id/web/src/collab.test.ts has unit tests for stepBatch's withheld case (line 345) but no connection-level test that the withheld step produces no frame, keeps the edit, and reaches the status callback.

    Why this lane is not fixing it

    The remainder is precisely, and only, the delta of PR #5022 — "fix(id/web): surface withheld-step sync wedge and test multi-chunk ACK flush (#4324)", queue/8483-4324-collab-step-status, single commit 08215ac608, two files, +115/−3: it adds updateStatus("error") to the withheld path plus the two connection-level tests. The runbook forbids touching a Drew-owned PR and forbids opening a competing PR for work it already owns, and prior lanes parked this task on exactly that basis 2026-11-08 03:55 / 04:20 / 04:42 / 05:12 / 05:43 / 06:04.

    Current state of that PR (fresh gh, 2026-11-08T06:22Z): OPEN, not draft, no labels, no review decision, mergeable: CONFLICTING (verified by git merge-tree — a single content conflict in pkgs/id/web/src/collab.test.ts, because the file has since grown the #4119 block), last updated 2026-11-03T21:56Z, checks: basic: production line limit SUCCESS, CodeRabbit NEUTRAL. Its collab.ts hunk still applies to main cleanly.

    Decision needed (yours)

    1. Land it — rebase queue/8483-4324-collab-step-status onto main (resolve the one collab.test.ts conflict) and merge; this closes id collab: split oversized step batches instead of blocking sync at the 1 MiB frame cap #4324 and satisfies the last bullet. Queue workers must not do this to your PR.
    2. Hand it back — say the queue may supersede PR fix(id/web): surface withheld-step sync wedge and test multi-chunk ACK flush (#4324) #5022, and a worker will land the same two-file change (one updateStatus("error") line plus the two tests) on a fresh branch and close the PR.
    3. Close id collab: split oversized step batches instead of blocking sync at the 1 MiB frame cap #4324 as satisfied — only if you consider the console-only outcome acceptable under the bullet's "explicit, visible outcome" wording; the local-state preservation half is already true.

    No code was changed by this triage; no competing branch or PR was created. Task 12151 is blocked with reason class escalated-to-user and carries this read.

  8. added
    user/escalatedRequires a Drew decision or access
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  9. added a commit that references this issue on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientqueue/blockedQueue or user escalation statesource/creatorFiled by the new-issue-creator jobstatus/blockedQueue or user escalation statetask/triageQueue packet kind: verify, reproduce, and route this itemuser/escalatedRequires a Drew decision or access

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions