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

@@ -2588,14 +2588,17 @@ async def api_start_workflow(case_number: str):
except Exception as 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:
wakeup = await pc_wake_ceo(issue["issue_id"], case_number, issue.get("company_id", ""))
except Exception as e:
logger.warning("CEO wakeup failed for case %s: %s", case_number, e)
wakeup = {"error": str(e)}
logger.error("CEO wakeup failed for case %s: %s", case_number, 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")
return {