Skip to content

feat(agent): resolve skipped duplicates on a covering projection (s3-opt-2) - #16671

Merged
christian-byrne merged 2 commits into
fix/s3opt6-dispatch-wiringfrom
fix/s3opt2-skipped-seq-gate
Sep 2, 2026
Merged

christian-byrne merged 2 commits into
fix/s3opt6-dispatch-wiringfrom
fix/s3opt2-skipped-seq-gate

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor
Full context for agent readers

What

The s3-opt-6 tracker (#16309) already handles applied (keep until effect), failed (revert), and unprocessed suffix (revert). The one outcome it could not finish was skipped: the host had already applied that op on a previous delivery, so no later doc_update will ever carry its op id and the shadow lingered until reset. This PR closes that gap.

Stack: cut from fix/s3opt6-dispatch-wiring (#16309, head d49dcaa1ba). Review only the top commit, 678fc7e177.

Policy

Situation Behavior
ack skipped:[id] with seq, and bridge.lastSequence >= seq clear shadow + take ledger entry immediately (authoritative state already on screen)
ack skipped:[id] with seq, projection behind park id keyed by seq; clear on the first applied doc_update whose seq >= ack.seq
ack skipped:[id] without seq park with null; cleared by the next applied doc_update
effect frame carrying the id arrives first onDocEffect still wins; the parked entry is dropped
doc_reset / unmount parked ids dropped (seqs belong to the dead lineage)
redelivered ack no double-resolve; ledger take is idempotent

Files

  • opSender.ts: OpsResultView.seq?: number (mirrors host DocOpsResultFrame.Seq in cloud/common/websocket/messages/crdt.go; FE docFrameClient.ts already parsed it).
  • pendingOpTracker.ts: currentSeq() dep, onAuthoritativeState(seq), awaitingSkipped map, drop()/clearSkipped() helpers; dev events skipped_awaiting / skipped_cleared.
  • useAgentCrdtFollower.ts: passes currentSeq: () => bridge.lastSequence, maps detail.seq into the ack view, calls onAuthoritativeState(update.seq) after each applied update.
  • Tests: pendingOpTracker.test.ts (describe('s3-opt-2: ...'), 6 tests + reworked skipped test), useAgentCrdtFollower.test.ts (1 follower-level test through the real frame dispatch path).

Re-expression of #16332

Source commit 9fdd7bb544 (opsResultReconciler.ts) implemented this as a separate pure reconciler over sentBatches(). #16309 later folded the reconciliation into PendingOpTracker, so the reconciler module would duplicate it; this PR instead adds only the missing skipped→covering-seq gate to the tracker. The policy table in #16332 is preserved verbatim for skipped; the other rows were already landed by #16309.

Diagram

doc_ops_result{skipped:[id], seq:S}
        │
        ▼
 currentSeq() >= S ? ──yes──▶ clear shadow + ledger.take(id)  → skipped_cleared
        │no
        ▼
 awaitingSkipped[id] = S      → skipped_awaiting
        │
        │  doc_update{seq:U} applied ──▶ onAuthoritativeState(U)
        │                                   U >= S ? clear : keep waiting
        │
        └─ doc_update{opIds:[id]} ──▶ onDocEffect(id) wins, drops parked entry

Evidence

  • Branch fix/s3opt2-skipped-seq-gate @ 678fc7e1770495d827d96a2a6e569049e3f3ef13, base fix/s3opt6-dispatch-wiring @ d49dcaa1bad961684cbaedf4f06035deccdad857
  • pnpm exec vitest run src/workbench/extensions/agent/crdt → 21 files, 252 passed (was 245 on base)
  • pnpm exec vue-tsc --noEmit → clean
  • oxfmt --check, oxlint, eslint on the 5 touched files → 0 warnings / 0 errors
  • knip --cache → no findings for touched modules; pre-commit lint-staged (oxfmt, oxlint type-aware, eslint, typecheck) passed
  • Source of policy: feat(agent): outcome-aware doc_ops_result reconciliation for the pending overlay #16332 head a49ac021f1, commit 9fdd7bb544

Glossary

  • s3-opt-2 / s3-opt-6: program work items for outcome reconciliation (skipped duplicates) and dispatch wiring of the pending ledger/shadow.
  • projection: an applied doc_update frame; its seq is the host's authoritative document sequence.
  • covering seq: a projected seq ≥ the seq reported on a doc_ops_result, meaning the projected state already includes that batch.
  • shadow: the local pending overlay drawn for an op that has been sent but not yet confirmed by an effect frame.
  • ledger: PendingOpLedger entries tracking sent op ids until resolved.

…opt-2)

When the host acks an op as `skipped` (already applied on a prior
delivery), no later `doc_update` will ever carry that op id, so the
pending shadow used to linger until reset. Re-expresses the outcome
reconciliation from #16332 onto the main-based s3-opt-6 tracker:

- `OpsResultView.seq` mirrors the host `doc_ops_result.seq`
  (`cloud/common/websocket/messages/crdt.go` `DocOpsResultFrame`).
- `PendingOpTracker` parks skipped ids keyed by the ack seq and clears
  them once `onAuthoritativeState(seq)` observes a projection at or past
  that seq; a seq-less ack clears on the next projection. If the
  effect frame does arrive first, `onDocEffect` still wins.
- `useAgentCrdtFollower` feeds `bridge.lastSequence` as `currentSeq` and
  calls `onAuthoritativeState(update.seq)` after each applied update.
- New dev-panel events `skipped_awaiting` / `skipped_cleared`.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright: ✅ 1894 passed, 0 failed · 2 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1873 / ❌ 0 / ⚠️ 2 / ⏭️ 4)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/02/2026, 05:18:00 PM UTC

Links

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance Report

canvas-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 54.7 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 65.2 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 70.9 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 71.7 MB heap
large-graph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.9 MB heap
large-graph-pan: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 86.3 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.3 MB heap
legacy-node-drag: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.9 MB heap
minimap-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.7 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.4 MB heap
subgraph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 62.1 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 58.1 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 134ms TBT · 82.8 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 78.8 MB heap
vue-large-graph-idle: · 56.2 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 169.1 MB heap
vue-large-graph-pan: · 56.2 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 83ms TBT · 161.5 MB heap
vue-node-resize-workload: · 56.3 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 520ms TBT · 163.8 MB heap
workflow-execution: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.2 MB heap

ℹ️ No baseline found — significance unavailable.

Absolute values
Metric Value
canvas-idle: avg frame time 17ms
canvas-idle: p95 frame time 17ms
canvas-idle: layout duration 0ms
canvas-idle: style recalc duration 8ms
canvas-idle: layout count 0
canvas-idle: style recalc count 8
canvas-idle: task duration 522ms
canvas-idle: script duration 9ms
canvas-idle: TBT 0ms
canvas-idle: heap used 54.7 MB
canvas-idle: DOM nodes -281
canvas-idle: event listeners -156
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 4ms
canvas-mouse-sweep: style recalc duration 41ms
canvas-mouse-sweep: layout count 14
canvas-mouse-sweep: style recalc count 79
canvas-mouse-sweep: task duration 896ms
canvas-mouse-sweep: script duration 161ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 65.2 MB
canvas-mouse-sweep: DOM nodes -282
canvas-mouse-sweep: event listeners -171
canvas-zoom-sweep: avg frame time 17ms
canvas-zoom-sweep: p95 frame time 17ms
canvas-zoom-sweep: layout duration 1ms
canvas-zoom-sweep: style recalc duration 18ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 31
canvas-zoom-sweep: task duration 366ms
canvas-zoom-sweep: script duration 11ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 70.9 MB
canvas-zoom-sweep: DOM nodes 78
canvas-zoom-sweep: event listeners 19
dom-widget-clipping: avg frame time 17ms
dom-widget-clipping: p95 frame time 17ms
dom-widget-clipping: layout duration 0ms
dom-widget-clipping: style recalc duration 8ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 11
dom-widget-clipping: task duration 467ms
dom-widget-clipping: script duration 166ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 71.7 MB
dom-widget-clipping: DOM nodes 18
dom-widget-clipping: event listeners 1
large-graph-idle: avg frame time 17ms
large-graph-idle: p95 frame time 17ms
large-graph-idle: layout duration 0ms
large-graph-idle: style recalc duration 3ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 4
large-graph-idle: task duration 580ms
large-graph-idle: script duration 34ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 82.9 MB
large-graph-idle: DOM nodes -272
large-graph-idle: event listeners -74
large-graph-pan: avg frame time 17ms
large-graph-pan: p95 frame time 17ms
large-graph-pan: layout duration 0ms
large-graph-pan: style recalc duration 11ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 65
large-graph-pan: task duration 1615ms
large-graph-pan: script duration 814ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 86.3 MB
large-graph-pan: DOM nodes -133
large-graph-pan: event listeners -74
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 12ms
large-graph-zoom: style recalc duration 11ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 61
large-graph-zoom: task duration 1713ms
large-graph-zoom: script duration 786ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 74.3 MB
large-graph-zoom: DOM nodes -140
large-graph-zoom: event listeners 9
legacy-node-drag: avg frame time 17ms
legacy-node-drag: p95 frame time 17ms
legacy-node-drag: layout duration 0ms
legacy-node-drag: style recalc duration 5ms
legacy-node-drag: layout count 0
legacy-node-drag: style recalc count 40
legacy-node-drag: task duration 1933ms
legacy-node-drag: script duration 964ms
legacy-node-drag: TBT 0ms
legacy-node-drag: heap used 82.9 MB
legacy-node-drag: DOM nodes 0
legacy-node-drag: event listeners 188
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 3ms
minimap-idle: layout count 0
minimap-idle: style recalc count 3
minimap-idle: task duration 568ms
minimap-idle: script duration 34ms
minimap-idle: TBT 0ms
minimap-idle: heap used 83.7 MB
minimap-idle: DOM nodes -133
minimap-idle: event listeners -75
subgraph-dom-widget-clipping: avg frame time 17ms
subgraph-dom-widget-clipping: p95 frame time 17ms
subgraph-dom-widget-clipping: layout duration 0ms
subgraph-dom-widget-clipping: style recalc duration 10ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 46
subgraph-dom-widget-clipping: task duration 415ms
subgraph-dom-widget-clipping: script duration 145ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 83.4 MB
subgraph-dom-widget-clipping: DOM nodes 18
subgraph-dom-widget-clipping: event listeners 7
subgraph-idle: avg frame time 17ms
subgraph-idle: p95 frame time 17ms
subgraph-idle: layout duration 0ms
subgraph-idle: style recalc duration 8ms
subgraph-idle: layout count 0
subgraph-idle: style recalc count 9
subgraph-idle: task duration 499ms
subgraph-idle: script duration 8ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 62.1 MB
subgraph-idle: DOM nodes -298
subgraph-idle: event listeners -200
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 6ms
subgraph-mouse-sweep: style recalc duration 39ms
subgraph-mouse-sweep: layout count 18
subgraph-mouse-sweep: style recalc count 77
subgraph-mouse-sweep: task duration 847ms
subgraph-mouse-sweep: script duration 113ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 58.1 MB
subgraph-mouse-sweep: DOM nodes -297
subgraph-mouse-sweep: event listeners -201
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 15ms
subgraph-transition-enter: style recalc duration 32ms
subgraph-transition-enter: layout count 16
subgraph-transition-enter: style recalc count 20
subgraph-transition-enter: task duration 907ms
subgraph-transition-enter: script duration 30ms
subgraph-transition-enter: TBT 134ms
subgraph-transition-enter: heap used 82.8 MB
subgraph-transition-enter: DOM nodes 13751
subgraph-transition-enter: event listeners 2381
viewport-pan-sweep: avg frame time 17ms
viewport-pan-sweep: p95 frame time 17ms
viewport-pan-sweep: layout duration 0ms
viewport-pan-sweep: style recalc duration 39ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 248
viewport-pan-sweep: task duration 5908ms
viewport-pan-sweep: script duration 2731ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 78.8 MB
viewport-pan-sweep: DOM nodes -269
viewport-pan-sweep: event listeners -153
vue-large-graph-idle: avg frame time 18ms
vue-large-graph-idle: p95 frame time 17ms
vue-large-graph-idle: layout duration 0ms
vue-large-graph-idle: style recalc duration 0ms
vue-large-graph-idle: layout count 0
vue-large-graph-idle: style recalc count 0
vue-large-graph-idle: task duration 16760ms
vue-large-graph-idle: script duration 293ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 169.1 MB
vue-large-graph-idle: DOM nodes -6548
vue-large-graph-idle: event listeners -7474
vue-large-graph-pan: avg frame time 18ms
vue-large-graph-pan: p95 frame time 17ms
vue-large-graph-pan: layout duration 0ms
vue-large-graph-pan: style recalc duration 18ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 170
vue-large-graph-pan: task duration 21040ms
vue-large-graph-pan: script duration 975ms
vue-large-graph-pan: TBT 83ms
vue-large-graph-pan: heap used 161.5 MB
vue-large-graph-pan: DOM nodes -6548
vue-large-graph-pan: event listeners -7470
vue-node-resize-workload: avg frame time 18ms
vue-node-resize-workload: p95 frame time 17ms
vue-node-resize-workload: layout duration 27ms
vue-node-resize-workload: style recalc duration 84ms
vue-node-resize-workload: layout count 20
vue-node-resize-workload: style recalc count 20
vue-node-resize-workload: task duration 6200ms
vue-node-resize-workload: script duration 112ms
vue-node-resize-workload: TBT 520ms
vue-node-resize-workload: heap used 163.8 MB
vue-node-resize-workload: DOM nodes -6548
vue-node-resize-workload: event listeners -7469
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 1ms
workflow-execution: style recalc duration 17ms
workflow-execution: layout count 3
workflow-execution: style recalc count 10
workflow-execution: task duration 89ms
workflow-execution: script duration 7ms
workflow-execution: TBT 0ms
workflow-execution: heap used 69.2 MB
workflow-execution: DOM nodes 116
workflow-execution: event listeners 74
Raw data
{
  "timestamp": "2026-09-02T17:30:09.113Z",
  "gitSha": "12c76931d6eb6c0899e56adb9aa3435c4ca2cf92",
  "branch": "fix/s3opt2-skipped-seq-gate",
  "measurements": [
    {
      "name": "canvas-idle",
      "durationMs": 2069.6660000000406,
      "styleRecalcs": 7,
      "styleRecalcDurationMs": 7.078999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 554.08,
      "heapDeltaBytes": -12137452,
      "heapUsedBytes": 57194664,
      "domNodes": -280,
      "jsHeapTotalBytes": 4972544,
      "scriptDurationMs": 8.937999999999999,
      "eventListeners": -157,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66999999999998,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-idle",
      "durationMs": 2020.3890000000229,
      "styleRecalcs": 9,
      "styleRecalcDurationMs": 8.76,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 490.51,
      "heapDeltaBytes": -12158016,
      "heapUsedBytes": 57617800,
      "domNodes": -281,
      "jsHeapTotalBytes": 5234688,
      "scriptDurationMs": 8.629000000000001,
      "eventListeners": -155,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1909.4330000000355,
      "styleRecalcs": 81,
      "styleRecalcDurationMs": 41.71900000000001,
      "layouts": 14,
      "layoutDurationMs": 4.33,
      "taskDurationMs": 902.8669999999998,
      "heapDeltaBytes": -8885444,
      "heapUsedBytes": 61701200,
      "domNodes": -283,
      "jsHeapTotalBytes": 5758976,
      "scriptDurationMs": 160.08,
      "eventListeners": -155,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1876.229999999964,
      "styleRecalcs": 76,
      "styleRecalcDurationMs": 39.588,
      "layouts": 14,
      "layoutDurationMs": 4.484999999999999,
      "taskDurationMs": 889.6659999999998,
      "heapDeltaBytes": 4385780,
      "heapUsedBytes": 75037968,
      "domNodes": -281,
      "jsHeapTotalBytes": 6545408,
      "scriptDurationMs": 162.678,
      "eventListeners": -187,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1737.7329999999915,
      "styleRecalcs": 32,
      "styleRecalcDurationMs": 17.666,
      "layouts": 6,
      "layoutDurationMs": 1.0790000000000002,
      "taskDurationMs": 377.02900000000005,
      "heapDeltaBytes": 4456308,
      "heapUsedBytes": 74646360,
      "domNodes": 78,
      "jsHeapTotalBytes": 5767168,
      "scriptDurationMs": 11.261000000000001,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1690.1790000000574,
      "styleRecalcs": 30,
      "styleRecalcDurationMs": 17.559,
      "layouts": 6,
      "layoutDurationMs": 1.171,
      "taskDurationMs": 354.649,
      "heapDeltaBytes": 4448628,
      "heapUsedBytes": 73975436,
      "domNodes": 77,
      "jsHeapTotalBytes": 5242880,
      "scriptDurationMs": 10.872,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 689.0720000000101,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 7.3629999999999995,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 471.895,
      "heapDeltaBytes": -7789768,
      "heapUsedBytes": 62899764,
      "domNodes": 18,
      "jsHeapTotalBytes": 5767168,
      "scriptDurationMs": 167.039,
      "eventListeners": 0,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 658.6490000000822,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 8.095,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 461.14200000000005,
      "heapDeltaBytes": 17792424,
      "heapUsedBytes": 87482608,
      "domNodes": 18,
      "jsHeapTotalBytes": 5242880,
      "scriptDurationMs": 165.09500000000003,
      "eventListeners": 2,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2011.5129999999795,
      "styleRecalcs": 1,
      "styleRecalcDurationMs": 0.6470000000000018,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 560.6729999999999,
      "heapDeltaBytes": 22108268,
      "heapUsedBytes": 87192224,
      "domNodes": -278,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 32.913,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66999999999998,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2044.8559999999816,
      "styleRecalcs": 6,
      "styleRecalcDurationMs": 5.786,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 599.0219999999999,
      "heapDeltaBytes": -13412696,
      "heapUsedBytes": 86627100,
      "domNodes": -266,
      "jsHeapTotalBytes": -1097728,
      "scriptDurationMs": 34.778000000000006,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2265.291999999988,
      "styleRecalcs": 63,
      "styleRecalcDurationMs": 8.828,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1591.1359999999997,
      "heapDeltaBytes": 22131516,
      "heapUsedBytes": 88088756,
      "domNodes": 2,
      "jsHeapTotalBytes": 225280,
      "scriptDurationMs": 801.726,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2246.007000000077,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 13.371,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1639.602,
      "heapDeltaBytes": 27601532,
      "heapUsedBytes": 92848076,
      "domNodes": -268,
      "jsHeapTotalBytes": 225280,
      "scriptDurationMs": 825.8570000000001,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3629.6649999999886,
      "styleRecalcs": 61,
      "styleRecalcDurationMs": 11.395,
      "layouts": 60,
      "layoutDurationMs": 12.868,
      "taskDurationMs": 1742.0610000000001,
      "heapDeltaBytes": 9901928,
      "heapUsedBytes": 76226228,
      "domNodes": -279,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 792.944,
      "eventListeners": 10,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3621.9650000000456,
      "styleRecalcs": 60,
      "styleRecalcDurationMs": 9.870000000000001,
      "layouts": 60,
      "layoutDurationMs": 11.938999999999998,
      "taskDurationMs": 1684.768,
      "heapDeltaBytes": 12030420,
      "heapUsedBytes": 79531500,
      "domNodes": 0,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 779.4859999999999,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 3201.9449999999665,
      "styleRecalcs": 40,
      "styleRecalcDurationMs": 5.229000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1967.746,
      "heapDeltaBytes": 22246660,
      "heapUsedBytes": 89617988,
      "domNodes": 0,
      "jsHeapTotalBytes": 417792,
      "scriptDurationMs": 983.1880000000001,
      "eventListeners": 188,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666696,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 3044.956999999954,
      "styleRecalcs": 40,
      "styleRecalcDurationMs": 4.864,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1898.12,
      "heapDeltaBytes": 17329588,
      "heapUsedBytes": 84314412,
      "domNodes": 0,
      "jsHeapTotalBytes": 417792,
      "scriptDurationMs": 945.281,
      "eventListeners": 188,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2034.0750000000298,
      "styleRecalcs": 4,
      "styleRecalcDurationMs": 3.602000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 607.2859999999998,
      "heapDeltaBytes": -15328272,
      "heapUsedBytes": 87463996,
      "domNodes": -270,
      "jsHeapTotalBytes": -1884160,
      "scriptDurationMs": 34.84100000000001,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "minimap-idle",
      "durationMs": 2001.6150000000152,
      "styleRecalcs": 2,
      "styleRecalcDurationMs": 1.8260000000000012,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 529.385,
      "heapDeltaBytes": 22098056,
      "heapUsedBytes": 88155728,
      "domNodes": 4,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 33.06500000000001,
      "eventListeners": 4,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 588.8820000000123,
      "styleRecalcs": 46,
      "styleRecalcDurationMs": 9.672,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 408.6820000000001,
      "heapDeltaBytes": 15130536,
      "heapUsedBytes": 87844048,
      "domNodes": 18,
      "jsHeapTotalBytes": 4718592,
      "scriptDurationMs": 140.69500000000002,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 622.9849999999715,
      "styleRecalcs": 46,
      "styleRecalcDurationMs": 10.661,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 422.0900000000001,
      "heapDeltaBytes": 15027040,
      "heapUsedBytes": 86975100,
      "domNodes": 18,
      "jsHeapTotalBytes": 6029312,
      "scriptDurationMs": 150.024,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2013.530000000003,
      "styleRecalcs": 9,
      "styleRecalcDurationMs": 7.837999999999997,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 510.4869999999999,
      "heapDeltaBytes": -8188380,
      "heapUsedBytes": 64573124,
      "domNodes": -297,
      "jsHeapTotalBytes": 6283264,
      "scriptDurationMs": 7.8210000000000015,
      "eventListeners": -201,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2016.2709999999606,
      "styleRecalcs": 9,
      "styleRecalcDurationMs": 8.4,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 487.567,
      "heapDeltaBytes": -7072860,
      "heapUsedBytes": 65582052,
      "domNodes": -298,
      "jsHeapTotalBytes": 4710400,
      "scriptDurationMs": 8.309000000000001,
      "eventListeners": -199,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1724.5770000000107,
      "styleRecalcs": 77,
      "styleRecalcDurationMs": 41.608,
      "layouts": 18,
      "layoutDurationMs": 6.236999999999999,
      "taskDurationMs": 873.168,
      "heapDeltaBytes": -12598148,
      "heapUsedBytes": 60179436,
      "domNodes": -297,
      "jsHeapTotalBytes": 6021120,
      "scriptDurationMs": 116.312,
      "eventListeners": -201,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1695.8680000000186,
      "styleRecalcs": 77,
      "styleRecalcDurationMs": 35.939,
      "layouts": 18,
      "layoutDurationMs": 4.993,
      "taskDurationMs": 820.034,
      "heapDeltaBytes": -10633988,
      "heapUsedBytes": 61747536,
      "domNodes": -297,
      "jsHeapTotalBytes": 4972544,
      "scriptDurationMs": 108.711,
      "eventListeners": -201,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-transition-enter",
      "durationMs": 1400.5730000000085,
      "styleRecalcs": 20,
      "styleRecalcDurationMs": 31.531999999999996,
      "layouts": 16,
      "layoutDurationMs": 15.445,
      "taskDurationMs": 907.2860000000003,
      "heapDeltaBytes": -5444368,
      "heapUsedBytes": 86865348,
      "domNodes": 13751,
      "jsHeapTotalBytes": 10747904,
      "scriptDurationMs": 30.485,
      "eventListeners": 2381,
      "totalBlockingTimeMs": 134,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8390.705000000025,
      "styleRecalcs": 247,
      "styleRecalcDurationMs": 37.782999999999994,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 5887.544,
      "heapDeltaBytes": 8874276,
      "heapUsedBytes": 84408056,
      "domNodes": -270,
      "jsHeapTotalBytes": -647168,
      "scriptDurationMs": 2727.7239999999997,
      "eventListeners": -169,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8541.478999999981,
      "styleRecalcs": 248,
      "styleRecalcDurationMs": 40.06399999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 5927.78,
      "heapDeltaBytes": -19636712,
      "heapUsedBytes": 80803492,
      "domNodes": -267,
      "jsHeapTotalBytes": -872448,
      "scriptDurationMs": 2734.788,
      "eventListeners": -137,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 17604.529000000013,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 16920.109999999997,
      "heapDeltaBytes": -38519288,
      "heapUsedBytes": 174808076,
      "domNodes": -6548,
      "jsHeapTotalBytes": -9629696,
      "scriptDurationMs": 306.09799999999996,
      "eventListeners": -7475,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.779999999999927,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 17086.13600000001,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 16600.101000000002,
      "heapDeltaBytes": -30438692,
      "heapUsedBytes": 179754244,
      "domNodes": -6548,
      "jsHeapTotalBytes": 7385088,
      "scriptDurationMs": 280.15000000000003,
      "eventListeners": -7473,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.776666666666763,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 21196.438000000002,
      "styleRecalcs": 171,
      "styleRecalcDurationMs": 17.900000000000027,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 20771.891,
      "heapDeltaBytes": -32433384,
      "heapUsedBytes": 176290096,
      "domNodes": -6548,
      "jsHeapTotalBytes": -5378048,
      "scriptDurationMs": 961.127,
      "eventListeners": -7471,
      "totalBlockingTimeMs": 117,
      "frameDurationMs": 17.779999999999927,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 21651.429000000007,
      "styleRecalcs": 169,
      "styleRecalcDurationMs": 18.513999999999974,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 21307.734,
      "heapDeltaBytes": -47007236,
      "heapUsedBytes": 162485368,
      "domNodes": -6548,
      "jsHeapTotalBytes": -5099520,
      "scriptDurationMs": 989.208,
      "eventListeners": -7469,
      "totalBlockingTimeMs": 49,
      "frameDurationMs": 17.776666666666642,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-node-resize-workload",
      "durationMs": 6304.7579999999925,
      "styleRecalcs": 20,
      "styleRecalcDurationMs": 86.81,
      "layouts": 20,
      "layoutDurationMs": 32.00699999999999,
      "taskDurationMs": 6201.244000000001,
      "heapDeltaBytes": -34654552,
      "heapUsedBytes": 168181156,
      "domNodes": -6548,
      "jsHeapTotalBytes": 9342976,
      "scriptDurationMs": 108.293,
      "eventListeners": -7469,
      "totalBlockingTimeMs": 615,
      "frameDurationMs": 17.776666666666642,
      "p95FrameDurationMs": 16.80000000000109
    },
    {
      "name": "vue-node-resize-workload",
      "durationMs": 6341.497000000004,
      "styleRecalcs": 20,
      "styleRecalcDurationMs": 81.26699999999998,
      "layouts": 20,
      "layoutDurationMs": 22.757999999999985,
      "taskDurationMs": 6198.578,
      "heapDeltaBytes": -33425540,
      "heapUsedBytes": 175363004,
      "domNodes": -6548,
      "jsHeapTotalBytes": 6799360,
      "scriptDurationMs": 114.923,
      "eventListeners": -7468,
      "totalBlockingTimeMs": 425,
      "frameDurationMs": 17.776666666666703,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "workflow-execution",
      "durationMs": 101.84100000003582,
      "styleRecalcs": 7,
      "styleRecalcDurationMs": 15.559,
      "layouts": 2,
      "layoutDurationMs": 1.4110000000000003,
      "taskDurationMs": 71.173,
      "heapDeltaBytes": 3163692,
      "heapUsedBytes": 71822476,
      "domNodes": 108,
      "jsHeapTotalBytes": 262144,
      "scriptDurationMs": 4.934000000000001,
      "eventListeners": 49,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66999999999998,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "workflow-execution",
      "durationMs": 458.00499999995736,
      "styleRecalcs": 12,
      "styleRecalcDurationMs": 19.139999999999997,
      "layouts": 3,
      "layoutDurationMs": 0.9719999999999998,
      "taskDurationMs": 107.12600000000002,
      "heapDeltaBytes": 5045928,
      "heapUsedBytes": 73267200,
      "domNodes": 123,
      "jsHeapTotalBytes": 262144,
      "scriptDurationMs": 8.334999999999999,
      "eventListeners": 99,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    }
  ]
}

🔬 E2E Coverage

Metric Covered Total Pct
Lines 48006 70665 67.9% 🟡
Functions 0 0 — —
Branches 0 0 — —
Top 10 files by uncovered lines
File Coverage Missed
src/LGraphCanvas.ts 67.1% 1188
src/LGraphNode.ts 69.4% 397
src/extensions/core/cameraInfo/CameraInfoViewport.ts 2.0% 343
src/platform/workspace/stores/billingOperationStore.ts 8.3% 300
src/platform/workspace/stores/workspaceAuthStore.ts 36.0% 288
src/platform/workspace/stores/teamWorkspaceStore.ts 37.7% 261
src/LGraph.ts 78.4% 258
src/scripts/app.ts 71.6% 250
src/scripts/pnginfo.ts 21.4% 221
src/renderer/core/canvas/pathRenderer.ts 24.7% 192

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed at 678fc7e against base fix/s3opt6-dispatch-wiring. Ran the crdt vitest dir locally (252/252 green) and read the bridge, ledger, docwire and relay sides to check the seq premise.

One correctness finding: the immediate-clear branch reads bridge.lastSequence, which falls back to the subscribe ack seq before any update has been applied, so in the reconnect window a skipped result clears the shadow before the catch-up frame has been projected. Details and a proposed fix inline. Two smaller notes on the doc comments.

Full context for agent readers

PR adds seq to OpsResultView, a currentSeq dep on the pending-op tracker, an awaitingSkipped map, and onAuthoritativeState(seq) called from the follower's doc_update handler after adapter.applyFrame. The stated invariant is that a skipped entry is never cleared on the ack itself; it clears only when the follower has projected doc state at or beyond the ack seq.

Checked: DocOpsResultFrame.Seq in cloud/common/websocket/messages/crdt.go is int64 with omitempty and docwire.go returns ApplyOutcome.Seq as the row seq after the batch (row.Seq on the NoOp all-duplicate path, the Advance result otherwise), so the seq semantics the PR relies on hold. The ledger keeps skipped entries in state skipped and take() removes them, so clearSkipped composes with the existing per-attempt gate. reset() paths (doc_reset, follower_replaced, unmount) clear awaitingSkipped. DocUpdate.seq is typed number, so the null branch of onAuthoritativeState is unreachable from the follower today.

The finding: LayoutFollowerBridge.lastSequence is this.lastSeq ?? this.ackSeq ?? 0, and reconcile() resets lastSeq and ackSeq to null on every successful subscribe send. The bridge's own doc comment on ackSeq says it is not an applied baseline because the catch-up doc_update(seq=N) may still be in flight (the relay joins fanout before acking). So after a reconnect resubscribe, once doc_subscribed{seq:N} lands and before doc_update{seq:N} is applied, currentSeq() returns N and a doc_ops_result{skipped:[id], seq:S<=N} takes the immediate-clear branch. That is a clear on the ack, and the canvas at that moment still shows the pre-op state the follower had before the reconnect (which is exactly why the op is a resend and comes back skipped). The pending styling disappears, the old value shows, then the catch-up lands and the effect appears. The follower test cannot see this because FakeBridge pins lastSequence = 41.

@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
@codecov

codecov Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                      Coverage Diff                       @@
##           fix/s3opt6-dispatch-wiring   #16671      +/-   ##
==============================================================
- Coverage                       82.37%   82.34%   -0.04%     
==============================================================
  Files                            2032     2026       -6     
  Lines                          117341   117117     -224     
  Branches                        31485    31500      +15     
==============================================================
- Hits                            96663    96435     -228     
- Misses                          20500    20505       +5     
+ Partials                          178      177       -1     
Flag Coverage Δ
e2e 67.93% <ø> (-0.07%) ⬇️
unit 76.66% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ench/extensions/agent/crdt/layoutFollowerBridge.ts 97.54% <100.00%> (+0.04%) ⬆️
src/workbench/extensions/agent/crdt/opSender.ts 100.00% <ø> (ø)
...orkbench/extensions/agent/crdt/pendingOpTracker.ts 100.00% <100.00%> (ø)
...ench/extensions/agent/crdt/useAgentCrdtFollower.ts 96.70% <100.00%> (+0.03%) ⬆️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… the ack

`currentSeq` fed the pending-op tracker `bridge.lastSequence`, which falls
back to the subscribe ack seq. Between `doc_subscribed{seq:N}` and the
catch-up `doc_update{seq:N}` nothing has landed in the doc, so a
`doc_ops_result{skipped, seq<=N}` cleared the optimistic shadow while the
canvas still showed pre-op state. Expose `lastAppliedSequence` (null until a
frame is applied, reset on every subscribe send) and gate on that; the
outbound `baseVersion` keeps using the ack-aware `lastSequence`.

Also reword the tracker doc: `skipped` covers both host-deduped and
LWW-dropped ops (docwire appends applier `Skipped`), and note the
`onAuthoritativeState` null branch is unreachable from DocUpdate frames.
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Review fixes pushed in 053cba6. Skipped-duplicate resolution now gates on the applied seq, not the subscribe ack. Three new tests, 255/255 green locally.

Full context for agent readers

Review: #16671 (review) (three threads, all replied to and resolved by the reviewer).

Commit 053cba6 on fix/s3opt2-skipped-seq-gate:

  • layoutFollowerBridge.ts: new lastAppliedSequence getter returning lastSeq only (null until a doc_update is applied; reset together with ackSeq on every subscribe send in reconcile()). lastSequence is unchanged and still falls back to the ack.
  • useAgentCrdtFollower.ts: currentSeq: () => bridge.lastAppliedSequence ?? 0. Between doc_subscribed{seq:N} and the catch-up doc_update{seq:N} the tracker now sees 0 and parks a doc_ops_result{skipped, seq<=N} until the frame lands, instead of clearing the shadow while the canvas still shows pre-op state. baseVersion keeps using lastSequence so outbound ops carry the ack seq.
  • pendingOpTracker.ts: header reworded (skipped = host-deduped or LWW-dropped; docwire appends the applier's Skipped), onAuthoritativeState doc notes the null branch is unreachable from DocUpdate frames.
  • Tests: followerSubscription.test.ts real-bridge test (ack seq 7 gives lastSequence 7, lastAppliedSequence null; applied frame 7 sets it; resubscribe nulls it again). useAgentCrdtFollower.test.ts FakeBridge gains lastAppliedSequence = null; two tests: skipped at seq 41 (== ack) stays pending until doc_update 41, and skipped at 43 clears immediately when lastAppliedSequence is already 43. Mutation check: reverting the currentSeq line fails both follower tests.

Verification: pnpm exec vitest run src/workbench/extensions/agent/crdt 21 files / 255 tests green; oxfmt, oxlint, eslint clean on touched files; vue-tsc --noEmit exit 0.

Trade-off accepted: an already-current follower (ack, no catch-up) parks a skipped entry until the next applied frame. A pending skipped entry means the op's effect frame never arrived, so the shadow staying up until real state lands is the safe side.

@DrJKL DrJKL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the top diff against fix/s3opt6-dispatch-wiring. The applied-only sequence fix is sound: subscription acknowledgements cannot clear skipped shadows before projection, while an already-applied covering sequence clears immediately. The tests cover the acknowledgement window, covering and non-covering updates, all-skipped batches, absent sequences, effect-first handling, redelivery, reset, and LWW-skipped semantics. CRDT tests passed 255/255, with typecheck, scoped ESLint/format, and Knip clean. No new blocker in this top diff. The base has advanced with the workflow-switch reset fix, so this branch should rebase onto it; the graph-scope identity blocker from #16302 remains inherited and must be resolved before the full stack merges.

@christian-byrne
christian-byrne merged commit e5e3cea into fix/s3opt6-dispatch-wiring Sep 2, 2026
88 checks passed
@christian-byrne
christian-byrne deleted the fix/s3opt2-skipped-seq-gate branch September 2, 2026 18:45

@CodeJuggernaut CodeJuggernaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The covering-projection resolution reads correctly end to end; no issues.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Inherited blocker queued.

Full context for agent readers

The approval says the graph-scope identity blocker from #16302 remains inherited and must be resolved before the full stack merges. No open or merged follow-up PR back-references #16671.

Queued as act-fe-16671-followup in the in-app-agent program. A follow-up PR should back-reference #16671.

christian-byrne added a commit that referenced this pull request Sep 2, 2026
Shadow identity omitted graph scope, but node/link ids are graph-local
and widget identity is graphId:nodeId:name (FE-1904 convention). Two
subgraphs minting the same local node/link/widget id therefore shared
one shadow key and refcount, so clearing/reverting an op in one
subgraph could silently unstyle a different subgraph's pending entity
with the same local id.

ShadowTarget now carries graphId on every kind; targetKey/cloneTarget
scope the key by graphId first. Adds 3 tests for cross-graph-scope
collisions on node/widget targets and pendingTargets() dedup.

Fixes the graph-scope identity blocker DrJKL flagged on #16302 review
comment #16302 (comment)
and reiterated as an inherited blocker on #16671's approval:
#16671 (review)

Evidence:
- pnpm exec vitest run src/workbench/extensions/agent/crdt/pendingOpShadow.test.ts -> 21/21 (was 18)
- pnpm exec vitest run src/workbench/extensions/agent/crdt -> 207/207
- pnpm exec vue-tsc --noEmit -> clean
- pnpm exec oxlint / eslint on touched files -> clean
- pnpm exec oxfmt --check -> clean
- pnpm exec knip --cache -> no findings for touched modules

<!-- authored-by:agent lane-act-fe-16671-followup -->
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Follow-up for the inherited blocker from @DrJKL's approval note ("the graph-scope identity blocker from #16302 remains inherited and must be resolved before the full stack merges"): fixed directly on #16302 at 2dc4312313 (ShadowTarget now carries graphId, targetKey/cloneTarget scope on it). Thread resolved there with evidence; this PR (#16671) itself needed no changes since the blocker lives in the shadow-key module, not this diff.

christian-byrne added a commit that referenced this pull request Sep 3, 2026
Shadow identity omitted graph scope, but node/link ids are graph-local
and widget identity is graphId:nodeId:name (FE-1904 convention). Two
subgraphs minting the same local node/link/widget id therefore shared
one shadow key and refcount, so clearing/reverting an op in one
subgraph could silently unstyle a different subgraph's pending entity
with the same local id.

ShadowTarget now carries graphId on every kind; targetKey/cloneTarget
scope the key by graphId first. Adds 3 tests for cross-graph-scope
collisions on node/widget targets and pendingTargets() dedup.

Fixes the graph-scope identity blocker DrJKL flagged on #16302 review
comment #16302 (comment)
and reiterated as an inherited blocker on #16671's approval:
#16671 (review)

Evidence:
- pnpm exec vitest run src/workbench/extensions/agent/crdt/pendingOpShadow.test.ts -> 21/21 (was 18)
- pnpm exec vitest run src/workbench/extensions/agent/crdt -> 207/207
- pnpm exec vue-tsc --noEmit -> clean
- pnpm exec oxlint / eslint on touched files -> clean
- pnpm exec oxfmt --check -> clean
- pnpm exec knip --cache -> no findings for touched modules

<!-- authored-by:agent lane-act-fe-16671-followup -->
christian-byrne added a commit that referenced this pull request Sep 6, 2026
…opt-2) (#16671)

- Skipped-duplicate shadows now clear on a covering projection (host
`doc_ops_result.seq` ≤ projected `doc_update.seq`), never on the ack
itself; failed/unprocessed rollback from #16309 is unchanged
- Re-expresses the skipped policy of #16332 (base branch
`nathaniel/agent-panel-v1`, now closed lineage) onto the main-based
tracker; #16332 stays as source history
- Green: 252/252 crdt suite (7 new tests), typecheck, oxlint/eslint,
oxfmt, knip

<details><summary>Full context for agent readers</summary>

## What

The s3-opt-6 tracker (#16309) already handles `applied` (keep until
effect), `failed` (revert), and unprocessed suffix (revert). The one
outcome it could not finish was `skipped`: the host had already applied
that op on a previous delivery, so **no later `doc_update` will ever
carry its op id** and the shadow lingered until reset. This PR closes
that gap.

**Stack:** cut from `fix/s3opt6-dispatch-wiring` (#16309, head
`d49dcaa1ba`). Review only the top commit, `678fc7e177`.

## Policy

| Situation | Behavior |
|---|---|
| ack `skipped:[id]` with `seq`, and `bridge.lastSequence >= seq` |
clear shadow + take ledger entry immediately (authoritative state
already on screen) |
| ack `skipped:[id]` with `seq`, projection behind | park id keyed by
`seq`; clear on the first applied `doc_update` whose `seq >= ack.seq` |
| ack `skipped:[id]` without `seq` | park with `null`; cleared by the
next applied `doc_update` |
| effect frame carrying the id arrives first | `onDocEffect` still wins;
the parked entry is dropped |
| `doc_reset` / unmount | parked ids dropped (seqs belong to the dead
lineage) |
| redelivered ack | no double-resolve; ledger `take` is idempotent |

## Files

- `opSender.ts`: `OpsResultView.seq?: number` (mirrors host
`DocOpsResultFrame.Seq` in `cloud/common/websocket/messages/crdt.go`; FE
`docFrameClient.ts` already parsed it).
- `pendingOpTracker.ts`: `currentSeq()` dep,
`onAuthoritativeState(seq)`, `awaitingSkipped` map,
`drop()`/`clearSkipped()` helpers; dev events `skipped_awaiting` /
`skipped_cleared`.
- `useAgentCrdtFollower.ts`: passes `currentSeq: () =>
bridge.lastSequence`, maps `detail.seq` into the ack view, calls
`onAuthoritativeState(update.seq)` after each applied update.
- Tests: `pendingOpTracker.test.ts` (`describe('s3-opt-2: ...')`, 6
tests + reworked skipped test), `useAgentCrdtFollower.test.ts` (1
follower-level test through the real frame dispatch path).

## Re-expression of #16332

Source commit `9fdd7bb544` (`opsResultReconciler.ts`) implemented this
as a separate pure reconciler over `sentBatches()`. #16309 later folded
the reconciliation into `PendingOpTracker`, so the reconciler module
would duplicate it; this PR instead adds only the missing
skipped→covering-seq gate to the tracker. The policy table in #16332 is
preserved verbatim for `skipped`; the other rows were already landed by
#16309.

## Diagram

```
doc_ops_result{skipped:[id], seq:S}
        │
        ▼
 currentSeq() >= S ? ──yes──▶ clear shadow + ledger.take(id)  → skipped_cleared
        │no
        ▼
 awaitingSkipped[id] = S      → skipped_awaiting
        │
        │  doc_update{seq:U} applied ──▶ onAuthoritativeState(U)
        │                                   U >= S ? clear : keep waiting
        │
        └─ doc_update{opIds:[id]} ──▶ onDocEffect(id) wins, drops parked entry
```

## Evidence

- Branch `fix/s3opt2-skipped-seq-gate` @
`678fc7e1770495d827d96a2a6e569049e3f3ef13`, base
`fix/s3opt6-dispatch-wiring` @
`d49dcaa1bad961684cbaedf4f06035deccdad857`
- `pnpm exec vitest run src/workbench/extensions/agent/crdt` → 21 files,
**252 passed** (was 245 on base)
- `pnpm exec vue-tsc --noEmit` → clean
- `oxfmt --check`, `oxlint`, `eslint` on the 5 touched files → 0
warnings / 0 errors
- `knip --cache` → no findings for touched modules; pre-commit
lint-staged (oxfmt, oxlint type-aware, eslint, typecheck) passed
- Source of policy: #16332 head `a49ac021f1`, commit `9fdd7bb544`

## Glossary

- **s3-opt-2 / s3-opt-6**: program work items for outcome reconciliation
(skipped duplicates) and dispatch wiring of the pending ledger/shadow.
- **projection**: an applied `doc_update` frame; its `seq` is the host's
authoritative document sequence.
- **covering seq**: a projected `seq` ≥ the `seq` reported on a
`doc_ops_result`, meaning the projected state already includes that
batch.
- **shadow**: the local pending overlay drawn for an op that has been
sent but not yet confirmed by an effect frame.
- **ledger**: `PendingOpLedger` entries tracking sent op ids until
resolved.

</details>

<!-- authored-by:agent role-hard-problem -->
@DrJKL DrJKL added agent Comfy Agent product, integration, tests or product documentation agent-crdt Agent document synchronization, graph projection or CRDT operations agent-test-unit Touches Agent-related unit/component tests or their support labels Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Comfy Agent product, integration, tests or product documentation agent-crdt Agent document synchronization, graph projection or CRDT operations agent-test-unit Touches Agent-related unit/component tests or their support risk:high PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants