From 20b171bd168915b678658965942aa982d21f1006 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sat, 7 Mar 2026 16:18:41 -0800 Subject: [PATCH] fix(server): wake agent when issue status changes from backlog Previously, agents were only woken when the assignee changed. Now also wakes the assigned agent when an issue transitions out of backlog status (e.g. backlog -> todo). Fixes #167 Co-Authored-By: Claude Opus 4.6 --- server/src/routes/issues.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/src/routes/issues.ts b/server/src/routes/issues.ts index 8d21fe65..e4035dfc 100644 --- a/server/src/routes/issues.ts +++ b/server/src/routes/issues.ts @@ -575,6 +575,10 @@ export function issueRoutes(db: Db, storage: StorageService) { } const assigneeChanged = assigneeWillChange; + const statusChangedFromBacklog = + existing.status === "backlog" && + issue.status !== "backlog" && + req.body.status !== undefined; // Merge all wakeups from this update into one enqueue per agent to avoid duplicate runs. void (async () => { @@ -592,6 +596,18 @@ export function issueRoutes(db: Db, storage: StorageService) { }); } + if (!assigneeChanged && statusChangedFromBacklog && issue.assigneeAgentId) { + wakeups.set(issue.assigneeAgentId, { + source: "automation", + triggerDetail: "system", + reason: "issue_status_changed", + payload: { issueId: issue.id, mutation: "update" }, + requestedByActorType: actor.actorType, + requestedByActorId: actor.actorId, + contextSnapshot: { issueId: issue.id, source: "issue.status_change" }, + }); + } + if (commentBody && comment) { let mentionedIds: string[] = []; try {