Filter LLM context around loop subgraphs during param completion#398
Filter LLM context around loop subgraphs during param completion#398zhongkaifu wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7e99bf447
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| nodes = [ | ||
| n | ||
| for n in iter_workflow_and_loop_body_nodes(workflow_dict) | ||
| if isinstance(n, Mapping) | ||
| ] |
There was a problem hiding this comment.
Keep loop-body param context in sync with updates
By switching _build_param_context to pull from iter_workflow_and_loop_body_nodes, get_param_context can now return payloads for loop body nodes (i.e., nodes with parent_node_id inside a loop). However update_node_params still validates against _build_workflow_for_params(), which builds a Workflow from only top-level nodes and therefore won’t contain those loop body nodes, causing updates to fail with “节点不存在于当前 workflow.” This breaks the param-completion flow for loop body nodes: the LLM can get context but cannot persist the filled params. Consider either excluding loop body nodes here or updating the validation path to include loop body nodes as well.
Useful? React with 👍 / 👎.
Motivation
params, ensure only loop-related nodes are visible to the LLM while constructing a loop body and that loop body details are excluded for non-loop nodes.Description
index_loop_body_nodesusage and a new_build_global_context_from_nodeshelper that builds global context from plain node/edge maps instead ofWorkflowobjects._summarize_node_outputs_from_mapto extractoutput_fieldsfor nodes represented as mappings (including loopexports)._build_param_contextto assembleworkflow_dict, computeloop_body_parents, deriveloop_related_ids, and filter upstream/context nodes with_allow_node_idso loop subgraph nodes are included only when relevant.action_id/paramslookups for the LLM-facing payload.Testing
Codex Task