Repository navigation
[backport cloud/1.55] fix(agent): stop a run-mode change from overtaking a message already sent - #20611
Conversation
…sent (#18706) ## Summary A run-mode change picked right after Send used to govern the message already sent: the composer clears on the click, but `performSend` awaits `prepareWorkflow()` before issuing the POST, and the server pins a turn's run mode when that POST *arrives* (`resolveRunMode`, run inside `postMessage` before the `202`). `agentSendGateStore` now counts this page's unsettled message POSTs and `agentRunModeStore.save()` waits on that count before writing, bounded only by the gate's own backstop — `MAX_HOLD_MS`, 190s, derived from `api.fetchApi`'s auth-init and response-headers timeouts plus the remint and prepare budgets rather than hand-summed. Page-scoped: a second tab's write is ordered against its own sends only, and closing that needs the ordering point to move to the server. Fixes PM-1660, with the regression test PM-1661 asks for. ## Changes - **What**: new `agentSendGateStore` — a page-global in-flight count, one single-use release per hold, and a backstop so a send that never settles cannot strand the control. `sendMessage` takes a hold before `prepareWorkflow()` and releases however the POST settles; `save()` waits on it inline. `load()` now snapshots `appliedSaveRevision` as well, so a load started inside the hold cannot put the pre-write mode back. `api.fetchApi`'s two request bounds move to `src/scripts/apiTimeouts.ts` so a caller that must *outlast* a request can derive from them: read from `api.ts` they arrive `undefined` under the manual mock, and `NaN` arithmetic arms a timer that fires immediately. - **Breaking**: none. - **Dependencies**: none. ## Review Focus - `MAX_HOLD_MS` is a liveness escape hatch, not the ordering guarantee — the guarantee is the release in `sendMessage`'s `finally`. The budget covering `getAuthHeader()` and the unified-user wait is explicit, not provable; a provable bound needs an overall send deadline or a release tied to dispatch, and both change send behaviour beyond this fix. There is deliberately no test asserting the budget covers the window: the constant is derived from the same timeouts the window is built from, so raising one raises both sides and such a test cannot fail. - Two residuals documented in `agentSendGateStore`'s docblock rather than closed: a client-side abort or network error ends the hold without proving the server discarded the POST (it turns on whether cloud cancels on client disconnect, which needs an experiment against the service), and the hold starts in `sendMessage` rather than at `startSubmission`, leaving one consent round trip on an account's first message. ## Verification Local, at `5b66a27` (branch merged with `main`): - `pnpm vitest run src/workbench/extensions/agent src/scripts` — 190 files, 3548 passed, 0 failures. - `pnpm typecheck` and `pnpm format:check` clean; `oxlint --type-aware` and `eslint` clean on the changed files. The whole-repo `oxlint --type-aware` pass is killed by the dev host on an unmodified tree too, so it ran per-file through the pre-commit hook and in CI. - Every new unit test was confirmed red against the code it protects: removing the gate wiring from `sendMessage` fails both `useAgentSession.test.ts` cases; removing the superseded-revision check fails `sends only the latest of two picks parked on one send`; reverting `load()`'s second snapshot fails `does not let a load started during the hold undo the saved mode`; removing the backstop fails both `agentSendGateStore.test.ts` cases by assertion rather than by timeout. - The `@cloud` Playwright spec is not runnable on the dev host (the agent panel's entry button does not render against a local CPU backend), so CI is its only real run. Its setup assertion was racing `agentRunModeStore.load()` and reaching its own assertion only on a fourth attempt; `db9a0c9` removes the race, and the no-retry `playwright-video-new-tests (cloud)` job passed at that head. Tests live in `agentSendGateStore.test.ts` (new), `agentRunModeStore.test.ts`, `useAgentSession.test.ts`, and `browser_tests/tests/agent/agentRunModePopover.spec.ts` (PM-1661). --------- Co-authored-by: glary <glary@comfy.org>
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 2154 passed, 0 failed · 1 flaky📊 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. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since c29c2cd311a52f3348ca8fc4c9691b9031b950d3
Full docs: ADR-DEVEX-LINT-0015 🧩 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 📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-10-09T01:47:09.305Z",
"gitSha": "27d81ab303960ccf08c7b30170cc22d881470f77",
"branch": "backport-18706-to-cloud-1.55",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2006.900000000087,
"styleRecalcs": 9,
"styleRecalcDurationMs": 9.035,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 471.34400000000005,
"heapDeltaBytes": -11354136,
"heapUsedBytes": 57915724,
"domNodes": -261,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 9.247000000000002,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-idle",
"durationMs": 1999.5409999999083,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.55,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 458.6940000000001,
"heapDeltaBytes": 3934224,
"heapUsedBytes": 73149880,
"domNodes": -262,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 9.299000000000001,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1725.3409999999576,
"styleRecalcs": 44,
"styleRecalcDurationMs": 14.278,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 827.1510000000001,
"heapDeltaBytes": 4704488,
"heapUsedBytes": 73888648,
"domNodes": -261,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 163.527,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1773.8429999999425,
"styleRecalcs": 45,
"styleRecalcDurationMs": 16.154999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 840.748,
"heapDeltaBytes": 4661256,
"heapUsedBytes": 73906024,
"domNodes": -260,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 170.17,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1732.071000000019,
"styleRecalcs": 31,
"styleRecalcDurationMs": 15.855,
"layouts": 6,
"layoutDurationMs": 1.1769999999999998,
"taskDurationMs": 380.20500000000004,
"heapDeltaBytes": 3254104,
"heapUsedBytes": 72325472,
"domNodes": 76,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 15.118,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1722.8220000001784,
"styleRecalcs": 31,
"styleRecalcDurationMs": 16.102,
"layouts": 6,
"layoutDurationMs": 1.038,
"taskDurationMs": 338.642,
"heapDeltaBytes": 3638536,
"heapUsedBytes": 72833680,
"domNodes": 77,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 12.380000000000003,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 642.2000000000025,
"styleRecalcs": 14,
"styleRecalcDurationMs": 9.516,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 451.133,
"heapDeltaBytes": 18217696,
"heapUsedBytes": 87224308,
"domNodes": 20,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 165.702,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 653.0550000002222,
"styleRecalcs": 13,
"styleRecalcDurationMs": 7.9319999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 452.263,
"heapDeltaBytes": -7689588,
"heapUsedBytes": 61457900,
"domNodes": 18,
"jsHeapTotalBytes": 6553600,
"scriptDurationMs": 164.79899999999998,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 1348.1859999999415,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1046.769,
"heapDeltaBytes": 29917216,
"heapUsedBytes": 102041304,
"domNodes": -297,
"jsHeapTotalBytes": 19288064,
"scriptDurationMs": 85.75399999999999,
"eventListeners": -217,
"totalBlockingTimeMs": 715,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 1238.6659999999665,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 906.152,
"heapDeltaBytes": 12754640,
"heapUsedBytes": 104769840,
"domNodes": -296,
"jsHeapTotalBytes": 21385216,
"scriptDurationMs": 75.05099999999999,
"eventListeners": -195,
"totalBlockingTimeMs": 619,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 860.178000000019,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 495.7339999999997,
"heapDeltaBytes": 15462956,
"heapUsedBytes": 92220144,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 172.97600000000003,
"eventListeners": 0,
"totalBlockingTimeMs": 234,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 860.0550000001022,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 485.652,
"heapDeltaBytes": 14814060,
"heapUsedBytes": 91534640,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 162.823,
"eventListeners": 0,
"totalBlockingTimeMs": 236,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "extension-clean-combined-draw",
"durationMs": 10667.45800000001,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9766.324999999999,
"heapDeltaBytes": 18963164,
"heapUsedBytes": 97476272,
"domNodes": -268,
"jsHeapTotalBytes": -8192,
"scriptDurationMs": 8096.428,
"eventListeners": -174,
"totalBlockingTimeMs": 1366,
"frameDurationMs": 20.00000000000006,
"p95FrameDurationMs": 50
},
{
"name": "extension-clean-combined-draw",
"durationMs": 10926.637000000028,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9922.322000000002,
"heapDeltaBytes": 12119816,
"heapUsedBytes": 93825712,
"domNodes": -12,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 8562.155999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 1458,
"frameDurationMs": 20,
"p95FrameDurationMs": 50
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 10326.248000000078,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9415.691,
"heapDeltaBytes": 153524,
"heapUsedBytes": 81574148,
"domNodes": -12,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 8072.598000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 1270,
"frameDurationMs": 18.889999999999965,
"p95FrameDurationMs": 50
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 11168.766000000005,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10241.38,
"heapDeltaBytes": 3772284,
"heapUsedBytes": 85388364,
"domNodes": -16,
"jsHeapTotalBytes": 4194304,
"scriptDurationMs": 8632.334,
"eventListeners": 0,
"totalBlockingTimeMs": 1448,
"frameDurationMs": 20,
"p95FrameDurationMs": 50
},
{
"name": "large-graph-idle",
"durationMs": 2021.5460000000576,
"styleRecalcs": 8,
"styleRecalcDurationMs": 8.288,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 522.513,
"heapDeltaBytes": -16147700,
"heapUsedBytes": 73899372,
"domNodes": -242,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 34.969,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2071.907999999894,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.860999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 562.3560000000001,
"heapDeltaBytes": -23296396,
"heapUsedBytes": 66528860,
"domNodes": -256,
"jsHeapTotalBytes": 4485120,
"scriptDurationMs": 35.433,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2334.0500000000475,
"styleRecalcs": 69,
"styleRecalcDurationMs": 13.891,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1643.722,
"heapDeltaBytes": -23503800,
"heapUsedBytes": 66762476,
"domNodes": -244,
"jsHeapTotalBytes": 28672,
"scriptDurationMs": 874.74,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2331.5739999998186,
"styleRecalcs": 66,
"styleRecalcDurationMs": 11.423999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1610.635,
"heapDeltaBytes": 1113792,
"heapUsedBytes": 65990188,
"domNodes": -252,
"jsHeapTotalBytes": 786432,
"scriptDurationMs": 893.2909999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3558.15999999993,
"styleRecalcs": 69,
"styleRecalcDurationMs": 14.381999999999996,
"layouts": 60,
"layoutDurationMs": 14.198,
"taskDurationMs": 1607.4069999999997,
"heapDeltaBytes": 25892328,
"heapUsedBytes": 91131008,
"domNodes": -224,
"jsHeapTotalBytes": 786432,
"scriptDurationMs": 832.69,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3507.027999999991,
"styleRecalcs": 69,
"styleRecalcDurationMs": 12.709999999999999,
"layouts": 60,
"layoutDurationMs": 12.857999999999999,
"taskDurationMs": 1461.4040000000002,
"heapDeltaBytes": 88532,
"heapUsedBytes": 65847476,
"domNodes": 32,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 789.48,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 3183.5989999999583,
"styleRecalcs": 44,
"styleRecalcDurationMs": 12.534000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2009.051,
"heapDeltaBytes": -9473208,
"heapUsedBytes": 83639936,
"domNodes": -239,
"jsHeapTotalBytes": -339968,
"scriptDurationMs": 1033.6570000000002,
"eventListeners": 28,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2747.659999999996,
"styleRecalcs": 43,
"styleRecalcDurationMs": 7.464000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1687.941,
"heapDeltaBytes": 7330116,
"heapUsedBytes": 73018392,
"domNodes": 6,
"jsHeapTotalBytes": 192512,
"scriptDurationMs": 973.947,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2049.7649999999794,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.9910000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 597.49,
"heapDeltaBytes": -18179456,
"heapUsedBytes": 72862072,
"domNodes": -245,
"jsHeapTotalBytes": 28672,
"scriptDurationMs": 40.765,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "minimap-idle",
"durationMs": 2026.4139999999315,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.979,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 559.0979999999998,
"heapDeltaBytes": -23746808,
"heapUsedBytes": 67205692,
"domNodes": -259,
"jsHeapTotalBytes": 3436544,
"scriptDurationMs": 39.43299999999999,
"eventListeners": -174,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 603.313000000071,
"styleRecalcs": 47,
"styleRecalcDurationMs": 10.665000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 429.9240000000001,
"heapDeltaBytes": 12935580,
"heapUsedBytes": 83968800,
"domNodes": 20,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 147.39599999999996,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 591.9659999999567,
"styleRecalcs": 48,
"styleRecalcDurationMs": 12.195,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 402.539,
"heapDeltaBytes": 13503304,
"heapUsedBytes": 83980292,
"domNodes": 22,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 145.32,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2020.768999999973,
"styleRecalcs": 11,
"styleRecalcDurationMs": 8.374,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 443.829,
"heapDeltaBytes": -15157920,
"heapUsedBytes": 55851648,
"domNodes": -275,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 7.364000000000001,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-idle",
"durationMs": 2001.0899999999765,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.6819999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 451.59800000000007,
"heapDeltaBytes": 9878860,
"heapUsedBytes": 80896792,
"domNodes": -277,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 8.301999999999998,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1706.6979999999603,
"styleRecalcs": 45,
"styleRecalcDurationMs": 14.902999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 770.456,
"heapDeltaBytes": -6406304,
"heapUsedBytes": 64625256,
"domNodes": -275,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 110.54299999999999,
"eventListeners": -220,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1718.8989999999649,
"styleRecalcs": 45,
"styleRecalcDurationMs": 13.037,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 715.246,
"heapDeltaBytes": 4681340,
"heapUsedBytes": 75929408,
"domNodes": -278,
"jsHeapTotalBytes": 6545408,
"scriptDurationMs": 102.871,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 966.2089999999353,
"styleRecalcs": 17,
"styleRecalcDurationMs": 30.847000000000005,
"layouts": 5,
"layoutDurationMs": 13.696,
"taskDurationMs": 774.7520000000001,
"heapDeltaBytes": -6316460,
"heapUsedBytes": 84737236,
"domNodes": 13667,
"jsHeapTotalBytes": 11010048,
"scriptDurationMs": 29.345999999999997,
"eventListeners": 2383,
"totalBlockingTimeMs": 146,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "viewport-pan-sweep",
"durationMs": 8535.989999999969,
"styleRecalcs": 250,
"styleRecalcDurationMs": 39.878,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5897.476000000001,
"heapDeltaBytes": -23998528,
"heapUsedBytes": 65899644,
"domNodes": -241,
"jsHeapTotalBytes": 28672,
"scriptDurationMs": 2898.117,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8340.553,
"styleRecalcs": 250,
"styleRecalcDurationMs": 38.559999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5636.071,
"heapDeltaBytes": 312220,
"heapUsedBytes": 88954992,
"domNodes": -216,
"jsHeapTotalBytes": 2875392,
"scriptDurationMs": 2858.029,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 17326.120999999945,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16902.403,
"heapDeltaBytes": -55761964,
"heapUsedBytes": 186783468,
"domNodes": -8061,
"jsHeapTotalBytes": -7987200,
"scriptDurationMs": 279.54400000000004,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 17058.07300000015,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16483.264,
"heapDeltaBytes": -63626584,
"heapUsedBytes": 176835404,
"domNodes": -8061,
"jsHeapTotalBytes": -18591744,
"scriptDurationMs": 290.25399999999996,
"eventListeners": -14928,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20998.97199999998,
"styleRecalcs": 152,
"styleRecalcDurationMs": 19.566,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20795.022000000004,
"heapDeltaBytes": -34773320,
"heapUsedBytes": 192948120,
"domNodes": -8061,
"jsHeapTotalBytes": -16785408,
"scriptDurationMs": 985.9169999999999,
"eventListeners": -14928,
"totalBlockingTimeMs": 165,
"frameDurationMs": 17.77333333333336,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20839.422000000013,
"styleRecalcs": 154,
"styleRecalcDurationMs": 17.93,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20572.623999999996,
"heapDeltaBytes": -64643928,
"heapUsedBytes": 170328676,
"domNodes": -8061,
"jsHeapTotalBytes": -11546624,
"scriptDurationMs": 938.9390000000001,
"eventListeners": -14928,
"totalBlockingTimeMs": 169,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-node-resize-workload",
"durationMs": 6297.939999999926,
"styleRecalcs": 20,
"styleRecalcDurationMs": 81.696,
"layouts": 20,
"layoutDurationMs": 25.941999999999993,
"taskDurationMs": 6205.585,
"heapDeltaBytes": -39798536,
"heapUsedBytes": 182716000,
"domNodes": -8061,
"jsHeapTotalBytes": 11857920,
"scriptDurationMs": 108.23400000000001,
"eventListeners": -14928,
"totalBlockingTimeMs": 553,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-node-resize-workload",
"durationMs": 6388.065999999981,
"styleRecalcs": 20,
"styleRecalcDurationMs": 92.83800000000004,
"layouts": 20,
"layoutDurationMs": 26.666000000000007,
"taskDurationMs": 6351.268,
"heapDeltaBytes": -66332224,
"heapUsedBytes": 175467944,
"domNodes": -8061,
"jsHeapTotalBytes": 1896448,
"scriptDurationMs": 131.551,
"eventListeners": -14928,
"totalBlockingTimeMs": 492,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8635.602000000063,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8471.457,
"heapDeltaBytes": -7342188,
"heapUsedBytes": 178127624,
"domNodes": 0,
"jsHeapTotalBytes": -17301504,
"scriptDurationMs": 140.91000000000008,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8680.122999999867,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8496.232000000002,
"heapDeltaBytes": 36318280,
"heapUsedBytes": 198619236,
"domNodes": 0,
"jsHeapTotalBytes": -8650752,
"scriptDurationMs": 134.7569999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 129.31600000001708,
"styleRecalcs": 8,
"styleRecalcDurationMs": 21.751,
"layouts": 4,
"layoutDurationMs": 1.911,
"taskDurationMs": 92.81400000000001,
"heapDeltaBytes": 3179432,
"heapUsedBytes": 69782112,
"domNodes": 131,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 9.664,
"eventListeners": 17,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "workflow-execution",
"durationMs": 101.31099999989601,
"styleRecalcs": 8,
"styleRecalcDurationMs": 16.055,
"layouts": 3,
"layoutDurationMs": 1.063,
"taskDurationMs": 81.57899999999998,
"heapDeltaBytes": 3061292,
"heapUsedBytes": 69985192,
"domNodes": 106,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 6.465,
"eventListeners": 33,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## cloud/1.55 #20611 +/- ##
=============================================
Coverage ? 85.08%
=============================================
Files ? 2359
Lines ? 135262
Branches ? 36576
=============================================
Hits ? 115086
Misses ? 19811
Partials ? 365
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 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 |
|---|---|
| 🟡 Medium | 6 |
| 🟢 Low | 4 |
Panel: 8/8 reviewers contributed findings.
| // one remounted mid-write) and both wake on the same release, so their | ||
| // PUTs would race and the server would keep whichever landed last. | ||
| if (revision !== saveRevision) return | ||
| applySaved(await api.putRunMode(next)) |
There was a problem hiding this comment.
🟡 Medium — The revision !== saveRevision guard only serializes saves that both parked on the gate; two saves that each pass it (two popover instances, or one picked just as the gate releases, since the savingMode guard is per-popover) both dispatch api.putRunMode and their PUTs race. The server keeps whichever lands last — possibly the earlier pick — while the client's appliedSaveRevision guard keeps the newer one displayed, so UI and server disagree on a consent-relevant setting until the next load. Tracking in-flight writes and re-checking the revision after the response, or serializing saves through a shared promise chain, would close it. Raised by 5 of 8 reviewers (gpt-5.6-sol-max adversarial, gemini-3.1-pro adversarial, claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial, kimi-k3-max edge-case).
| clearTimeout(backstop) | ||
| inFlight.value = Math.max(0, inFlight.value - 1) | ||
| } | ||
| const backstop = setTimeout(release, MAX_HOLD_MS) |
There was a problem hiding this comment.
🟡 Medium — The backstop releases on a wall-clock budget rather than on evidence the POST reached the server, and SEND_PRELUDE_BUDGET_MS/REMINT_BUDGET_MS cover work this file itself documents as having no ceiling (getAuthHeader(), shouldRemintCloudRequest()'s dynamic import, the unified-user wait before the mint). If the prelude overruns its 30s budget the gate opens while the POST is still undispatched, the parked run-mode PUT goes out first, and the server pins the already-sent turn to the newer mode — the PM-1660 escalation this store exists to prevent. Tying the release to request dispatch, or giving fetchApi an overall deadline, would make this a bound instead of a budget. Raised by 5 of 8 reviewers (claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial, kimi-k3-max adversarial, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max edge-case).
| ) | ||
| } finally { | ||
| sending.value = false | ||
| releaseSendGate() |
There was a problem hiding this comment.
🟡 Medium — Releasing in finally ends the hold on any settle, including a client-side abort: fetchApi aborts at FETCH_RESPONSE_HEADERS_TIMEOUT_MS (60s) with the request body already on the wire, so against a slow backend the gate opens, the parked run-mode PUT lands, and the server then processes the queued POST under the new mode. A 60s headers timeout against a busy backend is routine, which makes this more reachable than the backstop case. Either hold through ambiguous failures or carry the intended mode on the POST itself. Raised by 4 of 8 reviewers (claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, kimi-k3-max edge-case).
| } | ||
| promptEditState.value = { phase: 'idle' } | ||
| sending.value = true | ||
| const releaseSendGate = sendGateStore.begin() |
There was a problem hiding this comment.
🟡 Medium — The hold starts at sendMessage, but useAgentDraftSubmission.submit already cleared the composer (so the UI looks sent) and AgentPanelRoot's send awaits the first-message consent dialog and waitForCoachCompletion before reaching here. Both are user-paced with no ceiling and no hold, so a run-mode pick made in that window still reaches the server ahead of the POST. The store's doc calls this "one consent round trip", which understates an arbitrarily long window; taking the hold at startSubmission and threading the release through would close it. Raised by 4 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial).
| // back-to-back second save to supersede this one before it reaches the | ||
| // revision check below, so the first never sends its PUT. | ||
| const sendGate = useAgentSendGateStore() | ||
| if (sendGate.isSending) await until(() => sendGate.isSending).toBe(false) |
There was a problem hiding this comment.
🟡 Medium — This orders a PUT after an in-flight POST, but nothing orders a POST after an in-flight PUT: picking a stricter mode (auto to ask_approval) and then sending before the write lands leaves the server pinning that turn to the old permissive mode, the same unapproved-run outcome PM-1660 describes. RunModePopover is non-modal, so the UI actively permits clicking into the composer and sending while savingMode is still set. The symmetric guard — having sendMessage wait on unacknowledged run-mode writes — is missing. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).
| * holding on every ambiguous failure would change behaviour for every failed | ||
| * send. | ||
| */ | ||
| export const useAgentSendGateStore = defineStore('agentSendGate', () => { |
There was a problem hiding this comment.
🟡 Medium — The gate is page-scoped while the server resolves run mode per user, so a PUT from a second tab, window, or device is ordered only against that client's own sends and can still overtake this page's in-flight POST, re-authorizing a turn the user sent under a stricter mode. Two agent panels open is ordinary usage, so the authorization-ordering defect stays reachable; the durable fix is carrying the mode on the POST or pinning it server-side against the client's stated mode. The docblock acknowledges this — flagged so the follow-up is tracked rather than left in a comment. Raised by 3 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial).
| // A second pick can park on the same gate (two popover instances, or | ||
| // one remounted mid-write) and both wake on the same release, so their | ||
| // PUTs would race and the server would keep whichever landed last. | ||
| if (revision !== saveRevision) return |
There was a problem hiding this comment.
🟢 Low — The superseded branch resolves save() successfully without issuing a PUT or calling apply, and RunModePopover.onSelectMode cannot tell that apart from a real write: it fires trackAgentRunModeChanged({ from, to }) and closes the popover for a mode that was never persisted, while the radio group still shows the previous mode. Analytics then reports run-mode changes that did not happen, and if the superseding save later fails the user sees one error for two discarded picks. Returning a discriminated result, or throwing a dedicated superseded signal, would let the caller skip the telemetry. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, claude-opus-5-thinking-max adversarial).
| // The server pins a turn's run mode when that turn's POST ARRIVES, not | ||
| // when the user pressed send, so a mode written while the composer | ||
| // already looks sent overtakes the message and re-authorizes it | ||
| // (PM-1660). Bounded by the gate's own MAX_HOLD_MS and nothing else: a |
There was a problem hiding this comment.
🟢 Low — "Bounded by the gate's own MAX_HOLD_MS and nothing else" holds only for a single hold: the wait is on inFlight reaching zero and each begin() arms its own independent backstop, so overlapping holds extend this park with no ceiling. sendMessage's if (sending.value) guard is the only reason that is latent today — a second AgentPanelRoot or any future begin() caller makes the write starvable while the control stays disabled. Even with one hold, RunModePopover disables every option for up to ~190s after a stalled send with no cancel path; a real deadline on the park, or a comment naming the serialization it depends on, would help. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).
| await Promise.race([ | ||
| until(isInitialized).toBe(true), | ||
| promiseTimeout(10000) | ||
| promiseTimeout(AUTH_INIT_TIMEOUT_MS) |
There was a problem hiding this comment.
🟢 Low — VueUse's promiseTimeout defaults throwOnTimeout to false, so it resolves on timeout, Promise.race settles normally, and the catch never runs — an auth-init timeout is completely silent. Pass promiseTimeout(AUTH_INIT_TIMEOUT_MS, true) to make the warning fire. Separately, the losing until(isInitialized).toBe(true) arm is not cancelled by the race, leaving a live watcher per timed-out call. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, gemini-3.1-pro edge-case).
| await vi.waitFor(() => expect(postMessage).toHaveBeenCalled()) | ||
| session.newChat('new_chat_button') | ||
|
|
||
| expect(gate.isSending).toBe(true) |
There was a problem hiding this comment.
🟢 Low — The comment above this test claims it pins the gate being taken "before performSend awaits prepareWorkflow()", but the only isSending === true assertion runs after vi.waitFor(() => expect(postMessage).toHaveBeenCalled()). Moving begin() down to just before postTurn would keep this green while reopening a PREPARE_TIMEOUT_MS-wide (3s) window of exactly the PM-1660 race. Asserting gate.isSending while prepareWorkflow's promise is still pending would cover the stated claim. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).
christian-byrne
left a comment
There was a problem hiding this comment.
Backport fidelity check: sorted +/- lines against merged origin #18706 are identical (verified at head 81be644); no package.json touched. All 110 checks settled, no failures. The 10 unresolved Cursor-panel threads are carried over verbatim from #18706 and were not introduced by this backport. Approving to clear the cloud/1.55 branch-protection requirement.
…ng a message already sent (#20763) ## Summary Backport of [#18706](#18706) (`8bcbd9f3cd`) to `core/1.56`. The fix stops a run-mode change picked right after Send from governing the message already sent (PM-1660), with the regression test PM-1661 asks for. The 1.55 line already has this fix via [#20611](#20611). `core/1.56` and `cloud/1.56` did not, and `1.56` is what production serves — so the user-visible defect is still reachable on the served build. ## Changes - **What**: cherry-pick of `8bcbd9f3cd`. The applied delta is line-for-line identical to the merged `main` commit (9 files, +495/-7), verified by comparing the added/removed lines of this diff against `git show 8bcbd9f`. - **Breaking**: none. - **Dependencies**: none. ## Review Focus One conflict, in `src/scripts/api.ts`, and it is pure context adjacency rather than semantics. The upstream hunk deletes `const FETCH_RESPONSE_HEADERS_TIMEOUT_MS = 60_000` so the value can be imported from the new leaf module `src/scripts/apiTimeouts.ts`. On this release branch the PM-1802 `AuthScheme` type sits immediately after that constant, inside the same hunk, so git could not place the deletion. Resolved by deleting only the constant and keeping the `AuthScheme` docblock and type untouched. No behaviour was weakened to make the pick apply. ## Verification - Applied-delta equality against the merged `main` fix, as above. - Required checks at this exact head (`lint-and-format`, `test`, `e2e-status`) are the real run; the `@cloud` Playwright spec in `browser_tests/tests/agent/agentRunModePopover.spec.ts` is not runnable against a local CPU backend, which is the same constraint #18706 recorded. Co-authored-by: glary <glary@comfy.org>
…ing a message already sent (#20764) ## Summary Backport of [#18706](#18706) (`8bcbd9f3cd`) to `cloud/1.56`. The fix stops a run-mode change picked right after Send from governing the message already sent (PM-1660), with the regression test PM-1661 asks for. The 1.55 line already has this fix via [#20611](#20611). `core/1.56` and `cloud/1.56` did not, and `1.56` is what production serves — so the user-visible defect is still reachable on the served build. ## Changes - **What**: cherry-pick of `8bcbd9f3cd`. The applied delta is line-for-line identical to the merged `main` commit (9 files, +495/-7), verified by comparing the added/removed lines of this diff against `git show 8bcbd9f`. - **Breaking**: none. - **Dependencies**: none. ## Review Focus One conflict, in `src/scripts/api.ts`, and it is pure context adjacency rather than semantics. The upstream hunk deletes `const FETCH_RESPONSE_HEADERS_TIMEOUT_MS = 60_000` so the value can be imported from the new leaf module `src/scripts/apiTimeouts.ts`. On this release branch the PM-1802 `AuthScheme` type sits immediately after that constant, inside the same hunk, so git could not place the deletion. Resolved by deleting only the constant and keeping the `AuthScheme` docblock and type untouched. No behaviour was weakened to make the pick apply. ## Verification - Applied-delta equality against the merged `main` fix, as above. - Required checks at this exact head (`lint-and-format`, `test`, `e2e-status`) are the real run; the `@cloud` Playwright spec in `browser_tests/tests/agent/agentRunModePopover.spec.ts` is not runnable against a local CPU backend, which is the same constraint #18706 recorded. Co-authored-by: glary <glary@comfy.org>
Backport of #18706 to
cloud/1.55Automatically created by backport workflow.