Repository navigation
fix: context button for an LLM node cannot be interacted with within an agent workflow #8216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
peslyn
merged 1 commit into
v3
from
pr@v3@fix_context_button_for_an_llm_node_cannot_be_interacted_with_within_an_agent_workflow
Nov 30, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review
1. Bugs / correctness
a) Hard failure on unrelated updates (regression risk)
enableContextfalls back toBoolean(nodeData.enable_context). For any node that already hasenable_context === truebut nomaterialsbinding (legacy nodes, or nodes configured before this change), everyupdatecall now fails — including updates toprompt,tools,is_result, etc. — until the user either bindsmaterialsor explicitly passesenable_context: false. That breaks the documented contract ofupdate("只传要设置的字段,其余保持不变") and is a silent behavior break for existing workflows.Fix: only validate when the user is changing context state, e.g.
or auto-disable instead of erroring:
b) Silent data loss with multiple
materialsrefscontext_variableis a single[nodeId, field]reference, butmaterialRefsis a list. If the parent binds more than one, all but the first are dropped without warning. Either:materialRefs.length > 1, orcontext_variableto an array and store all refs.c) Silent clearing of an existing
context_variableIf
context_variableis currently a non-array shape (legacy/object/string),Array.isArrayis false → it becomes[], i.e. the value is wiped on an unrelated update. Safer: only write the key when you actually have something to write:d)
materialstype changed to an invalid JSON Schema type"any"is not a valid JSON Schematype. With Ajv (or any spec-compliant validator) this throwsschema is invalid: data/properties/materials/type must be equal to one of the allowed valuesat compile time — the wholeupdatetool would break. Use one of:If your validator is custom and accepts
'any', at least document that — it's non-standard and will confuse anyone reading it as JSON Schema.e) Schema/doc contradiction
materialsnow says "可为字符串、数组或对象 … 绑定后写到 context_variable", but the comment sayscontext_variableis a single[节点ID, 字段]reference. The description implies the caller can pass a literal value or multiple entries, which the implementation cannot honor. Align the wording with the actual constraint (a single bound upstream variable).2. Type-safety / robustness
[...materialRefs[0]!]— the non-null assertion is required bynoUncheckedIndexedAccess, but note the spread producesstring[], not a tuple. If the backend expects exactly[nodeId, field], a ref like[nodeId, 'a', 'b']will produce an invalid 3-element value. Destructure explicitly and validate length.node.properties.enableException— will throw ifpropertiesis ever undefined. Usenode.properties?.enableException. Also verify the field really lives undernode.properties(camelCase) rather thannode_data: everything else isnode_data+ snake_case, and this asymmetry is a likely source of a "setting silently doesn't persist" bug. Consider a helper (readExceptionFlag(node)/writeExceptionFlag(node, v)) so read and write locations can't drift.Boolean(nodeData.enable_context)vs the previous(nodeData.enable_context ?? false)is equivalent — no issue, just noise in the diff.Correct but trips
no-nested-ternary; prefer:context_variableis written even whenenable_contextisfalse. Decide whether that's intentional (keeps binding for a later toggle) or should be cleared; document it either way.3. Prompt / tool-description consistency
model_params_setting,tools_location, andenable_context. The model now has no instruction on those fields beyond the schema descriptions — acceptable, but fortools_location("customize" vs "reference") andmodel_params_settingthe schema text is terse; consider keeping a one-line hint or the model will guess.get_field_options, and theupdatedescription promises auto-validation — make sureget_field_optionsis actually registered in this agent'stoolsarray (the diff only showsupdate). If it isn't, the model will call a non-existent tool.enable_exceptionis added to the schema and to theupdatedescription, but the system prompt never mentions exception handling. Minor, but worth a clause so the model knows when to enable it.4. Optimization suggestions
pickBoolean(args.x, fallback)andtoContextRef(materialRefs).patchobject and write once, so you can omit keys you don't intend to change (context_variable,model_params_setting) instead of always writing defaults — reduces accidental overwrites and diff noise.console.warn/telemetry whenmaterialRefs.length > 1and only the first is used, so the truncation is observable.enable_exception, prefer reading the same source you write to, and add a unit test assertingupdate({prompt})does not mutateenableExceptionorcontext_variable.enable_contextarg → on; (ii) materials unbound +enable_context: true→ error; (iii) legacy node withenable_context: true, no materials, unrelated update → should succeed; (iv) multiple materials → defined behavior (error or all stored).materialsor passenable_context: false") — it partially does; make it explicit thatfalseis allowed.