Skip to content

Commit 19a912d

Browse files
authored
Merge pull request #80 from Blazity/dev
fix: cancelled state after ready to review
2 parents f6f3924 + 60e553f commit 19a912d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/workflows/agent.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,15 @@ export async function agentWorkflow(ticketId: string) {
734734
return;
735735
}
736736

737+
// Push has landed — agent work is durable. Unregister BEFORE any
738+
// downstream step that can trigger a Jira webhook: opening a PR can
739+
// transition the linked issue (GitHub-for-Jira / Jira automation),
740+
// and our own moveTicket fires a webhook for the AI → AI Review move.
741+
// Either webhook, if it sees a still-registered run, will call
742+
// cancelRun and emit a spurious "canceled" notification on top of
743+
// "pr_ready". Clearing the registry here closes that window.
744+
await unregisterRun(ticket.identifier);
745+
737746
// We need a {url, number} regardless of whether the PR is new or pre-existing.
738747
// - New PR: createPullRequest returns the PullRequest ({ id, url, branch }) — capture it.
739748
// - Existing PR: prContext was built from vcs.findPR(branch), but findPR's return
@@ -749,7 +758,6 @@ export async function agentWorkflow(ticketId: string) {
749758
pr: { url: pr.url, number: pr.id },
750759
usageReport,
751760
});
752-
await unregisterRun(ticket.identifier);
753761
await moveTicket(ticketId, env.COLUMN_AI_REVIEW);
754762
} finally {
755763
await teardownSandbox(sandboxId);

0 commit comments

Comments
 (0)