feat: add multi-feature batching for coding agents

Enable the orchestrator to assign 1-3 features per coding agent subprocess,
selected via dependency chain extension + same-category fill. This reduces
cold-start overhead and leverages shared context across related features.

Orchestrator (parallel_orchestrator.py):
- Add batch tracking: _batch_features and _feature_to_primary data structures
- Add build_feature_batches() with dependency chain + category fill algorithm
- Add start_feature_batch() and _spawn_coding_agent_batch() methods
- Update _on_agent_complete() for batch cleanup across all features
- Update stop_feature() with _feature_to_primary lookup
- Update get_ready_features() to exclude all batch feature IDs
- Update main loop to build batches then spawn per available slot

CLI and agent layer:
- Add --feature-ids (comma-separated) and --batch-size CLI args
- Add feature_ids parameter to run_autonomous_agent() with batch prompt selection
- Add get_batch_feature_prompt() with sequential workflow instructions

WebSocket layer (server/websocket.py):
- Add BATCH_CODING_AGENT_START_PATTERN and BATCH_FEATURES_COMPLETE_PATTERN
- Add _handle_batch_agent_start() and _handle_batch_agent_complete() methods
- Add featureIds field to all agent_update messages
- Track current_feature_id updates as agent moves through batch

Frontend (React UI):
- Add featureIds to ActiveAgent and WSAgentUpdateMessage types
- Update KanbanColumn and DependencyGraph agent-feature maps for batch
- Update AgentCard to show "Batch: #X, #Y, #Z" with active feature highlight
- Add "Features per Agent" segmented control (1-3) in SettingsModal

Settings integration (full stack):
- Add batch_size to schemas, settings router, agent router, process manager
- Default batch_size=3, user-configurable 1-3 via settings UI
- batch_size=1 is functionally identical to pre-batching behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Auto
2026-02-01 16:35:07 +02:00
parent e1e5209866
commit 1607fc8175
16 changed files with 654 additions and 82 deletions

View File

@@ -133,6 +133,13 @@ Authentication:
help="Work on a specific feature ID only (used by orchestrator for coding agents)",
)
parser.add_argument(
"--feature-ids",
type=str,
default=None,
help="Comma-separated feature IDs to implement in batch (e.g., '5,8,12')",
)
# Agent type for subprocess mode
parser.add_argument(
"--agent-type",
@@ -170,6 +177,13 @@ Authentication:
help="Number of features per testing batch (1-5, default: 3)",
)
parser.add_argument(
"--batch-size",
type=int,
default=3,
help="Max features per coding agent batch (1-3, default: 3)",
)
return parser.parse_args()
@@ -222,6 +236,15 @@ def main() -> None:
print(f"Error: --testing-feature-ids must be comma-separated integers, got: {args.testing_feature_ids}")
return
# Parse batch coding feature IDs (comma-separated string -> list[int])
coding_feature_ids: list[int] | None = None
if args.feature_ids:
try:
coding_feature_ids = [int(x.strip()) for x in args.feature_ids.split(",") if x.strip()]
except ValueError:
print(f"Error: --feature-ids must be comma-separated integers, got: {args.feature_ids}")
return
try:
if args.agent_type:
# Subprocess mode - spawned by orchestrator for a specific role
@@ -232,6 +255,7 @@ def main() -> None:
max_iterations=args.max_iterations or 1,
yolo_mode=args.yolo,
feature_id=args.feature_id,
feature_ids=coding_feature_ids,
agent_type=args.agent_type,
testing_feature_id=args.testing_feature_id,
testing_feature_ids=testing_feature_ids,
@@ -254,6 +278,7 @@ def main() -> None:
yolo_mode=args.yolo,
testing_agent_ratio=args.testing_ratio,
testing_batch_size=args.testing_batch_size,
batch_size=args.batch_size,
)
)
except KeyboardInterrupt: