phase-pr can ask the forge which pull request is on this branch instead of trusting the card #507

Closed
opened 2026-09-03 05:44:19 +00:00 by mph · 0 comments
Owner

phase-pr's duplicate path asks the card which pull request this phase opened. The card is keyed on the issue, so it can hold another phase's url, and #467 added a guard for exactly that — now a branch comparison (PR #506). The guard is correct and it refuses, but a refusal under --batch stops the batch and needs a person.

The forge already knows the answer. createPullRequest returned Duplicate, which means a pull request is open on phaseBranchName. Asking the forge which one that is removes the card from the decision entirely: no stale url can be read, no guard can refuse, and the autonomous path never stops for a human.

What is missing

A port method that answers "the open pull request whose head branch is X".

  • Forgejo already has it: ForgejoClient.fetchPullRequestForBranch (core/adapters/ForgejoClient.scala:615), with buildPullRequestListUrl and parsePullRequestForBranch beside it. It is not on TrackerOps.
  • GitHub: gh pr list --head <branch> --json url — no client method yet.
  • GitLab: glab api projects/:id/merge_requests?source_branch=<branch> — no client method yet.

What to do

Promote it to TrackerOps, implement the two missing clients, and have resolvePullRequest's Duplicate branch ask the forge instead of the card. The card's pr_url stays what it is — a record for the dashboard — and stops being an input to a merge decision.

The branch guard from PR #506 can then go, or stay as a cross-check on a card that disagrees with the forge. That is a decision for the change, not for this issue.

Origin

Recorded while fixing the two review warnings on #467. The guard fixes the false refusal and the misleading remedy; it does not remove the need for a human when the card is genuinely wrong.

`phase-pr`'s duplicate path asks the card which pull request this phase opened. The card is keyed on the issue, so it can hold another phase's url, and #467 added a guard for exactly that — now a branch comparison (PR #506). The guard is correct and it refuses, but a refusal under `--batch` stops the batch and needs a person. The forge already knows the answer. `createPullRequest` returned `Duplicate`, which means a pull request is open on `phaseBranchName`. Asking the forge which one that is removes the card from the decision entirely: no stale url can be read, no guard can refuse, and the autonomous path never stops for a human. ## What is missing A port method that answers "the open pull request whose head branch is X". - Forgejo already has it: `ForgejoClient.fetchPullRequestForBranch` (`core/adapters/ForgejoClient.scala:615`), with `buildPullRequestListUrl` and `parsePullRequestForBranch` beside it. It is not on `TrackerOps`. - GitHub: `gh pr list --head <branch> --json url` — no client method yet. - GitLab: `glab api projects/:id/merge_requests?source_branch=<branch>` — no client method yet. ## What to do Promote it to `TrackerOps`, implement the two missing clients, and have `resolvePullRequest`'s `Duplicate` branch ask the forge instead of the card. The card's `pr_url` stays what it is — a record for the dashboard — and stops being an input to a merge decision. The branch guard from PR #506 can then go, or stay as a cross-check on a card that disagrees with the forge. That is a decision for the change, not for this issue. ## Origin Recorded while fixing the two review warnings on #467. The guard fixes the false refusal and the misleading remedy; it does not remove the need for a human when the card is genuinely wrong.
mph closed this issue 2026-09-03 09:21:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#507
No description provided.