Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/workflows/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,15 @@ export async function agentWorkflow(ticketId: string) {
return;
}

// Push has landed — agent work is durable. Unregister BEFORE any
// downstream step that can trigger a Jira webhook: opening a PR can
// transition the linked issue (GitHub-for-Jira / Jira automation),
// and our own moveTicket fires a webhook for the AI → AI Review move.
// Either webhook, if it sees a still-registered run, will call
// cancelRun and emit a spurious "canceled" notification on top of
// "pr_ready". Clearing the registry here closes that window.
await unregisterRun(ticket.identifier);

// We need a {url, number} regardless of whether the PR is new or pre-existing.
// - New PR: createPullRequest returns the PullRequest ({ id, url, branch }) — capture it.
// - Existing PR: prContext was built from vcs.findPR(branch), but findPR's return
Expand All @@ -749,7 +758,6 @@ export async function agentWorkflow(ticketId: string) {
pr: { url: pr.url, number: pr.id },
usageReport,
});
await unregisterRun(ticket.identifier);
await moveTicket(ticketId, env.COLUMN_AI_REVIEW);
} finally {
await teardownSandbox(sandboxId);
Expand Down
Loading