Files
flowgraph/tasks/reactive-max-concurrency.md

38 lines
1.6 KiB
Markdown

---
id: reactive/max-concurrency
name: Implement maxConcurrency semaphore for Parallel groups
status: completed
depends_on:
- reactive/node-status
- component/parallel
scope: narrow
risk: medium
impact: component
level: implementation
---
## Description
Implement the reactive counting semaphore that enforces `maxConcurrency` on Parallel groups. When the root initializes signals for nodes in a Parallel group with `maxConcurrency: N`, a node's effective `ready` transition requires both `preconditions.value === true` AND `runningCount < maxConcurrency`.
## Acceptance Criteria
- [ ] For each node in a Parallel group with `maxConcurrency`, the `canStart` computed wraps preconditions: `preconditions.value && runningSiblingCount < maxConcurrency`
- [ ] `runningSiblingCount` is a reactive computed derived from counting sibling nodes currently in `"running"` state
- [ ] When a sibling completes and a slot opens, the next ready node transitions to ready/startable
- [ ] Parallel groups without `maxConcurrency` (default): all siblings start immediately when preconditions met — no semaphore
- [ ] `maxConcurrency` is a runtime scheduling hint — the DAG doesn't encode it
- [ ] Unit tests: parallel group with maxConcurrency: 2 limits to 2 running at a time, slot opens → next node starts, no maxConcurrency → all start immediately
## References
- docs/architecture/reactive-execution.md — maxConcurrency, counting semaphore
- docs/architecture/workflow-templates.md — Parallel.maxConcurrency prop
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion