From 088202e6f6809624b9bbf911076141fe833c6e40 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sat, 30 May 2026 00:23:34 +0800 Subject: [PATCH] auto-sync: 2026-05-30 00:23:34 --- src/daemon/spawner.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index 750e8d7..00db6ac 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -480,6 +480,9 @@ curl -X POST http://{self.api_host}:{self.api_port}/api/projects/{project_id}/ta # 2. session state 检查(main session 防外部占用) if use_main_session: session_state = self._check_session_state(agent_id) + logger.info("Session state check for %s: status=%s lock_pid=%s lock_pid_alive=%s recent_compact=%s", + agent_id, session_state.get('status'), session_state.get('lock_pid'), + session_state.get('lock_pid_alive'), session_state.get('recent_compact')) if session_state.get("lock_pid_alive"): logger.info("Spawn skipped: %s main session locked by PID %d", agent_id, session_state.get("lock_pid")) @@ -1174,7 +1177,7 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_ # 注意:exit=0 + stdout 为空可能是正常完成(--json 没输出), # 此时 task_status 如果是 done/review 会被上面的 A4 兜住 if status is None and not stdout_text.strip() and exit_code != 0: - return {"outcome": "process_crash", "should_retry": False} + return {"outcome": "crashed", "should_retry": False, "original": "process_crash"} # stdout 为空但 exit=0:可能是正常完成但 --json 没输出 # 查任务状态判断 @@ -1200,7 +1203,7 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_ return {"outcome": "agent_error", "should_retry": False} # 兜底:status 未知值 - return {"outcome": "unknown_status", "should_retry": False} + return {"outcome": "agent_error", "should_retry": False, "original": "unknown_status"} @staticmethod def _get_retry_counts(db_path: Optional[Path], task_id: Optional[str]) -> dict: