Skip to content

fix(github): correct readiness files and merged monitor output - #5349

Merged
dan-petty merged 14 commits into
mainfrom
fix/2530-readiness-compare-from-base-branch
Nov 13, 2026
Merged

dan-petty merged 14 commits into
mainfrom
fix/2530-readiness-compare-from-base-branch

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops pr check-readiness read the changed files from the pulls files endpoint. That list keeps the old base after a merge commit moves the merge base, so PR #2509 got a false not-grounded blocker from 184 files in place of 11. The readiness read and the implement draft read now compare the tip of the base branch with the head commit, also for a fork. They do not use the payload base.sha, because GitHub does not move it. A compare answer at the GitHub limit of 300 files gives one blocker that names the limit, and only the rules that read the file list skip it.

devops pr monitor reads the pull request state on each poll and stops at once on a merged or closed pull request. It prints PR #N is merged. (exit 0) or PR #N is closed. (exit 2), with no check count and no ready line. The implement watch also stops on a closed pull request.

Closes #2530

Change: openspec/changes/archive/2026-11-13-2530-readiness-compare-from-base-branch/

dan-petty and others added 14 commits November 13, 2026 03:30
#2530)

GitHub does not move the base.sha of a pull request when a merge commit
moves the merge base. A compare from that value gives the same stale
file list as the pulls files endpoint: for PR #2509, the compare from
base.sha gave 184 files, and the compare from main gave 11.

Readiness and the implement draft now compare from the base branch name
to the head commit sha. A fork's head is its commit sha too, because
GitHub keeps that commit in the base repository. The dry-run plan names
compare/<base-ref>...<head-sha>. The tests give the compare a merge base
that differs from base.sha, and one test routes the stale compare with
the archived changes of other issues.
…2530)

A compare answer at GitHub's limit of 300 files returned before every
other grounding rule, so the body form and the closing issues were not
judged, and the perimeter advisory still read the partial list.

The truncation is now the grounding rule changed_files_are_whole. Only
the rules that read the file list skip a truncated list. The perimeter
advisory does not judge it, and a warning names the limit where the item
rules do not apply. ChangedFilesRead.truncated has no default. An
implement draft at the limit is refused with a reason that names the
limit, not as a missing change. The messages read the limit from
CONST_GITHUB_COMPARE_FILES_LIMIT.
The watch of the implement job read only the merged flag, so a pull
request closed without a merge read as ready. The watch now stops the
item on any terminal state.

The monitor tests run with a settle time of 300 seconds, so they fail
when the terminal stop of the poll loop is removed, and they cover the
merged and the closed case. The markdown test has a closed row. The
help of devops pr monitor names the merged and the closed results, and
the generated command documents follow it.
#2530)

The tests of a malformed compare answer asserted the name _CompareFiles. They now assert the compare path and the count of invalid fields, which the error text gives.
…help (#2530)

plan_blockers takes the file read and the base branch, so the plan rule tests give both. The MCP tool listing snapshot holds the help of pr_monitor, which now names the merged and the closed results. The snapshot was regenerated with --snapshot-update.
…2530)

The lookup of the base's change directory still reads at the payload's
base.sha on purpose (design.md), so the scenario now says that no compare
request names it. The tasks name the tests by their current names, and a
test docstring names the base branch.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/github GitHub Projects v2, Views, Milestones, Labels, and PR automation labels Nov 13, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Review and checks

This PR carries the code of #4980 with the fixes of its vetting review:

  • The readiness read, read_draft and the dry-run target compare from the base branch (compare/<base-ref>...<head-sha>), not from the payload base.sha. _base_sha, _compare_head and PullStatus.base_sha are removed.
  • A fork head is compared by its commit sha, the same commit as the checks.
  • ChangedFilesRead.truncated is required. A truncated list stops only the rules that read the file list and the perimeter advisory. An implement draft at the limit is refused with a reason that names the limit.
  • A closed unmerged pull request stops the implement watch.
  • Tests: a payload whose base.sha is not the merge base, a stale compare route with the archives of other issues, the monitor stop with --settle-timeout 300, a closed markdown row, and a real GitHubClient in the draft test. The dead pulls files route is removed.

Fixes of this review, on top of the builder branch:

  • The scenario "A moved merge base" said that no request of the run names the payload base.sha. The lookup of the base change directory still reads at base.sha on purpose (design.md, rejected alternatives). The scenario now says that no compare request names it.
  • Tasks 2.1, 3.1 and 4.1 named three tests that the rework renamed. They now name the current tests.
  • A test docstring said "compare of the base commit". It now says "base branch".

Live probe on 2026-11-13: pulls/2509 gives base.sha 0137f23, base.ref main, head 344adba and 184 changed files. compare/main...344adba9 gives merge base 5c4d24e and 11 files.

Local checks at head 27fb0be:

  • uv run devops ci test on the 11 test files that cover the change: 421 passed.
  • Invariants change_folders, living_specs, source_tree, dry_run_class_ratchet: 78 passed.
  • uv run devops ci --check --only lint,format,openspec,docs: pass.
  • uv run mypy on the 9 changed source files: no issues.
  • uv run devops ci fail-to-pass --base origin/main: exit 0. 39 tests fail and 3 test modules do not load on the base. All pass on the head.
  • No k8s/ path changes, so there is no kustomize or helm render diff.

Known limits:

  • check-readiness of an implement pull request reads the compare twice (in assess_merge_readiness and in read_draft): one extra request.
  • The two new CLI tests in tests/commands/test_pr_cmd.py use the local runner fixture. tests/commands/test_pr.py covers the same output with the shared fakes.
  • fix(review): Review a pull request at the merge base of its base branch #5346 records that the review runner and devops ai analyze pr still read the pulls files endpoint.

@dan-petty
dan-petty marked this pull request as ready for review November 13, 2026 03:42
@dan-petty
dan-petty merged commit e477ab2 into main Nov 13, 2026
24 checks passed
@dan-petty
dan-petty deleted the fix/2530-readiness-compare-from-base-branch branch November 13, 2026 03:46
dan-petty pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.126.0](v0.125.5...v0.126.0)
(2026-11-13)


### Features

* **security:** refuse a commit that names the configured domain
([#5347](#5347))
([c0a53b7](c0a53b7))


### Bug Fixes

* **github:** correct readiness files and merged monitor output
([#5349](#5349))
([e477ab2](e477ab2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/github GitHub Projects v2, Views, Milestones, Labels, and PR automation type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(github): Fix check-readiness base and monitor merged state

1 participant