Repository navigation
Description
Problem or Motivation
The roadmap Service marks an implemented pull request ready when all CI checks pass.
Subsequent merges into the default branch can create merge conflicts with the open pull request.
For example, pull request #3961 was marked ready, but subsequent merges into main produced conflicts in capability specs and roadmap source files.
GitHub does not notify developers of conflicts unless they open the pull request page.
The Service does not monitor open ready delivery pull requests for merge conflicts against the default branch.
Consequently, conflicted pull requests stay blocked without notification until a person manually runs devops pr check-readiness.
Proposed Solution & Architectural Design
Add merge conflict detection and reporting for open ready delivery pull requests.
- In
src/devops_cli/roadmap/run.py, add a check to the status lane orstage_readyrow to evaluate open ready pull requests. - For each open pull request whose base is the default branch:
- Check the GitHub
mergeablestate via the GitHub API. - When the state is
conflictingordirty, add a label such aspr/conflictedor comment on the pull request. - When the branch is clean and behind
main, triggerdevops pr updateto keep the branch synchronized.
- Check the GitHub
- Integrate with
devops pr check-readinessso that conflict state is tracked and exposed in the roadmap dashboard.
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
GitHub's native mergeability check exposes whether a pull request has conflicts, but GitHub triggers no event or alert when background branch merges create new conflicts. Building this automated check in the Service row requires approximately 18,000 tokens to build and 4,000 tokens per year to maintain. Elapsed time is approximately 2 hours.
Proposed design
Problem statement
The roadmap Service marks a delivery pull request ready when its checks pass. A later merge into the default branch can create conflicts with that open pull request, and GitHub sends no alert for the new conflict. The pull request then stays blocked until a person runs devops pr check-readiness. The Service monitors no open ready delivery pull request for merge conflicts.
Acceptance criteria
Requirement: Status-lane conflict row
The status lane SHALL run a pr_conflicts row that evaluates the open ready delivery pull requests of the repository.
Scenario: Status lane table
- WHEN the status lane table is built
- THEN it contains a row named
pr_conflictslast, aftercloudflare_status.
Requirement: Delivery pull requests only
The row SHALL evaluate only open, non-draft pull requests whose base is the default branch and whose body closes exactly one open issue that holds a priority/* label.
Scenario: Plan pull request
- WHEN an open non-draft pull request whose base is the default branch closes no issue
- THEN the row skips it and posts no comment.
Requirement: Conflict comment
When the row reads a delivery pull request whose mergeable state is a conflict, it SHALL post one comment that names the default branch and asks to resolve the conflicts.
Scenario: Dirty mergeable state
- WHEN the read returns
mergeablefalse withmergeable_statedirty - THEN the row posts the conflict comment on that pull request.
Requirement: One comment per conflict
The row SHALL post no second conflict comment while the ledger records the pull request as conflicted at the same head SHA.
Scenario: Conflict persists
- WHEN the row runs again with the same head SHA and the ledger records the pull request as conflicted
- THEN it posts no second comment.
Requirement: Comment after a clean round
The row SHALL post the conflict comment again when a pull request becomes conflicted after a round that recorded it clean.
Scenario: Conflict returns
- WHEN the ledger records the pull request as clean and the read reports a conflict again at the same head SHA
- THEN it posts the conflict comment once.
Requirement: Unknown mergeable state
When GitHub reports the mergeable state as UNKNOWN, the row SHALL leave the pull request unchanged and check it in the next round.
Scenario: Unknown mergeable state
- WHEN the read returns
mergeablenull withmergeable_stateunknown - THEN the row posts no comment and keeps the ledger state.
Requirement: Clean behind update
When a delivery pull request is clean and behind the default branch, the row SHALL send one PUT /repos/{owner}/{repo}/pulls/{number}/update-branch that carries the head SHA it judged.
Scenario: Clean behind pull request
- WHEN the read returns
mergeabletrue withmergeable_statebehind - THEN the row sends the update-branch request once with
expected_head_shaequal to the head SHA.
Requirement: One conflict judgment
The row and devops pr check-readiness SHALL judge a conflict from the same mergeable states, so a pull request the command reports as conflicted is the one the row comments on.
Scenario: Check readiness and the row on one pull request
- WHEN the pull request payload holds
mergeablefalse withmergeable_statedirty - THEN the verdict and the row both report a conflict.
Requirement: Conflict gauge
The row SHALL emit a gauge with the number of conflicted ready delivery pull requests, labelled with the repository.
Scenario: Two conflicted pull requests
- WHEN the row finishes a round with two conflicted pull requests
- THEN it emits the gauge with value 2 and the repository attribute.
Requirement: Failed read fails its row
When the GitHub read fails, the pr_conflicts row SHALL fail and no other status row SHALL fail.
Scenario: Failed GitHub read
- WHEN the GitHub API returns an error for one pull request
- THEN the
pr_conflictsrow raises and the other status rows run.
Existing Tool Considered
GitHub's native mergeability state is the only tool considered. The REST read of one pull request returns mergeable and mergeable_state (https://docs.github.com/rest/pulls/pulls, fetched 2026-11-08), and devops pr check-readiness already reports a conflict from it. It lacks a scheduled check and a notification: no event or alert names a conflict that a background merge into the default branch creates, it emits no roadmap gauge, and it writes nothing to the item that the pull request delivers. No open, maintained tool or library was found that comments on an open delivery pull request, records the head SHA it commented on, and emits the Service's gauge. The plan builds the row in the Service: about 18,000 tokens to build, 4,000 tokens per year to maintain, and about 2 hours of elapsed time, as the body estimates.
Key questions
- Should the row signal a conflict with a
pr/conflictedlabel or with a comment?: Use a comment. It notifies the pull request watchers, needs no new label family in every managed repository, andGitHubClient.comment_on_pullalready posts it. The label families hold the item fields, and a newpr/conflictedfamily would collide with them. (best practice) [sources: docs/adr/0016-labels-hold-the-roadmap-items-fields.md:9, src/devops_cli/github/client.py:402, src/devops_cli/roadmap/stage/stage_ready.py:105]- Rejected: pr/conflicted label. It needs a label in every managed repository, sends no notification, and conflicts with the label families that hold item fields.
- Chosen: comment. It notifies the pull request watchers and needs no repository setting;
comment_on_pullalready posts a pull request comment through the session. - Rejected: both. It keeps two states that can drift.
- Should the check run in the existing
stage_readyrow or in a new status-lane row?: Run it in a newpr_conflictsrow at the end ofSTATUS_LANE_ROWS. The lane runs one row at a time, and the recorded decision puts the network-heavy status rows last so a slow read delays no other row. A separate row also makes a failed conflict read fail only its own row. (best practice) [sources: src/devops_cli/roadmap/run.py:739, CONTEXT.md:150, openspec/changes/archive/2026-11-08-4052-a-status-read-that-fails-fails/design.md:7]- Rejected: extend stage_ready. It mixes draft readiness with conflict monitoring, and a failed conflict read would fail the stage-ready row.
- Chosen: new status-lane row last. It follows the recorded rule that a failed read fails its own row and that a network-heavy status row goes last.
- Rejected: new row after stage_ready. It would put per-pull-request GitHub reads ahead of
release_commentsand the status pages, delaying them.
- Which GitHub API path should read the mergeable state?: Read each candidate pull request through the GitHub session,
GET /repos/{owner}/{repo}/pulls/{number}, asrelease/merge_candidate.pydoes: list the open pull requests into the default branch once, then read each candidate's payload. That payload holdsmergeableandmergeable_state, the fields the readiness verdict judges. Do not callassess_merge_readinessfor this: it also reads checks, review threads and changed files for every pull request. (best practice) [sources: src/devops_cli/release/merge_candidate.py:233, src/devops_cli/release/merge_candidate.py:275, src/devops_cli/github/merge_readiness.py:195, src/devops_cli/github/client.py:391, docs/adr/0006-github-session-requests-go-through-gidgethub.md:3]- Chosen: session REST read of each pull request. It is the recorded transport for the Service's GitHub reads, the payload holds
mergeable/mergeable_state, andrelease/merge_candidate.pyalready lists open pull requests and reads each one. - Rejected: fetch_pr_details (gh subprocess). It runs the
ghCLI for each read, which the session ADR rejects for the Service's own requests. - Rejected: full assess_merge_readiness. It reads the checks, the review threads and the changed files of every pull request for a judgment that needs two fields.
- Rejected: one GraphQL list query. It needs a second definition of a conflict (GraphQL's enum names) and departs from the REST payload that
check-readinessjudges.
- Chosen: session REST read of each pull request. It is the recorded transport for the Service's GitHub reads, the payload holds
- How should the row treat GitHub's
UNKNOWNmergeable state?: Leave the pull request unchanged and check it again in the next round. The verdict already treatsmergeablenull ormergeable_stateunknownas unresolved mergeability, not as a conflict, and GitHub computes mergeability on demand in the background, so a later read returns the settled state. The row polls, so the next round is the retry. (best practice) [sources: src/devops_cli/github/merge_readiness.py:204, tests/github/test_merge_readiness.py:382, docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md:7, https://stackoverflow.com/questions/30619549/why-does-github-api-return-an-unknown-mergeable-state-in-a-pull-request]- Rejected: treat as clean. It would skip a real conflict.
- Rejected: treat as conflicted. It would post false comments while GitHub still computes the state.
- Chosen: wait for the next round. The state is unresolved, not a conflict, and the next poll can read the settled value.
- Should the row auto-update a clean delivery pull request that is behind the default branch?: Yes. Send one
PUT /repos/{owner}/{repo}/pulls/{number}/update-branchbuilt bybuild_update_branch_cmd, withexpected_head_shaequal to the head the row judged, so GitHub refuses the update when the branch moved. Do not run thedevops pr updatecommand: it is a Typer command that prints and requires theghCLI. (best practice) [sources: src/devops_cli/github/branch_update.py:19, src/devops_cli/commands/pr.py:1976, src/devops_cli/commands/pr.py:1811]- Rejected: only report behind. It leaves the branch stale, and the issue asks to keep it synchronized.
- Chosen: update-branch request with the judged head SHA. It reuses
build_update_branch_cmdand itsexpected_head_shaguard, and needs no CLI process. - Rejected: run the devops pr update command. The command prints its own lines and requires the
ghCLI; the row runs in the Service. - Rejected: rebase in the row. It duplicates the update-branch request and can rewrite commits.
- How should the row avoid posting the same conflict comment every round?: Keep a ledger
pr_conflicts.jsonbesideschedule.json. For each pull request it records the head SHA and whether the last round found it conflicted or clean; a missing ledger reads as empty, and a ledger that exists and cannot be read fails the row and names the file. A lost ledger costs one duplicate comment, not a lost alert. (best practice) [sources: src/devops_cli/roadmap/run.py:644, src/devops_cli/roadmap/release_comments.py:53, k8s/README.md:673]- Rejected: comment every round. It spams the pull request.
- Rejected: search for a hidden marker in comments. It needs a comment listing for each pull request and cannot tell a conflict that returned after a clean round at the same head SHA.
- Chosen: ledger file. It follows the
release_comments.jsonledger that lies besideschedule.json, and it holds the previous round's state, which the two comment rules need.
- What does the roadmap dashboard exposure mean for this change?: Emit one gauge with the number of conflicted ready delivery pull requests, labelled with the repository, as
record_coverageemits its gauges. Do not build a new dashboard page. (best practice) [sources: src/devops_cli/roadmap/alternatives.py:1146, src/devops_cli/roadmap/run.py:691]- Rejected: new dashboard page. It duplicates the existing metrics pipeline and lies outside this repository.
- Chosen: gauge only. The Service's metrics pipeline already emits gauges with a repository attribute.
- How should the row read mergeable for many pull requests?: List the open pull requests whose base is the default branch once, then read each candidate pull request individually: the listing carries no mergeable fields, and
release/merge_candidate.pylists the open pull requests and reads each one for its payload. [sources: src/devops_cli/release/merge_candidate.py:233, src/devops_cli/release/merge_candidate.py:275, openspec/changes/archive/2026-11-01-2915-roadmap-inbox/proposal.md:67] - Which pull requests count as delivery pull requests?: Open, non-draft pull requests whose base is the default branch and whose body closes exactly one open issue that holds a
priority/*label. A plan pull request closes nothing, so the row skips it. [sources: .github/pull_request_template.md:3, docs/adr/0016-labels-hold-the-roadmap-items-fields.md:10, src/devops_cli/github/merge_readiness.py:485, src/devops_cli/roadmap/grounding.py:129]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-10: partly.
Tool: eps1lon/actions-label-merge-conflict (https://github.com/eps1lon/actions-label-merge-conflict), not stated, last activity 2026-05-27, maintained.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It removes a manual step that blocks delivery but does not cause data loss or a security gap.It prevents ready PRs from sitting blocked without notification, saving developer time.The body states approximately 2 hours and 18,000 tokens to build.Both monitor open PRs against the default branch, but #3968 detects plan drift on draft plan PRs while the candidate detects merge conflicts on ready delivery PRs and labels them.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 447f024 (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: partly
Reason: eps1lon/actions-label-merge-conflict is a maintained GitHub Action. It detects pull requests that conflict with the base branch and labels them or comments on them. The design needs more than that. It needs a ledger keyed on head SHA, a Service status-lane row, a gauge, an update-branch call for clean-but-behind pull requests, and the same conflict judgment as
check-readiness. The Action provides none of these. I read only the repository facts, not the README, so the label and comment behaviour comes from my prior knowledge of the Action.Tool: eps1lon/actions-label-merge-conflict (https://github.com/eps1lon/actions-label-merge-conflict)
Covers:
Lacks:
devops pr check-readinessTools considered:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 11, 2026
Scope change for this item: pull request #4766 does not build the requirement "Clean behind update".
docs/SDLC.md (Phase 1, step 5) tells us that an open pull request needs no rebase to catch up with
main. An update-branch request on a clean pull request that is only behindmainis such a catch-up update. It also starts a new CI run with no change in content.Thus the
pr_conflictsrow makes no update-branch request. A clean pull request that is behind the default branch gets no action. A conflicted delivery pull request gets one comment for each head SHA. The testtest_a_clean_pull_request_behind_the_default_branch_gets_no_actionintests/roadmap/test_pr_conflicts.pyshows the first rule. The archived proposal records the reason.devops-cli-service commentedon Nov 11, 2026
Released in v0.113.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.113.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 19:36 UTC