paperclip: assign CEO on issue creation so wakeup gate accepts run
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 9s

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.
This commit is contained in:
2026-05-01 15:32:22 +00:00
parent 817d6e6d8d
commit 5deb38f5cf

View File

@@ -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)