Chaim 26451f7c9d
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
fix(ceo): company-wide pending-comment scan with mandatory case binding
Root cause (proven 2026-06-30, legal-ai #164): the comment-sweep wakes the CEO
via ctx.agents.invoke, which does NOT populate $PAPERCLIP_WAKE_REASON or
payload.issueId. The run transcript showed "generic heartbeat with no scoped
wake" — the CEO's `user_commented` branch never fired, it ran a generic
heartbeat that scans only CEO-assigned issues, and chair comments on
chaim/sub-agent-owned issues (e.g. CMPA-116) were invisible → no-op. Two real
6-day-stale chair requests sat undelivered.

Fix: on any wake without a scoped reason, the CEO must DISCOVER pending chair
comments itself. Adds "סריקת הערות-יו"ר תלויות (company-wide)":
- enumerate all active company issues (/api/companies/{id}/issues)
- pending = newest user comment newer than newest agent comment (ignore
  system); order-independent sort_by(createdAt) since the API is newest-first
- MANDATORY case binding from the STRUCTURED project.name ("ערר <case> — …"),
  never from the title (CMPA-116 has none) nor the comment content (which may
  name a different case, e.g. "ניסיתי ב-CMPA-89"). No confident case → do NOT
  act; escalate to chair.
- handle each pending comment scoped to its own $ISSUE_ID/$CASE_NUMBER

Verified end-to-end against live data: 13 active issues → exactly 2 pending
(CMPA-116, CMPA-89), both resolved to case 8125-09-24 via project.name, zero
false positives. Step 0 + Step A wired to run the scan on blind wakes.

Refs #164. Pairs with the plugin sweep (delivery) — this is discovery+action.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 12:19:05 +00:00
Description
AI Legal Decision Drafting System — MCP server, web upload, RAG search
37 MiB
Languages
Python 65.8%
TypeScript 32.2%
JavaScript 1%
Shell 0.7%
CSS 0.2%