From 5deb38f5cfb182170004741a2e178db1b6cbfbe6 Mon Sep 17 00:00:00 2001 From: Chaim Date: Fri, 1 May 2026 15:32:22 +0000 Subject: [PATCH] paperclip: assign CEO on issue creation so wakeup gate accepts run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Paperclip heartbeat staleness gate (heartbeat.js evaluateQueuedRunStaleness) cancels queued runs when issue.assigneeAgentId !== run.agentId, with error "issue assignee changed before the queued run could start". Older Paperclip versions auto-assigned on wakeup; the current version does not, so issues created with NULL assignee silently never run. Set assignee_agent_id to the company's CEO at INSERT time. Affects both the project setup issue and the "התחל תהליך ניסוח" workflow issue. --- web/paperclip_client.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/paperclip_client.py b/web/paperclip_client.py index 91785fd..204f182 100644 --- a/web/paperclip_client.py +++ b/web/paperclip_client.py @@ -268,13 +268,19 @@ async def _create_issue( issue_number = row["issue_counter"] identifier = f"{prefix}-{issue_number}" + # Assign to the company's CEO so Paperclip's wakeup gate + # (heartbeat staleness check) accepts the wakeup. Without this, + # the run is cancelled with "issue assignee changed before the + # queued run could start" and the agent never starts. + ceo_agent_id = CEO_AGENTS.get(company_id, CEO_AGENT_ID) + await conn.execute( - """INSERT INTO issues (id, company_id, project_id, title, description, status, priority, issue_number, identifier) - VALUES ($1, $2::uuid, $3::uuid, $4, $5, 'todo', 'medium', $6, $7)""", + """INSERT INTO issues (id, company_id, project_id, title, description, status, priority, issue_number, identifier, assignee_agent_id) + VALUES ($1, $2::uuid, $3::uuid, $4, $5, 'todo', 'medium', $6, $7, $8::uuid)""", issue_id, company_id, project_id, f"[ערר {case_number}] {title}"[:200], f"תיק ערר {case_number}\nנוצר אוטומטית מממשק העלאת מסמכים", - issue_number, identifier, + issue_number, identifier, ceo_agent_id, ) logger.info("Created Paperclip issue %s: [ערר %s] %s", identifier, case_number, title)