Repository navigation
Run endings decided in one place: no partial salvage, no #0, never ready or done on red CI - #624
Merged
Merged
Conversation
…ady or done on red CI A run stopped mid-implement now gets the standard held draft (stop_pr): ticket line, a Not finished section with done and remaining tasks and the recorded reason, Summary, Changes, Verification. salvage_timeout_pr and its call sites are gone. The GitHub client strips any issue #0 reference from every body it sends. The plan check accepts a coder's "no change needed" in the words coders use and an explicit line, from the implement pass's own notes and every round, and saves it on the checklist so later steps don't ask again. After a step that changed nothing, the next one takes one task with a different approach. ready::decide reads CI on every open draft: a failing check holds it, a running one is a wait. The CI fix loop reads annotations and CI reporter comments, re-runs infrastructure failures once, tries up to CODERHELM_CI_FIX_ATTEMPTS (default 3) times with fresh evidence, and every give-up holds the draft with what fails and sets the run to needs_input. outcome.rs holds the rules, with a property test and a source scan that allows create_pull_request and mark_pr_ready in one place each. Reliability counts runs that ended done with red CI or after a stop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two runs ended wrong on one afternoon, and both came from paths that bypassed the rules every other ending follows.
This PR removes the bypasses and puts each decision in one place, with the rules checked in code and by tests:
passes/outcome.rs). A run is completed only with no planned task left, no recorded stop, and CI that is green, absent, or red only on checks the base branch fails too. Any other run needs a person, with every reason named. Words about a stop come from the recorded reason: only a recorded time limit mentions time. A property test covers all 120 combinations.stop_pr).salvage_timeout_prand both of its call sites are deleted. A run stopped mid-implement, or at its time limit, gets the standard held draft: the ticket line, a "Not finished" section, Summary, Changes, Verification, and Open items. "Not finished" lists why the run stopped, the tasks done (N of M), each task left, what a person can do, and a link to the run page.#0, ever. The ticket line comes from one function.Closes #Nis used only for a real GitHub issue; anything else getsSource ticket: KEY. The GitHub client also removes any reference to issue#0from every body it creates or updates.No change needed: <path>: <why>line that the instructions now ask for.while working on task 8 of 8 (...)).ready::decide). A failing check holds any pull request, with the check named. A running check is a wait. A failure the base branch has too doesn't hold it.CODERHELM_CI_FIX_ATTEMPTSattempts in all (default 3). Each later attempt is told what was tried, to reproduce the failure withrun_checksfirst, and gets the evidence again.ready::settle, and sets the run to needs_input. That status notifies the team.complete_run_with_status("completed")is checked against the run's CI record, so red CI becomes a wait on a person.ci.ended_wrong. It counts runs completed with this change's CI still red, and runs completed after a stop with work left, each with its newest run ids. Both should stay at zero.Changes
services/worker/src/passes/outcome.rs(new):CiState,Stop(read from the recorded stop sentence),decide,broken_rules,ci_blocker,ticket_line,guard_body,body_problems.services/worker/src/clients/github.rs:create_pull_requestandupdate_pr_bodysendoutcome::guard_body(body).services/worker/src/passes/mod.rs:salvage_timeout_prand its two call sites are deleted. The error arm and the timeout arm both callstop_pr::open.continuation_feedbacktakes the stall count and switches tonarrowed_feedback.with_declined.services/worker/src/passes/stop_pr.rs:Progress,not_finished,with_unfinished(an already open pull request gets the section too), and a Verification section. The ticket line now comes fromoutcome, and the body is checked withbody_problems.services/worker/src/passes/plan_coverage.rs:NO_CHANGE_LINE.settle_declinedis applied to the implement pass's notes and to every round.with_declined,narrowed_feedbackandcurrent_task.services/worker/src/passes/steps.rs:stall_reasonnames the task.services/worker/src/passes/ready.rs:reads_cicovers every open draft.repo_ciholds on failing checks and waits on running ones.red_on_baseis read for every failing CI.services/worker/src/passes/resume.rs:ci_evidence,ci_reporter_comments,looks_infra(feedsshould_rerunandtry_rerun_once),ci_fix_attempts,next_attempt_feedback,failure_excerpt.ci_failing_sectionandwith_ci_failingwrite the pull request's section;hand_off_red_ciis the one give-up path.red_ci_blocks_completionguardscomplete_run_with_status.services/worker/src/passes/pr.rs: the ticket line comes fromoutcome::ticket_line_for.services/gateway/src/routes/analytics.rs:ended_wrongunderci.services/worker/src/passes/incidents/ac_partial_and_red_ci.rsanddocs/incidents.md: the new incident case.Verification
cargo test -p worker: 1547 passed (12 ignored).cargo test -p gateway analytics: 50 passed.cargo clippy --workspace -- -D warningsandcargo fmt --checkare clean.outcome::testschecks every combination of tasks, CI, review and stop against the rules, and catches both old endings: completed or ready with red CI, and "ran out of time" for a no-progress stop.incidents::ac_partial_and_red_ci:create_pull_requestonly inpr.rs,stop_pr.rsande2e_setup.rs, andmark_pr_readyonly inready.rs;#0never renders;ready::decideholds a draft with red CI and waits on running CI, checked across 128 combinations;stop_pr::tests: the stopped run's body has the Source ticket line and Not finished, with no "Closes #0", "Partial" or "ran out of time".resume::ci_triage_tests: an infrastructure failure is re-run once; the failure excerpt is the error line, not the upload step; CI reporter comments are read; the next attempt's ask and the CI failing section.analytics:ended_wrongcounts both states.#0guard;guard_bodyitself;ci_blocker;