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
45 changes: 45 additions & 0 deletions .github/scripts/incidents_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""Prints the incident regression cases as one Markdown table.

Each case has its own page, docs/incidents/<case>.md, with a title
("# <letter>. `<case>`"), a **What happened:** paragraph and a
**The guarantee:** part. There is no committed table: two pull requests
that each add a case would collide on it. This builds it on demand.

Usage: python3 .github/scripts/incidents_table.py [DOCS_DIR]
"""

import os
import re
import sys


def one_line(text: str) -> str:
return " ".join(text.replace("|", "\\|").split())


def row(path: str) -> str:
text = open(path, encoding="utf-8").read()
title = text.splitlines()[0].lstrip("# ").strip() if text else os.path.basename(path)
what = re.search(r"\*\*What happened:\*\*(.*?)(?=\*\*The guarantee:\*\*|$)", text, re.S)
guarantee = re.search(r"\*\*The guarantee:\*\*(.*)$", text, re.S)
return "| {} | {} | {} |".format(
one_line(title),
one_line(what.group(1) if what else ""),
one_line(guarantee.group(1) if guarantee else ""),
)


def main() -> None:
docs = sys.argv[1] if len(sys.argv) > 1 else os.path.join(
os.path.dirname(__file__), "..", "..", "docs", "incidents"
)
pages = sorted(p for p in os.listdir(docs) if p.endswith(".md"))
print("| Case | What happened | The guarantee |")
print("|---|---|---|")
for p in pages:
print(row(os.path.join(docs, p)))


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions .github/scripts/rust_affected.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"services/",
"lambda/",
"docs/api/",
# The incident suite checks every case has its page.
"docs/incidents/",
"infra/cfn/",
"infra/lib/",
"infra/bin/",
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/test_rust_affected.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_rust_inputs_run(self):
"lambda/log-analyzer/model_prices.json",
"infra/cfn/coderhelm-log-reader.yaml",
"docs/api/openapi.json",
"docs/incidents/a_whole_branch.md",
"installer/lib/github-app.mjs",
"coderhelm-jira/src/index.js",
"selfhost/install.sh",
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ jobs:
cache-on-failure: true
- if: steps.changes.outputs.run == 'true'
run: cargo fmt --check --all
# The incident cases are compiled through a generated include
# (worker/build.rs), which cargo fmt doesn't follow: checked by name.
- if: steps.changes.outputs.run == 'true'
run: rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs
# --all-targets: tests are linted too (a test-only lint once failed
# only on a local --all-targets run).
- if: steps.changes.outputs.run == 'true'
Expand Down
84 changes: 10 additions & 74 deletions docs/incidents.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/incidents/a_whole_branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# a. `a_whole_branch`

**What happened:** The plan check said 5 of 7 tasks were done. The last step wrote nothing, and the run ended "I ran but produced no file changes".

**The guarantee:** A step that writes nothing is judged on the whole branch. Work on the branch goes on to the checks and the pull request. With nothing on the branch, the run names the planned tasks that weren't built and never asks generic questions.
5 changes: 5 additions & 0 deletions docs/incidents/aa_promised_round.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# aa. `aa_promised_round`

**What happened:** A ticket run's own review requested changes. The run took review fix rounds until its automatic fix budget was spent, handed its pull request over with two of its own review's findings still listed, and finished. The draft was then held every hour for three days on "CoderHelm fixes them in its review rounds", and no round ever ran after the run was done.

**The guarantee:** A hold never promises CoderHelm work that isn't queued. A finished run's draft held on its own review's findings queues one review fix round for them, once per head, while the run has rounds left (its own review rounds, its automatic fix pushes and its fix cycles), and waits for it ("CoderHelm is fixing N findings from its review"), a wait bounded like every other. With no round left, after the run stopped its rounds itself, or once a round ran on the head and the findings are still there, the hold names what a person does and promises nothing. The security and planned work holds name a person's action too, since nothing runs those again once the run is over. A review of a finished run's pull request leaves its findings to that decision, so they are never fixed twice or outside the run's budget.
5 changes: 5 additions & 0 deletions docs/incidents/ab_label_prefix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ab. `ab_label_prefix`

**What happened:** 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.

**The guarantee:** 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.
5 changes: 5 additions & 0 deletions docs/incidents/ac_partial_and_red_ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ac. `ac_partial_and_red_ci`

**What happened:** 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.

**The guarantee:** 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.
5 changes: 5 additions & 0 deletions docs/incidents/ad_hand_back_reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ad. `ad_hand_back_reply`

**What happened:** 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.

**The guarantee:** 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`).
5 changes: 5 additions & 0 deletions docs/incidents/ae_budget_rounds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ae. `ae_budget_rounds`

**What happened:** 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.

**The guarantee:** 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.
5 changes: 5 additions & 0 deletions docs/incidents/af_lockfiles_out_of_sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# af. `af_lockfiles_out_of_sync`

**What happened:** A security update's pull request changed three `package.json` files (a pnpm workspace root and two npm packages with their own lockfiles) and none of the lockfiles, so every CI job failed at its frozen install. A retry planned its bumps by rule, then handed the red pull request to a model instead of building the plan. The model changed nothing; landing "nothing" removed the round's work branch, so the next attempt wrote to a branch that was gone (every write a 404, a hand edit of a lockfile among them). The round was called unfinished and the run ended failed after one attempt of three, with the same vague sentence twice.

**The guarantee:** A lockfile out of sync with its manifest is repaired by code before any model round, for any ticket and every package manager CoderHelm writes lockfiles for: each manager writes its own lockfile in the sandbox (with another mode and the LTS Node as fallbacks), one commit, and one that can't be written never hides the others. Any run that changes a manifest gets its lockfile written before the pull request opens. A retry of a dependency fix rebuilds its change from its plan on the same branch. A model's write to a lockfile is refused and pointed to the regenerate tool. Every attempt of a CI fix round opens its work branch first; a fault inside the round (no work branch, a compare or push GitHub refuses, a sandbox failure, anything else) is classified and has a way around it, and the catch-all runs the round again from a clean state, then once in a fresh step, before the supervisor's ending is asked. An attempt that changed nothing is followed by the repairs by code, then fresh evidence, then the strongest model. A run about to complete with red checks goes back to its CI fix round first, and an ending for red checks names the recorded cause, once.
5 changes: 5 additions & 0 deletions docs/incidents/ag_red_ci_ships_what_passes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ag. `ag_red_ci_ships_what_passes`

**What happened:** Three ways were left for a run to end badly over red checks or a refused landing. A dependency fix whose CI stayed red was taken apart by planned task (one task per lockfile, so a lockfile went back without its manifest), and after three reverts the run ended failed with bumps left in that passed on their own. A run stopped after its work opened its pull request with manifests changed and lockfiles unwritten, and waited for CI to fail first. A review fix or feedback round whose finished work GitHub refused to land was recorded as unfinished at once.

**The guarantee:** Red checks after every fix take out only what breaks them. A dependency fix takes out its newest commit of verified bumps, defers those bumps with what CI printed, holds their findings out of later bundles and keeps the commits before it, again while CI stays red, never emptying the pull request. Any other run is taken apart task by task (up to eight reverts) down to the part that passes; what ships is green with the rest under "Deferred". A stopped run's lockfiles are written by their package managers before its pull request opens, and one that can't be written is named without stopping it. Every kind of fix round takes one classified decision about a fault (`round::plan_for_fault`): while it may continue it runs again in a fresh step, keeping its work when only the landing failed and starting from the pull request's head otherwise.
5 changes: 5 additions & 0 deletions docs/incidents/ah_dep_run_choice_and_proof.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ah. `ah_dep_run_choice_and_proof`

**What happened:** A dependency security run of 64 packages finished with its checks passed. Two packages had been forced onto a new major version through an override although a patched release existed on the installed line (a unit listed one bump per package, to the highest target of all of the package's copies); CoderHelm's reviewer caught it and a fix round pinned them back. Four overrides did have to cross a major version and nothing showed their parents work on it: the sandbox ran the install, the type check, the linter and the unit tests, never the application's build or its start. One pull request carried all 64 bumps, and it did not say how many advisories stayed open or why.

**The guarantee:** A bump stays on its installed version line with that line's lowest patched release, one bump per package and line; it crosses a major version only when the advisory data lists no patched release on the line, and says which advisory. A fix that crosses a major version is a pull request of its own from the start (a person who asks for one pull request still gets one), its release notes read before any patch bump's, with the parent of a transitive package named and the range it declares. After the batches, the repository's real build (the command its CI runs, else its build script) and its declared start command run in a sandbox build of their own with a full time window, on the base branch and on the branch; what passes on the base and fails with the bumps takes out the newest commit of bumps and defers it with the cause, and only the set whose removal made it pass is held as breaking. What did not run is said, never claimed. The description ends with the advisories that stay open, counted by reason.
5 changes: 5 additions & 0 deletions docs/incidents/ai_open_items_settled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ai. `ai_open_items_settled`

**What happened:** A dependency update finished completed with five Open items on its pull request for a person: the package manager's audit never ran so the advisory counts were unknown (listed twice, in different words), nothing showed that the packages an override moved still built and passed their tests, a README line claimed checks no run had made (and was still listed after a later round rewrote it), and the plan had no end-to-end checklist for a change with nothing to deploy. The coder's full checks had been refused twice for lack of time after two lockfile regenerations in one step, and nothing carried them anywhere.

**The guarantee:** A run settles its own open items before it finishes (`settle`). Each item is classified: CoderHelm runs it in its sandbox, the repository's CI settles it, it does not apply to the run, or only a person has what it needs (a reason on the human-only list). What CoderHelm can run it runs in a step with a full sandbox window, a fresh step when this one has too little time, and a check the coder was refused for lack of time is owed whether or not an item names it. A change to the dependencies is always audited by its package manager after the bumps (`common::dep_audit`, one row per manager) and the counts left are quoted. A passing result closes the item and is quoted under "Checked by CoderHelm"; a failing one takes out a dependency fix's newest verified set of bumps, or gives any other run a fix round with the real output. An end-to-end checklist is not raised for upkeep, the same missing fact is one item, every item names the head it was written on, and a run about to finish with items of an earlier head derives them again first. What stays says why. Lockfiles are regenerated once per state of the branch.
5 changes: 5 additions & 0 deletions docs/incidents/aj_coder_habits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# aj. `aj_coder_habits`

**What happened:** A bug fix was right on its face and wrong four ways. Its plan named two files and nothing about them. The fix was written first and its test after, and the test passed with or without the fix. It rounded per line, an approach one pull request had shipped and another had reverted two months earlier, with the reason one commit list away. It changed a response field another of the team's repositories read and never named that repository. Its one real doubt (half up or half even) was listed at the bottom of the finished pull request, and a helper file no task named was reformatted along the way.

**The guarantee:** Before code, a bug's plan names the test that fails on the code as it is (or why none can and the next best proof), and that test is the first task. The worker itself reads the commits of the files the plan modifies and what depends on them (the code graph, a search of the team's other repositories for each changed name); a revert must be answered by name, and every dependent is updated by a task or called safe with the reason. A doubt that changes what is built is asked at planning time with the default the run builds. After the build each new or changed test runs with and without the change: one that passes either way, a bug's test that can't build on the base, a changed file outside the plan with no reason and a planned dependent left untouched all go back to the coder. The pull request carries the failing and the passing result, the history, and who the change affects.
5 changes: 5 additions & 0 deletions docs/incidents/al_learning_loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# al. `al_learning_loop`

**What happened:** A person pushed the same fix on top of two of CoderHelm's pull requests two weeks apart, and the same reviewer asked for the same test both times. All that was kept from the first was "PR #101 was rewritten by people before merging", and nobody could say how often its pull requests were edited, closed or reverted without reading the runs.

**The guarantee:** What becomes of every pull request CoderHelm opens is counted from the webhooks, each pull request once however often an event is delivered: merged, closed, reverted, review rounds, a person's commit on top, open items. A person's edit, a close with a comment and a revert with a reason each become a lesson that names the code and says how to check a change against it, with the evidence attached. The same lesson from another pull request is counted on the kept one, and a lesson people go against loses weight until it is no longer given. What a reviewer asked for on several pull requests is given to the next build when that reviewer is likely to review it, and nothing personal is kept. A lesson seen on enough pull requests is proposed for the repository's guide file as one pull request at a time, never as a push to the default branch.
Loading
Loading