feat(agents): reset button + fix comment routing fallback #331

Merged
chaim merged 1 commits from worktree-agent-reset into main 2026-06-24 14:54:25 +00:00
Owner

סיכום

שני תיקונים שנובעים מהאבחון של תיק 8174-12-24 שהיה תקוע עם כותב/בודק-איכות במצב שגיאה.

שינויים

  • plugin-legal-ai/src/worker.ts: כאשר listComments() נכשל, השתמש ב-bodySnippet (תמיד זמין) במקום לשלוח לCEO טקסט "(שגיאה בקריאת התגובה)". מוסיף warn log עם השגיאה האמיתית לאבחון עתידי. אם גם bodySnippet ריק — שולח הוראה מפורשת ל-CEO לקרוא תגובות בעצמו.
  • web/paperclip_client.py: reset_case_agents(case_number) — מאפס issues תקועים + status שגיאה ב-Paperclip + קורא ל-reset_agent_session לכל סוכן שגוי
  • web/agent_platform_port.py: מייצא pc_reset_case_agents (שמירת G12)
  • web/app.py: POST /api/cases/{case_number}/agents/reset
  • web-ui/src/lib/api/agents.ts: useResetCaseAgents mutation + AgentResetResult type
  • web-ui/src/components/cases/agent-status-widget.tsx: כפתור "אפס" (מוצג רק כשיש סוכן במצב שגיאה) + Dialog אישור + toast סיכום

Invariants

  • G12: כל מגע Paperclip דרך agent_platform_port.py בלבד ✓
  • G2: משתמש בתשתית קיימת (reset_agent_session, pc_get_case_issues) — אין מסלול מקביל ✓

בדיקה

  1. בתיק 8174-12-24 — ווידג'ט הסוכנים יציג כפתור "אפס" לצד כותב/בודק-איכות שבמצב שגיאה
  2. לחיצה + אישור → agents חוזרים ל"ממתין" + toast סיכום
  3. שליחת תגובה על issue → CEO מקבל bodySnippet במקום שגיאה
## סיכום שני תיקונים שנובעים מהאבחון של תיק 8174-12-24 שהיה תקוע עם כותב/בודק-איכות במצב שגיאה. ## שינויים ### 1. תיקון ניתוב תגובות בפלאגין (plugin-legal-ai — כבר מוזג ב-`main` של הפלאגין + pm2 restart) - `plugin-legal-ai/src/worker.ts`: כאשר `listComments()` נכשל, השתמש ב-`bodySnippet` (תמיד זמין) במקום לשלוח לCEO טקסט "(שגיאה בקריאת התגובה)". מוסיף `warn` log עם השגיאה האמיתית לאבחון עתידי. אם גם `bodySnippet` ריק — שולח הוראה מפורשת ל-CEO לקרוא תגובות בעצמו. ### 2. כפתור "איפוס סוכנים" (legal-ai) - **`web/paperclip_client.py`**: `reset_case_agents(case_number)` — מאפס issues תקועים + status שגיאה ב-Paperclip + קורא ל-`reset_agent_session` לכל סוכן שגוי - **`web/agent_platform_port.py`**: מייצא `pc_reset_case_agents` (שמירת G12) - **`web/app.py`**: `POST /api/cases/{case_number}/agents/reset` - **`web-ui/src/lib/api/agents.ts`**: `useResetCaseAgents` mutation + `AgentResetResult` type - **`web-ui/src/components/cases/agent-status-widget.tsx`**: כפתור "אפס" (מוצג רק כשיש סוכן במצב שגיאה) + Dialog אישור + toast סיכום ## Invariants - G12: כל מגע Paperclip דרך `agent_platform_port.py` בלבד ✓ - G2: משתמש בתשתית קיימת (`reset_agent_session`, `pc_get_case_issues`) — אין מסלול מקביל ✓ ## בדיקה 1. בתיק 8174-12-24 — ווידג'ט הסוכנים יציג כפתור "אפס" לצד כותב/בודק-איכות שבמצב שגיאה 2. לחיצה + אישור → agents חוזרים ל"ממתין" + toast סיכום 3. שליחת תגובה על issue → CEO מקבל `bodySnippet` במקום שגיאה
chaim added 1 commit 2026-06-24 14:54:18 +00:00
feat(agents): reset button + endpoint to clear stuck agent error state
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 5s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
82844a63c2
Adds a one-click 'reset agents' action for cases where writer/QA agents
are stuck in Paperclip's error state (triggered by recovery loop or
failed run). Addresses the root cause documented in
reference_paperclip_recovery_loops: reassigns open issues from agents
back to the chair user, and calls reset_agent_session for each error
agent to clear wedged runtime sessions.

Changes:
- paperclip_client.py: reset_case_agents() — reassigns stuck issues +
  clears error status in Paperclip DB + calls reset_agent_session
- agent_platform_port.py: exports pc_reset_case_agents (G12 gate)
- app.py: POST /api/cases/{case_number}/agents/reset endpoint
- agents.ts: useResetCaseAgents mutation hook + AgentResetResult type
- agent-status-widget.tsx: 'אפס' button (shown only when error agents
  exist) with Dialog confirmation + loading state + toast feedback

Invariants: G12 (Paperclip only via port), G2 (no parallel path —
uses existing reset_agent_session + pc_get_case_issues).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chaim merged commit 331b8c4249 into main 2026-06-24 14:54:25 +00:00
chaim deleted branch worktree-agent-reset 2026-06-24 14:54:26 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#331