Skip to content

feat(wf nested condition): allow nested condition on gateway step - #2064

Merged
arnaud-moncel merged 3 commits into
mainfrom
feat/wf-nested-condition
Nov 10, 2026
Merged

arnaud-moncel merged 3 commits into
mainfrom
feat/wf-nested-condition

Conversation

@arnaud-moncel

@arnaud-moncel arnaud-moncel commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Definition of Done

Fixes PRD-1171

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Add nested and/or condition groups to deterministic condition-step options

Condition step options in gateway steps now accept recursive and/or groups, not just flat condition lists.

  • Adds recursive node schemas in step-definition.ts; groups must have at least one child and a valid aggregator (and/or).
  • ConditionStepExecutor.evaluateGroup recursively evaluates each child and aggregates per level, recording nested results and not-loaded reasons in the evaluation trace (condition-step-executor.ts).
  • ConditionEvaluation.conditions now uses the new recursive ConditionResult type (step-execution-data.ts); server-side types mirror the shape (server-types.ts).
  • Behavioral Change: consumers of ConditionEvaluation.conditions see the new nested ConditionResult shape instead of the previous flat inline fields.

Changes since #2064 opened

  • Refactored the condition result types in workflow-executor into a discriminated union of leaf and group results [b8b7d99]
  • Added tests to the ConditionStepExecutor AI decision tests in workflow-executor for group evaluation [b8b7d99]
  • Expanded the Deterministic Condition section of the workflow-executor documentation to cover nested condition groups [b8b7d99]

Macroscope summarized 0c53a99.

@qltysh

qltysh Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.1%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...ges/workflow-executor/src/executors/condition-step-executor.ts100.0%
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/types/validated/step-definition.ts100.0%
Total100.0%
Commit b8b7d99 · 🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Base automatically changed from feat/nested-condition-tree to main November 6, 2026 08:19
@qltysh

qltysh Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

All good ✅

@linear-code

linear-code Bot commented Nov 6, 2026

Copy link
Copy Markdown

PRD-1171

@arnaud-moncel
arnaud-moncel force-pushed the feat/wf-nested-condition branch from 2f61628 to bf29fb2 Compare November 6, 2026 10:16
@christophebrun-forest christophebrun-forest self-assigned this Nov 10, 2026

@christophebrun-forest christophebrun-forest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocker. Three small points below.

Package docs: packages/workflow-executor/CLAUDE.md:40 still says "Top-to-bottom, first-match-wins, and/or aggregator". It should also say that:

  • an option's conditions can hold and/or groups, nested at any depth;
  • an empty group is rejected at the schema boundary;
  • each group entry in evaluations[].conditions carries its own met and the results of its own conditions.

@christophebrun-forest christophebrun-forest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for me

@arnaud-moncel
arnaud-moncel merged commit aa0c257 into main Nov 10, 2026
40 checks passed
@arnaud-moncel
arnaud-moncel deleted the feat/wf-nested-condition branch November 10, 2026 15:20
forest-bot added a commit that referenced this pull request Nov 10, 2026
# @forestadmin/workflow-executor [1.36.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/workflow-executor@1.35.8...@forestadmin/workflow-executor@1.36.0) (2026-11-10)

### Features

* **wf nested condition:** allow nested condition on gateway step ([#2064](#2064)) ([aa0c257](aa0c257))
christophebrun-forest added a commit that referenced this pull request Nov 10, 2026
Resolves the conflict with #2064 (nested condition groups):
- the server condition node carries `sourceType`, nullable like the schema;
- a condition node is dispatched on its shape instead of through z.union, so an
  unknown source type, operator or sub-workflow End rule names the field at fault
  instead of a bare "Invalid input";
- tests cover a sub-workflow End condition inside a group, mixed with Get Data,
  and a second call of a workflow not seeing the Ends of the first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants