Validate loop depends_on entries against loop subgraphs#405
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0bce800f5
ℹ️ 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".
| effective_sub_graph_nodes = normalized_nodes if sub_graph_nodes is not None else current_body_nodes | ||
| conflict_error = _build_loop_depends_on_subgraph_conflict( | ||
| loop_id=id, | ||
| depends_on=effective_depends_on or [], | ||
| sub_graph_nodes=effective_sub_graph_nodes, |
There was a problem hiding this comment.
Validate against existing loop body nodes
When update_loop_node receives sub_graph_nodes, the conflict check only uses normalized_nodes, but the update path later only attaches nodes (it never detaches existing body nodes). That means the effective body is still the existing current_body_nodes plus the newly attached ones. If a caller updates depends_on while adding new sub_graph_nodes, depends_on can still reference an already-attached body node and the check will pass, leaving a loop that depends on its own body. Consider validating against the union of current_body_nodes and normalized_nodes (or recompute after attaching) so existing body nodes are included.
Useful? React with 👍 / 👎.
Motivation
depends_onentries that are actually nodes inside its ownbody_subgraph, and provide LLM-facing guidance to resolve naming conflicts.Description
_build_loop_depends_on_subgraph_conflictthat detects overlap between a loop'sdepends_onand itssub_graph_nodesand returns a structured payload includingloop_id,depends_on,sub_graph_nodes,overlap_nodes, and an LLM suggestion inrequirements_suggestions.add_loop_nodeusing the providedsub_graph_nodesduring creation and return aneeds_more_workpayload if overlap exists.update_loop_nodeby computing effectivedepends_on(existing or provided) and effective subgraph nodes (current body nodes or provided), validating the combined sets before applying updates.depends_onby ensuring it is a list before using it in the conflict check.Testing
Codex Task