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 <noreply@anthropic.com>
This commit is contained in:
parent
63a876ca3c
commit
20b171bd16
1 changed files with 16 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue