You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A node setInputs cannot remove a key from node data. useNodeCrud().setInputs goes through handleNodeDataUpdate, which shallow-merges the new inputs into the existing data ({ ...currentNode.data, ...data }). Any top-level key the caller deleted therefore keeps its old value.
web/app/components/workflow/nodes/_base/hooks/use-node-crud.ts:13-21: setInputs forwards the full new inputs as data.
Affected caller found by tests: web/app/components/workflow/nodes/knowledge-retrieval-v2/use-config.ts:144-160 (handleMetadataFilterChange). When the last filter value is cleared, it does delete draft.metadata_filters, so the stale metadata_filters survives. handleNodeKindToggle (L162-170) is affected the same way when the last node kind is toggled off.
Another caller with the same pattern: web/app/components/workflow/nodes/knowledge-retrieval/hooks/use-knowledge-input-manager.ts:13-17 deletes single_retrieval_config / multiple_retrieval_config when the retrieval mode changes, so the unused config is probably never removed from node data. Not separately verified at runtime.
Steps to reproduce (hook level)
Render a Knowledge Retrieval V2 node whose data has metadata_filters: { tags: ['policy'] }.
Call handleMetadataFilterChange('tags', []) from useConfig.
Read the node from the canvas store.
Expected
metadata_filters is removed (or is {}), so no tag filter is applied.
Actual
The node data still has metadata_filters: { tags: ['policy'] }, and the draft sync persists the stale filter.
Note: on current main, panel.tsx does not appear to wire handleMetadataFilterChange / handleNodeKindToggle into the UI yet. The root cause in handleNodeDataUpdate affects any setInputs caller that removes a top-level key.
Suggested fix
Replace node data instead of merging when a caller passes the full inputs, as useNodeCrud.setInputs does. Alternatively, have callers set keys to undefined and strip them, rather than using delete.
How this was found
This came up during the web test cleanup (#44630). The old web/app/components/workflow/nodes/knowledge-retrieval-v2/__tests__/use-config.spec.ts mocked the node CRUD setter and only asserted the setter payload, so it could not see the merge. With the real canvas, the "clears metadata filter" case failed. That misleading case was removed rather than asserting the buggy behavior. A regression test should be added together with the fix.
One constraint for the fix: handleNodeDataUpdateWithSyncDraft also serves partial-update callers. The node panel sends only { title } or { desc }, and retry settings send only { retry_config }, so making the shared updater replace data unconditionally would discard unrelated fields for those callers. [1][2]
The existing use-node-data-update.spec.ts explicitly tests merge semantics, including preserving title and earlier edits. That provides a compatibility check alongside the new deletion regression: retain patch behavior for direct callers, and distinguish full-input replacement through setInputs, which currently forwards its payload without any replacement marker. [3][4]
Hi @hyoban — I'd be happy to take a focused fix for this if nobody is already working on it.
I checked the current call path: useNodeCrud().setInputs passes a full node-data snapshot into handleNodeDataUpdateWithSyncDraft, but handleNodeDataUpdate shallow-merges it with the previous data, retaining keys intentionally deleted by callers. The shared updater also handles partial patches (e.g. title/description and retry settings), so globally switching it to replacement would be unsafe.
I'd isolate full-snapshot replacement (or explicit key removal) to the setInputs path while keeping partial updates as merges. The regression plan is to test clearing the final Knowledge Retrieval V2 metadata filter against the real canvas store, removing an obsolete retrieval config, and preserving unrelated fields after a partial title/retry update. I would then run the focused Web unit tests plus relevant lint/type checks before opening any PR.
Could you assign #45443 to me (GYJ99) if this scope makes sense? Thanks!
Activity
dosubot commentedon Nov 3, 2026
One constraint for the fix:
handleNodeDataUpdateWithSyncDraftalso serves partial-update callers. The node panel sends only{ title }or{ desc }, and retry settings send only{ retry_config }, so making the shared updater replace data unconditionally would discard unrelated fields for those callers. [1] [2]The existing
use-node-data-update.spec.tsexplicitly tests merge semantics, including preservingtitleand earlier edits. That provides a compatibility check alongside the new deletion regression: retain patch behavior for direct callers, and distinguish full-input replacement throughsetInputs, which currently forwards its payload without any replacement marker. [3] [4]To reply, just mention @dosu.
Docs are dead. Just use Dosu.
GYJ99 commentedon Nov 3, 2026
Hi @hyoban — I'd be happy to take a focused fix for this if nobody is already working on it.
I checked the current call path:
useNodeCrud().setInputspasses a full node-data snapshot intohandleNodeDataUpdateWithSyncDraft, buthandleNodeDataUpdateshallow-merges it with the previous data, retaining keys intentionally deleted by callers. The shared updater also handles partial patches (e.g. title/description and retry settings), so globally switching it to replacement would be unsafe.I'd isolate full-snapshot replacement (or explicit key removal) to the
setInputspath while keeping partial updates as merges. The regression plan is to test clearing the final Knowledge Retrieval V2 metadata filter against the real canvas store, removing an obsolete retrieval config, and preserving unrelated fields after a partial title/retry update. I would then run the focused Web unit tests plus relevant lint/type checks before opening any PR.Could you assign #45443 to me (
GYJ99) if this scope makes sense? Thanks!