Skip to content

fix(validator): warn when output templates reference conditionally-skipped agents#46

Merged
jrob5756 merged 3 commits intomainfrom
fix/validate-output-templates-against-conditional-paths
Mar 17, 2026
Merged

fix(validator): warn when output templates reference conditionally-skipped agents#46
jrob5756 merged 3 commits intomainfrom
fix/validate-output-templates-against-conditional-paths

Conversation

@jrob5756
Copy link
Copy Markdown
Collaborator

Summary

  • Add static path analysis to the validator that enumerates all execution paths from entry_point to $end and emits warnings (not errors) when output templates reference agents/groups that may not run on every path
  • Fix pre-existing gap where for-each group names were missing from the validator's name sets, causing false errors when referencing for-each groups in routes or output templates

Closes #6

Test plan

  • make lint passes
  • make typecheck passes
  • uv run pytest tests/test_config/test_validator.py -v — all 27 tests pass (10 new)
  • uv run pytest — full suite passes (1744 passed)
  • Verify warning appears on a workflow with conditional routing to $end
  • Verify no warnings on linear workflows

🤖 Generated with Claude Code

Jason Robert and others added 3 commits March 17, 2026 09:43
…ipped agents

Add static path analysis to the validator that enumerates all execution
paths from entry_point to $end and checks whether output template
references are guaranteed to have run. Emits warnings (not errors) for
references to agents/groups that may be skipped due to conditional
routing, with an example path and a {% if ... is defined %} suggestion.

Also fixes a pre-existing gap where for-each group names were missing
from the validator's all_names set and _validate_output_references,
causing false errors when referencing for-each groups in routes or
output templates.

Closes #6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix max_depth using max(max_iterations, node_count) so linear
  workflows longer than max_iterations are still fully analyzed
- Fix _validate_parallel_groups to include for-each names in route
  target validation (latent bug exposed by review)
- Promote MAX_PATHS to module-level _MAX_ENUMERATED_PATHS constant
  with documented best-effort semantics in docstring
- Update stale comments and docstrings to reflect for-each group
  support throughout the validator
- Add cross-reference comment linking the two output ref regex
  patterns and explaining their intentional scope difference
- Document _name_on_path for-each inline agent limitation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jrob5756 jrob5756 merged commit f806e73 into main Mar 17, 2026
7 checks passed
@jrob5756 jrob5756 deleted the fix/validate-output-templates-against-conditional-paths branch March 17, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Validate output templates against conditional execution paths

1 participant