fix(#85): claude_session retry על כשלים חולפים של claude -p #94

Merged
chaim merged 1 commits from worktree-style-acquisition-mvp into main 2026-06-06 20:09:09 +00:00
Owner

שורש הבעיה (אובחן)

#85 דווח כ"nested claude -p exits 1". אבחון אמפירי הראה שזה לא nesting: claude -p מקונן מ-bash הצליח (exit 0), פרומפט קטן דרך claude_session הצליח, ואותו פרומפט גדול (70K) שנכשל קודם — הצליח בריצה חוזרת (281s, TTFT 131s). כלומר כשל חולף ב-exit מהיר + stderr ריק על פרומפטים גדולים/איטיים (CEO write_interim_draft, learning_loop distillation).

התיקון

query() עוטף את spawn+communicate ב-לולאת retry (MAX_RETRIES=3, backoff לינארי 5s*attempt). FileNotFoundError ו-timeout נשארים דטרמיניסטיים (ללא retry); empty-response מטופל גם הוא כ-transient.

אימות e2e

distillation על 1130-25 רץ בהצלחה → pair=analyzed (9 שינויים, 6 style_method, 10 ביטויים, 33.8% diff). זה גם פותר את write_interim_draft של ה-CEO (אותו מסלול).

פריסה: claude_session רץ מקומית (MCP/agents) — לא בקונטיינר. MCP טוען per-run אחרי sync ל-main.

🤖 Generated with Claude Code

## שורש הבעיה (אובחן) #85 דווח כ"nested claude -p exits 1". אבחון אמפירי הראה ש**זה לא nesting**: `claude -p` מקונן מ-bash הצליח (exit 0), פרומפט קטן דרך claude_session הצליח, ואותו פרומפט גדול (70K) שנכשל קודם — **הצליח בריצה חוזרת** (281s, TTFT 131s). כלומר **כשל חולף** ב-exit מהיר + stderr ריק על פרומפטים גדולים/איטיים (CEO `write_interim_draft`, `learning_loop` distillation). ## התיקון `query()` עוטף את spawn+communicate ב-**לולאת retry** (`MAX_RETRIES=3`, backoff לינארי `5s*attempt`). `FileNotFoundError` ו-timeout נשארים דטרמיניסטיים (ללא retry); `empty-response` מטופל גם הוא כ-transient. ## אימות e2e distillation על 1130-25 רץ **בהצלחה** → pair=`analyzed` (9 שינויים, 6 style_method, 10 ביטויים, 33.8% diff). זה גם פותר את `write_interim_draft` של ה-CEO (אותו מסלול). פריסה: claude_session רץ **מקומית** (MCP/agents) — לא בקונטיינר. MCP טוען per-run אחרי sync ל-main. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-06 20:08:55 +00:00
שורש #85 התברר: `claude -p` נכשל מדי פעם ב-exit מהיר + stderr ריק על
פרומפטים גדולים/איטיים (CEO write_interim_draft, learning_loop distillation),
**אותו פרומפט מצליח בריצה חוזרת** — כשל חולף, לא nesting (אומת: nested claude
מ-bash וגם פרומפט 70K הצליחו; הכשל אינו דטרמיניסטי).

query() עוטף spawn+communicate ב-לולאת retry (MAX_RETRIES=3, backoff לינארי
5s*attempt). FileNotFoundError + timeout נשארים דטרמיניסטיים (ללא retry).
empty-response גם מטופל כ-transient.

אומת e2e: distillation על 1130-25 רץ בהצלחה → pair=analyzed (9 שינויים,
6 style_method, 33.8% diff). פותר גם את write_interim_draft של ה-CEO.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim force-pushed worktree-style-acquisition-mvp from 9d2536a667 to e096c51037 2026-06-06 20:08:55 +00:00 Compare
chaim merged commit 161d0d6ed6 into main 2026-06-06 20:09:09 +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#94