Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/incidents/xu_every_repo_gets_its_ci_rounds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# xu. `xu_every_repo_gets_its_ci_rounds`

**What happened:** A ticket asked the bookstore's orders service to return a book's price in cents and the storefront to show it. The plan changed both repositories and the run opened a pull request in each. CI failed on the storefront's pull request: a price test still expected the old shape. The run's CI loop read both heads, saw a red one, and finished with the pull requests open, saying CoderHelm fixes CI only inside a single repository. Nothing fixed the storefront, and its red check was left for a person.

**Why:** The loop for a run with several pull requests only read CI. The fix rounds, the mode diagnosis and the rule that rounds go on while they make progress all lived in the single repository loop, which reads one repository and one branch from the run record.

**The guarantee (invariants, enforced in code):**

- **Each pull request has its own CI ledger.** Every pull request of the run is an entry of `common::repo_ci::RepoCi` on the run record: its rounds, how many in a row met the same failure, and whether its rounds stopped or wait on a person.
- **A red pull request gets the same round a single repository gets.** The mode diagnosis first (`mode_cause`, `mode_repair::on_red`): a mode CoderHelm's own commits dropped is put back and CI decides again. Then the CI fix round every fix takes (`run_fix_round`, a `run_round` round with its own budget, parked for a fresh step when it needs one), on that pull request's branch, with its failing checks, their logs and the run's other pull requests named. A parked round runs again for the pull request it belongs to. The run waits for CI on what the round pushed.
- **Repositories go independently; providers first.** A pull request whose change builds on another repository's (the plan's order, which is also the merge order) waits while that one is red or its CI runs. Every other red pull request takes its round; the one with the fewest rounds goes first. A provider whose rounds stopped never holds the rest.
- **Rounds go on while they make progress.** The bound is the single repository loop's own rule (`run_round::ci_cycle_goes_on`): a round followed by the same failure it was asked to fix made no progress. Two such rounds in a row stop that pull request's rounds. The stop is CoderHelm's own problem: an internal alert and the run page's line (`own_problems::record`), the pull request says what fails and what was tried, and the run ends with its typed stop with the checks named (`stop_red`). Never a person's to-do.
- **The run ends only when every pull request is settled.** All green or merged: each goes through the ready decision in the plan's order and the run completes. A person is named only for a typed person-only reason (`common::person_only::admit`): a round that changed no code and found the fix needs a GitHub permission only an admin grants holds that pull request, and the run's note says exactly that, beside every other pull request having gone green.

**Where it's enforced:** `common::repo_ci::{RepoCi::of, next, begin, after_round, hold_for_person, brief}`, the worker's `resume::{resume_multi_repo, run_repo_round, repo_red, stop_repo_rounds, ready_in_merge_order, restore_primary, claim_for_round, CI_FIX_RULES}`, and `run_fix_round`, which keeps a CI round's account for the reading after it.
3 changes: 3 additions & 0 deletions services/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ pub mod embed;
/// Knowledge bases: files a team uploads, read into cited passages that the
/// brain chat and the team's agents search.
pub mod knowledge;
// CI fix rounds for every pull request of a run that spans several
// repositories.
pub mod repo_ci;
// Reading the team's repositories for Chat (overview, files, search).
pub mod repo_reach;
pub mod repo_read;
Expand Down
Loading