feat(seance): אחזור-הקשר מריצות-קודמות של issue לצמצום blind-heartbeats (#220)
מוסיף get_predecessor_context(issue_id, limit) ב-paperclip_client — read-only,
מחזיר ריצות-heartbeat שהסתיימו על אותו issue (newest-first) עם ה-summary שכל
heartbeat משאיר ב-result_json, כך ש-wake טרי קורא מה קודמיו הסיקו במקום לגלות-מחדש
(ה-generic blind heartbeat). קשירת run→issue דרך wakeup_request_id→payload.issueId;
limit מוגבל 1..10.
- Port: pc_get_predecessor_context (read-only, לא עטוף-טלמטריה).
- endpoint: GET /api/operations/issues/{issue_id}/predecessor?limit=3.
- 3 בדיקות (fake-asyncpg: shaping+isoformat, clamp, empty). אומת חי read-only על
issue בן 11 ריצות → מוחזרות מסקנות-דיספוזיציה אמיתיות.
Invariants: מקיים G12 (fetch מהמעטפת, המגע מהשער; אין REST/כלי-פלטפורמה בליבה),
G2 (מקור-predecessor יחיד). follow-up: MCP tool + HEARTBEAT (wake קורא בתחילת ריצה).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
13
web/app.py
13
web/app.py
@@ -63,6 +63,7 @@ from web.agent_platform_port import (
|
||||
pc_create_workflow_issue,
|
||||
pc_escalate_issue,
|
||||
pc_get_agent_health,
|
||||
pc_get_predecessor_context,
|
||||
pc_get_agents,
|
||||
pc_get_agents_for_case,
|
||||
pc_get_case_issues,
|
||||
@@ -7544,6 +7545,18 @@ async def operations_agent_health():
|
||||
return await pc_get_agent_health()
|
||||
|
||||
|
||||
@app.get("/api/operations/issues/{issue_id}/predecessor")
|
||||
async def operations_issue_predecessor(issue_id: str, limit: int = 3):
|
||||
"""Recent finished runs on an issue for session continuation (#220, "seance").
|
||||
|
||||
Read-only. Lets a fresh heartbeat read what its predecessors on the same
|
||||
issue concluded (the run ``summary`` each leaves) instead of rediscovering
|
||||
context from scratch. Agent-facing wiring (MCP tool + HEARTBEAT) is a
|
||||
follow-up; this is the backend it will call.
|
||||
"""
|
||||
return await pc_get_predecessor_context(issue_id, limit)
|
||||
|
||||
|
||||
@app.get("/api/operations/agents/runs/{run_id}/log")
|
||||
async def operations_agent_run_log(run_id: str):
|
||||
"""Full output log (NDJSON stream) of one heartbeat run."""
|
||||
|
||||
Reference in New Issue
Block a user