fix(agents): ניתוב הערת-יו"ר לא ל-issue סגור (cancelled) — תמיד ל-CEO החי
בעיה חוזרת: הקלדת הוראה בתיבת "כתוב הוראה לסוכנים..." נבלעה בשקט. השרת בחר את היעד ב-`active[-1]` תוך סינון `done` בלבד — לא `cancelled`. כשה-child האחרון בוטל (למשל 1027-04-26: "חישוב טיעונים" cancelled שנוצר אחרי ה-issue הראשי), ההערה נותבה אליו; Paperclip מדלג על wakeup ל-issue מבוטל → ההוראה לא הגיעה לאיש. תיקון (G1 — נרמול במקור, לא תיקון-בקריאה): - `pick_default_comment_target` חדש ב-paperclip_client — מעדיף את ה-issue הראשי החי של ה-CEO (top-level+open), נופל ל-open כלשהו, ואז top-level, ואף פעם לא מעדיף child-סגור. `get_case_issues` מחזיר כעת `parent_id`. - app.py מנתב דרכו; מחזיר `issue_status` כדי שה-UI יוכל לסמן יעד-סגור. - נחשף דרך ה-Port (G12) כ-`pc_pick_default_comment_target`. - 6 בדיקות ל-picker (כולל תרחיש 1027-04-26 המדויק). Invariants: G1 (נרמול-במקור), G2 (אין מסלול-ניתוב מקביל), G12 (מגע-Paperclip דרך ה-Port). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
web/app.py
12
web/app.py
@@ -69,6 +69,7 @@ from web.agent_platform_port import (
|
||||
pc_get_agents,
|
||||
pc_get_agents_for_case,
|
||||
pc_get_case_issues,
|
||||
pc_pick_default_comment_target,
|
||||
pc_get_issue_comments,
|
||||
pc_get_issue_interactions,
|
||||
pc_get_run_events,
|
||||
@@ -4609,7 +4610,8 @@ class AgentCommentRequest(BaseModel):
|
||||
async def api_post_agent_comment(case_number: str, req: AgentCommentRequest):
|
||||
"""Post a comment on a Paperclip issue linked to a case.
|
||||
|
||||
If issue_id is omitted, the most recent non-done issue is used.
|
||||
If ``issue_id`` is omitted, routing prefers the live CEO main issue and
|
||||
never a closed (done/cancelled) issue — see ``_pick_default_comment_target``.
|
||||
"""
|
||||
issues = await pc_get_case_issues(case_number)
|
||||
if not issues:
|
||||
@@ -4620,14 +4622,14 @@ async def api_post_agent_comment(case_number: str, req: AgentCommentRequest):
|
||||
if not target:
|
||||
raise HTTPException(404, f"Issue {req.issue_id} לא שייך לתיק {case_number}")
|
||||
else:
|
||||
# Pick the most recent non-done issue, or the last one
|
||||
active = [i for i in issues if i["status"] != "done"]
|
||||
target = active[-1] if active else issues[-1]
|
||||
target = pc_pick_default_comment_target(issues)
|
||||
|
||||
result = await pc_post_comment(target["id"], target["company_id"], req.body)
|
||||
|
||||
# Find the identifier for the response
|
||||
# Echo the resolved target so the UI can show where it landed and flag it
|
||||
# when the chair explicitly targeted a closed issue (whose wakeup is skipped).
|
||||
result["issue_identifier"] = target.get("identifier", "")
|
||||
result["issue_status"] = target.get("status", "")
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user