MCPcopy Index your code
hub / github.com/AutoForgeAI/autoforge / run_loop

Method run_loop

parallel_orchestrator.py:1354–1600  ·  view source on GitHub ↗

Main orchestration loop.

(self)

Source from the content-addressed store, hash-verified

1352 self.running_testing_agents.clear()
1353
1354 async def run_loop(self):
1355 """Main orchestration loop."""
1356 self.is_running = True
1357
1358 # Initialize the agent completion event for this run
1359 # Must be created in the async context where it will be used
1360 self._agent_completed_event = asyncio.Event()
1361 # Store the event loop reference for thread-safe signaling from output reader threads
1362 self._event_loop = asyncio.get_running_loop()
1363
1364 # Track session start for regression testing (UTC for consistency with last_tested_at)
1365 self.session_start_time = datetime.now(timezone.utc)
1366
1367 # Start debug logging session FIRST (clears previous logs)
1368 # Must happen before any debug_log.log() calls
1369 debug_log.start_session()
1370
1371 # Log startup to debug file
1372 debug_log.section("ORCHESTRATOR STARTUP")
1373 debug_log.log("STARTUP", "Orchestrator run_loop starting",
1374 project_dir=str(self.project_dir),
1375 max_concurrency=self.max_concurrency,
1376 yolo_mode=self.yolo_mode,
1377 testing_agent_ratio=self.testing_agent_ratio,
1378 session_start_time=self.session_start_time.isoformat())
1379
1380 print("=" * 70, flush=True)
1381 print(" UNIFIED ORCHESTRATOR SETTINGS", flush=True)
1382 print("=" * 70, flush=True)
1383 print(f"Project: {self.project_dir}", flush=True)
1384 print(f"Max concurrency: {self.max_concurrency} coding agents", flush=True)
1385 print(f"YOLO mode: {self.yolo_mode}", flush=True)
1386 print(f"Regression agents: {self.testing_agent_ratio} (maintained independently)", flush=True)
1387 print(f"Batch size: {self.batch_size} features per agent", flush=True)
1388 print("=" * 70, flush=True)
1389 print(flush=True)
1390
1391 # Phase 1: Check if initialization needed
1392 if not has_features(self.project_dir):
1393 print("=" * 70, flush=True)
1394 print(" INITIALIZATION PHASE", flush=True)
1395 print("=" * 70, flush=True)
1396 print("No features found - running initializer agent first...", flush=True)
1397 print("NOTE: This may take 10-20+ minutes to generate features.", flush=True)
1398 print(flush=True)
1399
1400 success = await self._run_initializer()
1401
1402 if not success or not has_features(self.project_dir):
1403 print("ERROR: Initializer did not create features. Exiting.", flush=True)
1404 return
1405
1406 print(flush=True)
1407 print("=" * 70, flush=True)
1408 print(" INITIALIZATION COMPLETE - Starting feature loop", flush=True)
1409 print("=" * 70, flush=True)
1410 print(flush=True)
1411

Callers 1

Calls 15

_run_initializerMethod · 0.95
get_sessionMethod · 0.95
get_all_completeMethod · 0.95
start_featureMethod · 0.95
get_ready_featuresMethod · 0.95
build_feature_batchesMethod · 0.95
start_feature_batchMethod · 0.95
has_featuresFunction · 0.90
create_databaseFunction · 0.90

Tested by

no test coverage detected