Repository navigation
fix(agent-crdt): realign named input links across multiple autogrow groups - #18275
Conversation
…roups The CRDT follower materialized an agent-authored node by building link adapters against the saved document's input positions. node.configure() and COMFY_AUTOGROW_V3 growth can reorder live inputs afterward, so when a node has two or more autogrow groups (e.g. independent reference-image and reference-video groups sharing scalar widgets), the adapters kept pointing at stale indexes: links visually landed on the wrong input, and the value read at submit time was wrong for the same reason. Reuse the existing document-to-live link realignment (already used by ordinary node loading) in the agent materializer, and resolve incoming reconcile/connect targets by name instead of position, so live order wins over document order regardless of how many autogrow groups reordered. Refill node-data-store slot arrays in place so reactive holders of those arrays keep their identity across a resync. Adds a regression fixture and test modeled on a node with two interleaved autogrow groups plus adjacent scalar widgets, which a single-group fixture does not exercise.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 2095 passed, 0 failed📊 Browser Reports
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. Fallow gates on new findings in changed files only, so everything below was introduced or moved by this PR (26 changed files).
Pre-existing findings are baselined in Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since 051150e7effd7e2a9d9375f771b57635c99ae6ac
Full docs: ADR-DEVEX-LINT-0015 📦 Bundle: 9.97 MB gzip 🔴 +1.14 kBDetailsSummary
Category Glance App Entry Points — 3.87 kB (baseline 3.87 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.44 MB (baseline 1.44 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 132 kB (baseline 132 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 14 added / 14 removed / 4 unchanged Panels & Settings — 639 kB (baseline 639 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 18 unchanged User & Accounts — 37.9 kB (baseline 37.9 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 6 added / 6 removed / 5 unchanged Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 7 added / 7 removed / 1 unchanged UI Components — 123 kB (baseline 123 kB) • ⚪ 0 BReusable component library chunks
Status: 7 added / 7 removed / 9 unchanged Data & Services — 3.92 MB (baseline 3.92 MB) • 🔴 +4 kBStores, services, APIs, and repositories
Status: 13 added / 13 removed / 3 unchanged Utilities & Hooks — 577 kB (baseline 577 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 19 added / 19 removed / 19 unchanged Vendor & Third-Party — 17.4 MB (baseline 17.4 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 18 unchanged Other — 17.8 MB (baseline 17.8 MB) • ⚪ 0 BBundles that do not match a named category
Status: 74 added / 74 removed / 228 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-09-22T22:09:09.215Z",
"gitSha": "6eb56c64f9d002e052cacb3f7f3de68d1dfdf8c5",
"branch": "fix/agent-crdt-multigroup-autogrow-realign",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 1993.6309999999935,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.924000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 357.90599999999995,
"heapDeltaBytes": 10851384,
"heapUsedBytes": 78150752,
"domNodes": -258,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 7.268,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 1992.0169999999189,
"styleRecalcs": 12,
"styleRecalcDurationMs": 7.782999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 371.966,
"heapDeltaBytes": 6386972,
"heapUsedBytes": 74219024,
"domNodes": -261,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 7.772000000000001,
"eventListeners": -162,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1694.279999999992,
"styleRecalcs": 44,
"styleRecalcDurationMs": 11.23,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 613.7249999999999,
"heapDeltaBytes": 11744892,
"heapUsedBytes": 79221884,
"domNodes": -260,
"jsHeapTotalBytes": 6545408,
"scriptDurationMs": 112.36200000000001,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1694.6249999999736,
"styleRecalcs": 45,
"styleRecalcDurationMs": 12.369,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 625.848,
"heapDeltaBytes": -493896,
"heapUsedBytes": 61867596,
"domNodes": -258,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 115.79,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1698.5850000000937,
"styleRecalcs": 28,
"styleRecalcDurationMs": 11.629999999999997,
"layouts": 6,
"layoutDurationMs": 0.832,
"taskDurationMs": 259.944,
"heapDeltaBytes": 3102200,
"heapUsedBytes": 70782692,
"domNodes": 78,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 9.168,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1692.0969999999897,
"styleRecalcs": 28,
"styleRecalcDurationMs": 10.870999999999999,
"layouts": 6,
"layoutDurationMs": 0.9780000000000001,
"taskDurationMs": 257.053,
"heapDeltaBytes": 3125492,
"heapUsedBytes": 70735164,
"domNodes": 77,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 9.214999999999998,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 549.9530000000732,
"styleRecalcs": 14,
"styleRecalcDurationMs": 8.287,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 362.345,
"heapDeltaBytes": 18889392,
"heapUsedBytes": 86476304,
"domNodes": 23,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 134.199,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "dom-widget-clipping",
"durationMs": 532.7649999999267,
"styleRecalcs": 13,
"styleRecalcDurationMs": 8.110999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 361.567,
"heapDeltaBytes": 18904104,
"heapUsedBytes": 86712260,
"domNodes": 22,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 134.40300000000002,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 1020.3759999999988,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 678.535,
"heapDeltaBytes": -17679100,
"heapUsedBytes": 72649016,
"domNodes": -293,
"jsHeapTotalBytes": 20054016,
"scriptDurationMs": 48.28099999999999,
"eventListeners": -217,
"totalBlockingTimeMs": 378,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 996.825000000058,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 625.965,
"heapDeltaBytes": 35110180,
"heapUsedBytes": 101620700,
"domNodes": 0,
"jsHeapTotalBytes": 19820544,
"scriptDurationMs": 47.611,
"eventListeners": 0,
"totalBlockingTimeMs": 388,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 767.628000000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 365.9760000000003,
"heapDeltaBytes": 14536100,
"heapUsedBytes": 89328544,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 115.53099999999996,
"eventListeners": 0,
"totalBlockingTimeMs": 156,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 763.418999999999,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 364.15599999999995,
"heapDeltaBytes": 14664340,
"heapUsedBytes": 91003672,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 109.30299999999998,
"eventListeners": 0,
"totalBlockingTimeMs": 154,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "extension-clean-combined-draw",
"durationMs": 7175.127000000031,
"styleRecalcs": 1,
"styleRecalcDurationMs": 0.6579999999999988,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6385.627,
"heapDeltaBytes": -8556940,
"heapUsedBytes": 73663704,
"domNodes": -16,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 5108.677,
"eventListeners": 0,
"totalBlockingTimeMs": 28,
"frameDurationMs": 17.776666666666703,
"p95FrameDurationMs": 33.29999999999927
},
{
"name": "extension-clean-combined-draw",
"durationMs": 7207.157999999936,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6398.131,
"heapDeltaBytes": 3962564,
"heapUsedBytes": 86152580,
"domNodes": -18,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 5115.444,
"eventListeners": 0,
"totalBlockingTimeMs": 26,
"frameDurationMs": 17.779999999999987,
"p95FrameDurationMs": 33.29999999999927
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 7543.934000000036,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6710.561000000001,
"heapDeltaBytes": 5714960,
"heapUsedBytes": 81357296,
"domNodes": -10,
"jsHeapTotalBytes": 12582912,
"scriptDurationMs": 5464.014,
"eventListeners": 0,
"totalBlockingTimeMs": 77,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 33.29999999999927
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 7314.8519999999735,
"styleRecalcs": 1,
"styleRecalcDurationMs": 0.12200000000000058,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6453.354,
"heapDeltaBytes": 4798820,
"heapUsedBytes": 87499932,
"domNodes": -18,
"jsHeapTotalBytes": 9175040,
"scriptDurationMs": 5191.755000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 33,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 33.399999999999636
},
{
"name": "large-graph-idle",
"durationMs": 2031.9490000000542,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.127000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 356.51,
"heapDeltaBytes": -3569156,
"heapUsedBytes": 83449156,
"domNodes": -236,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 27.361000000000004,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2022.2210000000587,
"styleRecalcs": 9,
"styleRecalcDurationMs": 5.825,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 454.5319999999999,
"heapDeltaBytes": -3966876,
"heapUsedBytes": 83564612,
"domNodes": -238,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 28.592999999999993,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2164.798000000019,
"styleRecalcs": 70,
"styleRecalcDurationMs": 12.643,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1287.895,
"heapDeltaBytes": -11391020,
"heapUsedBytes": 76603692,
"domNodes": -214,
"jsHeapTotalBytes": 1302528,
"scriptDurationMs": 667.972,
"eventListeners": -184,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2102.0180000000437,
"styleRecalcs": 67,
"styleRecalcDurationMs": 10.99,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1229.3149999999998,
"heapDeltaBytes": 15013040,
"heapUsedBytes": 79319444,
"domNodes": -244,
"jsHeapTotalBytes": 749568,
"scriptDurationMs": 639.908,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3141.707999999994,
"styleRecalcs": 67,
"styleRecalcDurationMs": 13.801999999999998,
"layouts": 60,
"layoutDurationMs": 12.389999999999999,
"taskDurationMs": 1369.1330000000003,
"heapDeltaBytes": -15536328,
"heapUsedBytes": 74011452,
"domNodes": -246,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 621.13,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3177.249999999958,
"styleRecalcs": 66,
"styleRecalcDurationMs": 14.046000000000003,
"layouts": 60,
"layoutDurationMs": 12.459999999999999,
"taskDurationMs": 1373.293,
"heapDeltaBytes": -16373548,
"heapUsedBytes": 73294672,
"domNodes": -245,
"jsHeapTotalBytes": -1019904,
"scriptDurationMs": 617.648,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "legacy-node-drag",
"durationMs": 2277.4859999999535,
"styleRecalcs": 44,
"styleRecalcDurationMs": 7.287000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1515.133,
"heapDeltaBytes": 17778736,
"heapUsedBytes": 83738576,
"domNodes": 8,
"jsHeapTotalBytes": 1204224,
"scriptDurationMs": 782.126,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2147.3680000000286,
"styleRecalcs": 44,
"styleRecalcDurationMs": 7.127999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1480.6570000000002,
"heapDeltaBytes": 17292840,
"heapUsedBytes": 83725252,
"domNodes": 8,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 765.1750000000001,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2036.1059999999043,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.162000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 475.7509999999999,
"heapDeltaBytes": -9387656,
"heapUsedBytes": 79600624,
"domNodes": -246,
"jsHeapTotalBytes": 552960,
"scriptDurationMs": 26.878000000000007,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2053.3359999999448,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.502,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 476.8389999999999,
"heapDeltaBytes": -10382016,
"heapUsedBytes": 78913528,
"domNodes": -246,
"jsHeapTotalBytes": -1019904,
"scriptDurationMs": 27.753,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 460.5189999999766,
"styleRecalcs": 50,
"styleRecalcDurationMs": 10.882,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 290.202,
"heapDeltaBytes": 13628768,
"heapUsedBytes": 83441000,
"domNodes": 26,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 116.513,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 465.1169999999638,
"styleRecalcs": 48,
"styleRecalcDurationMs": 10.427000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 318.488,
"heapDeltaBytes": 13407756,
"heapUsedBytes": 83539956,
"domNodes": 22,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 116.301,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.669999999999998,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-idle",
"durationMs": 2005.6829999999763,
"styleRecalcs": 13,
"styleRecalcDurationMs": 7.892999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 365.073,
"heapDeltaBytes": -5846188,
"heapUsedBytes": 63155908,
"domNodes": -272,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.619,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 1989.9440000000368,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.1709999999999985,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 283.58400000000006,
"heapDeltaBytes": -9390504,
"heapUsedBytes": 60549248,
"domNodes": -274,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.751,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1677.8120000000172,
"styleRecalcs": 47,
"styleRecalcDurationMs": 12.575000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 579.538,
"heapDeltaBytes": -4028788,
"heapUsedBytes": 58929752,
"domNodes": -274,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 80.032,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1690.142999999921,
"styleRecalcs": 47,
"styleRecalcDurationMs": 13.198999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 567.315,
"heapDeltaBytes": 8102064,
"heapUsedBytes": 78110580,
"domNodes": -272,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 82.625,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 850.5130000000918,
"styleRecalcs": 19,
"styleRecalcDurationMs": 21.488,
"layouts": 5,
"layoutDurationMs": 9.341000000000003,
"taskDurationMs": 668.412,
"heapDeltaBytes": -6244368,
"heapUsedBytes": 81414612,
"domNodes": 13667,
"jsHeapTotalBytes": 10747904,
"scriptDurationMs": 20.568999999999996,
"eventListeners": 2383,
"totalBlockingTimeMs": 85,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8211.393999999927,
"styleRecalcs": 252,
"styleRecalcDurationMs": 38.016,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4491.758,
"heapDeltaBytes": -10743712,
"heapUsedBytes": 76504228,
"domNodes": -242,
"jsHeapTotalBytes": 1826816,
"scriptDurationMs": 2180.142,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8228.516000000014,
"styleRecalcs": 250,
"styleRecalcDurationMs": 35.536,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4473.254,
"heapDeltaBytes": -6414612,
"heapUsedBytes": 80396712,
"domNodes": -239,
"jsHeapTotalBytes": -794624,
"scriptDurationMs": 2170.88,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 14260.296999999922,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13635.799000000003,
"heapDeltaBytes": -50124816,
"heapUsedBytes": 187236800,
"domNodes": -8062,
"jsHeapTotalBytes": -9809920,
"scriptDurationMs": 193.282,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 10580.495000000043,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10150.696,
"heapDeltaBytes": -61066212,
"heapUsedBytes": 168474112,
"domNodes": -8062,
"jsHeapTotalBytes": -14913536,
"scriptDurationMs": 159.329,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 16910.45900000006,
"styleRecalcs": 128,
"styleRecalcDurationMs": 13.267999999999974,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16508.284,
"heapDeltaBytes": -31751188,
"heapUsedBytes": 191008112,
"domNodes": -8062,
"jsHeapTotalBytes": -21745664,
"scriptDurationMs": 722.332,
"eventListeners": -14928,
"totalBlockingTimeMs": 3,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 16759.411,
"styleRecalcs": 126,
"styleRecalcDurationMs": 13.439000000000007,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16351.153,
"heapDeltaBytes": -42326036,
"heapUsedBytes": 181084376,
"domNodes": -8062,
"jsHeapTotalBytes": -18583552,
"scriptDurationMs": 690.505,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 5039.713000000006,
"styleRecalcs": 20,
"styleRecalcDurationMs": 59.20499999999998,
"layouts": 20,
"layoutDurationMs": 20.858,
"taskDurationMs": 4977.923999999999,
"heapDeltaBytes": -36335124,
"heapUsedBytes": 178382308,
"domNodes": -8061,
"jsHeapTotalBytes": 22036480,
"scriptDurationMs": 83.72699999999998,
"eventListeners": -14928,
"totalBlockingTimeMs": 143,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-node-resize-workload",
"durationMs": 5084.600000000023,
"styleRecalcs": 20,
"styleRecalcDurationMs": 61.90999999999999,
"layouts": 20,
"layoutDurationMs": 20.960000000000008,
"taskDurationMs": 5031.167,
"heapDeltaBytes": -36492192,
"heapUsedBytes": 176909024,
"domNodes": -8062,
"jsHeapTotalBytes": 20725760,
"scriptDurationMs": 82.70799999999998,
"eventListeners": -14928,
"totalBlockingTimeMs": 245,
"frameDurationMs": 17.220000000000013,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 7144.187999999986,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6881.964,
"heapDeltaBytes": -5239628,
"heapUsedBytes": 191953196,
"domNodes": 0,
"jsHeapTotalBytes": -21233664,
"scriptDurationMs": 101.33500000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333237,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 7064.569000000006,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6844.774999999999,
"heapDeltaBytes": 9657392,
"heapUsedBytes": 178904376,
"domNodes": 0,
"jsHeapTotalBytes": -30408704,
"scriptDurationMs": 98.09099999999998,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 434.4300000000203,
"styleRecalcs": 15,
"styleRecalcDurationMs": 20.802999999999997,
"layouts": 2,
"layoutDurationMs": 0.44799999999999995,
"taskDurationMs": 97.15499999999999,
"heapDeltaBytes": 4993980,
"heapUsedBytes": 69707448,
"domNodes": 128,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 8.690999999999999,
"eventListeners": 81,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "workflow-execution",
"durationMs": 92.33499999993455,
"styleRecalcs": 7,
"styleRecalcDurationMs": 12.523000000000001,
"layouts": 3,
"layoutDurationMs": 1.5210000000000001,
"taskDurationMs": 58.561000000000014,
"heapDeltaBytes": 2981612,
"heapUsedBytes": 68721964,
"domNodes": 125,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 4.496999999999997,
"eventListeners": 17,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
🧩 Custom Nodes Ecosystem Matrix: ✅ PassedExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight
On a pin-bump PR, a red gate means the ecosystem moved — not that your diff broke something. That is what the bump PR is for. Outside a pin bump or a cold rebuild of the unpinned tail, a red means the diff. Note the corpus size and the executed count are different numbers, and the verdict is against the executed count: roughly 3,100 of ~5,100 packs ship no extension-shaped JS and are skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md |
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #18275 +/- ##
==========================================
+ Coverage 83.35% 84.37% +1.01%
==========================================
Files 2990 2284 -706
Lines 147204 130398 -16806
Branches 38043 33449 -4594
==========================================
- Hits 122708 110022 -12686
+ Misses 23214 20080 -3134
+ Partials 1282 296 -986
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 762 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @christian-byrne.
Found 10 finding(s).
| Severity | Count |
|---|---|
| 🟠 High | 2 |
| 🟡 Medium | 4 |
| 🟢 Low | 4 |
Panel: 8/8 reviewers contributed findings.
Fixes several correctness gaps in the input/output realignment logic added for multi-group autogrow (fix/agent-crdt-multigroup-autogrow-realign): - mergeInputSlotsByName now falls back to document-authoritative handling when the document drops an input the live node still carries a link on, or asks for more copies of a shared name than live has — not just when it names an input live lacks entirely. A shrink (autogrow group shrinking, an input removed from the node def) can now retract from the live node. - patchLiveSlot copies an explicit allowlist of presentation fields instead of blocklisting two keys, so it can never clobber a live slot's boundingRect with the serialized stub, or let an attacker/bug-supplied __proto__ or internal key (_node, _widget, ...) reach Object.assign. - Both slot-patch loops (target inputs on connect-apply, and mergeInputSlotsByName's own merge) now consume each matched index at most once, so two live/document slots sharing a name no longer alias onto the same array position. - connect resolves a target slot name from the raw payload at the raw index (not a filtered copy), and resolves duplicate names by occurrence instead of first match, rejecting explicitly when no match exists. - The origin-outputs patch loop is bounded to the document's own output count, so a live output beyond it is never resurrected (outputs are never autogrown and nothing removes it again). - reconcileNode now rejects a malformed live input the same way connect already does, instead of throwing. - nodeDataStore's replaceSlotsInPlace refills arrays index-by-index instead of spreading into splice, avoiding a RangeError on a pathologically long slot list. Adds regression tests for each of the above in graphMutations.test.ts. - Fixes #18275 (review feedback)
Fixes several correctness gaps in the input/output realignment logic added for multi-group autogrow (fix/agent-crdt-multigroup-autogrow-realign): - mergeInputSlotsByName now falls back to document-authoritative handling when the document drops an input the live node still carries a link on, or asks for more copies of a shared name than live has — not just when it names an input live lacks entirely. A shrink (autogrow group shrinking, an input removed from the node def) can now retract from the live node. - patchLiveSlot copies an explicit allowlist of presentation fields instead of blocklisting two keys, so it can never clobber a live slot's boundingRect with the serialized stub, or let an attacker/bug-supplied __proto__ or internal key (_node, _widget, ...) reach Object.assign. - Both slot-patch loops (target inputs on connect-apply, and mergeInputSlotsByName's own merge) now consume each matched index at most once, so two live/document slots sharing a name no longer alias onto the same array position. - connect resolves a target slot name from the raw payload at the raw index (not a filtered copy), and resolves duplicate names by occurrence instead of first match, rejecting explicitly when no match exists. - The origin-outputs patch loop is bounded to the document's own output count, so a live output beyond it is never resurrected (outputs are never autogrown and nothing removes it again). - reconcileNode now rejects a malformed live input the same way connect already does, instead of throwing. - nodeDataStore's replaceSlotsInPlace refills arrays index-by-index instead of spreading into splice, avoiding a RangeError on a pathologically long slot list. Adds regression tests for each of the above in graphMutations.test.ts. - Fixes #18275 (review feedback)
…lotsByName Pull the growth-vs-shrink detection (count tracking, live-only-linked check) out of mergeInputSlotsByName into hasNonGrowthInputSetChange so the merge function itself carries less branching. No behavior change.
christian-byrne
left a comment
There was a problem hiding this comment.
issue: the source regressions at 5b6bfd7c66e3e95158130726c5bbeda15173ffe0 cover the reviewed slot-identity, duplicate-name, shrink, malformed-input, and output-resurrection cases, and the hosted checks are green, but this Agent behavior change still has no black-box case under browser_tests/. PM-1155 is a visible socket/link-placement failure after multi-autogrow reconciliation; the existing Playwright pass only exercises the pre-existing suite, while the new coverage is Vitest-only. Could the current qabrowser-2 owner attach or land a case that asserts the visible endpoint and persisted reload behavior at this exact head before merge? This is the remaining harness-first gate; I found no additional source-level blocker in the current diff.
christian-byrne
left a comment
There was a problem hiding this comment.
I found one additional correctness gap at the reviewed head. The existing black-box gate remains applicable.
…hange Duplicate-named inputs were compared by name presence, not by count, so a document shrinking a duplicate-named group (live [dup, dup] -> document [dup]) never registered as a non-growth change when the extra live slot was still linked: the leftover linked slot and its stale wire survived a reconcile it should have been dropped by. Pair live occurrences against the document's per-name count as each live input is visited; any occurrence left over once that budget is exhausted is only tolerable growth if it's unlinked, matching the check already applied to entirely-undocumented names. Adds a regression test for a linked duplicate-name shrink.
Current takeaways
Full dated historical evidence and superseded snapshotsFreshness correction: Candidate single-writer contribution route (not foreign-writer acknowledgement or claim transfer): the current org-owned branch question: current head Exact-head note: Current iteration: Hosted failure attributionAt old head At prior head Preserved dispositionsThe prior occurrence, naming, DynamicCombo-at-reachable-node, explicit-name-at-reachable-node, and root-scope findings remain fixed. The previous 17 production-port passes remain useful historical evidence but do not certify this changed implementation. The writer has replied to the original 11 new review threads with source/test changes covering slot typing, narration, malformed-state injection, array identity, shared fixtures, renderer tag, typed responses, cleanup propagation, and lifecycle comments; those threads remain unresolved pending reviewer disposition. Main-source landing remains separate from Correction and scope withdrawal at live head Authoritative boundary: merged PR #18243 added The sole candidate contribution returns to harness-only scope in the existing Amp thread: faithful saved-file directory listing and exact saved GET/body; visible DOM/named endpoints and Run assertions before replay; a real UI next turn with the subscription count sampled immediately before it; then the same visible/named/Run outcomes after replay. Retain the cold-automatic-red patch and log separately and describe them as evidence for the still-open gap, not as closed behavior. Harness publication update: the reviewed one-file candidate is available as stacked PR #18303, targeting this PR branch rather than overwriting it. Remote read-back pins head This routes the harness repair to the existing FE18275 owner for integration or requested changes. It preserves explicit reselection/new-turn reattachment from #18243 and does not close automatic cold binding tracked by #16708 and #16849. Mocked cloud Vite evidence does not clear real service persistence, model execution, deployment, distinct-model, canonical Exact contribution CI update for #18303 at One completed check remains visibly red: https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/35653872842/job/106517980709 ( Existing owner responsibility is unchanged: integrate or disposition the stacked contribution after terminal unit/check state and owner review. Automatic cold binding, parent architecture, target inclusion, canonical browser ownership, and authentic service/launch acceptance remain separate open gates. No parent claim transfer or merge is requested. Terminal contribution/check and integration update: unit The parent branch has independently advanced to No automatic rebase, writer-branch overwrite, rerun, new review lane, claim takeover, or merge is performed. The existing FE18275 owner decides whether to integrate the retained PR18303 assertions and evidence into |
…nce handling - The fallback live-slot lookup used for an omitted document link (liveByName) resolved every document occurrence of a repeated name to the same (first) live occurrence via .find(), so a second live occurrence's link was lost whenever the document also repeated that name without carrying a link. It now consumes each live occurrence at most once, in document order, matching the pairwise consumption already used for the document-side occurrence count. - hasNonGrowthInputSetChange tolerated ANY unlinked live-only leftover as unpropagated autogrow growth, including an ordinary extra input the document had legitimately dropped (no autogrow involved at all). It now requires the leftover to also be shaped like an autogrow slot (group.member, the only naming autogrow growth ever produces) before tolerating it; anything else is treated as a real drop like a linked leftover already is. Adds regression tests for both, and reshapes the existing "unpropagated growth" fixture's input name to the autogrow shape it was meant to represent, now that an ordinary name no longer qualifies.
|
Replying to #discussion_r5761522147 (github doesn't let me thread a reply onto a top-level comment): Both confirmed real. Fixed in 8b74fff:
Both verified red against the prior implementation and green with the fix; the full |
christian-byrne
left a comment
There was a problem hiding this comment.
The occurrence fixes address the three archived probes, but the replacement growth boundary still has one source-level collision.
…ame as autogrow autogrowGroupOf treated every dotted input name as an autogrow member, but COMFY_DYNAMICCOMBO_V3 mints the identical group.key shape for an unrelated reason (dynamicWidgets.ts's updateWidgets), where key is an ordinary schema field name, not an ordinal. A removed, unlinked DynamicCombo input could therefore be mistaken for an unpropagated autogrow spare and wrongly kept. Require the segment after the last dot to end in a digit -- the same trailing-ordinal shape dynamicWidgets.ts's resolveAutogrowOrdinal itself falls back to for a group with no explicit names list -- before treating a leftover as autogrow-shaped. Reshapes the existing "unpropagated growth" fixture's input name to end in an ordinal, since that's what a real autogrow spare's default naming always does, and adds a regression test for a removed DynamicCombo-shaped input being correctly dropped.
…ss a reconcile Adds a browser-level regression for the multi-group autogrow index realignment fixed in this branch: a node with two interleaved COMFY_AUTOGROW_V3 groups (ref_images, ref_videos) plus scalar widgets between them, seeded already grown and linked the way a saved MiniMax-style template reaches disk. Drives the real agent CRDT follower over a mocked /ws socket (HostDoc, the same mechanism agentAutogrowTabSwitchReconcile.spec.ts uses) rather than mocking the reconcile logic itself, and asserts every link lands on its named slot both right after materialization and again after a tab switch forces the follower to resubscribe and reconcile the same node in place -- the scenario this fix's graphMutations.ts changes actually affect. Checks both the live graph's link targets and the rendered canvas (lg-slot--connected on the correct slot rows). Mirrors the Vitest fixture in agentNodeMaterializer.multiAutogrow.test.ts.
|
Re: the black-box gate in review #pullrequestreview-5267081471 — added It seeds a node with two interleaved One caveat I want to be upfront about: I could not get a live Playwright run in my sandboxed session to confirm it passes. |
christian-byrne
left a comment
There was a problem hiding this comment.
The existing numeric DynamicCombo finding remains open. One distinct supported autogrow contract also regresses at this exact production head.
This comment has been minimized.
This comment has been minimized.
Playwright videos for new testsDownload the recorded videos and HTML report Recorded projects: cloud Recorded test titles:
|
…hape inference hasNonGrowthInputSetChange's name-shape heuristic (dotted name + trailing digit) failed in both directions: a DynamicCombo key that happens to end numerically (e.g. `0.0.0.0`) was wrongly treated as autogrow (false positive, over-retained after a document deletion), while an explicit-names autogrow group's member (e.g. `0.b`, not ending in a digit) was wrongly treated as an ordinary removed input (false negative) -- dropping a real unpropagated spare and, worse, misattributing a later scalar's link onto the wrong name via the positional fallback this triggered. Real provenance is reachable: the live LGraphNode's own `comfyDynamic.autogrow` registration (dynamicWidgets.ts) says definitively which groups exist and which names belong to them. Adds `liveAutogrowGroupOf` (dynamicWidgets.ts) reading that registration, a new `SemanticLiveNodeQueryPort` (mirroring the existing `liveWidgets` port pattern) to reach it from the ECS/semantic graphMutations.ts layer without importing litegraph there directly, and wires it in AgentPanelRoot.vue via `app.rootGraphOrUndefined`. `nameShapeAutogrowGroupOf` (renamed from `autogrowGroupOf`) remains as a documented fallback for when no live node is reachable (e.g. a background/unmounted workflow). Adds regression tests for both failure directions (with and without a live node wired) in graphMutations.test.ts, plus source-level coverage of `liveAutogrowGroupOf` itself in dynamicWidgets.test.ts using the exact DynamicCombo/`names`-list shapes that produce each failure mode. Claude-Session: https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv
…t order CI failed agentCrdtMultiAutogrowRealign.spec.ts: node 2's `ref_videos.ref_video_0` row never gained `lg-slot--connected`, even though the link-target check (readLinkTargets, which resolves by name) passed. Root cause is in the test, not production: interleaved COMFY_AUTOGROW_V3 growth during `node.configure()` does not preserve the saved document's input order in the live node -- confirmed by reproducing the same seed shape in Vitest (see the new assertion in agentNodeMaterializer.multiAutogrow.test.ts, which locks in that `isInputSlotConnected` is correct at each input's actual live index). CONNECTED_SOCKET_SLOTS/SPARE_SLOTS hardcoded indices from the seed's position, which growth reordering had already invalidated by the time the DOM assertions ran; `getInputSlotRow` was then querying the row for whatever input growth actually left at that raw index (e.g. `width` or a spare), not the named autogrow member the test intended. Resolves each slot's row by its live index (`node.findInputSlot(name)`, the same authority `readLinkTargets` already trusts) instead of assuming it matches its position in `seed`. Claude-Session: https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv
|
Replying to #issuecomment-5761522147 — both gates addressed. Gate 1: real provenance instead of name-shape inference. Added Both rows you found are fixed whenever a live node is reachable (the real-world case):
Both cases have red/green regression coverage in Gate 2: the hosted-browser connected-slot failure. Diagnosed, and it's a bug in the new test, not in production. Fixed the test by resolving each row via Full |
|
|
…DT apply (no fix) (Comfy-Org#18332) <!-- ccr-slack-attribution --> _Requested by **Christian Byrne** · [Slack thread](https://comfy-org.slack.com/archives/C0BGH348Z0C/p1789965317152049)_ ## Summary A test-only, red-on-`main` regression for a bug found (but explicitly not fixed) while working Comfy-Org#18275: the agent CRDT **outbound** (page → host doc) link-write leg corrupts a link's slot assignment when the destination node's document-side input order has diverged from its live canvas order. ## Changes - **What**: Adds one Vitest regression, `linkMintOutboundPositionCorruption.test.ts`, at the CRDT/mutation layer (no browser test needed — the bug is fully reachable through `attachLinkMintPort` plus the real, pinned `@comfyorg/comfy-multi-player` `applyOps`). - **Before**: `attachLinkMintPort` mints a `connect` op's `to_slot` straight from litegraph's *live* topology index (`linkMintPort.ts`), with no name lookup. The pinned applier's `applyConnect` → `claimConcreteInput` then treats that index as a raw position into the destination node's *document-order* `inputs` array. When a node has interleaved autogrow groups, live order and document name order diverge, and the link silently lands on whatever input the document happens to hold at that position — regardless of its name or type. - **After**: This PR adds a failing test that asserts the correct behavior (the link lands on the input it was actually drawn to, by name). It is red on `main`: a VIDEO link ends up written onto an unrelated STRING input while the real VIDEO target is left unlinked, reproducing the live evidence from Comfy-Org#18275 (`error_reconciling_agent_incompatible_link_type`, tuple `[204, 1, 3, 2, 4, "VIDEO"]` landing on a `prompt` STRING input). - **This is a repro-only PR.** No fix is included, per Christian Byrne's request — a follow-up PR should redesign the mint/outbound leg's slot addressing (the same positional-vs-named class of bug Comfy-Org#18275 already fixed on the *inbound* leg). ## Review Focus - The test builds a real Y.Doc via `mint()`, mints the op through the unmodified production `attachLinkMintPort`, wraps it via the real `mintWireOps` envelope, and applies it with the real `applyOps` — no fixture stand-in for either the mint port or the applier, so this exercises the actual production code paths on both ends of the outbound leg. - See Comfy-Org#18275's description ("Known issue found while fixing the above") and its review-thread discussion (`https://github.com/Comfy-Org/ComfyUI_frontend/pull/18275#discussion_r4067684933`) for the original evidence this test is modeled on. ## Test plan - [x] `pnpm vitest run src/workbench/extensions/agent/crdt/linkMintOutboundPositionCorruption.test.ts` — fails with a clear, specific assertion (`ref_videos.ref_video_1` expected `link: 204`, received `link: null`), confirming genuine red for the documented reason (not a setup bug). - [x] `pnpm exec vue-tsc --noEmit -p tsconfig.json` — clean. - [x] `pnpm exec oxlint` / `pnpm exec eslint` on the new file — clean. - [x] `pnpm exec oxfmt --check` on the new file — clean. Fixes: reproduces the bug documented in Comfy-Org#18275 (not fixed there by design — see that PR's "Known issue found while fixing the above" section). --- _Generated by [Claude Code](https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
… workflow connections after dynamic input reordering (#18509) <!-- ccr-slack-attribution --> _Requested by **Christian Byrne** · [Slack thread](https://comfy-organization.slack.com/archives/C0BGH348Z0C/p1790128455751879?thread_ts=1789965317.152049&cid=C0BGH348Z0C)_ ## Summary Manual backport of #17221 to `core/1.54`. Christian asked for this directly in Slack to unblock backporting #18479 (the `cloud/1.54` counterpart of #18275), which depends on #17221's name-based CRDT input-targeting architecture that `core/1.54` currently lacks (it resolves inputs positionally). An automated backport was not attempted since this was a deliberately-requested manual op. Original PR #17221: "MiniMax template wiring (PM-993): preserve agent workflow connections after dynamic input reordering." Fixes [PM-993](https://linear.app/comfy-org/issue/PM-993): document links could target the wrong MiniMax input after node configuration or autogrow changed the live input order. Resolves document input targets by name (not position) during initial materialization, reconcile, and remote connect; preserves live order/extra inputs when every document input name exists live; keeps outputs index-based. See `docs/adr/CRDT-INPUTS-0030-preserve-named-input-targets.md`. ## Conflict resolution notes - `docs/adr/README.md`: inserted the new `CRDT-INPUTS-0030` row into `core/1.54`'s existing ADR index in alphabetical order, rather than importing `main`'s full index (`core/1.54` doesn't carry the many other ADRs added on `main` since it branched). - `src/workbench/extensions/agent/crdt/graphMutations.test.ts`: adjacent-import conflict only, kept both sides' new imports. - `src/workbench/extensions/agent/crdt/useAgentCrdtFollower.test.ts`: the conflict's "theirs" side pulled in `BatchOutcome`/`DocFrameTransport` imports that actually predate #17221 on `main` (added by a separate, still-unbackported PR) and have no corresponding usage in this file on `core/1.54`. Kept only the `GraphOperation` import #17221 itself adds (used by the `enqueue`-wiring hunk); dropped the other two as unused (`vue-tsc` TS6133) rather than smuggling in that unrelated PR's imports. - `src/workbench/extensions/agent/crdt/graphMutations.ts` and `agentNodeMaterializer.ts`: applied cleanly, no conflicts. ## Dropped from this backport (not present, and not required, on `core/1.54`) - `browser_tests/fixtures/agentConversationFixture.ts` (modified) and `browser_tests/tests/agent/agentConversationReplay.spec.ts` (added): this E2E spec and its fixture edit depend on agent-conversation E2E harness infrastructure from other PRs never backported to `core/1.54` — the fixture file itself doesn't exist on this branch at all. Dropping it doesn't affect the runtime fix; it's Playwright coverage only. - `browser_tests/fixtures/data/minimaxAutogrowReload.ts` and `browser_tests/fixtures/utils/minimaxAutogrowReload.ts` (both added): fixture data/utilities consumed exclusively by the spec above; dropped as dead code once that spec was dropped. All runtime code (`graphMutations.ts`, `agentNodeMaterializer.ts`) and all Vitest unit coverage for the CRDT input-targeting logic (`graphMutations.test.ts`, the new `agentNodeMaterializer.inputOrder.test.ts` + its new fixtures, `nodeDataStore.test.ts`, `useAgentCrdtFollower.test.ts`) are included, unchanged in substance from #17221. ## Verification - `pnpm typecheck` — clean - `pnpm lint` on the changed files (`eslint` directly; full-repo `pnpm lint` hit an unrelated OOM kill on this container's `oxlint` vitest-cleanup pass, not caused by this diff) — clean - `pnpm format:check` — clean, all matched files correctly formatted - `pnpm test:unit` on the directly relevant suites (`graphMutations.test.ts`, `agentNodeMaterializer.inputOrder.test.ts`, `useAgentCrdtFollower.test.ts`, `nodeDataStore.test.ts`) — 4 test files passed (4), 146 tests passed, 1 expected fail. (An unrelated, pre-existing failure in `AgentPanelRoot.test.ts` — a file this backport never touches — showed up when `pnpm test:unit` was run without file filtering in this environment; it is a happy-dom `Blob.stream`/iframe-loading quirk in media-upload tests, confirmed unrelated by running the four target files directly.) ## Does this unblock #18275's own core/1.54 backport? Partially. Landing this PR removes the primary architectural blocker: `core/1.54` will have `mergeInputSlotsByName`/`resolveConnectTargetInputs` and the rest of the name-based input-targeting rework that #18275 builds directly on top of (its own PR body calls out `mergeInputSlotsByName`/`hasNonGrowthInputSetChange` in `graphMutations.ts` as the base it extends). However, `core/1.54` has at least one more gap of the same shape that the `cloud/1.54` backport (#18479) also hit: it's missing `src/stores/linkPresentationStore.ts` and `src/types/linkPresentation.ts` (introduced by a separate, still-unbackported PR), which #18275's `graphMutations.ts` diff uses to preserve link presentation across a replace/displace. `core/1.54` is also still missing `browser_tests/fixtures/agentConversationFixture.ts`, same as `cloud/1.54`. So #18275's `core/1.54` backport won't be a fully clean cherry-pick once this lands — it will need the same kind of targeted fix #18479 already proved out for `cloud/1.54` (porting `linkPresentationStore.ts`/`linkPresentation.ts` + their unit test from `main`, and dropping the `agentConversationFixture`-dependent E2E spec). But it removes the one prerequisite this task was scoped to: the base architecture #18275 assumes is now present. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv Co-authored-by: Ryan Di <ryan.weihao.di@gmail.com>
- agentConversationHostDoc.ts: add HostDoc.subscribeRefused(), backported from #18213 (never backported to core/1.54), which agentFollowerHostSocket.ts (#18275) already calls. - MultiAutogrowRealignHarness.ts: fix mocked PromptResponse to match this branch's apiSchema (no number field, error is required), instead of the main-branch shape the backport picked up. Fixes pnpm typecheck:browser failures in the lint-and-format CI check.
Keeps both new imports in AgentPanelRoot.vue (useSettingStore from cloud/1.54 and LiveAutogrowGroupAnswer from the #18275 backport); neither side removed the other's usage.
…roups (#18275) <!-- ccr-slack-attribution --> _Requested by **Christian Byrne** · [Slack thread](https://comfy-organization.slack.com/archives/C0BGH348Z0C/p1789965317152049?thread_ts=1789965317.152049&cid=C0BGH348Z0C)_ Fixes agent-authored nodes with more than one autogrow group (e.g. a reference node with separate image and video reference groups) losing track of which wire goes where after the agent chat materializes the node. **Before:** For a node like `MiniMaxH3ReferenceToVideo`, which has two independent autogrow groups (`ref_images`, `ref_videos`) alongside scalar widgets (`width`, `height`, `length`, `ref_image_size`), both the agent panel and the canvas painted wires onto the wrong inputs after the node was built or reopened — a Load Image could land on `ref_image_size`, a text input on `length`, a Math node on `ref_videos`, and `width`/`height` could show as `0`. The server's own view of the graph was correctly wired, so pressing Run submitted the client's shifted (wrong) values and failed with type errors that didn't actually exist. Reopening the tab reconstructed the slots differently each time. **After:** For a document that is already correctly wired, projecting it onto the live canvas now lands every wire on the input it was actually connected to, and the value submitted on Run matches what's shown on canvas, regardless of how many autogrow groups the node has or how their growth interleaves with each other and with the node's scalar widgets. This covers the document-to-live projection direction only; the outbound leg (minting a link back into the host document) can still corrupt a node's addressing before this projection ever runs on it — see "Known issue" below and #18332. - **What**: `node.configure()` and autogrow growth (`COMFY_AUTOGROW_V3`) can reorder or insert a node's live inputs after the agent CRDT follower has already built its link adapters against the saved document's input *positions*. With one autogrow group this only shifts a couple of neighboring scalar widgets; with two or more groups growing on the same node, the drift compounds across the whole input list. The fix re-points the follower's link adapters, and the incoming reconcile/connect handling, at the input with the same *name* as the saved slot, instead of the same index — reusing the link realignment ordinary node loading already relies on, and extending the reconcile/connect path to resolve by name. A live-only input (one no document occurrence matches) is retained, rather than dropped along with the rest of the document's positional replacement, only when it classifies as a real autogrow group member — via a live query, this follower's own remembered answer, the node type's static `COMFY_AUTOGROW_V3` definition, or (last resort) the name-shape heuristic; a genuine removal still lets the document win. Duplicate input names on one node are matched pairwise by occurrence (the Nth document occurrence against the Nth live occurrence), not by first match. Node-data-store slot arrays are now refilled in place rather than reassigned, so any reactive view already holding that array keeps its identity across a resync. - **How**: Added a regression fixture and CRDT-follower test modeled on a node with two interleaved autogrow groups plus adjacent scalar widgets (the shape a single-group fixture can't exercise) — confirmed it fails on the unfixed code, then confirmed the by-name realignment above (generalized, not per-pair) makes it pass without further special-casing. The live-node autogrow-membership port collapsed "the live node can't answer yet" and "the live node answered no" into the same `undefined`, so an activate/resubscribe race could drop an explicit-name autogrow spare. The port now returns a tagged `unavailable`/`member`/`notMember` result and only the last two are authoritative. When the port is `unavailable`, provenance falls back in this order: this follower's own remembered live answer, then the node type's own static `COMFY_AUTOGROW_V3` definition, and only then the name-shape heuristic. The membership classification against a static schema (explicit `names` list vs. trailing ordinal) is one predicate shared with `dynamicWidgets.ts`'s live registration rather than a second implementation. `graphMutations.ts`) The remembered answers are addressable only from the node incarnation that produced them: - **Graph scope in the key.** One `GraphMutations` instance is retained per cloud workflow while resolving the current local workflow's scope on every batch, so the key is `rootGraphId` + `owningGraphId` + node id for remember, read and forget alike. - **Per-mutation transactional writes.** `batch()` opens a draft before `prepare()`; every `member`/`notMember` write and forget (replace, `deleteNode`, `removeMissing`, `clearSemanticGraph`) is staged into that draft, journaled under the mutation that produced it. `commit()` applies one mutation's journaled writes to the persisted store immediately after that mutation's own graph effect lands, and only when that effect actually landed — a `connect` whose `replaceLink` returns `undefined` (a stale expected occupant, an ID collision, or a newly-occupied target) never publishes the write it staged. A later mutation in the same batch throwing therefore still keeps every earlier mutation's already-applied write, and a `prepare()` rejection leaves the persisted store completely untouched. Within `prepare()` itself, a mutation can still see an earlier mutation's own staged (not yet committed) answer for the same node — its pending overlay chains onto the nearest earlier-indexed mutation's still-pending one, so two mutations prepared back to back in one batch agree on the same name's classification — but nothing outside that single `prepare()`/`commit()` pass, including a later batch's own `currentView()` reads, ever sees a same-batch mutation's answer before its own `commit()` iteration actually applies it. - **Definition-identity revalidation.** Each entry stores the `ComfyNodeDefImpl` it was answered against; a re-registration under the same type name constructs a new one, so the current definition always beats stale memory. Node type is still part of the entry for the case where another writer changes a node's type without this instance observing it. Also fixed a real race in the turn step: `agentConversationStore.ingest` only routes `agent_message_done` while the store already holds the ack's `message_id`, so the host must not answer before the assistant placeholder `startTurn` renders, or the turn hangs on a live Stop button forever. `agentCrdtMultiAutogrowRealign.spec.ts` sets sentinel widget values through the UI and inspects the submitted-prompt payload by name across three scenarios: a same-page tab-switch resubscribe, an actual save-and-reload of the same workflow, and a reload of a workflow whose saved bytes were corrupted after the save. The tab-switch case fills its sentinels *before* switching tabs and re-verifies those same values afterward, so a reconcile that resets or shifts an existing scalar during replay fails it, not just one that mis-wires a link. Three defects in the reload path (the second and third scenarios) are fixed here: - `mockSavedWorkflowPersistence` never served the `GET /api/userdata?dir=workflows&...` listing (its `**/api/userdata/*` pattern cannot match a URL with no path segment after `userdata`), so after a reload `workflowStore`'s `syncEntities` saw an empty listing, dropped the saved path from `openWorkflowPaths`, and the agent panel's workflow picker — which lists `openWorkflows` — came up **empty**. The reopen step then waited on a menu item that could never appear. This is the state the hosted runs were failing in; no timeout could help. - The saved-path GET counter route could never match an `encodeURIComponent`-encoded userdata path (`/api/userdata/workflows%2F<name>.json`), so the "the reopen really read the file" assertion polled a counter stuck at zero. It is now counted inside the persistence mock, and only for GETs it actually answered from retained saved bytes. - Saving under the default `Unsaved Workflow` name made the reopen indistinguishable from the fresh tab a reload always offers; it now saves under an explicit name through the Save As UI. **Spec structure.** The 506-line free-standing scenario function is replaced by a fixture-owned harness (`browser_tests/fixtures/helpers/MultiAutogrowRealignHarness.ts`, registered via `browser_tests/fixtures/multiAutogrowRealignFixture.ts`), per `browser_tests/README.md`. The spec file now contains only imports, `test.describe`, `test.describe.configure` and three `test()` bodies whose acts and assertions read in order. Per-test budgets drop from 240s to 90s/120s/120s. With the empty picker fixed, the second-turn reattach case reaches its assertions for the first time and fails deterministically: after save → reload → reattach, a link is dropped with `error_reconciling_agent_incompatible_link_type`. The live graph is correct (origin `VIDEO`, target `VIDEO`); the **host document** is not — node 2's doc inputs are in document name order (`prompt` at index 4, `ref_videos.ref_video_1` at index 7) but the link values were written by LIVE position, so `"link": 204` sits on the `prompt` (`STRING`) input and the link tuple reads `[204, 1, 3, 2, 4, "VIDEO"]`. `excludeIncompatibleLinks` then correctly refuses it. That is the same positional-vs-named confusion this PR fixes on the inbound path, occurring on the page → host doc leg through the real `applyOps` from `@comfyorg/comfy-multi-player`. Fixing it means changing the mint/outbound leg, which is a different code path needing its own design and regressions. **This defect is NOT covered by this PR.** It is not exercised by `agentCrdtMultiAutogrowRealign.spec.ts` (verifies the inbound/reconcile path only) and it is not exercised by `agentFollowerReloadBinding.spec.ts` either — that spec reattaches an ordinary scalar widget edit on a single-input node, never a multi-autogrow node, and never mints an outbound link at all. Rather than ship a red test or weaken an assertion in this PR, the reproduction is tracked separately with a real failing unit test: #18332 (branch `test/agent-crdt-outbound-link-position-bug`, `src/workbench/extensions/agent/crdt/linkMintOutboundPositionCorruption.test.ts`). - `realignInputLinkSlots` (already used by ordinary graph loading) is now also invoked after agent materialization; it iterates all of a node's named links in passes, so it isn't limited to a single autogrow group. - `mergeInputSlotsByName`/`hasNonGrowthInputSetChange` in `graphMutations.ts`: a live-only input only survives when it is a widget-promoted input slot (the wire format never carries one as a named input either way) or classifies as an autogrow group member (and, unless the caller opts into `preserveLinkedAutogrow`, is unlinked); any other live-only input means the whole input set changed, and the document's list and order replace it positionally. See `docs/adr/CRDT-INPUTS-0030-preserve-named-input-targets.md` for the full rule. - `createAutogrowMemory`'s read contract: an entry is trusted only when the graph scope, the node type, and the node definition object all still match. Its writes are gated on the producing mutation's own commit result — see "Autogrow memory lifecycle" above. - [x] **Red/green on each of the cache and commit-ordering blockers.** Each fix was reverted in isolation and the matching case confirmed to fail, then restored: - dropping the graph scope from the key fails `does not let one graph scope read another scope's remembered autogrow answer on the same GraphMutations instance` - making `remember()` write straight to the real map fails `does not leak the live answer a rejected batch resolved while preparing` - dropping the `nodeDef` identity clause fails `prefers a re-registered node definition over an autogrow answer remembered under the definition it replaced` - dropping the `nodeType` clause fails `does not apply a remembered autogrow answer to a node id another writer has since given a different type` - moving `beginMutation` back to prepare-only fails `journals a connect mutation's commit-time autogrow answer under its own index, not the batch's last-prepared one` - removing the `committed` gate on `connect`'s memory publication fails `does not publish a connect mutation's staged autogrow answer when its own replaceLink fails to land` - reverting `refillArray` to a spread-based `splice` fails `updateNode refills a slot list long enough to overflow a spread-based splice, without changing array identity` - **(round 8)** ordering `nodeStore.registerNode()` before `deps.layout.createNode()` (the pre-fix shape) fails `keeps an earlier mutation's remembered autogrow answer when a later mutation in the same batch throws`'s new node-3-absence assertion - **(round 8)** reverting the autogrow-memory draft to a single shared `shadow` (no per-mutation pending overlay / `rollbackMutation`) fails `does not leak a failed connect's staged autogrow answer to a later connect in the same batch` - **(round 9)** deleting the incumbent before `deps.layout.createNode()` in a type-changing `replaceNode` (the pre-fix shape) fails `keeps the incumbent node fully intact when a type-changing replace throws creating its layout` - **(round 9)** reverting `currentView` to check only the current mutation's own pending overlay and the confirmed shadow fails `lets a mutation see an earlier mutation's still-pending autogrow answer from the same batch`, while `does not leak a failed connect's staged autogrow answer to a later connect in the same batch` (round 8) keeps passing under the fixed, chained version - **(round 9)** restoring `preserveLinkedAutogrow`'s blanket non-plain-object early return fails `drops a linked, non-plain runtime slot the document dropped, even with preserveLinkedAutogrow set` - **(round 9)** removing the new widget-promoted-slot exception fails `retains a widget-promoted input slot no document snapshot ever lists`, and (caught only by the full suite, not this file's own unit tests) regresses `agentNodeMaterializer.inputOrder.test.ts`'s `preserves named targets when an agent reconnect follows growth that moves width` - [x] `pnpm exec vue-tsc --noEmit` and `pnpm exec vue-tsc --noEmit -p browser_tests/tsconfig.json` — clean - [x] `pnpm oxlint` (type-aware, whole repo) — no new warnings on `graphMutations.ts`/`nodeDataStore.ts`; `pnpm exec eslint src/workbench/extensions/agent/crdt/graphMutations.ts src/workbench/extensions/agent/crdt/graphMutations.test.ts src/stores/nodeDataStore.ts src/stores/nodeDataStore.test.ts` — clean; `pnpm exec oxfmt --check .` — clean; `pnpm knip` — clean - [x] `pnpm fallow audit --base origin/main` — `complexity_introduced: 2`, `dead_code_introduced: 0`, `duplication_introduced: 0`; the 2 introduced complexity findings are `LGraphCanvas.deselectAll` and `widgetMap.adoptConcreteWidget`, neither touched this round or by this PR — `graphMutations.ts`'s own `prepare`/`commit` findings are still `introduced: false` (pre-existing baseline). The overall verdict is `fail` only from those two plus unrelated inherited styling/complexity drift on `main` since this branch's base; nothing under `src/workbench/extensions/agent/crdt/` or `src/stores/nodeDataStore.ts` is newly introduced. - [x] `pnpm vitest run src/workbench/extensions/agent/crdt/ src/stores/nodeDataStore.test.ts` — 57 files, **885 passed, 5 expected fail** - [ ] The browser spec reorder (fill-then-switch-then-reverify) was not re-executed locally this round — this session had no dev server or backend available. It only reorders existing `test.step`s around already-existing harness methods (`fillSentinelWidgetValues`, `expectSentinelWidgetValues`, `switchTabsAwayAndBack`), with no new harness API surface, and typechecks clean. Hosted CI is the authority for this file, as it was for the prior round's own claim. **Known CI blocker (not addressed here):** `Check for AI agent co-author trailers` fails on 2 pre-existing commits on this branch that need a history rewrite (rewording). Destructive git history operations are outside what this session's own permission system allows regardless of reviewer sign-off; a human with push access to this branch needs to do that reword directly. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: bymyself <cbyrne@comfy.org> Co-authored-by: Amp <amp@ampcode.com> Automated backport of #18275 hit cherry-pick conflicts; resolved manually: - browser_tests/fixtures/agentConversationFixture.ts: dropped from this backport. The file doesn't exist on cloud/1.54 (added by the still- unbackported #17875) and nothing on this branch imports it, including the new agentCrdtMultiAutogrowRealign.spec.ts. - src/lib/litegraph/src/LGraphCanvas.ts (selectItems): kept cloud/1.54's existing body. The only diff here was an unrelated Array.from -> spread refactor picked up as context noise from #17048 (ownsSelectable filter), which also isn't on cloud/1.54. - src/core/graph/widgets/dynamicWidgets.ts, AgentPanelRoot.vue: additive conflicts, took the incoming side. Dropped an incoming useSettingStore import in AgentPanelRoot.vue that belonged to a separate, unbackported PR (#17730) and was unused on this branch. - src/workbench/extensions/agent/crdt/graphMutations.ts: took the new by-name `connect` handler wholesale (the actual fix). This uncovered a missing dependency: linkPresentationStore, introduced by unbackported #17875 and used (in code already present before #18275 on main) to preserve link presentation across a replace/displace. Ported src/types/linkPresentation.ts and src/stores/linkPresentationStore.ts (+ its unit test) from main, and added the missing `const linkPresentationStore = useLinkPresentationStore()` wiring that #18275's diff never touched because it already existed upstream of the cherry-pick's base. - graphMutations.test.ts: same missing-dependency shape, but for the test file the only pre-existing usages of linkPresentationStore live in other unbackported PRs' test blocks that aren't part of this branch, so the import ended up unused; removed it. - Checked open backport PRs against cloud/1.54 stacking on the same files (#18475, #18473, #18418, #18411, #18370, #18367, #18355, #18351): none of them are merged into cloud/1.54 yet, so no additional stacking conflicts applied. Verification: pnpm typecheck clean; pnpm vitest run on the directly relevant suites (graphMutations.test.ts, dynamicWidgets.test.ts, linkStore.test.ts, nodeDataStore.test.ts, linkPresentationStore.test.ts, crdtSession.test.ts, agentNodeMaterializer.multiAutogrow.test.ts) is 209 passed / 1 expected-fail; eslint and oxlint clean on all changed files.
Keeps both new imports in AgentPanelRoot.vue (useSettingStore from cloud/1.54 and LiveAutogrowGroupAnswer from the #18275 backport); neither side removed the other's usage.
…ss multiple autogrow groups (#18479) Backport of #18275 to `cloud/1.54`. Manual backport: the automated backport bot hit cherry-pick conflicts and requested a manual one. ## Conflict resolution notes - `browser_tests/fixtures/agentConversationFixture.ts`: dropped from this backport. The file doesn't exist on `cloud/1.54` (added by the still-unbackported #17875) and nothing on this branch imports it, including the new `agentCrdtMultiAutogrowRealign.spec.ts`. - `src/lib/litegraph/src/LGraphCanvas.ts` (`selectItems`): kept `cloud/1.54`'s existing body. The only diff here was an unrelated `Array.from` -> spread refactor picked up as context noise from #17048's `ownsSelectable` filter, which also isn't on `cloud/1.54`. - `src/core/graph/widgets/dynamicWidgets.ts`, `AgentPanelRoot.vue`: additive conflicts, took the incoming side. Dropped an incoming `useSettingStore` import in `AgentPanelRoot.vue` that belonged to a separate, unbackported PR (#17730) and was unused on this branch. - `src/workbench/extensions/agent/crdt/graphMutations.ts`: took the new by-name `connect` handler wholesale (the actual fix). This uncovered a missing dependency: `linkPresentationStore`, introduced by unbackported #17875 and used (in code already present before #18275 on `main`) to preserve link presentation across a replace/displace. Ported `src/types/linkPresentation.ts` and `src/stores/linkPresentationStore.ts` (+ its unit test) from `main`, and added the missing `const linkPresentationStore = useLinkPresentationStore()` wiring that #18275's diff never touched because it already existed upstream of the cherry-pick's base. - `graphMutations.test.ts`: same missing-dependency shape, but for the test file the only pre-existing usages of `linkPresentationStore` live in other unbackported PRs' test blocks that aren't part of this branch, so the import ended up unused; removed it. - Checked open backport PRs against `cloud/1.54` stacking on the same files (#18475, #18473, #18418, #18411, #18370, #18367, #18355, #18351): none of them are merged into `cloud/1.54` yet, so no additional stacking conflicts applied. ## Verification - `pnpm typecheck`: clean - `pnpm vitest run` on the directly relevant suites (`graphMutations.test.ts`, `dynamicWidgets.test.ts`, `linkStore.test.ts`, `nodeDataStore.test.ts`, `linkPresentationStore.test.ts`, `crdtSession.test.ts`, `agentNodeMaterializer.multiAutogrow.test.ts`): 209 passed, 1 expected fail - `eslint` / `oxlint` on all changed files: clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv --- _Generated by [Claude Code](https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv)_ --------- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
|
… after dynamic input reordering (#17221) Fixes [PM-993](https://linear.app/comfy-org/issue/PM-993): document links can target the wrong MiniMax input after node configuration or autogrow changes the live input order. - Resolve document input targets by name during initial materialization, reconcile, and remote connect. Preserve live order and extra inputs when every document input name exists live; otherwise use the document input list and order. - Incoming connect preserves matching runtime slot instances and shared arrays, including multiple connects in one batch. Commit the prepared slot order without re-merging it, and reject a target that slot validation removed before changing the graph. - Keep outputs index-based. Document the durable name-targeting rule separately from the interim store-first implementation and its [FE-2504 migration](https://linear.app/comfyorg/issue/FE-2504/agentcrdt-remove-store-first-remote-apply-and-every-reconciliation) in the [ADR](https://github.com/Comfy-Org/ComfyUI_frontend/blob/ryandi/pm-994-minimax-wiring-investigation/docs/adr/CRDT-INPUTS-0030-preserve-named-input-targets.md). - Surface all fixture cleanup failures, supply the bound root graph required by current main, and align regression data, utilities and assertions with repository conventions. Authoritative snapshot reconciliation retains slot arrays but can replace slot instances and lose runtime-only metadata. That existing preservation gap is separate follow-up work, not fixed by the incoming-connect path. Duplicate input names resolve to the first match; uniqueness is not enforced here. Producer-side/local-to-document addressing remains outside this PR under the [Option A ruling](https://github.com/christian-byrne/blocked-on-christian/issues/448). - Local CRDT suites and nodeDataStore: 54 files, 825 passed and 6 expected failures. The final review regression failed before the resolved-target bounds fix and passes afterward. - Application/browser typechecks, full lint, formatting, Knip and ADR validation passed during this follow-up; affected tests and commit hooks were rerun for the final fix. - The cloud browser regression covers live graph serialize/configure, not direct CRDT-document inspection. No local browser execution was performed during this follow-up; see the current remote CI checks for automated browser results. - Integrated remote PR head 322e726 and main 23559a8. The fixture now supplies boundRootGraphId, resolving the build/typecheck failures seen when CI combined the previous head with newer main. --------- Co-authored-by: Terry Jia <terryjia88@gmail.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Amp <amp@ampcode.com> ## Backport notes (core/1.54) Manual backport of #17221 onto core/1.54. Requested by Christian Byrne to unblock the core/1.54 backport of #18479 (cloud/1.54's #18275 counterpart), which depends on this PR's name-based CRDT input-targeting architecture. Conflicts resolved: - docs/adr/README.md: inserted the new CRDT-INPUTS-0030 row into core/1.54's existing ADR index instead of importing main's full index (core/1.54 does not carry the many other ADRs added on main since). - src/workbench/extensions/agent/crdt/graphMutations.test.ts: kept both sides' new imports (no substantive logic conflict, just adjacent import lines). - src/workbench/extensions/agent/crdt/useAgentCrdtFollower.test.ts: the conflict's theirs-side pulled in BatchOutcome/DocFrameTransport imports that predate #17221 on main (added by a separate, still-unbackported PR) and have no corresponding usage in this file on core/1.54. Kept only the GraphOperation import that #17221 itself adds and that the enqueue-wiring hunk actually uses; dropped the other two as unused (vue-tsc TS6133) rather than smuggling in that unrelated PR's imports. Dropped from this backport (not present, and not required, on core/1.54): - browser_tests/fixtures/agentConversationFixture.ts (modified) and browser_tests/tests/agent/agentConversationReplay.spec.ts (added): this E2E spec and its fixture edits depend on agent-conversation E2E harness additions from other PRs never backported to core/1.54. The file itself is missing on this branch, so the modify/delete conflict is a real gap, not something introduced by this commit. - browser_tests/fixtures/data/minimaxAutogrowReload.ts and browser_tests/fixtures/utils/minimaxAutogrowReload.ts (both added): test-only fixture data/utilities consumed exclusively by the spec above; dropped as dead code once that spec was dropped. All runtime code (graphMutations.ts, agentNodeMaterializer.ts) and all Vitest unit coverage for the CRDT input-targeting logic (graphMutations.test.ts, agentNodeMaterializer.inputOrder.test.ts + its new fixtures, nodeDataStore.test.ts, useAgentCrdtFollower.test.ts) are included unchanged in substance.
…roups (#18275) <!-- ccr-slack-attribution --> _Requested by **Christian Byrne** · [Slack thread](https://comfy-organization.slack.com/archives/C0BGH348Z0C/p1789965317152049?thread_ts=1789965317.152049&cid=C0BGH348Z0C)_ Fixes agent-authored nodes with more than one autogrow group (e.g. a reference node with separate image and video reference groups) losing track of which wire goes where after the agent chat materializes the node. **Before:** For a node like `MiniMaxH3ReferenceToVideo`, which has two independent autogrow groups (`ref_images`, `ref_videos`) alongside scalar widgets (`width`, `height`, `length`, `ref_image_size`), both the agent panel and the canvas painted wires onto the wrong inputs after the node was built or reopened — a Load Image could land on `ref_image_size`, a text input on `length`, a Math node on `ref_videos`, and `width`/`height` could show as `0`. The server's own view of the graph was correctly wired, so pressing Run submitted the client's shifted (wrong) values and failed with type errors that didn't actually exist. Reopening the tab reconstructed the slots differently each time. **After:** For a document that is already correctly wired, projecting it onto the live canvas now lands every wire on the input it was actually connected to, and the value submitted on Run matches what's shown on canvas, regardless of how many autogrow groups the node has or how their growth interleaves with each other and with the node's scalar widgets. This covers the document-to-live projection direction only; the outbound leg (minting a link back into the host document) can still corrupt a node's addressing before this projection ever runs on it — see "Known issue" below and #18332. - **What**: `node.configure()` and autogrow growth (`COMFY_AUTOGROW_V3`) can reorder or insert a node's live inputs after the agent CRDT follower has already built its link adapters against the saved document's input *positions*. With one autogrow group this only shifts a couple of neighboring scalar widgets; with two or more groups growing on the same node, the drift compounds across the whole input list. The fix re-points the follower's link adapters, and the incoming reconcile/connect handling, at the input with the same *name* as the saved slot, instead of the same index — reusing the link realignment ordinary node loading already relies on, and extending the reconcile/connect path to resolve by name. A live-only input (one no document occurrence matches) is retained, rather than dropped along with the rest of the document's positional replacement, only when it classifies as a real autogrow group member — via a live query, this follower's own remembered answer, the node type's static `COMFY_AUTOGROW_V3` definition, or (last resort) the name-shape heuristic; a genuine removal still lets the document win. Duplicate input names on one node are matched pairwise by occurrence (the Nth document occurrence against the Nth live occurrence), not by first match. Node-data-store slot arrays are now refilled in place rather than reassigned, so any reactive view already holding that array keeps its identity across a resync. - **How**: Added a regression fixture and CRDT-follower test modeled on a node with two interleaved autogrow groups plus adjacent scalar widgets (the shape a single-group fixture can't exercise) — confirmed it fails on the unfixed code, then confirmed the by-name realignment above (generalized, not per-pair) makes it pass without further special-casing. The live-node autogrow-membership port collapsed "the live node can't answer yet" and "the live node answered no" into the same `undefined`, so an activate/resubscribe race could drop an explicit-name autogrow spare. The port now returns a tagged `unavailable`/`member`/`notMember` result and only the last two are authoritative. When the port is `unavailable`, provenance falls back in this order: this follower's own remembered live answer, then the node type's own static `COMFY_AUTOGROW_V3` definition, and only then the name-shape heuristic. The membership classification against a static schema (explicit `names` list vs. trailing ordinal) is one predicate shared with `dynamicWidgets.ts`'s live registration rather than a second implementation. `graphMutations.ts`) The remembered answers are addressable only from the node incarnation that produced them: - **Graph scope in the key.** One `GraphMutations` instance is retained per cloud workflow while resolving the current local workflow's scope on every batch, so the key is `rootGraphId` + `owningGraphId` + node id for remember, read and forget alike. - **Per-mutation transactional writes.** `batch()` opens a draft before `prepare()`; every `member`/`notMember` write and forget (replace, `deleteNode`, `removeMissing`, `clearSemanticGraph`) is staged into that draft, journaled under the mutation that produced it. `commit()` applies one mutation's journaled writes to the persisted store immediately after that mutation's own graph effect lands, and only when that effect actually landed — a `connect` whose `replaceLink` returns `undefined` (a stale expected occupant, an ID collision, or a newly-occupied target) never publishes the write it staged. A later mutation in the same batch throwing therefore still keeps every earlier mutation's already-applied write, and a `prepare()` rejection leaves the persisted store completely untouched. Within `prepare()` itself, a mutation can still see an earlier mutation's own staged (not yet committed) answer for the same node — its pending overlay chains onto the nearest earlier-indexed mutation's still-pending one, so two mutations prepared back to back in one batch agree on the same name's classification — but nothing outside that single `prepare()`/`commit()` pass, including a later batch's own `currentView()` reads, ever sees a same-batch mutation's answer before its own `commit()` iteration actually applies it. - **Definition-identity revalidation.** Each entry stores the `ComfyNodeDefImpl` it was answered against; a re-registration under the same type name constructs a new one, so the current definition always beats stale memory. Node type is still part of the entry for the case where another writer changes a node's type without this instance observing it. Also fixed a real race in the turn step: `agentConversationStore.ingest` only routes `agent_message_done` while the store already holds the ack's `message_id`, so the host must not answer before the assistant placeholder `startTurn` renders, or the turn hangs on a live Stop button forever. `agentCrdtMultiAutogrowRealign.spec.ts` sets sentinel widget values through the UI and inspects the submitted-prompt payload by name across three scenarios: a same-page tab-switch resubscribe, an actual save-and-reload of the same workflow, and a reload of a workflow whose saved bytes were corrupted after the save. The tab-switch case fills its sentinels *before* switching tabs and re-verifies those same values afterward, so a reconcile that resets or shifts an existing scalar during replay fails it, not just one that mis-wires a link. Three defects in the reload path (the second and third scenarios) are fixed here: - `mockSavedWorkflowPersistence` never served the `GET /api/userdata?dir=workflows&...` listing (its `**/api/userdata/*` pattern cannot match a URL with no path segment after `userdata`), so after a reload `workflowStore`'s `syncEntities` saw an empty listing, dropped the saved path from `openWorkflowPaths`, and the agent panel's workflow picker — which lists `openWorkflows` — came up **empty**. The reopen step then waited on a menu item that could never appear. This is the state the hosted runs were failing in; no timeout could help. - The saved-path GET counter route could never match an `encodeURIComponent`-encoded userdata path (`/api/userdata/workflows%2F<name>.json`), so the "the reopen really read the file" assertion polled a counter stuck at zero. It is now counted inside the persistence mock, and only for GETs it actually answered from retained saved bytes. - Saving under the default `Unsaved Workflow` name made the reopen indistinguishable from the fresh tab a reload always offers; it now saves under an explicit name through the Save As UI. **Spec structure.** The 506-line free-standing scenario function is replaced by a fixture-owned harness (`browser_tests/fixtures/helpers/MultiAutogrowRealignHarness.ts`, registered via `browser_tests/fixtures/multiAutogrowRealignFixture.ts`), per `browser_tests/README.md`. The spec file now contains only imports, `test.describe`, `test.describe.configure` and three `test()` bodies whose acts and assertions read in order. Per-test budgets drop from 240s to 90s/120s/120s. With the empty picker fixed, the second-turn reattach case reaches its assertions for the first time and fails deterministically: after save → reload → reattach, a link is dropped with `error_reconciling_agent_incompatible_link_type`. The live graph is correct (origin `VIDEO`, target `VIDEO`); the **host document** is not — node 2's doc inputs are in document name order (`prompt` at index 4, `ref_videos.ref_video_1` at index 7) but the link values were written by LIVE position, so `"link": 204` sits on the `prompt` (`STRING`) input and the link tuple reads `[204, 1, 3, 2, 4, "VIDEO"]`. `excludeIncompatibleLinks` then correctly refuses it. That is the same positional-vs-named confusion this PR fixes on the inbound path, occurring on the page → host doc leg through the real `applyOps` from `@comfyorg/comfy-multi-player`. Fixing it means changing the mint/outbound leg, which is a different code path needing its own design and regressions. **This defect is NOT covered by this PR.** It is not exercised by `agentCrdtMultiAutogrowRealign.spec.ts` (verifies the inbound/reconcile path only) and it is not exercised by `agentFollowerReloadBinding.spec.ts` either — that spec reattaches an ordinary scalar widget edit on a single-input node, never a multi-autogrow node, and never mints an outbound link at all. Rather than ship a red test or weaken an assertion in this PR, the reproduction is tracked separately with a real failing unit test: #18332 (branch `test/agent-crdt-outbound-link-position-bug`, `src/workbench/extensions/agent/crdt/linkMintOutboundPositionCorruption.test.ts`). - `realignInputLinkSlots` (already used by ordinary graph loading) is now also invoked after agent materialization; it iterates all of a node's named links in passes, so it isn't limited to a single autogrow group. - `mergeInputSlotsByName`/`hasNonGrowthInputSetChange` in `graphMutations.ts`: a live-only input only survives when it is a widget-promoted input slot (the wire format never carries one as a named input either way) or classifies as an autogrow group member (and, unless the caller opts into `preserveLinkedAutogrow`, is unlinked); any other live-only input means the whole input set changed, and the document's list and order replace it positionally. See `docs/adr/CRDT-INPUTS-0030-preserve-named-input-targets.md` for the full rule. - `createAutogrowMemory`'s read contract: an entry is trusted only when the graph scope, the node type, and the node definition object all still match. Its writes are gated on the producing mutation's own commit result — see "Autogrow memory lifecycle" above. - [x] **Red/green on each of the cache and commit-ordering blockers.** Each fix was reverted in isolation and the matching case confirmed to fail, then restored: - dropping the graph scope from the key fails `does not let one graph scope read another scope's remembered autogrow answer on the same GraphMutations instance` - making `remember()` write straight to the real map fails `does not leak the live answer a rejected batch resolved while preparing` - dropping the `nodeDef` identity clause fails `prefers a re-registered node definition over an autogrow answer remembered under the definition it replaced` - dropping the `nodeType` clause fails `does not apply a remembered autogrow answer to a node id another writer has since given a different type` - moving `beginMutation` back to prepare-only fails `journals a connect mutation's commit-time autogrow answer under its own index, not the batch's last-prepared one` - removing the `committed` gate on `connect`'s memory publication fails `does not publish a connect mutation's staged autogrow answer when its own replaceLink fails to land` - reverting `refillArray` to a spread-based `splice` fails `updateNode refills a slot list long enough to overflow a spread-based splice, without changing array identity` - **(round 8)** ordering `nodeStore.registerNode()` before `deps.layout.createNode()` (the pre-fix shape) fails `keeps an earlier mutation's remembered autogrow answer when a later mutation in the same batch throws`'s new node-3-absence assertion - **(round 8)** reverting the autogrow-memory draft to a single shared `shadow` (no per-mutation pending overlay / `rollbackMutation`) fails `does not leak a failed connect's staged autogrow answer to a later connect in the same batch` - **(round 9)** deleting the incumbent before `deps.layout.createNode()` in a type-changing `replaceNode` (the pre-fix shape) fails `keeps the incumbent node fully intact when a type-changing replace throws creating its layout` - **(round 9)** reverting `currentView` to check only the current mutation's own pending overlay and the confirmed shadow fails `lets a mutation see an earlier mutation's still-pending autogrow answer from the same batch`, while `does not leak a failed connect's staged autogrow answer to a later connect in the same batch` (round 8) keeps passing under the fixed, chained version - **(round 9)** restoring `preserveLinkedAutogrow`'s blanket non-plain-object early return fails `drops a linked, non-plain runtime slot the document dropped, even with preserveLinkedAutogrow set` - **(round 9)** removing the new widget-promoted-slot exception fails `retains a widget-promoted input slot no document snapshot ever lists`, and (caught only by the full suite, not this file's own unit tests) regresses `agentNodeMaterializer.inputOrder.test.ts`'s `preserves named targets when an agent reconnect follows growth that moves width` - [x] `pnpm exec vue-tsc --noEmit` and `pnpm exec vue-tsc --noEmit -p browser_tests/tsconfig.json` — clean - [x] `pnpm oxlint` (type-aware, whole repo) — no new warnings on `graphMutations.ts`/`nodeDataStore.ts`; `pnpm exec eslint src/workbench/extensions/agent/crdt/graphMutations.ts src/workbench/extensions/agent/crdt/graphMutations.test.ts src/stores/nodeDataStore.ts src/stores/nodeDataStore.test.ts` — clean; `pnpm exec oxfmt --check .` — clean; `pnpm knip` — clean - [x] `pnpm fallow audit --base origin/main` — `complexity_introduced: 2`, `dead_code_introduced: 0`, `duplication_introduced: 0`; the 2 introduced complexity findings are `LGraphCanvas.deselectAll` and `widgetMap.adoptConcreteWidget`, neither touched this round or by this PR — `graphMutations.ts`'s own `prepare`/`commit` findings are still `introduced: false` (pre-existing baseline). The overall verdict is `fail` only from those two plus unrelated inherited styling/complexity drift on `main` since this branch's base; nothing under `src/workbench/extensions/agent/crdt/` or `src/stores/nodeDataStore.ts` is newly introduced. - [x] `pnpm vitest run src/workbench/extensions/agent/crdt/ src/stores/nodeDataStore.test.ts` — 57 files, **885 passed, 5 expected fail** - [ ] The browser spec reorder (fill-then-switch-then-reverify) was not re-executed locally this round — this session had no dev server or backend available. It only reorders existing `test.step`s around already-existing harness methods (`fillSentinelWidgetValues`, `expectSentinelWidgetValues`, `switchTabsAwayAndBack`), with no new harness API surface, and typechecks clean. Hosted CI is the authority for this file, as it was for the prior round's own claim. **Known CI blocker (not addressed here):** `Check for AI agent co-author trailers` fails on 2 pre-existing commits on this branch that need a history rewrite (rewording). Destructive git history operations are outside what this session's own permission system allows regardless of reviewer sign-off; a human with push access to this branch needs to do that reword directly. --------- Co-authored-by: bymyself <cbyrne@comfy.org> Co-authored-by: Amp <amp@ampcode.com>
- agentConversationHostDoc.ts: add HostDoc.subscribeRefused(), backported from #18213 (never backported to core/1.54), which agentFollowerHostSocket.ts (#18275) already calls. - MultiAutogrowRealignHarness.ts: fix mocked PromptResponse to match this branch's apiSchema (no number field, error is required), instead of the main-branch shape the backport picked up. Fixes pnpm typecheck:browser failures in the lint-and-format CI check.
…s multiple autogrow groups (#18512) <!-- ccr-slack-attribution --> _Requested by **Christian Byrne** · [Slack thread](https://comfy-organization.slack.com/archives/C0BGH348Z0C/p1790128455751879?thread_ts=1789965317.152049&cid=C0BGH348Z0C)_ ## Summary Manual backport of #18275 to `core/1.54`, following the same pattern proven for the `cloud/1.54` backport (#18479). **STACKED ON #18509 — do not merge this before #18509 merges.** This branch is based on `backport-17221-to-core-1.54` (#18509's head), not on `origin/core/1.54` directly, because `core/1.54` proper still resolves agent CRDT inputs positionally and lacks the name-based input-targeting architecture from #17221 that #18275 builds directly on top of (`mergeInputSlotsByName`/`hasNonGrowthInputSetChange` in `graphMutations.ts`). Once #18509 merges into `core/1.54`, this PR's base should be retargeted/rebased onto `core/1.54` before merging. ## Conflict resolution notes - `browser_tests/fixtures/agentConversationFixture.ts`: dropped. Doesn't exist on this branch (added by still-unbackported #17875); nothing here imports it, including the new `agentCrdtMultiAutogrowRealign.spec.ts` (only comment references, no real import). - `src/lib/litegraph/src/LGraphCanvas.ts` (`selectItems`): kept this branch's existing body. The only diff was an unrelated `Array.from` → spread refactor from #17048's `ownsSelectable` filter, which isn't on this branch (`ownsSelectable` doesn't exist anywhere in `src/`). - `src/core/graph/widgets/dynamicWidgets.ts`, `AgentPanelRoot.vue`: additive conflicts, took the incoming side. Dropped an incoming `useSettingStore` import in `AgentPanelRoot.vue` (belongs to unbackported #17730, unused here). - `src/workbench/extensions/agent/crdt/graphMutations.ts`: took the new by-name `connect`/`commitUpsertNode` handlers wholesale (the actual fix). Uncovered missing dependency: `linkPresentationStore` (from unbackported #17875). Ported `src/types/linkPresentation.ts` and `src/stores/linkPresentationStore.ts` (+ unit test) from `main`, and wired `const linkPresentationStore = useLinkPresentationStore()`. - `graphMutations.test.ts`: same missing-dependency shape; `useLinkPresentationStore` import ended up unused in the test file, removed it. ## Additional gaps beyond the cloud/1.54 backport's notes (found and verified, not just copied) - `browser_tests/fixtures/agentFollowerHostSocket.ts` was missing (needed by the new `MultiAutogrowRealignHarness.ts`). Ported verbatim from `main`, which required exporting `DOC_PROTOCOL_VERSION` from `docFrameClient.ts` (it was a local `const`). - `commitUpsertNode`'s call to `applyWidgetValues` used a 5th `guardLocalEdits` argument that only exists on `main` via unbackported PR #18361 (the "local-edit guard" feature, already on `cloud/1.54` via #18423 but not on `core/1.54`). Dropped the extra argument to match this branch's existing 4-parameter `applyWidgetValues` — this guard is unrelated to #18275's actual fix (named-link realignment), so dropping it doesn't affect this PR's mechanism; it just means core/1.54 doesn't yet get #18361's separate improvement. - `zAutogrowOptions` import in `graphMutations.ts`: verified this already resolves fine — `@/schemas/nodeDefSchema` re-exports `@comfyorg/object-info-parser`, which already defines it. Not a gap. - `zComfyApiWorkflow` in `workflowSchema.ts` (used by the new `MultiAutogrowRealignHarness.ts`): wasn't exported on this branch (only `ComfyApiWorkflow` the type was). Exported it, matching how `main` already exports it. - `MultiAutogrowRealignHarness.ts` / `savedWorkflowPersistence.ts` imported `PromptResponse`/`UserDataFullInfo` from `@/platform/remote/comfyui/types`, a module that doesn't exist on this older branch. Both types live in `@/schemas/apiSchema` here; fixed the import paths. - `reconcileAutogrowInputs` (new additive export in `dynamicWidgets.ts`) has no caller on this branch — its only call site on `main` is in `agentNodeMaterializer.ts`, added by a separate, unbackported PR (not #18275's own diff, and not #17221's either). Dropped it as dead code rather than smuggling in that unrelated PR's wiring. ## Verification - `pnpm typecheck` — clean - `pnpm exec eslint` on all changed files — clean - `pnpm exec oxfmt --check` on all changed files — clean, all correctly formatted - `pnpm knip` — clean - `pnpm vitest run` on `graphMutations.test.ts`, `dynamicWidgets.test.ts`, `linkStore.test.ts`, `nodeDataStore.test.ts`, `linkPresentationStore.test.ts`, `crdtSession.test.ts`, `agentNodeMaterializer.multiAutogrow.test.ts` — 7 files, 198 passed / 1 expected fail - `pnpm exec playwright test --list` — collects cleanly, no `@e2e/fixtures` resolution errors (2237 tests / 367 files total, including the 2 new specs in `agentCrdtMultiAutogrowRealign.spec.ts`) --------- Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv --- _Generated by [Claude Code](https://claude.ai/code/session_01XqLXka9Jsg8EMTYmsnZjjv)_ --------- Co-authored-by: Ryan Di <ryan.weihao.di@gmail.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: bymyself <cbyrne@comfy.org> Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Claude <noreply@anthropic.com>
Requested by Christian Byrne · Slack thread
Summary
Fixes agent-authored nodes with more than one autogrow group (e.g. a reference node with separate image and video reference groups) losing track of which wire goes where after the agent chat materializes the node.
Changes
Before: For a node like
MiniMaxH3ReferenceToVideo, which has two independent autogrow groups (ref_images,ref_videos) alongside scalar widgets (width,height,length,ref_image_size), both the agent panel and the canvas painted wires onto the wrong inputs after the node was built or reopened — a Load Image could land onref_image_size, a text input onlength, a Math node onref_videos, andwidth/heightcould show as0. The server's own view of the graph was correctly wired, so pressing Run submitted the client's shifted (wrong) values and failed with type errors that didn't actually exist. Reopening the tab reconstructed the slots differently each time.After: For a document that is already correctly wired, projecting it onto the live canvas now lands every wire on the input it was actually connected to, and the value submitted on Run matches what's shown on canvas, regardless of how many autogrow groups the node has or how their growth interleaves with each other and with the node's scalar widgets. This covers the document-to-live projection direction only; the outbound leg (minting a link back into the host document) can still corrupt a node's addressing before this projection ever runs on it — see "Known issue" below and #18332.
node.configure()and autogrow growth (COMFY_AUTOGROW_V3) can reorder or insert a node's live inputs after the agent CRDT follower has already built its link adapters against the saved document's input positions. With one autogrow group this only shifts a couple of neighboring scalar widgets; with two or more groups growing on the same node, the drift compounds across the whole input list. The fix re-points the follower's link adapters, and the incoming reconcile/connect handling, at the input with the same name as the saved slot, instead of the same index — reusing the link realignment ordinary node loading already relies on, and extending the reconcile/connect path to resolve by name. A live-only input (one no document occurrence matches) is retained, rather than dropped along with the rest of the document's positional replacement, only when it classifies as a real autogrow group member — via a live query, this follower's own remembered answer, the node type's staticCOMFY_AUTOGROW_V3definition, or (last resort) the name-shape heuristic; a genuine removal still lets the document win. Duplicate input names on one node are matched pairwise by occurrence (the Nth document occurrence against the Nth live occurrence), not by first match. Node-data-store slot arrays are now refilled in place rather than reassigned, so any reactive view already holding that array keeps its identity across a resync.Live-node provenance
The live-node autogrow-membership port collapsed "the live node can't answer yet" and "the live node answered no" into the same
undefined, so an activate/resubscribe race could drop an explicit-name autogrow spare. The port now returns a taggedunavailable/member/notMemberresult and only the last two are authoritative. When the port isunavailable, provenance falls back in this order: this follower's own remembered live answer, then the node type's own staticCOMFY_AUTOGROW_V3definition, and only then the name-shape heuristic. The membership classification against a static schema (explicitnameslist vs. trailing ordinal) is one predicate shared withdynamicWidgets.ts's live registration rather than a second implementation.Autogrow memory lifecycle (
createAutogrowMemory,graphMutations.ts)The remembered answers are addressable only from the node incarnation that produced them:
GraphMutationsinstance is retained per cloud workflow while resolving the current local workflow's scope on every batch, so the key isrootGraphId+owningGraphId+ node id for remember, read and forget alike.batch()opens a draft beforeprepare(); everymember/notMemberwrite and forget (replace,deleteNode,removeMissing,clearSemanticGraph) is staged into that draft, journaled under the mutation that produced it.commit()applies one mutation's journaled writes to the persisted store immediately after that mutation's own graph effect lands, and only when that effect actually landed — aconnectwhosereplaceLinkreturnsundefined(a stale expected occupant, an ID collision, or a newly-occupied target) never publishes the write it staged. A later mutation in the same batch throwing therefore still keeps every earlier mutation's already-applied write, and aprepare()rejection leaves the persisted store completely untouched. Withinprepare()itself, a mutation can still see an earlier mutation's own staged (not yet committed) answer for the same node — its pending overlay chains onto the nearest earlier-indexed mutation's still-pending one, so two mutations prepared back to back in one batch agree on the same name's classification — but nothing outside that singleprepare()/commit()pass, including a later batch's owncurrentView()reads, ever sees a same-batch mutation's answer before its owncommit()iteration actually applies it.ComfyNodeDefImplit was answered against; a re-registration under the same type name constructs a new one, so the current definition always beats stale memory. Node type is still part of the entry for the case where another writer changes a node's type without this instance observing it.Also fixed a real race in the turn step:
agentConversationStore.ingestonly routesagent_message_donewhile the store already holds the ack'smessage_id, so the host must not answer before the assistant placeholderstartTurnrenders, or the turn hangs on a live Stop button forever.Browser regression
agentCrdtMultiAutogrowRealign.spec.tssets sentinel widget values through the UI and inspects the submitted-prompt payload by name across three scenarios: a same-page tab-switch resubscribe, an actual save-and-reload of the same workflow, and a reload of a workflow whose saved bytes were corrupted after the save. The tab-switch case fills its sentinels before switching tabs and re-verifies those same values afterward, so a reconcile that resets or shifts an existing scalar during replay fails it, not just one that mis-wires a link.Three defects in the reload path (the second and third scenarios) are fixed here:
mockSavedWorkflowPersistencenever served theGET /api/userdata?dir=workflows&...listing (its**/api/userdata/*pattern cannot match a URL with no path segment afteruserdata), so after a reloadworkflowStore'ssyncEntitiessaw an empty listing, dropped the saved path fromopenWorkflowPaths, and the agent panel's workflow picker — which listsopenWorkflows— came up empty. The reopen step then waited on a menu item that could never appear. This is the state the hosted runs were failing in; no timeout could help.encodeURIComponent-encoded userdata path (/api/userdata/workflows%2F<name>.json), so the "the reopen really read the file" assertion polled a counter stuck at zero. It is now counted inside the persistence mock, and only for GETs it actually answered from retained saved bytes.Unsaved Workflowname made the reopen indistinguishable from the fresh tab a reload always offers; it now saves under an explicit name through the Save As UI.Spec structure. The 506-line free-standing scenario function is replaced by a fixture-owned harness (
browser_tests/fixtures/helpers/MultiAutogrowRealignHarness.ts, registered viabrowser_tests/fixtures/multiAutogrowRealignFixture.ts), perbrowser_tests/README.md. The spec file now contains only imports,test.describe,test.describe.configureand threetest()bodies whose acts and assertions read in order. Per-test budgets drop from 240s to 90s/120s/120s.Known issue found while fixing the above (not addressed here)
With the empty picker fixed, the second-turn reattach case reaches its assertions for the first time and fails deterministically: after save → reload → reattach, a link is dropped with
error_reconciling_agent_incompatible_link_type. The live graph is correct (originVIDEO, targetVIDEO); the host document is not — node 2's doc inputs are in document name order (promptat index 4,ref_videos.ref_video_1at index 7) but the link values were written by LIVE position, so"link": 204sits on theprompt(STRING) input and the link tuple reads[204, 1, 3, 2, 4, "VIDEO"].excludeIncompatibleLinksthen correctly refuses it.That is the same positional-vs-named confusion this PR fixes on the inbound path, occurring on the page → host doc leg through the real
applyOpsfrom@comfyorg/comfy-multi-player. Fixing it means changing the mint/outbound leg, which is a different code path needing its own design and regressions.This defect is NOT covered by this PR. It is not exercised by
agentCrdtMultiAutogrowRealign.spec.ts(verifies the inbound/reconcile path only) and it is not exercised byagentFollowerReloadBinding.spec.tseither — that spec reattaches an ordinary scalar widget edit on a single-input node, never a multi-autogrow node, and never mints an outbound link at all. Rather than ship a red test or weaken an assertion in this PR, the reproduction is tracked separately with a real failing unit test: #18332 (branchtest/agent-crdt-outbound-link-position-bug,src/workbench/extensions/agent/crdt/linkMintOutboundPositionCorruption.test.ts).Review Focus
realignInputLinkSlots(already used by ordinary graph loading) is now also invoked after agent materialization; it iterates all of a node's named links in passes, so it isn't limited to a single autogrow group.mergeInputSlotsByName/hasNonGrowthInputSetChangeingraphMutations.ts: a live-only input only survives when it is a widget-promoted input slot (the wire format never carries one as a named input either way) or classifies as an autogrow group member (and, unless the caller opts intopreserveLinkedAutogrow, is unlinked); any other live-only input means the whole input set changed, and the document's list and order replace it positionally. Seedocs/adr/CRDT-INPUTS-0030-preserve-named-input-targets.mdfor the full rule.createAutogrowMemory's read contract: an entry is trusted only when the graph scope, the node type, and the node definition object all still match. Its writes are gated on the producing mutation's own commit result — see "Autogrow memory lifecycle" above.Test plan
does not let one graph scope read another scope's remembered autogrow answer on the same GraphMutations instanceremember()write straight to the real map failsdoes not leak the live answer a rejected batch resolved while preparingnodeDefidentity clause failsprefers a re-registered node definition over an autogrow answer remembered under the definition it replacednodeTypeclause failsdoes not apply a remembered autogrow answer to a node id another writer has since given a different typebeginMutationback to prepare-only failsjournals a connect mutation's commit-time autogrow answer under its own index, not the batch's last-prepared onecommittedgate onconnect's memory publication failsdoes not publish a connect mutation's staged autogrow answer when its own replaceLink fails to landrefillArrayto a spread-basedsplicefailsupdateNode refills a slot list long enough to overflow a spread-based splice, without changing array identitynodeStore.registerNode()beforedeps.layout.createNode()(the pre-fix shape) failskeeps an earlier mutation's remembered autogrow answer when a later mutation in the same batch throws's new node-3-absence assertionshadow(no per-mutation pending overlay /rollbackMutation) failsdoes not leak a failed connect's staged autogrow answer to a later connect in the same batchdeps.layout.createNode()in a type-changingreplaceNode(the pre-fix shape) failskeeps the incumbent node fully intact when a type-changing replace throws creating its layoutcurrentViewto check only the current mutation's own pending overlay and the confirmed shadow failslets a mutation see an earlier mutation's still-pending autogrow answer from the same batch, whiledoes not leak a failed connect's staged autogrow answer to a later connect in the same batch(round 8) keeps passing under the fixed, chained versionpreserveLinkedAutogrow's blanket non-plain-object early return failsdrops a linked, non-plain runtime slot the document dropped, even with preserveLinkedAutogrow setretains a widget-promoted input slot no document snapshot ever lists, and (caught only by the full suite, not this file's own unit tests) regressesagentNodeMaterializer.inputOrder.test.ts'spreserves named targets when an agent reconnect follows growth that moves widthpnpm exec vue-tsc --noEmitandpnpm exec vue-tsc --noEmit -p browser_tests/tsconfig.json— cleanpnpm oxlint(type-aware, whole repo) — no new warnings ongraphMutations.ts/nodeDataStore.ts;pnpm exec eslint src/workbench/extensions/agent/crdt/graphMutations.ts src/workbench/extensions/agent/crdt/graphMutations.test.ts src/stores/nodeDataStore.ts src/stores/nodeDataStore.test.ts— clean;pnpm exec oxfmt --check .— clean;pnpm knip— cleanpnpm fallow audit --base origin/main—complexity_introduced: 2,dead_code_introduced: 0,duplication_introduced: 0; the 2 introduced complexity findings areLGraphCanvas.deselectAllandwidgetMap.adoptConcreteWidget, neither touched this round or by this PR —graphMutations.ts's ownprepare/commitfindings are stillintroduced: false(pre-existing baseline). The overall verdict isfailonly from those two plus unrelated inherited styling/complexity drift onmainsince this branch's base; nothing undersrc/workbench/extensions/agent/crdt/orsrc/stores/nodeDataStore.tsis newly introduced.pnpm vitest run src/workbench/extensions/agent/crdt/ src/stores/nodeDataStore.test.ts— 57 files, 885 passed, 5 expected failtest.steps around already-existing harness methods (fillSentinelWidgetValues,expectSentinelWidgetValues,switchTabsAwayAndBack), with no new harness API surface, and typechecks clean. Hosted CI is the authority for this file, as it was for the prior round's own claim.Known CI blocker (not addressed here):
Check for AI agent co-author trailersfails on 2 pre-existing commits on this branch that need a history rewrite (rewording). Destructive git history operations are outside what this session's own permission system allows regardless of reviewer sign-off; a human with push access to this branch needs to do that reword directly.