Skip to content

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

Closed
devops-cli-service[bot] wants to merge 8 commits into
mainfrom
fix/2530-fix-check-readiness-base-and-monitor
Closed

devops-cli-service[bot] wants to merge 8 commits into
mainfrom
fix/2530-fix-check-readiness-base-and-monitor

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

The issue #2530 reports two wrong states of the devops pr commands. devops pr check-readiness judged a stale file list from the pulls files endpoint, which keeps the base of the last push, so a merge commit that moved the merge base gave a false not-grounded blocker naming archived changes of other issues. devops pr monitor read merged but printed Checks: 0/0 passed and the ready line on every exit 0, so a pull request merged while it waited was reported 100% ready, and a closed unmerged pull request had no terminal result at all.

Closes #2530

Change: openspec/changes/archive/2026-11-13-2530-fix-check-readiness-base-and-monitor/

@devops-cli-service devops-cli-service Bot added type/docs Type docs: a change to the documents scope/openspec OpenSpec changes, specs and their checks verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix labels Nov 12, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The stage_ready row leaves pull request #4980 a draft. It holds the label plan/needs-fix, because the model review of its plan found an open finding. Fix the plan, or remove the label when the finding is no defect.

dan-petty added a commit that referenced this pull request Nov 12, 2026
#5160)

The step fix-plan compared the count of open findings of the last plan
comment, which an earlier review wrote at an earlier commit, with the
last review of the revision. Two reviews of one plan can find different
counts: on #4980 the comment listed 1 open finding and a review of the
same head plan found 2, so the attempt reported a revision with 2 open
findings as worse.

Now each attempt reviews the head plan with the verification pass at the
latest default branch and compares the last review of the revision with
that review. The planner gets the open findings of that review and of
the comment. A head plan with no open finding in its review loses the
label with no plan call. The result line and the report of the command
also show the count of the comment.

Closes #5150

Change:
`openspec/changes/archive/2026-11-12-5150-fix-plan-compares-the-revision-with/`
@devops-cli-service
devops-cli-service Bot force-pushed the fix/2530-fix-check-readiness-base-and-monitor branch from 89b5e65 to 3a2d186 Compare November 12, 2026 23:29
@devops-cli-service devops-cli-service Bot changed the title docs(openspec): plan #2530 Fix stale PR files and merged monitor state docs(openspec): plan #2530 Fix readiness files and merged monitor output Nov 12, 2026
@devops-cli-service devops-cli-service Bot removed the verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix label Nov 12, 2026
@devops-cli-service
devops-cli-service Bot force-pushed the fix/2530-fix-check-readiness-base-and-monitor branch 3 times, most recently from ee1e1ea to 90db533 Compare November 13, 2026 00:20
@devops-cli-service
devops-cli-service Bot force-pushed the fix/2530-fix-check-readiness-base-and-monitor branch from 90db533 to 506c399 Compare November 13, 2026 00:23
@devops-cli-service devops-cli-service Bot changed the title docs(openspec): plan #2530 Fix readiness files and merged monitor output fix(github): Fix check-readiness base and monitor merged state Nov 13, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Step Status Attempts Tokens in/out Last failing command
group 1 done 1 1636419/8167 pytest on base: tests/github/test_github_client.py
group 2 done 1 7424730/31210 pytest on base: tests/commands/test_pr.py, tests/github/test_merge_readiness.py
group 3 done 1 1932470/8699 pytest on base: tests/roadmap/test_roadmap_draft_readiness.py
group 4 done 1 3643024/17180 pytest on base: tests/commands/test_pr.py, tests/github/test_github_pr_monitor.py
group 5 done 1 2769722/11393 pytest on base: tests/commands/test_pr.py, tests/commands/test_pr_cmd.py
group 6 done 1 1311269/6070 pytest on base: tests/commands/test_pr_dry_run.py
  • scoped check pre-push: passed, 9 s
  • scoped check static: passed, 22 s
  • scoped check tests: passed, 40 s
  • scoped check tests: the changed files select more than 30 test modules, so only the changed test modules ran. The required checks of CI run the others
  • fail-to-pass of group 1: fails on the base commit. Tests that fail on the base commit: tests.github.test_github_client::test_the_compare_files_are_read_with_the_limit_flag.
  • fail-to-pass of group 2: fails on the base commit. Tests that fail on the base commit: tests.github.test_merge_readiness::test_a_commit_with_no_check_and_no_status_is_still_running, tests.github.test_merge_readiness::test_a_compare_answer_at_the_file_limit_is_one_blocker_naming_the_limit, tests.github.test_merge_readiness::test_the_verdict_reads_check_runs_only_when_statuses_are_not_read, tests.github.test_merge_readiness::test_a_malformed_files_entry_fails_read[non-object], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[mergeability-unknown], tests.github.test_merge_readiness::test_each_problem_of_the_body_form_is_a_blocker[in-form], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[draft], tests.github.test_merge_readiness::test_each_problem_of_the_body_form_is_a_blocker[attribution-after-change], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[closed], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[mergeability], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[conflict], tests.github.test_merge_readiness::test_unresolved_review_threads_block_and_are_shown, tests.github.test_merge_readiness::test_a_check_runs_page_that_cannot_be_read_fails_closed[html], tests.github.test_merge_readiness::test_closing_issues_that_cannot_be_read_are_one_blocker[no-pull-request], tests.github.test_merge_readiness::test_closing_issues_that_cannot_be_read_are_one_blocker[gh-failure], tests.github.test_merge_readiness::test_checks_that_failed_or_still_run_block[running-excused], tests.github.test_merge_readiness::test_a_check_runs_page_that_cannot_be_read_fails_closed[error-object], tests.github.test_merge_readiness::test_a_changed_files_page_that_is_no_list_fails_read, tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[threads], tests.github.test_merge_readiness::test_with_replied_threads_allowed_only_unreplied_threads_block, tests.github.test_merge_readiness::test_checks_that_failed_or_still_run_block[cancelled-and-timed-out], tests.github.test_merge_readiness::test_a_malformed_files_entry_fails_read[no-status], tests.github.test_merge_readiness::test_a_pr_touching_a_suppressed_file_names_the_suppression, tests.github.test_merge_readiness::test_closing_issues_that_cannot_be_read_are_one_blocker[not-json], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[checks-failing], tests.github.test_merge_readiness::test_a_change_directory_lookup_that_fails_blocks_naming_it, tests.github.test_merge_readiness::test_a_valid_plan_pull_request_is_ready_and_reads_no_closing_issue, tests.github.test_merge_readiness::test_a_clean_grounded_pull_request_is_ready, tests.github.test_merge_readiness::test_a_failed_combined_commit_status_beyond_the_listed_ones_blocks, tests.github.test_merge_readiness::test_review_threads_that_cannot_be_read_block_naming_the_error, tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[branch-protection], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[checks-unread], tests.github.test_merge_readiness::test_the_changed_files_are_read_from_every_linked_page, tests.github.test_merge_readiness::test_readiness_reads_the_files_the_base_and_the_closing_issues_once_each, tests.github.test_merge_readiness::test_the_changed_files_are_read_from_the_compare_of_the_base_and_head, tests.github.test_merge_readiness::test_a_plan_pull_request_that_closes_its_issue_is_blocked, tests.github.test_merge_readiness::test_closing_issues_that_cannot_be_read_are_one_blocker[graphql-error], tests.github.test_merge_readiness::test_checks_that_failed_or_still_run_block[running], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[threads-unread], tests.github.test_merge_readiness::test_checks_that_failed_or_still_run_block[failing], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[behind], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[closed], tests.github.test_merge_readiness::test_a_pr_into_another_branch_reads_no_closing_issues, tests.github.test_merge_readiness::test_a_check_runs_page_that_cannot_be_read_fails_closed[runs-not-a-list], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[draft-excused], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[draft], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[conflicts], tests.github.test_merge_readiness::test_a_check_runs_page_that_cannot_be_read_fails_closed[5xx], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[grounding], tests.github.test_merge_readiness::test_each_blocker_keeps_its_kind[checks-pending], tests.github.test_merge_readiness::test_a_fork_head_is_compared_by_its_owner_and_branch, tests.github.test_merge_readiness::test_replied_threads_alone_do_not_block_when_allowed, tests.github.test_merge_readiness::test_a_commit_status_read_that_fails_fails_closed, tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[blocked-excused], tests.github.test_merge_readiness::test_the_pull_request_state_blocks_unless_excused[blocked], tests.commands.test_pr::test_check_readiness_prints_the_verdict_and_exits_on_it[compare-at-the-file-limit].
  • fail-to-pass of group 3: fails on the base commit. Tests that fail on the base commit: tests.roadmap.test_roadmap_draft_readiness::test_read_draft_with_active_change_and_no_pull_arg, tests.roadmap.test_roadmap_draft_readiness::test_read_draft_reads_the_files_from_the_compare_of_the_base_and_head.
  • fail-to-pass of group 4: fails on the base commit. Tests that fail on the base commit: tests.github.test_github_pr_monitor::test_a_closed_pull_request_is_read_before_the_verdict, tests.commands.test_pr::test_a_closed_pull_request_stops_the_monitor_with_exit_2.
  • fail-to-pass of group 5: fails on the base commit. Tests that fail on the base commit: tests.commands.test_pr::test_the_markdown_of_a_merged_pull_request_names_it_merged, tests.commands.test_pr_cmd.TestPrCommands::test_a_closed_pull_request_prints_closed_with_no_check_count, tests.commands.test_pr_cmd.TestPrCommands::test_a_merged_pull_request_prints_merged_with_no_check_count.
  • fail-to-pass of group 6: fails on the base commit. Tests that fail on the base commit: tests.commands.test_pr_dry_run::test_the_check_readiness_plan_lists_the_compare_request.

@devops-cli-service devops-cli-service Bot added type/bug Type bug: the code does not do what it must scope/github GitHub Projects v2, Views, Milestones, Labels, and PR automation and removed type/docs Type docs: a change to the documents scope/openspec OpenSpec changes, specs and their checks labels Nov 13, 2026
@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 13, 2026 00:30

@dan-petty dan-petty left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A vetting review (4 reviewers by lens, a skeptic for each finding) found that this pull request does not fix the main defect of #2530. Do not merge it.

Blocking

  • src/devops_cli/github/merge_readiness.py:353: Confirmed, blocking (C1 = S1 = F1). _base_sha returns the payload base.sha, and read_changed_files compares from it. GitHub does not move base.sha when a merge commit moves the merge base. For PR #2509, the read returns 184 files and the false archived folders from the issue (2026-10-28-1024-..., 1652-..., 2429-...) in place of 11 files. The docstring claim 'it follows the merge base when a merge commit moves it' is false. The issue asks for the compare from the tip of the base branch (main...344adba).
    • Fix: Compare from the base branch name: compare/{quote(base.ref)}...{head sha}. Remove _base_sha. Correct the read_changed_files docstring, the get_merge_base docstring (client.py:501), the spec delta and the living spec (openspec/specs/pr-merge-readiness/spec.md:146, change 'the base commit' to 'the tip of the base branch'). Add a test whose payload base.sha is different from the merge base. The test must route only compare/main... and assert that the stale sha is not requested. Record the live PR #2509 probe in the proposal Feasibility section.
  • src/devops_cli/roadmap/implement/implement_pull.py:276: Confirmed, blocking (same root cause as C1/S1/F1). read_draft calls get_compare_files(repo, pull.base_sha, pull.head_sha). This uses the same stale base.sha, so the draft readiness of an implement PR reads the stale file list too. The dry-run target compare/... (src/devops_cli/commands/pr_plans.py:368) has the same defect.
    • Fix: Use pull.base_ref in place of pull.base_sha, and remove PullStatus.base_sha if nothing else reads it. Change the dry-run target to compare/.... Change test_read_draft_reads_the_files_from_the_compare_of_the_base_and_head so that it asserts the base ref.

Minor (fix in the same rework where it is easy)

  • C2 (confirmed, minor) src/devops_cli/roadmap/implement/implement_pull.py:331: _judge checks only status.merged. Thus a closed unmerged PR gives WatchKind.READY or stops with a check-failure reason, and the run does not stop with implement_stop_merged. Fix: use 'if status.terminal:' and add a watch test for a closed PR. This gap existed before the PR.
  • C3 = S2 (confirmed or partly, minor) src/devops_cli/roadmap/implement/implement_pull.py:276: read_draft does not use the truncated flag of the compare answer. A list cut at 300 files can hide tasks.md, and the refusal then gives a wrong reason (draft_change_missing). The result fails closed. Fix: carry the flag into Draft and refuse with a text that names the 300-file limit.
  • S3 (confirmed, minor) src/devops_cli/github/merge_readiness.py:366: for a fork head, the compare uses owner:branch, but the checks use head.sha. Thus the compare can read a later commit than the checks (time-of-check to time-of-use). A live probe on pallets/click shows that GitHub resolves a fork head sha in the base repository. Fix: always compare to the head sha, and remove the fork rule. Then read_draft and read_changed_files use one compare-head rule.
  • S5 (confirmed, minor) src/devops_cli/roadmap/grounding.py:42: ChangedFilesRead.truncated has the default False, and this reads as clean. ARCHITECTURE.md 'No Clean Default on a Result' forbids that. Fix: make the field required. Because ChangedFilesRead is a NamedTuple, put the field before error. Then update tests/github/test_item_grounding.py:77 and :303.
  • F2 (confirmed, minor) src/devops_cli/github/merge_readiness.py:527: the early return on a truncated list also skips the body-form blockers, the closing-issue read and the 6 grounding rules that do not read files. perimeter_advisory (line 625) still runs on the partial list. Fix: skip only the rules that read the file list, and do not run the perimeter advisory when the list is truncated.
  • TQ1 (partly, minor) tests/commands/test_pr.py:746: the closed-monitor test runs with --settle-timeout 0, so its one-poll assertion cannot fail. A revert of the terminal stop at pr_monitor.py:666 passes all tests. Fix: run the test with --settle-timeout 300.
  • TQ2 (confirmed, minor) tests/commands/test_pr.py:142: the pulls/335/files route in _GitHub.files is dead, and its comment is false. The route hides a revert of read_draft to the pulls files read. Fix: delete the route and the comment (F3 found the same thing and rated it a nit).
  • TQ3 (confirmed, minor) tests/roadmap/test_roadmap_draft_readiness.py:299: the new test replaces GitHubClient with MagicMock, but GitHubClient is not an edge. The test also accepts get_compare_files(repo, '', 'sha123'). Fix: use a real GitHubClient over github_api with route_compare_files, and assert the requested paths.
  • TQ5 (confirmed, minor) src/devops_cli/commands/pr.py:621 and :553: no test covers the 'closed' markdown state label or the print_error output of a closed result. A mutation of either line passes all tests. Fix: add a closed row to the merged markdown test that asserts 'State: closed' and exit 2.

An agent delivers the fix in a new pull request that starts from the commits of this one, and this one closes as replaced. #2530 is claimed for that work, so the implement job does not start again on it.

@dan-petty

Copy link
Copy Markdown
Owner

Replaced by #5349, which carries this code with the fixes of the vetting review.

@dan-petty dan-petty closed this Nov 13, 2026
@devops-cli-service
devops-cli-service Bot deleted the fix/2530-fix-check-readiness-base-and-monitor branch November 13, 2026 04:06
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