Task stays "In review" with a Merge button after its PR is merged on the forge #1872

Closed
opened 2026-11-12 09:42:51 +00:00 by sam · 2 comments
Owner

Task #462 still shows "In review" and a Merge button, but its PR (#1846) was merged on Gitea on 2026-11-10 06:54 UTC, two days before this was seen. Clicking Merge fails with:

task action conflict: merge pull request #1846: forge merge pull request: merge pull request sam/archie#1846: Gitea did not merge it

Why

The pr-reconcile job (reconcilePRs in internal/daemon/daemon.go, every minute) is what moves a task to merged when its PR is merged outside Archie. It lists tasks with status = 'pr_open' (ListOpenPRs in internal/infrastructure/postgres/queries/tasks.sql), calls fg.PRState, and on "merged" transitions pr_open to merged. #462 was not moved, so one of these holds:

  1. PRState for Gitea does not return "merged" for this PR. It goes through forgeext.PRState to the Gitea forge extension in archipelago, which I could not read. A closed, merged Gitea PR may come back as "closed" or "open".
  2. The task is not in pr_open, so the job never sees it. The "In review" label may come from another status.
  3. forgeFor returns a NoopForge for the task, so the job skips it silently (continue with no log).
  4. PRState or Transition fails every pass. Both log a warning or error, so check the daemon logs for PR state check failed or PR merged but task transition failed on #1846.

Also

applyMerge in internal/domain/taskactions/service.go calls the forge merge, and on refusal returns ErrConflict and leaves the task unchanged. If the PR is already merged, the action should check PRState, record the task merged, and return success instead of a conflict. Even if the reconciler is fixed, the Merge button can race it.

Done when

  • A task whose PR is merged on Gitea reaches merged within one reconcile pass, and the Merge button disappears.
  • Clicking Merge on a PR already merged on the forge moves the task to merged rather than returning a conflict.
  • #462 shows Merged.
Task #462 still shows "In review" and a Merge button, but its PR (#1846) was merged on Gitea on 2026-11-10 06:54 UTC, two days before this was seen. Clicking Merge fails with: `task action conflict: merge pull request #1846: forge merge pull request: merge pull request sam/archie#1846: Gitea did not merge it` ## Why The `pr-reconcile` job (`reconcilePRs` in `internal/daemon/daemon.go`, every minute) is what moves a task to `merged` when its PR is merged outside Archie. It lists tasks with `status = 'pr_open'` (`ListOpenPRs` in `internal/infrastructure/postgres/queries/tasks.sql`), calls `fg.PRState`, and on `"merged"` transitions `pr_open` to `merged`. #462 was not moved, so one of these holds: 1. `PRState` for Gitea does not return `"merged"` for this PR. It goes through `forgeext.PRState` to the Gitea forge extension in archipelago, which I could not read. A closed, merged Gitea PR may come back as `"closed"` or `"open"`. 2. The task is not in `pr_open`, so the job never sees it. The "In review" label may come from another status. 3. `forgeFor` returns a `NoopForge` for the task, so the job skips it silently (`continue` with no log). 4. `PRState` or `Transition` fails every pass. Both log a warning or error, so check the daemon logs for `PR state check failed` or `PR merged but task transition failed` on #1846. ## Also `applyMerge` in `internal/domain/taskactions/service.go` calls the forge merge, and on refusal returns `ErrConflict` and leaves the task unchanged. If the PR is already merged, the action should check `PRState`, record the task merged, and return success instead of a conflict. Even if the reconciler is fixed, the Merge button can race it. ## Done when - A task whose PR is merged on Gitea reaches `merged` within one reconcile pass, and the Merge button disappears. - Clicking Merge on a PR already merged on the forge moves the task to `merged` rather than returning a conflict. - #462 shows Merged.
sam added the mediumbug labels 2026-11-12 15:51:30 +00:00
Author
Owner

Landed on main; task check passed on the merged tree. Not yet proven live.

Landed on main; task check passed on the merged tree. Not yet proven live.
Author
Owner

Live cause: the reconciler resolved each task's forge through the execution-identity gate, which refuses tasks run as an operator's user account, so they were skipped every minute. It now resolves the forge through the repository's bound connection in the task's org, as the Merge action does. Verified on the live host after deploy: a closed PR moved its task to rejected and a merged PR moved its task to merged within a minute. A refused merge now tells the operator why (closed without merging) instead of the forge error chain.

Live cause: the reconciler resolved each task's forge through the execution-identity gate, which refuses tasks run as an operator's user account, so they were skipped every minute. It now resolves the forge through the repository's bound connection in the task's org, as the Merge action does. Verified on the live host after deploy: a closed PR moved its task to rejected and a merged PR moved its task to merged within a minute. A refused merge now tells the operator why (closed without merging) instead of the forge error chain.
sam closed this issue 2026-11-14 01:06:53 +00:00
sam added the task label 2026-11-14 14:45:21 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1872