Summary
Add per-state concurrency limits to batch execution, allowing different parallelism levels for tasks in different states. Inspired by Symphony's max_concurrent_agents_by_state configuration.
Motivation
Currently cf work batch run --max-parallel N applies a single global concurrency limit. In practice, teams may want different limits based on task state or type — for example, allowing more agents on READY tasks but limiting how many IN_PROGRESS tasks run simultaneously to avoid resource contention.
This becomes more important in Phase 4 multi-agent scenarios where different agent roles may have different resource requirements.
Design (single session)
Changes to core/conductor.py
-
Add ConcurrencyConfig dataclass:
@dataclass
class ConcurrencyConfig:
max_parallel: int = 4 # global limit
by_status: dict[str, int] = {} # per-status limits
# e.g., {"READY": 3, "IN_PROGRESS": 2, "BLOCKED": 1}
-
Update _get_available_slots() to check both global and per-status limits:
- Global slots =
max_parallel - running_count
- Per-status slots =
by_status[status] - running_count_for_status
- Available =
min(global_slots, per_status_slots)
-
Update dispatch logic to count running tasks by status
Changes to cli/app.py
- Add
--max-parallel-by-status flag:
cf work batch run --all-ready --max-parallel 4 --max-parallel-by-status "READY=3,IN_PROGRESS=2"
Changes to config
- Support in AGENTS.md/CODEFRAME.md:
batch:
max_parallel: 4
max_parallel_by_status:
READY: 3
IN_PROGRESS: 2
Acceptance Criteria
Dependencies
Summary
Add per-state concurrency limits to batch execution, allowing different parallelism levels for tasks in different states. Inspired by Symphony's
max_concurrent_agents_by_stateconfiguration.Motivation
Currently
cf work batch run --max-parallel Napplies a single global concurrency limit. In practice, teams may want different limits based on task state or type — for example, allowing more agents on READY tasks but limiting how many IN_PROGRESS tasks run simultaneously to avoid resource contention.This becomes more important in Phase 4 multi-agent scenarios where different agent roles may have different resource requirements.
Design (single session)
Changes to
core/conductor.pyAdd
ConcurrencyConfigdataclass:Update
_get_available_slots()to check both global and per-status limits:max_parallel - running_countby_status[status] - running_count_for_statusmin(global_slots, per_status_slots)Update dispatch logic to count running tasks by status
Changes to
cli/app.py--max-parallel-by-statusflag:cf work batch run --all-ready --max-parallel 4 --max-parallel-by-status "READY=3,IN_PROGRESS=2"Changes to config
Acceptance Criteria
--max-parallel-by-statusCLI flag worksDependencies