Repository navigation
feat(agent): paste an image into the agent composer to attach it - #18248
Conversation
The composer editor's handlePaste unconditionally claimed every paste and inserted clipboard text, so an image paste dispatched an empty insertText and returned handled: the image was dropped and nothing attached. Claim the paste for clipboard files the composer can attach and route them through the existing drag-and-drop upload path. Clipboard screenshots often arrive unnamed, so name them from their MIME type before the extension-based attachable check and the upload, which rejects an empty filename. The canvas paste listener judges ownership by event target and a rich-text surface is not an input element, so it also handled these pastes and left a stray LoadImage node behind; it now defers to an already-claimed paste.
…d rename Review found the paste branch returned before reading text/plain, so a clipboard carrying a bitmap alongside text - a spreadsheet or document copy - attached the image and silently discarded the text. Insert the pasted content first and attach afterwards. Staging an attachment rewrites the prompt through the store, so emitting first let the editor write its pre-attachment document back over the staged asset; ordering it this way keeps both. A files-only clipboard still skips the insert, which would otherwise delete the selection it was pasted over. Chromium hands a pasted screenshot over as image.png, measured against a real clipboard, so the MIME-derived rename never ran and is removed along with the invalid extension it produced for image/svg+xml. Cover the paste path end to end in AgentPanelRoot, which is what pins the composer-to-panel forwarding the feature rides on.
The handler returns before its first await, so waiting for the negative assertion only risks tolerating a later call.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (11)
Included review availability: This review used your included allowance. 9 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour. Your free on-demand review promotion remains active until October 9, 2026 at 6:00 PM UTC. 📝 WalkthroughWalkthroughThe change adds clipboard file attachment handling to the agent composer. It preserves applicable text and workflow references, forwards attachable files for staging, and records paste attachment telemetry after successful staging. The generic paste handler now ignores events that were already prevented. ChangesPaste and agent attachments
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Clipboard
participant InlinePromptEditor
participant Composer
participant AgentPanel
participant AgentPanelRoot
Clipboard->>InlinePromptEditor: paste files and text
InlinePromptEditor->>InlinePromptEditor: filter files and insert applicable text
InlinePromptEditor->>Composer: emit attachFiles(File[])
Composer->>AgentPanel: forward attachFiles(File[])
AgentPanel->>AgentPanelRoot: forward attach-files(File[])
AgentPanelRoot->>AgentPanelRoot: stage files and track successful paste attachment
Suggested reviewers: Merge Risk: 🟡 Moderate · up to Pasting text that also carries an attachable image can upload the image before the user sends the agent prompt. Confirm this is intended before merging. 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: End-To-End Regression Coverage For FixesExplanation The PR contains bug-fix signals, including commit subjects
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
No changes made — the CodeRabbit comment above is its rate-limit notice ("Review paused — included plan limit reached"), not review feedback. It produced no findings against any of the 10 files, so there is nothing to address. The branch is unchanged and still at For what it's worth, the change has already been through two rounds of independent review. The first round caught a real bug — the paste branch returned before reading |
🎭 Playwright: ✅ 2154 passed, 0 failed📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook🌾 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 (15 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 a40d05b4aef3f14be6fe8ed7aff07f3e11ec5789
Full docs: ADR-DEVEX-LINT-0015 📦 Bundle: 10 MB gzipDetailsSummary
Category Glance App Entry Points — 3.77 kBMain entry bundles and manifests
Status: 1 added Graph Workspace — 1.45 MBGraph editor runtime, canvas, workflow orchestration
Status: 3 added Views & Navigation — 134 kBTop-level views, pages, and routed surfaces
Status: 18 added Panels & Settings — 640 kBConfiguration panels, inspectors, and settings screens
Status: 28 added User & Accounts — 39.4 kBAuthentication, profile, and account management bundles
Status: 11 added Editors & Dialogs — 126 kBModals, dialogs, drawers, and in-app editors
Status: 8 added UI Components — 125 kBReusable component library chunks
Status: 16 added Data & Services — 4.01 MBStores, services, APIs, and repositories
Status: 15 added Utilities & Hooks — 579 kBHelpers, composables, and utility bundles
Status: 36 added Vendor & Third-Party — 17.4 MBExternal libraries and shared vendor chunks
Status: 18 added Other — 17.9 MBBundles that do not match a named category
Status: 301 added ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-09-28T06:30:39.302Z",
"gitSha": "cfcbb52ef349b63fb3f535642c2ae726aebad7bd",
"branch": "glary/agent-paste-image-attach",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2039.447999999993,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.623000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 576.994,
"heapDeltaBytes": -33778056,
"heapUsedBytes": 64582292,
"domNodes": -228,
"jsHeapTotalBytes": 2359296,
"scriptDurationMs": 14.547000000000004,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66639344262295,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-idle",
"durationMs": 2046.0959999999204,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.318,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 557.3280000000001,
"heapDeltaBytes": -16342552,
"heapUsedBytes": 62410880,
"domNodes": -228,
"jsHeapTotalBytes": -1048576,
"scriptDurationMs": 13.971999999999998,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.6655737704918,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1925.7349999999747,
"styleRecalcs": 73,
"styleRecalcDurationMs": 21.247000000000003,
"layouts": 12,
"layoutDurationMs": 4.81,
"taskDurationMs": 991.7069999999999,
"heapDeltaBytes": 832828,
"heapUsedBytes": 79568808,
"domNodes": -228,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 187.871,
"eventListeners": -164,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.665517241379316,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1858.8260000000218,
"styleRecalcs": 70,
"styleRecalcDurationMs": 18.148999999999997,
"layouts": 12,
"layoutDurationMs": 4.2170000000000005,
"taskDurationMs": 922.534,
"heapDeltaBytes": -19495232,
"heapUsedBytes": 79066140,
"domNodes": -228,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 177.97400000000002,
"eventListeners": -164,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.817272727272734,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1759.5910000000003,
"styleRecalcs": 34,
"styleRecalcDurationMs": 13.383,
"layouts": 6,
"layoutDurationMs": 1.42,
"taskDurationMs": 437.93499999999995,
"heapDeltaBytes": -18749228,
"heapUsedBytes": 79876200,
"domNodes": 53,
"jsHeapTotalBytes": 7864320,
"scriptDurationMs": 17.858999999999998,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1757.7270000000453,
"styleRecalcs": 33,
"styleRecalcDurationMs": 12.075,
"layouts": 6,
"layoutDurationMs": 1.3860000000000001,
"taskDurationMs": 420.74100000000004,
"heapDeltaBytes": -18652088,
"heapUsedBytes": 79944100,
"domNodes": 53,
"jsHeapTotalBytes": 7340032,
"scriptDurationMs": 16.644,
"eventListeners": 15,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.665714285714284,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 801.5129999999999,
"styleRecalcs": 13,
"styleRecalcDurationMs": 4.593,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 520.3299999999999,
"heapDeltaBytes": 18259220,
"heapUsedBytes": 96821576,
"domNodes": 0,
"jsHeapTotalBytes": 3670016,
"scriptDurationMs": 189.556,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66808510638299,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 748.8299999999981,
"styleRecalcs": 12,
"styleRecalcDurationMs": 4.416999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 499.444,
"heapDeltaBytes": -2817548,
"heapUsedBytes": 95434840,
"domNodes": 0,
"jsHeapTotalBytes": 7602176,
"scriptDurationMs": 172.902,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.665909090909075,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 1280.3659999999581,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 988.1669999999999,
"heapDeltaBytes": 6187696,
"heapUsedBytes": 83738420,
"domNodes": 0,
"jsHeapTotalBytes": 3047424,
"scriptDurationMs": 79.06200000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 649,
"frameDurationMs": 37.74411764705883,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-dense-n200-w200-i120",
"durationMs": 1298.6830000000964,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1003.2890000000001,
"heapDeltaBytes": 9104656,
"heapUsedBytes": 84963756,
"domNodes": 0,
"jsHeapTotalBytes": 4358144,
"scriptDurationMs": 70.87299999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 666,
"frameDurationMs": 38.23235294117646,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 876.0120000000029,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 522.8160000000006,
"heapDeltaBytes": 15894848,
"heapUsedBytes": 89254524,
"domNodes": 0,
"jsHeapTotalBytes": 266240,
"scriptDurationMs": 177.86999999999998,
"eventListeners": 0,
"totalBlockingTimeMs": 243,
"frameDurationMs": 25.979411764705915,
"p95FrameDurationMs": 33.29999999999927
},
{
"name": "dom-widget-order-sparse-n1000-w20-i120",
"durationMs": 860.9570000000986,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 511.72000000000037,
"heapDeltaBytes": 14216120,
"heapUsedBytes": 92288612,
"domNodes": 0,
"jsHeapTotalBytes": 266240,
"scriptDurationMs": 176.21400000000003,
"eventListeners": 0,
"totalBlockingTimeMs": 237,
"frameDurationMs": 25.488235294117604,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "extension-clean-combined-draw",
"durationMs": 12019.331000000022,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10895.279999999999,
"heapDeltaBytes": -14010732,
"heapUsedBytes": 67082884,
"domNodes": 0,
"jsHeapTotalBytes": -7077888,
"scriptDurationMs": 8906.447,
"eventListeners": 0,
"totalBlockingTimeMs": 2065,
"frameDurationMs": 34.983673469387746,
"p95FrameDurationMs": 66.70000000000073
},
{
"name": "extension-clean-combined-draw",
"durationMs": 11440.578999999958,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10337.471,
"heapDeltaBytes": -1656940,
"heapUsedBytes": 79104888,
"domNodes": 0,
"jsHeapTotalBytes": -14417920,
"scriptDurationMs": 8503.199,
"eventListeners": 0,
"totalBlockingTimeMs": 1431,
"frameDurationMs": 32.572649572649574,
"p95FrameDurationMs": 66.69999999999891
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 11940.01000000003,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10867.58,
"heapDeltaBytes": 4041448,
"heapUsedBytes": 84254988,
"domNodes": 0,
"jsHeapTotalBytes": -14942208,
"scriptDurationMs": 8936.531,
"eventListeners": 0,
"totalBlockingTimeMs": 1671,
"frameDurationMs": 34.09371428571429,
"p95FrameDurationMs": 66.70000000000073
},
{
"name": "extension-rgthree-prototype-draw",
"durationMs": 11442.371000000094,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10316.600999999999,
"heapDeltaBytes": -12918204,
"heapUsedBytes": 67298392,
"domNodes": 0,
"jsHeapTotalBytes": -12320768,
"scriptDurationMs": 8445.059,
"eventListeners": 0,
"totalBlockingTimeMs": 1482,
"frameDurationMs": 32.66542857142857,
"p95FrameDurationMs": 66.70000000000073
},
{
"name": "large-graph-idle",
"durationMs": 2024.5360000000119,
"styleRecalcs": 7,
"styleRecalcDurationMs": 2.8810000000000016,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 672.002,
"heapDeltaBytes": 20940712,
"heapUsedBytes": 82326656,
"domNodes": -228,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 42.651999999999994,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666115702479342,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2069.8879999999917,
"styleRecalcs": 7,
"styleRecalcDurationMs": 3.2359999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 766.6800000000001,
"heapDeltaBytes": -36999388,
"heapUsedBytes": 81460252,
"domNodes": -228,
"jsHeapTotalBytes": 688128,
"scriptDurationMs": 41.486,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666129032258066,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 3101.1279999999033,
"styleRecalcs": 65,
"styleRecalcDurationMs": 10.099,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1870.7279999999998,
"heapDeltaBytes": 23853460,
"heapUsedBytes": 87121940,
"domNodes": -228,
"jsHeapTotalBytes": 225280,
"scriptDurationMs": 958.136,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66594594594594,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 3069.150000000036,
"styleRecalcs": 67,
"styleRecalcDurationMs": 10.499,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1850.429,
"heapDeltaBytes": 23488428,
"heapUsedBytes": 86136104,
"domNodes": -228,
"jsHeapTotalBytes": 225280,
"scriptDurationMs": 939.1260000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66576086956522,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3991.8840000000273,
"styleRecalcs": 63,
"styleRecalcDurationMs": 11.79,
"layouts": 60,
"layoutDurationMs": 15.042,
"taskDurationMs": 1914.3210000000001,
"heapDeltaBytes": 10169068,
"heapUsedBytes": 73337940,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 892.686,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666108786610874,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3988.1670000000895,
"styleRecalcs": 63,
"styleRecalcDurationMs": 11.951,
"layouts": 60,
"layoutDurationMs": 15.231,
"taskDurationMs": 1900.2720000000002,
"heapDeltaBytes": 8571388,
"heapUsedBytes": 72649680,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 875.205,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66610878661088,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3251.469000000043,
"styleRecalcs": 43,
"styleRecalcDurationMs": 6.653,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2173.8120000000004,
"heapDeltaBytes": 1292068,
"heapUsedBytes": 65610476,
"domNodes": 0,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 1120.574,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.838341968911912,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 3177.9999999999973,
"styleRecalcs": 41,
"styleRecalcDurationMs": 5.464,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2140.008,
"heapDeltaBytes": -1908472,
"heapUsedBytes": 64013244,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 1105.5729999999999,
"eventListeners": 180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.84308510638298,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2061.629000000039,
"styleRecalcs": 7,
"styleRecalcDurationMs": 3.1680000000000006,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 738.1460000000001,
"heapDeltaBytes": -37859056,
"heapUsedBytes": 82586400,
"domNodes": -228,
"jsHeapTotalBytes": -360448,
"scriptDurationMs": 42.001,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2043.2220000000143,
"styleRecalcs": 7,
"styleRecalcDurationMs": 2.0540000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 688.45,
"heapDeltaBytes": -36994768,
"heapUsedBytes": 82689392,
"domNodes": -228,
"jsHeapTotalBytes": -360448,
"scriptDurationMs": 43.325,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.6650406504065,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 694.105000000036,
"styleRecalcs": 48,
"styleRecalcDurationMs": 7.200999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 435.479,
"heapDeltaBytes": 13153700,
"heapUsedBytes": 93843828,
"domNodes": 0,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 155.812,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66341463414634,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 727.2850000000517,
"styleRecalcs": 46,
"styleRecalcDurationMs": 7.261,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 462.91,
"heapDeltaBytes": 12675224,
"heapUsedBytes": 93781420,
"domNodes": 0,
"jsHeapTotalBytes": 4194304,
"scriptDurationMs": 160.635,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66744186046511,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2055.7870000000094,
"styleRecalcs": 10,
"styleRecalcDurationMs": 4.334000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 596.875,
"heapDeltaBytes": -14728724,
"heapUsedBytes": 65985924,
"domNodes": -244,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 14.575999999999999,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.665853658536584,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2033.4020000000237,
"styleRecalcs": 9,
"styleRecalcDurationMs": 4.319999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 598.7280000000001,
"heapDeltaBytes": -19696212,
"heapUsedBytes": 60659684,
"domNodes": -244,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 13.847999999999999,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66639344262295,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1757.5120000000197,
"styleRecalcs": 59,
"styleRecalcDurationMs": 21.540000000000003,
"layouts": 16,
"layoutDurationMs": 7.101999999999999,
"taskDurationMs": 880.488,
"heapDeltaBytes": -3915512,
"heapUsedBytes": 75630876,
"domNodes": -244,
"jsHeapTotalBytes": -1310720,
"scriptDurationMs": 127.54099999999998,
"eventListeners": -210,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66571428571429,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1766.5839999999662,
"styleRecalcs": 59,
"styleRecalcDurationMs": 21.000000000000004,
"layouts": 16,
"layoutDurationMs": 7.277,
"taskDurationMs": 925.952,
"heapDeltaBytes": -25393380,
"heapUsedBytes": 54445996,
"domNodes": -244,
"jsHeapTotalBytes": 1048576,
"scriptDurationMs": 134.21800000000002,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.824761904761907,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1433.6809999999787,
"styleRecalcs": 17,
"styleRecalcDurationMs": 32.940999999999995,
"layouts": 5,
"layoutDurationMs": 14.792,
"taskDurationMs": 1045.265,
"heapDeltaBytes": 23208104,
"heapUsedBytes": 104197560,
"domNodes": 13667,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 36.593,
"eventListeners": 2383,
"totalBlockingTimeMs": 156,
"frameDurationMs": 19.861643835616434,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "viewport-pan-sweep",
"durationMs": 9410.542999999961,
"styleRecalcs": 251,
"styleRecalcDurationMs": 37.306,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5764.066,
"heapDeltaBytes": -40103664,
"heapUsedBytes": 79073936,
"domNodes": -228,
"jsHeapTotalBytes": 1404928,
"scriptDurationMs": 3003.512,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.6955595026643,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 10686.639000000014,
"styleRecalcs": 248,
"styleRecalcDurationMs": 36.332,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6513.355,
"heapDeltaBytes": 25164236,
"heapUsedBytes": 86971156,
"domNodes": -228,
"jsHeapTotalBytes": 192512,
"scriptDurationMs": 3104.24,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.665937500000002,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 17913.07400000005,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17708.061,
"heapDeltaBytes": -17824600,
"heapUsedBytes": 184318336,
"domNodes": -3045,
"jsHeapTotalBytes": 8593408,
"scriptDurationMs": 308.453,
"eventListeners": -14915,
"totalBlockingTimeMs": 0,
"frameDurationMs": 34.9595703125,
"p95FrameDurationMs": 66.70000000000073
},
{
"name": "vue-large-graph-idle",
"durationMs": 17851.57499999991,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17524.945,
"heapDeltaBytes": -64031564,
"heapUsedBytes": 166756696,
"domNodes": -3045,
"jsHeapTotalBytes": 2301952,
"scriptDurationMs": 411.28499999999997,
"eventListeners": -14915,
"totalBlockingTimeMs": 57,
"frameDurationMs": 34.32557692307693,
"p95FrameDurationMs": 66.70000000000073
},
{
"name": "vue-large-graph-pan",
"durationMs": 22633.85500000004,
"styleRecalcs": 165,
"styleRecalcDurationMs": 24.75700000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 22529.374999999996,
"heapDeltaBytes": -17972728,
"heapUsedBytes": 179162788,
"domNodes": -3045,
"jsHeapTotalBytes": 8867840,
"scriptDurationMs": 1016.8649999999999,
"eventListeners": -14915,
"totalBlockingTimeMs": 169,
"frameDurationMs": 44.816831683168324,
"p95FrameDurationMs": 83.39999999999964
},
{
"name": "vue-large-graph-pan",
"durationMs": 22289.99799999997,
"styleRecalcs": 166,
"styleRecalcDurationMs": 23.74799999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 22082.145,
"heapDeltaBytes": -60073084,
"heapUsedBytes": 168678668,
"domNodes": -3045,
"jsHeapTotalBytes": 1515520,
"scriptDurationMs": 1011.3559999999999,
"eventListeners": -14915,
"totalBlockingTimeMs": 125,
"frameDurationMs": 43.468031189083824,
"p95FrameDurationMs": 83.40000000000146
},
{
"name": "vue-node-resize-workload",
"durationMs": 4933.779000000072,
"styleRecalcs": 20,
"styleRecalcDurationMs": 85.37,
"layouts": 20,
"layoutDurationMs": 25.367,
"taskDurationMs": 4860.592,
"heapDeltaBytes": 20578712,
"heapUsedBytes": 218509740,
"domNodes": 0,
"jsHeapTotalBytes": 786432,
"scriptDurationMs": 103.399,
"eventListeners": 0,
"totalBlockingTimeMs": 151,
"frameDurationMs": 30.162576687116566,
"p95FrameDurationMs": 50.100000000000364
},
{
"name": "vue-node-resize-workload",
"durationMs": 6519.686999999976,
"styleRecalcs": 20,
"styleRecalcDurationMs": 89.98400000000001,
"layouts": 20,
"layoutDurationMs": 28.61799999999999,
"taskDurationMs": 6476.608,
"heapDeltaBytes": -25664784,
"heapUsedBytes": 202707492,
"domNodes": 0,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 129.30600000000004,
"eventListeners": 0,
"totalBlockingTimeMs": 538,
"frameDurationMs": 40.98364779874215,
"p95FrameDurationMs": 83.30000000000109
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8917.359000000033,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8824.016,
"heapDeltaBytes": -50997776,
"heapUsedBytes": 171893576,
"domNodes": -3045,
"jsHeapTotalBytes": 13312000,
"scriptDurationMs": 159.26300000000003,
"eventListeners": -14915,
"totalBlockingTimeMs": 0,
"frameDurationMs": 33.08438661710037,
"p95FrameDurationMs": 66.69999999999709
},
{
"name": "vue-zoom-out-idle",
"durationMs": 9062.50399999999,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8908.154999999999,
"heapDeltaBytes": -18313996,
"heapUsedBytes": 178198972,
"domNodes": -3046,
"jsHeapTotalBytes": 11636736,
"scriptDurationMs": 149.57200000000003,
"eventListeners": -14915,
"totalBlockingTimeMs": 0,
"frameDurationMs": 34.34562737642586,
"p95FrameDurationMs": 66.69999999999709
},
{
"name": "workflow-execution",
"durationMs": 522.1490000000131,
"styleRecalcs": 22,
"styleRecalcDurationMs": 23.946,
"layouts": 6,
"layoutDurationMs": 3.1399999999999997,
"taskDurationMs": 184.434,
"heapDeltaBytes": -14894720,
"heapUsedBytes": 81867144,
"domNodes": 129,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 20.322000000000003,
"eventListeners": 81,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66451612903227,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 516.4589999999407,
"styleRecalcs": 21,
"styleRecalcDurationMs": 19.317,
"layouts": 4,
"layoutDurationMs": 2.069,
"taskDurationMs": 164.329,
"heapDeltaBytes": -14577924,
"heapUsedBytes": 82077988,
"domNodes": 126,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 13.466000000000001,
"eventListeners": 81,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "agent-composer-empty-conversation-typing",
"durationMs": 1021.6279999999642,
"styleRecalcs": 78,
"styleRecalcDurationMs": 114.758,
"layouts": 76,
"layoutDurationMs": 24.469,
"taskDurationMs": 985.53,
"heapDeltaBytes": 19140784,
"heapUsedBytes": 89445292,
"domNodes": 76,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 398.23199999999997,
"eventListeners": 876,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66557377049181,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "agent-composer-empty-conversation-typing",
"durationMs": 1201.2600000000475,
"styleRecalcs": 78,
"styleRecalcDurationMs": 122.944,
"layouts": 76,
"layoutDurationMs": 29.33,
"taskDurationMs": 1179.656,
"heapDeltaBytes": 21218828,
"heapUsedBytes": 91485332,
"domNodes": 76,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 502.926,
"eventListeners": 876,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.667123287671217,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "agent-composer-long-conversation-typing",
"durationMs": 1546.088999999938,
"styleRecalcs": 78,
"styleRecalcDurationMs": 272.13100000000003,
"layouts": 76,
"layoutDurationMs": 27.632,
"taskDurationMs": 1527.0869999999998,
"heapDeltaBytes": 9205136,
"heapUsedBytes": 115782744,
"domNodes": 76,
"jsHeapTotalBytes": 1048576,
"scriptDurationMs": 512.895,
"eventListeners": 876,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.822352941176465,
"p95FrameDurationMs": 33.30000000000109
},
{
"name": "agent-composer-long-conversation-typing",
"durationMs": 1589.7929999998723,
"styleRecalcs": 78,
"styleRecalcDurationMs": 286.834,
"layouts": 76,
"layoutDurationMs": 27.881,
"taskDurationMs": 1565.973,
"heapDeltaBytes": 9371256,
"heapUsedBytes": 116258584,
"domNodes": 76,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 516.119,
"eventListeners": 876,
"totalBlockingTimeMs": 0,
"frameDurationMs": 19.477108433734923,
"p95FrameDurationMs": 33.399999999999636
}
]
}🔬 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✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #18248 +/- ##
==========================================
+ Coverage 84.05% 85.05% +1.00%
==========================================
Files 3161 2316 -845
Lines 154596 133800 -20796
Branches 40065 34577 -5488
==========================================
- Hits 129939 113800 -16139
+ Misses 23053 19678 -3375
+ Partials 1604 322 -1282
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 949 files with indirect coverage changes 🚀 New features to boost your workflow:
|
dante01yoon
left a comment
There was a problem hiding this comment.
Thanks for this — the root-cause writeup is genuinely useful, and the ordering constraint between the document edit and the store-driven attachment rewrite is documented exactly where a future reader needs it.
I checked the things this feature can break indirectly and most of them come out clean:
- Handler lifecycle:
handlePasteis anEditorViewprop andonBeforeUnmountcallsview?.destroy()(InlinePromptEditor.vue:427-429), so the handler goes away with the component. - The
usePasteguard does not regress canvas paste:usePaste's listener is the only document-levelpastelistener insrc/,useNodePasteonly assignsnode.pasteFiles(no DOM listener), andLGraphCanvas'spasteFromClipboard()call sites are a context-menu callback. Nothing in the canvas path callspreventDefault(), so your claim holds. - Limits and in-flight uploads: paste routes into the same
attachment.addFilesas drop, soisTooLarge/MAX_ATTACHMENT_BYTESand the sequential upload loop apply unchanged. No new exposure. - House rules: no hand-declared server/API response shapes are introduced (
attachableClipboardFilesand theattachFilesemit are DOM types only), andmain'suseAttachment.tshas no synthesized upload limit, so nothing from the #16985 discussion is inherited here.
Two blocking things below, both narrow. Happy to re-review quickly.
| } | ||
|
|
||
| export function attachableClipboardFiles(clipboard: DataTransfer): File[] { | ||
| return Array.from(clipboard.files).filter(isAgentAttachable) |
There was a problem hiding this comment.
question: should the clipboard path fall back to MIME when the name is unusable?
isAgentAttachable judges by filename only, which is deliberate and correct for drag-and-drop — the doc comment above explains that dragged glb/md files carry no reliable MIME, and that a bare-dropped .json must stay unclaimed so the graph loader can open it. Neither of those reasons applies to a clipboard paste: a pasted blob is never a workflow file the graph loader should claim, and its MIME is set by the engine rather than by the filesystem.
The description says Chromium names a pasted screenshot image.png, so the name check is enough there, and I agree that speculating about other engines is not worth shipping code for. But the consequence of guessing wrong got worse in this PR: with the new usePaste guard, an unnamed blob no longer falls through to the canvas, so it silently disappears (see my comment on InlinePromptEditor.vue:294).
Non-blocking on its own, and I would rather not add unverified branches either. Something like file.type.startsWith('image/') as an additional accept condition for clipboard files specifically would close it without touching drop behavior — but if you would rather confirm on a real Safari/Firefox first and handle it separately, that is reasonable. Mainly want to make sure the combination with the guard is a deliberate call.
Dismissed at DrJKL's request during the Agent PR survey. This does not mark the findings as fixed or approve the PR.
Addresses review feedback: #18248 (comment)
Addresses review feedback: #18248 (comment)
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed the updated head. The compatibility branch now preserves legacy /api/userdata/... paths, the exercised custom-backend behavior is covered, and the CI checks pass.
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @christian-byrne.
Found 10 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 3 |
| 🟢 Low | 6 |
| ⚪ Nit | 1 |
Panel: 8/8 reviewers contributed findings.
| .setMeta('uiEvent', 'paste') | ||
| .scrollIntoView() | ||
| ) | ||
| const attachmentsOnly = clipboard.files.length > 0 && text === '' |
There was a problem hiding this comment.
🟡 Medium — attachmentsOnly is computed from the unfiltered clipboard.files.length while the attach emit uses the filtered files, so a clipboard holding only non-attachable files (a copied .zip, .pdf, or workflow.json) with an empty text/plain inserts nothing, emits nothing, and still returns true — the paste is silently discarded with no feedback. Key the skip off files.length so those pastes fall through to content insertion instead. The new test "leaves the paste to the editor when no clipboard file is attachable" misses this because it sets text/plain on the clipboard. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max adversarial).
| useEventListener(document, 'paste', async (e) => { | ||
| // A rich-text surface such as the agent composer is not an input element, | ||
| // so it claims the paste by preventing the default rather than by target. | ||
| if (e.defaultPrevented) return |
There was a problem hiding this comment.
🟡 Medium — The e.defaultPrevented early-return is a global, implicit side-channel: because usePaste listens on document in the bubble phase, any paste handler anywhere in the document that calls preventDefault() — a third-party custom-node extension, a browser extension, or a future component — now silently disables all graph-level paste handling (image node creation and workflow JSON loading) with no diagnostic and no way to distinguish an intended claim from a bug. Consider an explicit claim mechanism (a target check or a custom event flag) rather than relying on defaultPrevented. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial).
| // Attaching rewrites the prompt through the store, so the document edit | ||
| // has to land first or the editor overwrites the staged attachment. | ||
| if (!attachmentsOnly) insertPastedContent(editor, clipboard, slice, text) | ||
| if (files.length > 0) emit('attachFiles', files) |
There was a problem hiding this comment.
🟡 Medium — Every attachable File on a mixed clipboard is staged and uploaded even when the user only meant to paste text; Office and spreadsheet apps routinely add a bitmap alternative to a text copy, so a plain text paste can push a snapshot of the copied range to /upload/image before the user consents to attaching anything. The new test "keeps both the attachment and the text of a mixed clipboard" locks this in — consider only auto-attaching when the clipboard carries no text, or requiring an explicit confirmation. Raised by 1 of 8 reviewers (gpt-5.6-sol-max adversarial).
| @selection-change="onEditorSelectionChange" | ||
| @click="syncMention" | ||
| @blur="closeMention()" | ||
| @attach-files="emit('attachFiles', $event)" |
There was a problem hiding this comment.
🟢 Low — attachFiles is forwarded unconditionally, while the menu entry that emits attach is gated by v-if="canAttach" (prop defaults to false), so a host that mounts Composer with attachments disabled still gets pasted files staged and uploaded. Latent today because AgentPanelRoot hardcodes :can-attach="true", but the new Composer.pasteAttachment.test.ts mounts without canAttach and asserts the emit fires, which locks the bypass in. Raised by 4 of 8 reviewers (gpt-5.6-sol-max adversarial, claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case).
| const attachmentsOnly = clipboard.files.length > 0 && text === '' | ||
| // Attaching rewrites the prompt through the store, so the document edit | ||
| // has to land first or the editor overwrites the staged attachment. | ||
| if (!attachmentsOnly) insertPastedContent(editor, clipboard, slice, text) |
There was a problem hiding this comment.
🟢 Low — Skipping insertPastedContent is decided on text/plain alone, but that function is the only consumer of text/html — a clipboard carrying a file plus workflow reference chips in text/html with an empty text/plain loses the chips entirely. Decide on the presence of any non-file representation (or on the parsed slice) rather than text === ''. Raised by 2 of 8 reviewers (gpt-5.6-sol-max edge-case, claude-opus-5-thinking-max adversarial).
| } | ||
|
|
||
| export function attachableClipboardFiles(clipboard: DataTransfer): File[] { | ||
| return Array.from(clipboard.files).filter(isAgentAttachable) |
There was a problem hiding this comment.
🟢 Low — The clipboard file list is forwarded with no count or aggregate-size bound, so a single Ctrl+V of a large multi-file selection stages every file and Promise.alls the uploads with no confirmation step — the per-file size check is the only limit. Consider a max-per-batch cap shared with the drop and picker paths. Raised by 2 of 8 reviewers (gpt-5.6-sol-max adversarial, claude-opus-5-thinking-max adversarial).
| return ATTACHABLE_EXTENSIONS.has(extension) | ||
| } | ||
|
|
||
| export function attachableClipboardFiles(clipboard: DataTransfer): File[] { |
There was a problem hiding this comment.
🟢 Low — isAgentAttachable judges by file name only — a rule its doc comment justifies by dragged files carrying no MIME — but clipboard files are the inverse case: the name is synthesized by the browser while file.type is reliable (image/png). A pasted image whose synthesized name lacks a recognized extension is filtered out here and, combined with the attachmentsOnly skip, produces nothing at all; consider accepting a clipboard file whose type is an attachable media kind even without a usable extension. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).
|
reviewing and making tweaks at the moment, please do not merge yet |
A paste into the composer ended an in-progress node pick and recorded no attach telemetry, unlike dropping the same file. Pasting happens inside the composer, so it now keeps node selection active, and a paste whose upload lands tracks trackAgentAttachButtonClicked with method 'paste', matching the drag_drop gate added in #18665.
dd2f663 stopped a paste carrying only an unattachable file from deleting the selected text, but nothing failed if it regressed.
The guard's tests dispatched on document with shouldIgnoreCopyPaste mocked out, so they only showed that a cancelled event is skipped. Run the real shouldIgnoreCopyPaste instead: a paste into a contenteditable is left alone by target (#18062), and a paste claimed from inside an uneditable chip, whose target is not editable, is left alone only by the guard. The guard's comment now gives that reason.
…#20147) ## Summary Pin the reported symptom of [PM-1261](https://linear.app/comfyorg/issue/PM-1261/fix-pasting-text-into-the-agent-box-also-pastes-the-last-copied-node) — pasting text into the agent composer also pastes the last copied canvas node — which had no black-box case even though the behaviour is fixed. ## Changes - **What**: two cases in `browser_tests/tests/agent/agentCopyPaste.spec.ts`. - `pasting text into the composer leaves the graph untouched` — copy a node on the canvas, put plain text on the clipboard, paste into the composer: the text lands in the composer and no node is added to the graph. - `a composer paste keeps the node clipboard usable on the canvas` — after that composer paste, an ordinary canvas Ctrl+V still pastes the copied node. This is the half that stops the first case from being satisfiable by simply disabling the node clipboard. - No production code changes. ## Review Focus **Why these were missing.** #18062 fixed this family and added four cases, but all four exercise the *copy* side or a *canvas* paste: a node clicked after a transcript selection, Ctrl+C in the composer preserving the node clipboard, a transcript text copy clearing it, and copy-id ownership. None pastes into the composer, so the exact user-visible symptom was unpinned. **Why the precondition is real.** The text goes on the clipboard with `ClipboardHelper.writeText`, which is a programmatic write, not a `copy` event — so `useCopy` never runs and `localStorage['litegrapheditor_clipboard']` still holds the Ctrl+C node copy. That is the state the reports describe ("the *last copied* node"). With `text/html` carrying no node payload, `pasteClipboardItems` declines it, the workflow parse fails, and the only remaining route to the graph is the `canvas.pasteFromClipboard()` fallback in `usePaste` — the fallback the report is about. **Red-on-parent evidence.** The spec cannot run on #18062's parent because `AgentCopyPasteDriver.ts` was added by that PR, so the equivalent is removing the guards that cover this path today. There are now **two**, which is worth knowing: 1. `isContentEditable` in `shouldIgnoreCopyPaste` (#18062), and 2. the `if (e.defaultPrevented) return` early return in `usePaste` (added later by #18248, 2026-09-28) — ProseMirror cancels the paste it handles, so this covers the composer independently. Removing only (1) leaves both new cases **green**, because (2) still holds. Removing both makes both cases fail with a `SaveImage` node landing on the graph — the reported symptom exactly. So the cases bind the *behaviour* rather than either mechanism, and would catch the regression if either guard were removed in isolation only once both went. **Measured locally** against `DISTRIBUTION=cloud` at head `314cfe9d62`, which contains current `main`: all 6 cases in the spec pass (19.2s, `--project=cloud --workers=1`). Both new cases fail with both guards removed — now at the strengthened whole-graph assertion rather than the single-frame diff. ## Review round: the four Cursor findings are addressed All four were about the same risk, and it is the one that matters most for a PR whose only job is to be a pin: each case could stay green while binding nothing. They are fixed in `ce3c7a7d5e`, and every change is a strengthening — no assertion was weakened and no case was retired. | Finding | Fix | | --- | --- | | Nothing proved the node clipboard held a node, so the negative assertion could pass vacuously | Both cases now assert `localStorage['litegrapheditor_clipboard']` holds exactly the copied node before asserting anything about the graph | | A single `nextFrame` samples once, but `usePaste`'s handler is `async` | `expectGraphUnchanged` re-asserts across a 10-frame settle window | | `nodesAddedSince` is a one-way diff, blind to a removal | The whole node set is compared, sorted by id | | `before` spans both pastes, so the canvas-paste addition is not attributable | The canvas-paste assertion re-baselines on a post-composer-paste snapshot, taken only after the composer paste is proved to have added nothing | **Each finding was verified real rather than accepted.** For all four, the failure mode it names was injected and both halves were checked: the original assertion stayed green under it — so the hole was genuine — and the new guard rejects. Clearing the clipboard key after the copy left the old negative assertion passing; a node inserted on a 120 ms timer slipped past the single-frame sample; a removal was invisible to the one-way diff; and a leaked node plus a cleared clipboard satisfied both of the original canvas-paste assertions. The proof spec was a throwaway and is not committed. The change stays inside `browser_tests/tests/agent/` deliberately: the two helpers are local to the spec rather than added to `AgentCopyPasteDriver`, because that file sits outside the Agent path globs and moving the PR outside them would change which team's approval the PR requires. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR Created by the Glary-Bot Agent
Ctrl+V an image into the agent chat input and it attaches to the in-progress message, the same way a dropped file does.
Root cause
InlinePromptEditor'shandlePasteclaimed every paste unconditionally and insertedclipboardData.getData('text/plain'). For an image that string is'', so it dispatched an emptyinsertText(a no-op) and returnedtrue— telling ProseMirror the paste was handled. The image was dropped on the floor. That is the reported "nothing happens at all".Change
attachableClipboardFiles(clipboard)filtersclipboard.filesthrough the existingisAgentAttachable, so paste accepts exactly the file types drag-and-drop does.handlePasteemitsattachFileswhen the clipboard carries attachable files;AgentPanelRootroutes them intoattachment.addFiles, the same upload path as drag-and-drop.InlinePromptEditor→Composer→AgentPanel→AgentPanelRoot.trackAgentAttachButtonClicked({ method: 'paste' }), gated onaddFilessucceeding the same waydrag_dropis (feat: instrument agent panel actions #18665).Two ordering constraints worth knowing when reading the diff:
watch(model)isflush: 'post'. Emitting first lets the editor write its pre-attachment document back over the staged asset. There is a test that fails if these two lines are swapped.insertText('')would delete whatever the user had selected. This holds whether or not the files are attachable, so pasting only a.zipover selected text leaves the text alone.A clipboard carrying both text and an attachable file keeps both: the text is inserted and the file attaches.
usePastedefers to a paste the editor already claimedusePastereturns early when the paste was already cancelled (e.defaultPrevented). Since #18062,shouldIgnoreCopyPastetreats contenteditable targets as text inputs, so an ordinary composer paste is ignored by target. The guard covers the case the target check cannot: a collapsed caret inside an uneditable reference chip (contenteditable=false, e.g. after pressing on a chip and moving a few pixels before release) makes the chip's label the paste target. ProseMirror still handles and cancels that paste, butshouldIgnoreCopyPastesees a non-editable target and would hand it to the canvas — an image would also become a LoadImage node, and workflow JSON would replace the graph vialoadGraphData.The
usePastetests now run the realshouldIgnoreCopyPaste(vi.mock(..., { spy: true })) and dispatch from realistic targets: pastes into a contenteditable editor or paragraph leave the graph alone by target, and a claimed paste from inside a chip is left alone only by the guard (those tests fail with the guard removed). Canvas-focused paste is untouched.Verification
Exercised against a real Chromium clipboard (
navigator.clipboard.write+ a real Ctrl+V keypress), with the ComfyUI backend serving uploads:POST /api/upload/image→ 200, canvas unchangedLoadImagenodeThe feature was re-checked by hand on a local dev server against staging after the review follow-ups.
Unit coverage: the agent, paste, and telemetry suites pass (180 files, 3,008 tests);
pnpm typecheck,pnpm lint,pnpm format:check,pnpm knipclean. Each new regression test was confirmed to fail without its fix — including the node-selection, paste-telemetry (both the success and rejected-upload cases), unattachable-file selection, and chip-guard tests.Known gaps
Only Chromium was exercised; Safari and Firefox clipboard shapes are unverified. Chromium hands a pasted screenshot over as
image.png; an engine that hands over an unnamed blob would not attach.Ctrl+Shift+V (paste as plain text) of an image over selected text deletes the selection, because the browser strips the file and the empty-text insert runs. Pre-existing on
main; not changed here.Copying and pasting an asset or node reference chip pastes its readable text rather than a chip (only workflow chips round-trip since fix: restore workflow references on composer cut and paste #17443). Out of scope for this PR.
Fixes PM-1438
Fixes PM-528
Screenshots