fix(cases): tolerant case_number lookup so agents see case documents
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m39s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m39s
Reported: an agent claimed the case had no documents because document_list returned empty — but the documents exist. Root cause: get_case_by_number did an exact `WHERE case_number = $1`, so any formatting variant of the number silently failed to resolve. Verified on 8137-24 (9 docs): "8137/24", "ערר 8137-24", leading/trailing space, and "בל\"מ 8126/03/25" all returned "תיק לא נמצא", which the agent read as "no documents" and went blind. Add _normalize_case_number (strip leading proceeding-type prefix to the first digit, trim, unify '/'→'-') and a normalized fallback in the lookup query (exact match preferred via ORDER BY). One fix covers every case_number-scoped tool (document_list, extract_references, search_case_documents, get_claims, drafting, ...). Bogus numbers still correctly resolve to "not found". (#58) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1988,13 +1988,25 @@
|
||||
"testStrategy": "אחרי re-chunk לתיק לדוגמה: 0 chunks<50 לאותו case_law_id; search_internal_decisions עדיין מחזיר את התיק; ספירת chunks סבירה.",
|
||||
"subtasks": [],
|
||||
"updatedAt": "2026-05-30T11:19:06.142606+00:00"
|
||||
},
|
||||
{
|
||||
"id": "58",
|
||||
"title": "[Case access] get_case_by_number שביר לפורמט — סוכן 'עיוור' למסמכי תיק",
|
||||
"description": "דווח ע\"י chaim: סוכן כתב שחסרים מסמכי תיק כי document_list החזיר ריק, אך המסמכים קיימים. שורש: get_case_by_number (db.py) עושה 'WHERE case_number=$1' התאמה מדויקת בלבד. אומת — 8137-24 מחזיר 9 מסמכים, אבל 8137/24 / 'ערר 8137-24' / רווחים / zero-pad → 'תיק לא נמצא'. הסוכן מקבל את המספר בפורמט שונה (כותרת issue, לוכסן, תחילית ערר/בל\"מ) → התאמה נכשלת → 'אין מסמכים'. משפיע על כל הכלים מבוססי case_number (document_list, extract_references, search_case_documents, get_claims, draft, וכו'). תיקון: נורמליזציה (strip prefix לתחילת ספרה, trim, '/'→'-') + fallback בשאילתה. תיקון נקודה-אחת מתקן את כל הכלים.",
|
||||
"status": "done",
|
||||
"priority": "high",
|
||||
"dependencies": [],
|
||||
"details": "db.py: get_case_by_number (~שורה לאחר get_case). להוסיף _normalize_case_number + שאילתה עם OR על replace(trim(case_number),'/','-')=norm, ORDER BY exact-first. בדיקה: כל הווריאציות של 8137-24 מחזירות 9 מסמכים.",
|
||||
"testStrategy": "document_list על 7 וריאציות פורמט של תיק קיים → כולן מחזירות את אותם מסמכים; תיק לא-קיים אמיתי עדיין מחזיר 'לא נמצא'.",
|
||||
"subtasks": [],
|
||||
"updatedAt": "2026-05-30T11:54:34.291Z"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"version": "1.0.0",
|
||||
"lastModified": "2026-05-30T11:19:23.923Z",
|
||||
"taskCount": 57,
|
||||
"completedCount": 52,
|
||||
"lastModified": "2026-05-30T11:54:34.291Z",
|
||||
"taskCount": 58,
|
||||
"completedCount": 53,
|
||||
"tags": [
|
||||
"legal-ai"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user