fix(extraction): self-heal לתור חילוץ-ההלכות + drainer מתוזמן #142

Merged
chaim merged 1 commits from worktree-halacha-selfheal into main 2026-06-08 06:05:27 +00:00
Owner

למה

תור חילוץ-ההלכות היה תקוע (אותו סוג בעיה כמו המטא): 26 פסיקות ביקשו חילוץ ללא drainer, + 1 יתומה ב-processing (status=processing, requested_at נוקה → התור לעולם לא בוחר אותה שוב).

הבהרה: ה-38 ב-/approvals הן שער-אישור-היו"ר (INV-G10) — לא נגעתי בהן; דפנה מאשרת. ה-PR רק מנקז את החילוץ (שמייצר הלכות לאישור).

מה השתנה

  • db.requeue_stale_processing_extractions(kind) — re-stamp ל-orphaned processing (requested_at IS NULL) כדי שייכנסו שוב לתור. מחלץ-ההלכות עם force=False ממשיך מ-checkpoints (בלי כפילויות).
  • process_pending_extractions קורא לזה בתחילתו — unattended, בטוח תחת ה-advisory-lock הגלובלי. מראָה ל-self-heal של תור-היומונים.
  • legal-halacha-drain.config.cjs — pm2 cron (כל שעתיים, קצב שמרני — Claude איטי/rate-limited וכל ריצה מוסיפה לתור-אישור-היו"ר). drain_halacha_queue.py נשאר על claude_session (איכות-נימוק גבוהה ל-holding/ratio; לא Gemini).

אימות

  • ה-orphaned row (1023-20) requeued, drain רץ עכשיו על 27 הפריטים (Claude, ברקע).
  • compile + self-heal callable (0 כעת — היתום כבר תוקן ידנית).

🤖 Generated with Claude Code

## למה תור חילוץ-**ההלכות** היה תקוע (אותו סוג בעיה כמו המטא): 26 פסיקות ביקשו חילוץ ללא drainer, + 1 **יתומה ב-`processing`** (status=processing, requested_at נוקה → התור לעולם לא בוחר אותה שוב). > הבהרה: ה-**38 ב-`/approvals`** הן **שער-אישור-היו"ר** (INV-G10) — לא נגעתי בהן; דפנה מאשרת. ה-PR רק מנקז את **החילוץ** (שמייצר הלכות לאישור). ## מה השתנה - **`db.requeue_stale_processing_extractions(kind)`** — re-stamp ל-orphaned `processing` (requested_at IS NULL) כדי שייכנסו שוב לתור. מחלץ-ההלכות עם `force=False` **ממשיך מ-checkpoints** (בלי כפילויות). - **`process_pending_extractions`** קורא לזה בתחילתו — unattended, בטוח תחת ה-advisory-lock הגלובלי. מראָה ל-self-heal של תור-היומונים. - **`legal-halacha-drain.config.cjs`** — pm2 cron (כל שעתיים, קצב שמרני — Claude איטי/rate-limited וכל ריצה מוסיפה לתור-אישור-היו"ר). `drain_halacha_queue.py` **נשאר על claude_session** (איכות-נימוק גבוהה ל-holding/ratio; **לא** Gemini). ## אימות - ✅ ה-orphaned row (1023-20) requeued, drain רץ עכשיו על 27 הפריטים (Claude, ברקע). - ✅ compile + self-heal callable (0 כעת — היתום כבר תוקן ידנית). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-08 06:05:20 +00:00
The halacha extraction queue was stuck (same class as the metadata issue): 26
precedents requested extraction with no drainer, plus 1 orphaned in 'processing'
(status=processing, requested_at cleared → never re-picked by the queue).

- db.requeue_stale_processing_extractions(kind): re-stamp orphaned 'processing'
  rows (requested_at IS NULL) so they re-drain; halacha extractor force=False
  resumes from chunk checkpoints (no duplicates).
- process_pending_extractions calls it at the top — fully unattended, safe under
  the global advisory lock. Mirrors the digests-drain self-heal.
- legal-halacha-drain.config.cjs: pm2 cron (every 2h, conservative — Claude is
  slow/rate-limited and each run adds to the chair's pending_review queue).
  drain_halacha_queue.py stays on claude_session (high reasoning quality for
  holding/ratio; NOT moved to Gemini). SCRIPTS.md.

The chair-approval gate (INV-G10) is untouched — this only produces halachot;
Daphna still approves each in /approvals.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit a1db283ce1 into main 2026-06-08 06:05:27 +00:00
chaim deleted branch worktree-halacha-selfheal 2026-06-08 06:05:27 +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#142