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
1 change: 1 addition & 0 deletions docs/incidents.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pipeline still calls it there.
| ab. `ab_label_prefix` | A failing-test fix's staging deploy and staging end-to-end checks were skipped on its draft. The reading of why went through the staging workflow line by line and kept every quoted string next to a label test as a label name, so a prefix test (`startsWith(github.event.label.name, 'E2E:')`) became a label named `E2E:`, and a condition that needs the staging label *and* `CI:E2E` read as either one. The staging label was refused, the team's `E2E:*` family let the bare `E2E:` through, and CoderHelm added `CI:E2E` and `E2E:`. Adding a missing label creates it, so the repository got an `E2E:` label that matches no area, and `CI:E2E` alone could never run the job. | A job's `if:` is read as an expression (multi-line blocks included) into the label combinations that run it, with those of the jobs it needs. A prefix or substring test is a pattern, never a label: CoderHelm adds only an existing repository label that satisfies it, the one the team's settings name when several do, and nothing when that isn't one certain label; a family allows `E2E:nav`, never `E2E:`. A label is added only when it alone runs the check, the settings allow it, it isn't a deploy, staging or production label and none is on the pull request; otherwise the hold names the exact real label for a person to add. Labels the old reading added that were a bare prefix or couldn't run their check alone come off when CoderHelm itself put them on, and a bare-prefix repository label GitHub made for that add is deleted when nothing else carries it. |
| ac. `ac_partial_and_red_ci` | A Jira run stopped after two steps that changed nothing (the coder twice said the last planned file needed no change, in words the plan check did not know) and a separate salvage path opened "⚠️ Partial", "Closes #0", "ran out of time" and marked it completed; another run's CI fix changed nothing and the run was completed with its pull request marked ready while every check was red. | One path opens a stopped run's pull request (`stop_pr`: ticket line, Not finished with done and left tasks and the recorded reason); no body names issue `#0` (client guard); a planned file the coder says needs no change settles and stays settled across steps; a step after a stalled one takes one task with a different approach; a CI fix that changes nothing tries again with fresh evidence (reporter comments, annotations, rerun on infrastructure failures), then holds the draft with what fails and the run needs a person; `ready::decide` never marks a pull request ready with a failing or running check; a source scan allows `create_pull_request` and `mark_pr_ready` only in their one place each. |
| ad. `ad_hand_back_reply` | A coder ended its step with "I couldn't finish, please complete the remaining tasks manually". Nothing it lacked was a credential, access, a product decision, an ambiguous ticket or an approval; its words alone handed the work to a person. | A model reply that hands the work back for a reason not on the human-only list is not an ending: the implement pass tells the coder to change its approach and runs it again, and a reply that still changes nothing is a step without progress, which climbs the supervisor's ladder (one task, other tools, a re-split, the strongest model, then the stuck task deferred with its reason) until the run finishes with what is done. Only a reply naming something on the list makes a hand-back. Every coder's system prompt carries the same stance (`ownership::coder_stance`), and a source scan fails on a hand-off phrase in any prompt or message (`ownership`). |
| ae. `ae_budget_rounds` | Two loops of fix rounds still stopped on their own budget after the supervisor took every other ending. At eight automatic pushes the CI-only rounds on a finished run's pull request marked it ready, completed the run with its checks red and said a comment naming a change would start the next round, even while each round turned another red check green; at two rounds the self-review on CoderHelm's own pull request said the same and left its findings holding the draft, even while each round closed one. | Both loops follow `supervisor::next_round`: rounds go on while they make progress (checks that were red turn green, findings close), past the cap up to twice it and below the spend ceiling; a round without progress changes approach (one item, a fresh context with small edits, a re-split, the strongest model). When the rounds end, the findings left move to "Deferred" with the reason and stop holding the draft, and the run finishes; red checks are reverted to the last green head and deferred, or, when nothing can come out, the run fails with what fails and why. No message asks for a comment to go on: the phrases are on the `ownership` hand-off list. |

## Adding a case

Expand Down
62 changes: 45 additions & 17 deletions services/worker/src/passes/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,21 @@ pub(crate) async fn run_for_branch(
Some((get("run_id"), get("status")))
}

/// What the pull request is told when CoderHelm's fix rounds on its E2E
/// failures end: what still fails, and why the rounds ended. No hand-off.
fn e2e_rounds_ended_note(caused: &[&Line], why: &str) -> String {
format!(
"These E2E failures may come from this change, and CoderHelm's fix rounds on them ended \
({why}). Each round tried a different approach once one made no progress. Still \
failing:\n\n{}",
caused
.iter()
.map(|l| format!("- {}", l.text))
.collect::<Vec<_>>()
.join("\n")
)
}

/// What happens when E2E fails on a PR Coderhelm opened: fix what the change
/// broke; otherwise confirm with one re-run and say why, once.
async fn own_pr_failures(
Expand Down Expand Up @@ -814,23 +829,36 @@ async fn own_pr_failures(
info!(pr, run_id, "E2E failure left to the run's own CI-fix loop");
return;
}
if !super::claim_auto_fix_slot(state, &msg.team_id, &run_id).await {
super::record_ci_outcome(
state,
&msg.team_id,
&run_id,
super::CiOutcome::HandedOff(super::GaveUp::Budget),
)
.await;
let body = format!(
"These E2E failures may come from this change. CoderHelm has used the automatic fix rounds this PR has, so it doesn't start another on its own; a comment naming a change starts the next one right away:\n\n{}",
caused.iter().map(|l| format!("- {}", l.text)).collect::<Vec<_>>().join("\n")
);
let _ = gh
.create_issue_comment(&msg.repo_owner, &msg.repo_name, pr, &body)
// The same rounds as every CI fix after the run, by the supervisor's
// rule: on while failures turn green, a new approach when a round
// makes no progress, and when they end the pull request says what
// fails and why, never "a comment starts the next one".
let failing: Vec<String> = caused.iter().map(|l| l.title.clone()).collect();
let rung = match super::claim_auto_fix_round(state, &msg.team_id, &run_id, &failing).await {
super::AutoFix::Round(rung) => rung,
super::AutoFix::Busy => {
info!(
pr,
run_id, "E2E fix round not claimed now (busy or unreadable)"
);
return;
}
super::AutoFix::End(why) => {
super::record_ci_outcome(
state,
&msg.team_id,
&run_id,
super::CiOutcome::HandedOff(super::GaveUp::NoProgress),
)
.await;
return;
}
let body = e2e_rounds_ended_note(&caused, &why);
super::add_progress_note(state, &msg.team_id, &run_id, &body).await;
let _ = gh
.create_issue_comment(&msg.repo_owner, &msg.repo_name, pr, &body)
.await;
return;
}
};
let body = format!(
"E2E tests failed on this PR's commit `{sha}` and nothing outside this change explains them (they aren't known to be flaky and they pass on `{main}`). Fix the application code this PR changed so these tests pass. Do not change, skip or loosen the tests themselves unless the test is plainly wrong about the intended behaviour, and say so if it is.\n\n{items}\n\nRun: {url}",
sha = msg.head_sha.get(..7).unwrap_or(&msg.head_sha),
Expand All @@ -845,7 +873,7 @@ async fn own_pr_failures(
.collect::<Vec<_>>()
.join("\n"),
url = run.url,
);
) + &super::supervisor::round_instruction(rung, "these E2E failures");
let fb = FeedbackMessage {
github_wait: Default::default(),
team_id: msg.team_id.clone(),
Expand Down
Loading
Loading