-
Notifications
You must be signed in to change notification settings - Fork 0
Epic: Composite triggers — AND/OR combinators for multi-condition workflows #805
Copy link
Copy link
Closed
4 / 44 of 4 issues completed
Copy link
Labels
Milestone
Description
Summary
Implement a composite trigger system that combines multiple trigger strategies with boolean logic (AND/OR). This enables powerful multi-condition workflows — e.g., "fire when a PR has label ready AND review is approved" or "fire on cron schedule OR manual trigger."
Goals
- Design a combinator architecture wrapping existing
TriggerStrategyimplementations - Implement
CompositeStrategysupporting AND (all conditions) and OR (any condition) semantics - Add
Compositevariant toTriggerConfigwith nested trigger configurations - Handle task merging/correlation for AND conditions across sub-strategies
- Adapt the runner loop to evaluate composite conditions correctly
- Wire into the strategy factory, API validation, and CLI
Design Notes
- OR combinator: Fires when ANY sub-strategy produces tasks. Straightforward —
tokio::select!across sub-strategies. - AND combinator: Fires when ALL sub-strategies have produced at least one task within a configurable time window. Requires a correlation window and state tracking.
- AND semantics are significantly more complex — consider a phased approach: OR first, AND later
- Nested composites should be supported (AND of ORs, etc.) but may be deferred
- Task merging: when AND fires, the produced task should include context from all sub-conditions
- This likely requires changes to how
WorkflowRunnerinteracts with strategies, particularly for AND conditions that need to accumulate state
Architectural Considerations
- The current
TriggerStrategy::next_tasks()interface returns when tasks are ready — AND combinators need to buffer partial results - Consider a
CompositeStrategythat internally manages sub-strategy tasks and only yields when the composite condition is met - Template variables should provide access to all sub-trigger contexts (e.g.,
{{triggers[0].source_id}}) - Config validation must detect circular references in nested composites
Acceptance Criteria
-
CompositeStrategyimplementsTriggerStrategytrait - OR combinator: fires when any sub-strategy produces tasks
- AND combinator: fires when all sub-strategies have produced tasks within a time window
-
Compositevariant added toTriggerConfigwith nested configs - Configurable correlation window for AND conditions
- Strategy factory recursively creates sub-strategies
- API and CLI support for creating composite workflows
- Config validation prevents circular references
- Unit and integration tests for all combinator types
- Documentation with usage examples
Blocked By
- Phase 1-5 (Epic: Phase 1 — Introduce TriggerStrategy abstraction #326, Epic: Phase 2 — Cron and Delay triggers #327, Epic: Phase 4 — Webhook trigger #329, Epic: Phase 5 — Manual trigger and API dispatch #330) — all closed
- AgentIdle and FileWatch epics should ideally land first so they can be composed
Stack Base
Stack on: feature/autonomous-pipeline — this epic depends on other Phase 6 epics being available for composition but can begin implementation in parallel since it wraps the existing strategy trait.
Key Files
crates/orchestrator/src/scheduler/strategy.rs— add CompositeStrategycrates/orchestrator/src/scheduler/types.rs— add Composite variant with nested TriggerConfigcrates/orchestrator/src/scheduler/runner.rs— recursive strategy creationcrates/orchestrator/src/scheduler/api.rs— validation for nested configs
Reactions are currently unavailable