diff --git a/tests/test_automation_ck_health.py b/tests/test_automation_ck_health.py index 2241a2c..6a467ac 100644 --- a/tests/test_automation_ck_health.py +++ b/tests/test_automation_ck_health.py @@ -617,7 +617,7 @@ class TestOrphanRunCleanup(_Base): self.session.refresh(stale) self.session.refresh(done) assert cleaned == 1 - assert stale.status == "failed" + assert stale.status == "interrupted" assert stale.finished_at is not None assert stale.message == "服务重启中断" assert done.status == "success" # 已完成的不受影响 diff --git a/web/backend/services/automation/scheduler.py b/web/backend/services/automation/scheduler.py index 05174ea..e32b64c 100644 --- a/web/backend/services/automation/scheduler.py +++ b/web/backend/services/automation/scheduler.py @@ -140,7 +140,10 @@ def cleanup_orphan_runs(db: Session, message: str = "服务重启中断") -> int """ orphans = db.query(AutomationRun).filter(AutomationRun.status == "running").all() for run in orphans: - run.status = "failed" + # 用 interrupted 而不是 failed:这不是作业本身的失败(账号侧 CK 没丢、 + # 被中断的也会按退避重试),只是进程没了导致那轮没跑完。混进 failed + # 会让页面一片红,掩盖真正的失败。 + run.status = "interrupted" run.finished_at = datetime.now(UTC) run.message = message if orphans: diff --git a/web/frontend/src/pages/AutomationPage.tsx b/web/frontend/src/pages/AutomationPage.tsx index b5eba65..95100ea 100644 --- a/web/frontend/src/pages/AutomationPage.tsx +++ b/web/frontend/src/pages/AutomationPage.tsx @@ -31,6 +31,9 @@ import { formatTime } from "../utils/time"; const STATUS_TAG: Record = { success: { color: "green", text: "成功" }, failed: { color: "red", text: "失败" }, + // 被部署/重启打断:不是作业本身的失败(CK 没丢,会自动重试), + // 用中性色,避免和真失败混在一起。 + interrupted: { color: "default", text: "被中断" }, running: { color: "blue", text: "执行中" }, skipped: { color: "default", text: "已跳过" }, };