Skip to content

The CI watch hands each Inherited failure its Base branch checks, and the Base fix reads none itself #362

Closed

Description

@JacobStephens2

What to build

The CI watch module becomes the one place that decides what an Inherited failure is and where it fails on the Base branch. When CI on a Run's head is red, the CI watch reads the checks on the Base branch commit once, decides which red checks are Inherited failures by its one name rule, and hands back, beside each Inherited failure on the head, the Base branch's own failing checks of those names with their URLs there.

The Base fix module consumes that and never asks GitHub about the Base branch commit itself. Both things it needs the Base branch's checks for, the Base fix issue's body and the advice a Run gives after its cause when Inherited failures fail it with no Base fix taken (the Base check: lines), are built from what the CI watch returned.

Nothing a user sees changes, except that a Run no longer reports "could not read the checks on " when it fails on Inherited failures: that second read, and its failure mode, are gone.

Acceptance criteria

  • What the CI watch returns for a red commit carries, beside the branch's own failures and the Inherited failures on the head, the Base branch commit's own checks under the Inherited failures' names, with their Base branch URLs. It is empty when there are no Inherited failures, including when no Base branch commit was given, as in a Base fix's own Run.
  • The Base fix module reads no checks from GitHub. Its own query of the Base branch commit's checks is deleted, and so is the "could not read the checks on " progress line in the advice.
  • Starting a Base fix takes the CI watch's result for the red commit, not a bare list of the Inherited failures, and writes the Base fix issue's body from the Base branch checks in it.
  • The Base check: advice lines, on stderr and in the Run notification, come from the Base branch checks in that result, unchanged in wording and order.
  • The split of red checks into the branch's own and Inherited failures, together with picking out the Base branch checks, is one function inside the CI watch module, with unit tests on plain check lists for: a red check with no check of its name on the Base branch commit (own); one whose every same-name check failed there (inherited, with the Base branch check's URL, not the head's); one where only some same-name checks failed there (own); a Base branch check whose name matches no red check (not carried); and no Base branch commit given (every red check own, nothing carried).
  • The existing integration tests for CI, Base fix, Spec run and Architect run pass unchanged. A prototype of this change passed all of them (tests/ci.rs, tests/base_fix.rs, tests/spec_run.rs, tests/architect_run.rs) with no test edited.
  • The generated prompts page is unchanged: the CI-fix Repair's Session prompt still lists the Inherited failures with the head's check URLs. If constructing its sample input needs the new field, set it, and confirm UPDATE_PROMPTS=1 cargo test prompts_page produces no diff in prompts/.
  • No change to CONTEXT.md or any ADR is needed: "Inherited failure" already names the concept, and ADR-0008 is untouched.

Blocked by

None (can start immediately).

Decisions

  • The CI watch owns the whole Inherited failure rule, evidence included. Today it reads the Base branch commit's checks, classifies by name, then drops them; the Base fix module reads the same checks again and filters them with a second, differently written name rule. One read and one rule, in the module that already owns the comparison, gives locality: the rule cannot drift between two places. The Base fix module keeps everything that is truly its own (the lock, the mark files, finding an open Base fix issue by title, starting and waiting on the child Run, the advice's retry and setting lines).

  • Carry the Base branch checks as a third list on the existing failed-checks result, rather than a new nested type. Every current reader (the Repair loop, the CI-fix Repair prompt, the Check re-run) keeps reading the own and inherited lists as they are; only the Base fix module reads the new one. Invariant, documented on the field: every check in it failed on the Base branch commit and shares its name with an Inherited failure, and it is empty exactly when there are no Inherited failures. Under the existing rule (every same-name check on the Base branch failed), "the Base branch checks of an inherited name" and "the failed ones of an inherited name" are the same set, so the Base fix module's old filter is subsumed, not changed. Sketch from the prototype:

    pub struct FailedChecks {
        pub own: Vec<Check>,
        pub inherited: Vec<Check>,
        /// Where the Inherited failures fail on the Base branch commit: its own
        /// checks of those names, with their URLs there. Empty when `inherited` is.
        pub on_base: Vec<Check>,
    }
  • Starting a Base fix takes the whole failed-checks result, not two slices. Passing the inherited checks and the Base branch checks as two separate arguments would make the caller keep them in step; one value keeps the invariant inside the CI watch's result. The Base branch name and the Base branch commit stay separate arguments: the Repair loop chose that commit (the one the head last merged in) and uses it in its own progress line, so it is the Repair loop's fact, not CI's output.

  • The Base branch checks are those read when CI was judged, not re-read when the Base fix starts. Judging and reporting from one read is more correct than two reads of a commit whose checks can be re-run in between; a re-read could, in principle, link a check that no longer matches the decision taken. It also saves one GitHub call per failing Run.

  • The advice becomes infallible. With no read, it has no "could not read" path; it lists the Base branch checks it was handed. Nothing reads that progress line (no test asserts on it).

  • Unit tests go on the split, an internal seam of the CI watch module; the integration tests stay the interface's tests. The CI watch's interface is exercised end to end through the fake gh, which stays; the name rule's edge cases (several same-name checks, partial failure, URL taken from the Base branch) are cheaper and clearer on plain check lists than through polling scenarios, and today they have no unit test at all.

  • Out of scope: the Base fix issue title as the store of check names (finding an open Base fix by parsing its title) stays as it is; it is about finding another Run's Base fix, not about judging CI, and changing it would change what is written on GitHub.

Architecture review

Strength: Strong · Dependencies: in-process (the GitHub reads stay behind the existing gh adapter)

Files: src/ci.rs, src/base_fix.rs, src/delivery.rs, src/prompts_page.rs

Before

flowchart LR
  RL[Repair loop] -->|head, base commit| CI[CI watch]
  RL -->|base commit, inherited| BF[Base fix]
  CI -->|checks on base commit| GH[(GitHub)]
  BF -.checks on base commit, again.-> GH
  CI -->|own, inherited| RL
  classDef leak stroke:#dc2626,stroke-width:2px;
  class BF leak
Loading

After

flowchart LR
  RL[Repair loop] -->|head, base commit| CI[CI watch]
  CI -->|checks on base commit, once| GH[(GitHub)]
  CI -->|own, inherited, on base| RL
  RL -->|failed checks| BF[Base fix]
  classDef deep stroke-width:3px;
  class CI deep
Loading

Problem: the Inherited failure rule is split: the CI watch reads the Base branch commit's checks and drops them, and the Base fix module reads them again with a second name rule and a second failure mode.

Solution: the CI watch returns the Base branch checks behind each Inherited failure, and the Base fix module consumes them and reads nothing from GitHub.

Wins

  • Locality: one Inherited failure rule
  • Base fix stops reaching into GitHub
  • Delete a read and its failure mode
  • Name rule gets unit tests
  • One fewer GitHub call per failure

Activity

  1. added
    needs-triage
    ready-for-agent
    architect-plan
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Oct 4, 2026
  2. removed
    in-progress
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    architect-plan

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions