Comfy-Org / Comfy-Org/ComfyUI_frontend

Follower bridge advances lastSeq before applyRemoteUpdate, so a failed apply diverges silently

Open
#16,869 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Prerequisites

- [x] I am running the latest version of ComfyUI
- [ ] I have custom nodes enabled

### What happened?

In the agent CRDT follower bridge, `onDocUpdate` advances `lastSeq` to the incoming frame's seq before `applyRemoteUpdate` runs, and the apply sits outside the `try` that only guards the schema assert (`src/workbench/extensions/agent/crdt/layoutFollowerBridge.ts:279` and `:281` on main). If `Y.applyUpdate` throws on frame N, the exception escapes the listener with `lastSeq` already at N: the doc never integrated N, the bridge believes it did, frame N+1 passes the gap check, no `doc_gap` fires and no resubscribe is armed. The follower diverges silently, which is exactly the recovery this code exists to provide.

### Steps to Reproduce

1. Subscribe a follower to a document and let it reach seq N-1.
2. Deliver a `doc_update` with seq N whose `update` bytes make `Y.applyUpdate` throw (a corrupt or foreign payload).
3. Deliver a valid `doc_update` with seq N+1.
4. Observe: no `doc_gap` event, no resubscribe, and the follower doc lacks frame N while `lastSequence` reports N+1.

### Workflow

N/A (protocol path, not a workflow)

### How is this affecting you?

Feature doesn't work as expected

### ComfyUI Frontend Version

1.54.1 (main)

### Browser

Chrome/Chromium

### Additional Context

Found while reviewing #16452 at 6b8d9d09f3; the lines are on main, not in that diff. Fix: advance `lastSeq` (and clear `catchUpPending`) only after the apply returns, or route an apply failure into the resubscribe path.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.