File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments