Skip to content

A run stays with its pull request through review, merge and deploy; a red check is judged flaky or broken before code changes - #651

Closed
nambok wants to merge 1 commit into
mainfrom
pr-trust-stay-through-deploy
Closed

nambok wants to merge 1 commit into
mainfrom
pr-trust-stay-through-deploy

Conversation

@nambok

@nambok nambok commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

A run stays with its pull request until it is merged and deployed, and never rests as Done with its own reviewer's verdict missing on the head. A finished run's pull request is looked at when the run completes and every 15 minutes: a verdict missing on the head asks for the review of that commit, changes requested get their fix round, a conflict with a moved base is resolved, checks that went red later go to the fix loop, and a merge by anyone gets its deploy watched. A failed deploy of CoderHelm's own change gets a revert pull request with the evidence, ready for the team's approval and never merged by CoderHelm. A red check is judged flaky or broken before any code changes for it. The description gains a short section written for the reviewer, and the run API names the one true reason a pull request is where it is.

Changes

A run never rests as Done on a stale or negative verdict (pr_watch, resume)

  • Found in the code: set_run_complete (CI green with no event to read, no checks, the 24 hour cap) completed a run without the hand-off review every other ending asks for. A fix pushed just before it was never reviewed, so the reviewer stayed at "changes requested" on the commit before the fix while the run read Done.
  • pr_watch::after_completion runs on both endings, and pr_watch::sweep on the existing 15 minute review_sweep tick. pr_watch::decide picks one act per look: resolve a conflict, send red checks to the fix loop, ask for the review of the head, take the review's findings in a fix round, or watch the deploy.
  • Each act is claimed on the run record against the commit it is about, so a head is never reviewed or fixed twice by this path, and a failed start gives the claim back.
  • When the run's fix rounds are over by the supervisor's rule, the findings are deferred on the pull request with the reason, as before.
  • The pass count on the run record (ceil_passes) only counts: the ceiling is 300 and did not end the run in the incident.

The run page's reason (common::merge_standing, run API)

  • merge_standing::decide returns one standing with a stable code, the sentence, what happens next, whether a person has to act and where the rule is set. CoderHelm's own work (a review of the head, a fix round, checks, a conflict) never asks for a person.
  • A person is named only for the team's own rule: auto_merge_off ("Auto-merge is off for this repo", link to /reviewer/config), needs_person_approval (the repo's auto-merge setting requires a person's approving review), repo_requires_person_review (GitHub reports the branch's rules block the merge, link to the branch rules).
  • A verdict on an older commit is never shown as the verdict on the head: the standing is reviewing, naming both commits.
  • The run API returns it as merge_standing; docs/api/openapi.json is regenerated.
  • Audit: merging without a person already exists as the repo setting auto_merge with require_human_approval off (OnApproveConfig, evaluated by await_merge). No merge rule changes here.

Flaky or broken (common::flaky_checks, flaky, resume)

  • Before a CI fix round the failure is judged: a failure that names a file the pull request changed is the change's. A failing workflow with a record of failing and then passing on one commit of at least two other pull requests in 30 days, naming no changed file, is re-run once and no code changes for it.
  • The record is one item per repository (FLAKY#owner/repo in the settings table, versioned writes), written only when a head that failed was re-run with nothing changed and passed.
  • The pull request says which check, the evidence and what was done, in its own section. When GitHub refuses the re-run because the App has no Actions write permission, the section says that with the permission by name and the run finishes without changing code. A second failure on a head already re-run is read by a fix round, told what the record says.
  • A re-run started after the run was claimed now puts the run back to awaiting_ci instead of leaving it running until the stale reset.

For the reviewer (reviewer_guide, completeness, pr)

  • A section built from records, never by the writer: where to look first (the file the diff's risk floor names, else the largest code change), how to roll back and what a revert does not undo (migrations, infrastructure), and one verification line per check on the head with its result, commit and link. Failed, running and skipped checks are listed as not verified. No check result, no claim; nothing to say, no section.
  • Rebuilt in apply_checks and refresh_description from the current diff and head.

Through deploy (health_check, deploy_revert)

  • A merge of CoderHelm's pull request by anyone gets the merge commit's deploy watched once (claim per merge commit, shared with the team's own health check setting). The watch is quiet unless the deploy fails.
  • On a deploy that fails on checks passing before the merge, deploy_revert::propose builds the revert from trees: every path the merge changed goes back to what it was, on the base as it stands. A file changed again since is never overwritten: no revert is opened and the report names the files. One revert per merge; the pull request opens ready, starts with Reverts #N, carries the failing jobs as evidence, and is never merged by CoderHelm.

Shared files touched: resume.rs (the judgement before the fix round, try_rerun_once, both endings), pr.rs and completeness.rs (two new owned sections). implement.rs and review_fix/mod.rs are not touched.

Not in this change

  • Before and after screenshots: not feasible yet. The sandbox has no browser, cannot start the app, has no way to return new files, and nothing hosts an image a description could show; no preview URL is read.
  • The dashboard still renders its own chip and sentence. It reads merge_standing in a follow-up to CoderHelm/coderhelm, which can only pass its API contract check once this is merged.
  • A push to the base branch does not trigger the look by itself; the sweep finds the conflict within 15 minutes.
  • A revert from alert or log evidence: only a failed deploy opens one.
  • No new permission, queue, schedule or table. The App keeps Actions read only.

Verification

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace in services/: all pass locally.
  • Unit tests for each mechanism: flaky_checks (record, paths, judgement, section), merge_standing, reviewer_guide, deploy_revert (plan, body, report), pr_watch (decision and claims per commit).
  • Incident tests: ba_verdict_on_old_commit, bb_flaky_not_broken, bc_stays_through_merge_and_deploy, each also checking the pipeline still calls the decision at its place. docs/incidents.md has their rows.
  • Not exercised against live GitHub or AWS: the sweep's scan, the review and fix round it queues, the re-run refusal text GitHub returns, the quiet deploy watch and the revert's tree writes.

… red check is judged flaky or broken before code changes

A finished run's pull request is looked at when the run completes and on
the 15 minute sweep (pr_watch). One act per look, claimed on the run record
against the commit it is about: a reviewer verdict missing on the head asks
for the review of that commit, changes requested get their fix round, a
conflict with a moved base starts the conflict round, checks red on the
head and not on the base go to the fix loop, and a merge by anyone gets its
merge commit's deploy watched.

set_run_complete (CI green with no event to read, no checks, the 24 hour
cap) completed a run without the hand-off review every other ending asks
for, so a fix pushed just before it was never reviewed and the reviewer
stayed at changes requested on the commit before the fix. Both endings now
look at the pull request.

The run API returns merge_standing: the one true reason the pull request
is where it is, what happens next, and whether a person has to act, which
is only for the team's own rule and names where it is set.

Before a CI fix round the failure is judged (flaky_checks): a failure that
names a changed file is the change's; a workflow with a record of failing
and then passing on one commit of other pull requests, naming no changed
file, is re-run once and no code changes for it. The record is kept per
repository. A re-run GitHub refuses for a missing Actions write permission
is said on the pull request and still changes no code.

The description gains a section for the reviewer built from records: where
to look first, how to roll back and what a revert does not undo, and each
verification line pointing at a check result on the head.

A deploy of CoderHelm's own merged change that fails on checks passing
before the merge gets a revert pull request built from trees, with the
failing jobs as evidence, opened ready and never merged by CoderHelm. A
file changed again since is never overwritten.
@nambok nambok closed this Nov 13, 2026
@nambok
nambok deleted the pr-trust-stay-through-deploy branch November 13, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant