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
2 changes: 1 addition & 1 deletion .github/workflows/ci-timings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
TIMING_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
since=$(date -u -d '2 days ago' +%Y-%m-%dT%H:%M:%SZ)
bun scripts/ci-timings.ts collect --repo "$TIMING_REPO" --since "$since" --seed "$TIMING_DEFAULT_BRANCH" --request-budget 200 --reserve 500 --reservations
bun scripts/ci-timings.ts collect --repo "$TIMING_REPO" --since "$since" --seed "$TIMING_DEFAULT_BRANCH" --request-budget 200 --reserve 500 --reservations --red-main
- name: Retain normalized timing archive
if: always()
uses: actions/upload-artifact@v7
Expand Down
40 changes: 39 additions & 1 deletion docs/process/ci-throughput.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ its append-only history without changing it. Actor IDs and revocation prose
are omitted. Protocol expiry establishes authorized lease time, not actual
worker activity or caller waiting.

Hourly incremental collection includes PR lifecycle and reservation history,
Hourly incremental collection includes PR lifecycle, reservation and
[red-main](#red-main-incidents-flakes-and-proof-stopped-while-red) history,
within the [shared API budget](ci-timings.md#api-cost-and-expected-coverage-gaps). Explicit
`--since`/`--until` choose the half-open throughput analysis interval. Without
them, collection manifests supply a bounding interval whose gaps need review.
Expand Down Expand Up @@ -143,6 +144,43 @@ diagnoses. No incident surveillance means unknown overall incident rate.
Arbitrary fields such as prompts, names, hosts and prose are refused. Keep event
files with normalized snapshots under ignored `tmp/`, not in the public tree.

## Red-main incidents, flakes and proof stopped while red

`--red-main --since ...` reads the [red-main record](../decisions/ci-utility.md#red-main-record-and-coordinator)
from the same public coordination ref, walking only the commits that changed
`red-main.json`, back to the last green state before the window. It writes
`red-main.json` with one observation per record, keyed by its opening run, and
one per suspected flake. During `collect`, it also reads the coordinator's
`BRAIN_RED_MAIN` lines from the `red-main` workflow runs created while main was
red, as `coordinator-<run>-attempt-<n>.json`. A window in which main stayed green
costs no API request. Each archived attempt is seeded forward and never fetched
twice.

`summary.json` carries a `redMain` section; `summary.md` renders it.

| Field | Definition and boundary |
| --- | --- |
| `incidents` | Each record's opening run, first bad SHA and its bisect refinements, failing tests and categories with their estimator reasons, incident issue, declared and expedited fixes, and when it was cleared. |
| `timeToGreenSeconds` | Record opened to record cleared, on GitHub server time. An open record has none; `openIncidents` counts them. |
| `flakes` | Per test: suspicions, triage probe outcomes, flake issues, and `escalations` where a second suspicion within the window, or a reproducing probe, made it real. |
| `cancellations` | PR runs the coordinator cancelled, with observed runner seconds consumed and an estimated saving. |
| `refusals` | PR attempts the hosted gate refused (the failed gate step in `changeset`), with the same accounting. |
| `savingReference` | The median observed runner time of successful PR CI attempts in the archive. Saving is that reference minus the time consumed. It is an estimate, not a measured counterfactual. |
| `mergesDuringRed` | Non-fix squashes the coordinator reported landing while red, with their PR from the exact squash identity. |
| `acquisition` | History scopes and their errors, scopes whose red hours lack coordinator logs, and coordinator attempts whose cancellations are unknown. |

Unknowns never read as zero. A cancelled or refused run without a complete
timing snapshot has unknown consumption and saving. With no reference attempt,
saving is unknown. Each is counted separately (`unknownConsumed`,
`unknownSaved`). A run that finished before its cancellation took effect saved
nothing. A coordinator attempt that failed before printing its line has
unknown cancellations. Probe-triggered cancellations print the same line from
the change that added this collector. Earlier probe attempts that succeeded
without it read as none. A squash without an exact PR identity is counted in
`unknownPR`. No `red-main.json` makes the whole section `null`: unknown, not a
quiet main. Overlapping archives join per record; contradicting opening times,
clearings or incident numbers are refused.

## Scenario estimates and formal proof

Use `report --scenario <JSON-file>`. The default assumptions are:
Expand Down
14 changes: 11 additions & 3 deletions docs/process/ci-timings.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ separate from the hourly artifact collection described here; this guide does
not imply that durable compaction or scheduled report delivery is enabled.

`.github/workflows/ci-timings.yml` collects an overlapping two-day creation
window hourly, with job/step timings, PR lifecycle and reservation history,
window hourly, with job/step timings, PR lifecycle, reservation history and
[red-main evidence](ci-throughput.md#red-main-incidents-flakes-and-proof-stopped-while-red),
and supports manual dispatch. Each invocation seeds from the preceding
default-branch `ci-timings` artifact, then fetches only new or incomplete
attempts. Completed attempts and unchanged/merged lifecycle observations are
Expand Down Expand Up @@ -101,7 +102,10 @@ older rerun attempts also need an attempt-identity call. One shared PR index
costs one call per 100 recently updated PRs. A changed PR normally costs two
calls (detail and one timeline page), or three when its immutable squash is
read. Unattributed main heads add an exact-SHA lookup. No resource-job log
calls occur on the schedule.
calls occur on the schedule. Red-main history is read through Git, not the API.
Only while main was red does each new coordinator attempt cost two calls (jobs
and its log), plus one discovery call per 100 coordinator runs in each red
interval.

For example, a warm run with two discovery pages, one PR-index page, 20 new
attempts, and five changed merged PRs costs **42 calls**: `1 + 3 + 2 + 1 + 20 +
Expand Down Expand Up @@ -129,7 +133,11 @@ Reservation-history failures are isolated: `reservations.json` records an
continues. The report keeps that error in its reservation scopes and sets
`reservationAcquisition.complete` to false. Any failed reservation scope leaves
total occupancy unknown; successful lease observations remain available in
`reservationAcquisition.leases` for inspection.
`reservationAcquisition.leases` for inspection. Red-main history failures are
isolated the same way in `red-main.json`. A failed coordinator discovery, or a
budget stop before it, marks that scope `partial` in its `coordinatorScope`.
The report then lists it under `redMain.acquisition`, rather than reporting no
cancellations.

Download archives before they expire, using their measurement workflow run IDs:

Expand Down
2 changes: 1 addition & 1 deletion scripts/check-ci-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function timingWorkflowProblems(text: string): string[] {
checkouts[0]?.with?.["persist-credentials"] !== false || checkouts[0]?.with?.repository !== undefined) fail("collector must check out trusted default-branch code without credentials");
if (JSON.stringify(workflow.on?.schedule) !== JSON.stringify([{ cron: "43 * * * *" }])) fail("timing collection must remain hourly and incremental");
const collection = steps.find(s => s.run?.includes("bun scripts/ci-timings.ts collect"));
if (!collection?.run?.includes('bun scripts/ci-timings.ts collect --repo "$TIMING_REPO" --since "$since" --seed "$TIMING_DEFAULT_BRANCH" --request-budget 200 --reserve 500 --reservations') ||
if (!collection?.run?.includes('bun scripts/ci-timings.ts collect --repo "$TIMING_REPO" --since "$since" --seed "$TIMING_DEFAULT_BRANCH" --request-budget 200 --reserve 500 --reservations --red-main') ||
/--resources\b/.test(collection.run) || collection.env?.TIMING_DEFAULT_BRANCH !== "${{ github.event.repository.default_branch }}") fail("timing collection requires seeded acquisition, a hard budget/reserve and no scheduled resource logs");
for (const step of steps) if ((step.run ?? "").includes("${{") || /bun install/.test(step.run ?? "")) fail("collector scripts must not interpolate events or install candidate dependencies");
if (!steps.some(s => s.uses === "actions/upload-artifact@v7" && s.if === "always()" && s.with?.["retention-days"] === 90 && s.with?.path === "tmp/ci-timings/")) fail("bounded always-upload timing archive missing");
Expand Down
Loading
Loading