fix(daemon): reconcile and merge tasks whose PR was merged on the forge (#1872)

ListOpenPRs dropped org_id, so the reconciler resolved the forge and
worktrees in the default org instead of the task's own and skipped the
task silently. Select the org, log a skipped task, and let the Merge
action succeed when the forge reports the PR already merged.
This commit is contained in:
sam committed 2026-11-14 04:01:31 +11:00
1 parent da1795c597
commit 5edf58fd68
7 files changed
+80 -5

No files matched your search

@@ -651,12 +651,13 @@ func (q *Queries) InsertTransition(ctx context.Context, arg InsertTransitionPara
}
const listOpenPRs = `-- name: ListOpenPRs :many
SELECT id, owner, repo, issue_number, pr_number, status, source, identity, attempt, review_cursor, watch_comment_id, outputs
SELECT id, org_id, owner, repo, issue_number, pr_number, status, source, identity, attempt, review_cursor, watch_comment_id, outputs
FROM tasks WHERE status = 'pr_open' AND ($1::text IS NULL OR org_id = $1)
`
type ListOpenPRsRow struct {
ID int64
OrgID string
Owner string
Repo string
IssueNumber int64
@@ -681,6 +682,7 @@ func (q *Queries) ListOpenPRs(ctx context.Context, scopeOrg pgtype.Text) ([]List
var i ListOpenPRsRow
if err := rows.Scan(
&i.ID,
&i.OrgID,
&i.Owner,
&i.Repo,
&i.IssueNumber,