From 078104f0f0824476a1b707f48c7f00c53069080f Mon Sep 17 00:00:00 2001 From: cfdaily Date: Tue, 26 May 2026 14:38:09 +0800 Subject: [PATCH] auto-sync: 2026-05-26 14:38:09 --- src/daemon/spawner.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index 27f0e07..70365c2 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -1029,10 +1029,6 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_ summary = json_result.get("summary", "") fallback_used = json_result.get("fallback_used", False) - # stdout 为空 = 进程异常终止 - if status is None and not stdout_text.strip(): - return {"outcome": "process_crash", "should_retry": False} - # A4: 任务 DB status=failed(Agent 自己标的) if task_status == "failed": return {"outcome": "agent_failed", "should_retry": False} @@ -1052,6 +1048,20 @@ curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task_ # A7-A12: status=error → 不续杯,stderr 辅助分类 if status == "error": + + # A0: stdout 为空且 exit≠0 = 进程异常终止 + # 注意:exit=0 + stdout 为空可能是正常完成(--json 没输出), + # 此时 task_status 如果是 done/review 会被上面的 A1/A4 兜住 + if status is None and not stdout_text.strip() and exit_code != 0: + return {"outcome": "process_crash", "should_retry": False} + + # stdout 为空但 exit=0:可能是正常完成但 --json 没输出 + # 查任务状态判断 + if status is None and not stdout_text.strip() and exit_code == 0: + terminal_statuses = {"done", "review"} + if task_status in terminal_statuses: + return {"outcome": "completed", "should_retry": False} + return {"outcome": "agent_error", "should_retry": False} stderr_lower = stderr_text.lower() if any(kw in stderr_lower for kw in ["401", "403", "unauthorized", "auth"]): return {"outcome": "auth_failed", "should_retry": False}