fix: start-workflow wakeup failure now returns 502 instead of silent success
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m33s

If pc_wake_ceo fails, the endpoint now raises HTTP 502 and skips the
case_update to processing — preventing cases from silently getting stuck
with no CEO running. Also adds `processing` to CEO routing table and
updates case_list docstring with full status list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 11:02:30 +00:00
parent 83b6ff51b7
commit cddc7c8d24
3 changed files with 12 additions and 5 deletions

View File

@@ -585,6 +585,7 @@ Paperclip חוסם אוטומטית כל issue ב-`in_progress` שאין לו ru
| סטטוס | מי שינה לזה | פעולה הבאה | | סטטוס | מי שינה לזה | פעולה הבאה |
|--------|-------------|------------| |--------|-------------|------------|
| `processing` | start-workflow (ממשק) | → בדוק אם כבר קיים issue פעיל לסוכן משנה. אם לא → המשך ל-§A כרגיל (בדוק documents + claims) |
| `new` | (יצירת תיק) | → בדוק extraction_status של מסמכים. אם יש `pending` → צור issue למגיה (410c0167). אם כולם `completed`/`proofread` → צור issue למנתח | | `new` | (יצירת תיק) | → בדוק extraction_status של מסמכים. אם יש `pending` → צור issue למגיה (410c0167). אם כולם `completed`/`proofread` → צור issue למנתח |
| `proofread` | מגיה | → צור issue למנתח משפטי (ראה תבנית למטה) | | `proofread` | מגיה | → צור issue למנתח משפטי (ראה תבנית למטה) |
| `documents_ready` | מנתח | → שלב A (בדיקות שלמות + שליליות + מתודולוגיה). אם עובר → עדכן ל-`analyst_verified` | | `documents_ready` | מנתח | → שלב A (בדיקות שלמות + שליליות + מתודולוגיה). אם עובר → עדכן ל-`analyst_verified` |

View File

@@ -237,7 +237,10 @@ async def case_list(status: str = "", limit: int = 50) -> str:
"""רשימת תיקי ערר עם אפשרות סינון לפי סטטוס. """רשימת תיקי ערר עם אפשרות סינון לפי סטטוס.
Args: Args:
status: סינון לפי סטטוס (new, in_progress, drafted, reviewed, final). ריק = הכל status: סינון לפי סטטוס (new, processing, proofread, documents_ready, analyst_verified,
research_complete, outcome_set, direction_pending, direction_approved,
analysis_enriched, ready_for_writing, drafted, qa_passed, qa_failed,
exported, done). ריק = הכל
limit: מספר תוצאות מקסימלי limit: מספר תוצאות מקסימלי
""" """
cases = await db.list_cases(status=status or None, limit=limit) cases = await db.list_cases(status=status or None, limit=limit)

View File

@@ -2588,14 +2588,17 @@ async def api_start_workflow(case_number: str):
except Exception as e: except Exception as e:
raise HTTPException(502, f"שגיאת Paperclip: {e}") raise HTTPException(502, f"שגיאת Paperclip: {e}")
# 3. Wake the CEO agent # 3. Wake the CEO agent — must succeed before marking case as processing
try: try:
wakeup = await pc_wake_ceo(issue["issue_id"], case_number, issue.get("company_id", "")) wakeup = await pc_wake_ceo(issue["issue_id"], case_number, issue.get("company_id", ""))
except Exception as e: except Exception as e:
logger.warning("CEO wakeup failed for case %s: %s", case_number, e) logger.error("CEO wakeup failed for case %s: %s", case_number, e)
wakeup = {"error": str(e)} raise HTTPException(
502,
f"נוצר issue {issue['identifier']} אך עירור ה-CEO נכשל: {e}. ניתן לנסות שנית.",
)
# 4. Update case status to processing # 4. Update case status to processing (only after wakeup confirmed)
await cases_tools.case_update(case_number, status="processing") await cases_tools.case_update(case_number, status="processing")
return { return {