fix(routing): comment→CEO wakeup reads issue id from event.entityId #2

Merged
chaim merged 1 commits from fix/comment-routing-ceo-entityid into main 2026-06-17 04:55:46 +00:00
Owner

הבאג

ה-handler של issue.comment.created קרא את מזהה-ה-issue מ-payload.issueId, אבל Paperclip הנוכחי לא שולח שדה כזה — מזהה-ה-issue מגיע ב-event.entityId, וה-payload מכיל commentId/bodySnippet/reopened. לכן ה-handler נפל על missing issueId, skipping בכל תגובת-משתמש, וניתוב "תגובה → CEO" (המתועד ב-CLAUDE.md) היה מת בשקט.

אבחון (תיק 8124-09-24, CMPA)

שאלה שנכתבה על sub-issue של המנתח המשפטי (במצב done) לא הגיעה ל-CEO:

  1. הפלאגין דילג (payload.issueId ריק).
  2. מנגנון reopen-on-comment הנייטיב של Paperclip ניסה להעיר את הסוכן-המשויך (המנתח), וריצת-ה-CEO בתור בוטלה עם issue_assignee_changed.

התיקון

  • issueId מ-event.entityId (fallback ל-payload.issueId לעמידות מול גרסאות-host).
  • חילוץ גוף-התגובה המלא לפי payload.commentId מתוך listComments (ה-payload נושא רק bodySnippet קצוץ); fallback ל-latest/snippet.
  • guard לדה-דופ: אם התגובה פתחה-מחדש issue שכבר משויך ל-CEO, ה-wake הנייטיב מטפל בזה — מדלגים כדי לא להריץ את ה-CEO פעמיים. ל-issues של סוכן אחר עדיין מנתבים ל-CEO.

Invariants

מקיים את חוזה "תגובת-משתמש מנותבת דרך ה-CEO" (CLAUDE.md §"ניתוב comments"); הנגיעה היא רק במעטפת שער-הפלטפורמה (הפלאגין), בהתאם ל-G12 / X15. אין מסלול-מקביל חדש.

אימות

לאחר merge: npm run build + pm2 restart paperclip, ואז תגובת-בדיקה על sub-issue של סוכן שאינו ה-CEO → צפוי בלוג Routed user comment to CEO agent + heartbeat-run של ה-CEO ב-running (לא cancelled).

TaskMaster: legal-ai #149.

🤖 Generated with Claude Code

## הבאג ה-handler של `issue.comment.created` קרא את מזהה-ה-issue מ-`payload.issueId`, אבל Paperclip הנוכחי **לא** שולח שדה כזה — מזהה-ה-issue מגיע ב-`event.entityId`, וה-payload מכיל `commentId`/`bodySnippet`/`reopened`. לכן ה-handler נפל על `missing issueId, skipping` בכל תגובת-משתמש, וניתוב **"תגובה → CEO"** (המתועד ב-CLAUDE.md) היה **מת בשקט**. ## אבחון (תיק 8124-09-24, CMPA) שאלה שנכתבה על sub-issue של המנתח המשפטי (במצב `done`) לא הגיעה ל-CEO: 1. הפלאגין דילג (`payload.issueId` ריק). 2. מנגנון reopen-on-comment הנייטיב של Paperclip ניסה להעיר את הסוכן-המשויך (המנתח), וריצת-ה-CEO בתור בוטלה עם `issue_assignee_changed`. ## התיקון - `issueId` מ-`event.entityId` (fallback ל-`payload.issueId` לעמידות מול גרסאות-host). - חילוץ גוף-התגובה המלא לפי `payload.commentId` מתוך `listComments` (ה-payload נושא רק `bodySnippet` קצוץ); fallback ל-latest/snippet. - **guard לדה-דופ:** אם התגובה פתחה-מחדש issue **שכבר משויך ל-CEO**, ה-wake הנייטיב מטפל בזה — מדלגים כדי לא להריץ את ה-CEO פעמיים. ל-issues של סוכן אחר עדיין מנתבים ל-CEO. ## Invariants מקיים את חוזה "תגובת-משתמש מנותבת דרך ה-CEO" (CLAUDE.md §"ניתוב comments"); הנגיעה היא רק במעטפת שער-הפלטפורמה (הפלאגין), בהתאם ל-**G12 / X15**. אין מסלול-מקביל חדש. ## אימות לאחר merge: `npm run build` + `pm2 restart paperclip`, ואז תגובת-בדיקה על sub-issue של סוכן שאינו ה-CEO → צפוי בלוג `Routed user comment to CEO agent` + heartbeat-run של ה-CEO ב-`running` (לא `cancelled`). TaskMaster: legal-ai #149. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-17 04:55:41 +00:00
The `issue.comment.created` handler read `payload.issueId`, which the current
Paperclip host never sends — the issue id arrives in `event.entityId` and the
payload carries `commentId`/`bodySnippet`/`reopened` instead. So the handler
hit "missing issueId, skipping" on every user comment and the documented
"user comment → CEO" routing was silently dead.

Diagnosed on case 8124-09-24 (CMPA): a question commented on an analyst's
`done` sub-issue never reached the CEO. The plugin skipped; Paperclip's native
reopen-on-comment wake then targeted the sub-issue's assignee (the analyst) and
the queued CEO run was cancelled with `issue_assignee_changed`.

Fix:
- issueId from `event.entityId` (fallback `payload.issueId` for host-version skew).
- Resolve full comment body by matching `payload.commentId` in listComments
  (payload only has a truncated `bodySnippet`); fall back to latest/snippet.
- Dedup guard: when the comment reopened an issue ALREADY assigned to the CEO,
  the host's native wake covers it — skip to avoid double-running the CEO.
  For issues owned by any other agent we still route to the CEO.

Invariants: upholds the "user comment routes through CEO" contract (CLAUDE.md);
touches only the platform-port shell (plugin), per G12/X15. No new parallel path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit b6bf726570 into main 2026-06-17 04:55:46 +00:00
chaim deleted branch fix/comment-routing-ceo-entityid 2026-06-17 04:55:46 +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/plugin-legal-ai#2