fix: auto-assign tasks to PM agent when moved to in_progress, fix datetime serialization in WebSocket, add executor logging
This commit is contained in:
@@ -43,13 +43,18 @@ class AgentExecutor:
|
||||
async def start(self):
|
||||
"""Start the executor service"""
|
||||
self.running = True
|
||||
print("=== Agent Executor Loop Started ===")
|
||||
logger.info("Agent executor service started")
|
||||
|
||||
while self.running:
|
||||
try:
|
||||
print(f"[Executor] Checking for pending executions... (running={self.running})")
|
||||
await self._process_pending_executions()
|
||||
except Exception as e:
|
||||
print(f"[Executor] Error in executor loop: {e}")
|
||||
logger.error(f"Error in executor loop: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
await asyncio.sleep(5) # Check every 5 seconds
|
||||
|
||||
@@ -61,11 +66,14 @@ class AgentExecutor:
|
||||
async def _process_pending_executions(self):
|
||||
"""Process pending agent executions"""
|
||||
executions = await opc_db.get_agent_executions(status="pending", limit=10)
|
||||
print(f"[Executor] Found {len(executions)} pending executions")
|
||||
|
||||
for execution in executions:
|
||||
try:
|
||||
print(f"[Executor] Processing execution {execution['id']} for agent {execution['agent_id']}")
|
||||
await self._execute_agent(execution)
|
||||
except Exception as e:
|
||||
print(f"[Executor] Failed to execute agent {execution['agent_id']}: {e}")
|
||||
logger.error(f"Failed to execute agent {execution['agent_id']}: {e}")
|
||||
await self._mark_execution_failed(execution["id"], str(e))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user