diff --git a/browser_tests/tests/widget.spec.ts-snapshots/image-preview-drag-and-dropped-chromium-linux.png b/browser_tests/tests/widget.spec.ts-snapshots/image-preview-drag-and-dropped-chromium-linux.png index 9c5bffa2d1f..436f1bbfe1b 100644 Binary files a/browser_tests/tests/widget.spec.ts-snapshots/image-preview-drag-and-dropped-chromium-linux.png and b/browser_tests/tests/widget.spec.ts-snapshots/image-preview-drag-and-dropped-chromium-linux.png differ diff --git a/docs/adr/AGENT-GRAPH-0031-extension-owned-graph-feedback.md b/docs/adr/AGENT-GRAPH-0031-extension-owned-graph-feedback.md new file mode 100644 index 00000000000..8a7e806d206 --- /dev/null +++ b/docs/adr/AGENT-GRAPH-0031-extension-owned-graph-feedback.md @@ -0,0 +1,69 @@ +# ADR-AGENT-GRAPH-0031: Extension-owned graph feedback + +Date: 2026-09-16 + +## Status + +Proposed + +## Context + +Agent-generated node feedback needs mutation provenance, turn completion, and +canvas presentation. Putting that policy in graph mutations, workflow-tab +activity, or the minimap couples application services to an optional extension. + +Canvas components can unmount while a turn continues. Graph loading also clears +and reuses the canvas graph. Neither component lifetime nor node IDs alone can +identify the workflow that received a change. + +## Decision + +The agent extension owns provenance and reports. It observes successful node-store +actions and receives explicit turn events from the conversation store. Generic +canvas-overlay and minimap-layer registries expose presentation capabilities to +extensions without interpreting agent state. A shared viewport helper measures +host geometry from generic DOM attributes. + +Marks use root graph, owning graph, and node identity. Workflow-load hooks retain +marks across tab switches only for the same workflow object with unchanged +incoming contents. Replacing contents or reopening a different object does not +inherit the report. Failed-load rollback retains the pending snapshot until the +original workflow loads again. Presentation remounts do not reset activity or +unregister the minimap layer; the extension store owns both registrations. + +Live actors identify their thread separately from the frontend's message ID. +Different threads may write the same workflow concurrently, so gold provenance +includes both while a report excludes identified updates from other threads. +The backend permits only one active turn per thread. We use thread identity +because the send acknowledgment does not expose the backend turn UUID. Actorless +catch-up cannot distinguish historical writers and retains the existing +active-turn hydration behavior. + +View opens the latest reported node's owning graph and frames reported nodes in +that graph. Combining bounds across graphs would combine unrelated coordinate +systems. Gold appears immediately; hydration staggers growth rather than initial +visibility. The extension owns reduced-motion policy and monotonic deadlines. + +We rejected a host provenance service because actor classification belongs to +the extension. Component watchers cannot own turn history because remounting loses +the baseline. Path-keyed snapshots cannot distinguish replacement workflows. + +## Consequences + +### Positive + +- Shared graph services do not import agent feedback policy. +- Deletion and graph reset remove live marks through existing node-store actions. +- Host framing and agent framing use the same visible canvas geometry. + +### Negative + +- Snapshot comparison clones workflow contents at load boundaries. Its cost grows + with workflow size, and harmless serialized changes can discard feedback. +- Feedback remains session-local and does not survive a page reload. +- View frames one owning graph at a time when a report spans subgraphs. + +## Notes + +This decision addresses the ownership and lifecycle findings in +[PR #17730](https://github.com/Comfy-Org/ComfyUI_frontend/pull/17730). diff --git a/docs/adr/README.md b/docs/adr/README.md index 7dc2b3b0247..372e63f320a 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -12,6 +12,7 @@ An Architecture Decision Record captures an important architectural decision mad | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------- | ---------- | | [AGENT-BINDING-0035](AGENT-BINDING-0035-document-identity-gates-persisted-workflow-tab-bindings.md) | Document Identity Gates Persisted Workflow Tab Bindings | Proposed | 2026-09-19 | | [AGENT-CONTEXT-0028](AGENT-CONTEXT-0028-separate-workflow-references-from-editor-tabs.md) | Separate Workflow References from Editor Tabs | Proposed | 2026-09-07 | +| [AGENT-GRAPH-0031](AGENT-GRAPH-0031-extension-owned-graph-feedback.md) | Extension-owned graph feedback | Proposed | 2026-09-16 | | [AGENT-SESSION-0028](AGENT-SESSION-0028-compose-turn-origin-and-account-generation.md) | Compose Turn Origin and Account Generation | Proposed | 2026-09-05 | | [ASSETS-DRAG-DROP-0035](ASSETS-DRAG-DROP-0035-asset-card-drag-uses-file-url.md) | Asset Card Drag-and-Drop Uses the File URL, Never the Preview URL | Proposed | 2026-09-19 | | [AUTH-BILLING-0014](AUTH-BILLING-0014-billing-attempt-context-and-workspace-scope.md) | Billing Attempt Context and Workspace Scope | Proposed | 2026-07-28 | diff --git a/eslint.config.ts b/eslint.config.ts index 188917f5713..32bebfc2e06 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -522,6 +522,34 @@ export default defineConfig([ } }, + { + files: [ + 'src/core/graph/**/*.{ts,vue}', + 'src/renderer/extensions/minimap/**/*.{ts,vue}', + 'src/stores/canvasOverlayStore.ts', + 'src/stores/minimapLayerStore.ts', + 'src/composables/canvas/visibleCanvasViewport.ts', + 'src/components/graph/GraphCanvas.vue' + ], + ignores: ['**/*.test.ts'], + rules: { + 'import-x/no-restricted-paths': [ + 'error', + { + zones: [ + { + target: './src/**', + from: './src/workbench/extensions/agent', + except: ['./composables/useAgentDockMount.ts'], + message: + 'Agent graph feedback belongs in the agent extension. Register generic overlays and minimap layers instead of importing agent policy into the host.' + } + ] + } + ] + } + }, + // src/lib/ holds vendored leaf libraries (litegraph). They may import from // src/lib/ and from the shared base utilities, but never from an app layer — // a vendored library depending on the app that vendors it is a dependency diff --git a/src/components/LiteGraphCanvasSplitterOverlay.vue b/src/components/LiteGraphCanvasSplitterOverlay.vue index 2802132136b..ff2ce63b4be 100644 --- a/src/components/LiteGraphCanvasSplitterOverlay.vue +++ b/src/components/LiteGraphCanvasSplitterOverlay.vue @@ -93,6 +93,7 @@ @resizestart="onResizestart" > diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index a4ebe6ada22..9638b207da2 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -60,6 +60,17 @@ " class="pointer-events-auto" /> +
+ +
@@ -181,6 +192,7 @@ import { useWorkflowStore } from '@/platform/workflow/management/stores/workflow import { useWorkflowAutoSave } from '@/platform/workflow/persistence/composables/useWorkflowAutoSave' import { useWorkflowPersistenceV2 as useWorkflowPersistence } from '@/platform/workflow/persistence/composables/useWorkflowPersistenceV2' import { useNodeDataStore } from '@/stores/nodeDataStore' +import { useCanvasOverlayStore } from '@/stores/canvasOverlayStore' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions' import { arrangeForLegacyRender } from '@/renderer/core/canvas/litegraph/arrangeForLegacyRender' @@ -228,6 +240,7 @@ const nodeSearchboxPopoverRef = shallowRef | null>(null) const settingStore = useSettingStore() +const canvasOverlayStore = useCanvasOverlayStore() const nodeDefStore = useNodeDefStore() const workspaceStore = useWorkspaceStore() const { isBuilderMode } = useAppMode() diff --git a/src/components/rightSidePanel/errors/ErrorGroupList.test.ts b/src/components/rightSidePanel/errors/ErrorGroupList.test.ts index f4de7877072..2a0242ac912 100644 --- a/src/components/rightSidePanel/errors/ErrorGroupList.test.ts +++ b/src/components/rightSidePanel/errors/ErrorGroupList.test.ts @@ -149,6 +149,9 @@ function createCanvasFixture(pinia: Pinia, graph = ROOT_GRAPH) { const canvasElement = document.createElement('canvas') canvasElement.width = 900 canvasElement.height = 700 + vi.spyOn(canvasElement, 'getBoundingClientRect').mockReturnValue( + new DOMRect(0, 0, 900, 700) + ) const canvas = fromPartial({ graph, read_only: false, diff --git a/src/components/sidebar/SideToolbar.vue b/src/components/sidebar/SideToolbar.vue index 8439e5ad11e..2adbbf97182 100644 --- a/src/components/sidebar/SideToolbar.vue +++ b/src/components/sidebar/SideToolbar.vue @@ -2,6 +2,7 @@