Skip to content

feat(claude-lane-incident): escalate rate-limit storms across three distinct pull requests - #469

Merged
kyle-sexton merged 2 commits into
mainfrom
feat/rate-limit-storm-escalation
Aug 14, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
feat/rate-limit-storm-escalation

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

The incident aggregator was structurally blind to a rate-limit-only outage: rate-limit sits outside ESCALATING_CLASSES by design (a singleton 429 is weather), so a polling cycle whose every observation is rate-limit classified clean, opened no incident, and rendered nothing — the gap #466 documents. On 2026-08-13, ~15:07–18:04Z, an exhausted shared seat 429'd every lane execution across the fleet; all five hourly aggregator cycles in the window logged cycle=clean coverage=complete action=none (runs 31714199816, 31719147314, 31724322542, 31729008787, 31735138855 — each polling 15 repositories), and PRs across two repositories merged with zero completed reviews behind green checks.

This PR escalates rate-limit density, not presence: a cycle whose tally shows rate-limit on RATE_LIMIT_STORM_THRESHOLD (3) or more distinct pull requests is an incident cycle, exactly as an auth or runner observation is.

How storms and weather stay separated

  • One or two throttled PRs never escalate. The weather rationale is refined, not reversed: escalating is membership-OR-density, and density is classPulls["rate-limit"].size >= 3 inside a single cycle's tally.
  • Deduplication is the guard rail. Counts are distinct <repo>#<pull> keys, so one stuck PR re-observed every cycle for 24 hours — or annotated repeatedly on one head — can never sum its way to a storm (pinned by test).
  • Any class=rate-limit annotation already survived the lane's own gated in-run retry (one retry, minutes later, jittered — claude-review.yml's retry gate). A transient RPM spike clears in-run and never emits the class; only a 429 that persisted past the retry is ever observed here. On 2026-08-13 the retries 429'd too.
  • Purely intra-cycle. No new cross-cycle state channel: the state block, coverage gate, escalation-marker dedup (posted at most once per incident), and the three-covered-clean-cycles close path are untouched. A storm-opened incident closes itself once the window lifts and the failed attempts age out of the 24h lookback or are superseded by re-runs — re-running the affected lanes is already the documented remediation step.
  • No new abuse surface. A hostile consumer annotation could already open an incident with a single forged class=auth; forging a storm needs three distinct PRs, which is strictly harder.

Threshold: >=3 distinct PRs, validated against 19 days of fleet history

I swept every lane check-run annotation across all eight lane-running surfaces (dotfiles, claude-code-plugins review + security lanes, medley, standards, provisioning, github-iac, ci-workflows self-lanes) with filter=all — superseded attempts included — over 2026-07-26 → 2026-08-13: 257 class=rate-limit annotations on 110 distinct heads, then simulated the aggregator's hourly cycle over them (24h lookback, distinct-PR dedup, PR numbers resolved via commits/{sha}/pulls).

Distinct-PR rate-limit density per simulated hourly cycle:

Distinct PRs in view Cycles
1 34
2 14
3–9 99
10+ 35

The distribution is bimodal: isolated throttles (1–2 PRs) and storm waves (5–48 PRs at peak), with nothing in between that a threshold choice could split. Every candidate threshold from >=2 through >=5 produces exactly the same five escalation episodes:

Episode (UTC) Peak distinct PRs Surface
Jul 26 16:17 – Jul 27 15:17 5 ci-workflows
Jul 29 04:17 – Jul 30 04:17 8 ci-workflows
Jul 30 23:17 – Aug 1 14:17 7 ci-workflows, dotfiles, provisioning, standards
Aug 9 11:17 – Aug 10 15:17 10 claude-code-plugins, standards
Aug 13 06:17 – Aug 13 21:17 48 (31 mapped PRs + 17 heads) claude-code-plugins, dotfiles, medley, provisioning, standards

So:

  • Positive case: >=3 fires on the 2026-08-13 outage — and on four earlier rate-limit storms that also opened no incident. This failure shape recurs roughly weekly; the blindness was not a one-off cost. (The Aug 13 wave visibly started hours before the 15:07Z window the issue names.)
  • Negative case: all 34 singleton cycles and all 14 pair cycles stay quiet under >=3. In this dataset the pair cycles are storm edges rather than independent throttles, so even they represent conservative late-opens, not false pages.
  • >=2 buys earlier opens on the same five episodes but gives up the safety margin against two coincidental throttles (e.g. one push train briefly throttled across two PRs) — with an hourly safety net, a one-cycle-later open is the cheaper error.
  • >=4 / >=5 would still have caught these five storms, but only because they were all wide; a three-PR storm is already three unreviewed merges in flight, operationally identical to auth, and there is no data suggesting 3 over-fires.
  • Requiring >=2 distinct repositories (the issue leaves it open): deliberately not required. Two of the five real episodes were single-repository at first observation (Jul 26, Jul 29), and the seat is shared — repository spread measures which repo happened to push during the window, not severity. Three distinct PRs in one repo losing reviews to 429s in one window is the same exhausted-seat shape.

Data caveat, in the safe direction: the sweep includes superseded attempts while the shipped poll reads filter: latest, so this OVERSTATES the density production would see — a threshold quiet on this data is quieter live. The storms firing does not rest on that inflation: the issue's live observation of the densest Aug 13 cycle already showed 4–5 distinct pulls, and every episode had >=5 distinct mapped PRs at peak.

Rendering

The per-class "Escalating" column now derives from what actually escalates rather than set membership: a storm-opened incident renders storm (>=3 PRs in one cycle) (the peak per-cycle distinct-PR count vs the threshold — mergeCounts takes the max across cycles, so this faithfully answers "did any single cycle reach storm density"); a below-threshold rate-limit rider on an auth incident still renders no. The Remediate list gains a storm step (check the seat's usage/quota in the Console; re-review what merged during the window), renumbering the coverage and re-run steps — the pinned counting-rule sentence is byte-identical, only the test's extraction regexes moved with the numbers.

The byte-pinned write job's escalation-marker prose no longer claims incidents open only on an escalating class; the pin file and every write-gate fixture carry the same bytes — that is the 46-file mechanical portion of this diff, and the write gate enforces the lockstep.

Red-first proof

With the new tests present and claude-lane-incident.cjs reverted to HEAD:

FAIL a fleet-wide rate-limit storm produces an incident cycle through the shipped poll
FAIL a rate-limit storm across three or more distinct pull requests escalates
FAIL a storm-opened incident opens, renders the storm, and closes on recovery
pass isolated rate-limit throttles below the storm threshold never escalate
pass one throttled pull request re-observed many times is not a storm
pass a below-threshold rate-limit rider on an auth incident still renders as non-escalating

The three positive cases (the 2026-08-13 shape: 3+ distinct PRs, two repos, rate-limit/429, one cycle — including an end-to-end run of the shipped poll script) fail against current code and pass after. The negatives pin the weather rationale — singleton, pair, and one-PR-re-annotated — and exist to fail against a future change that escalates on presence.

Gates

  • node --test .github/scripts/*.test.cjs — 714/714 pass (708 before; +6 new)
  • node --test .github/actions/claude-lane-outcome/*.test.cjs — pass
  • actionlint — clean on the changed workflow
  • zizmor — no new findings; the one pre-existing High (github-app unscoped mint) is on the untouched mint step and documented as deliberate in the workflow header (advisory lane)
  • biome 2.5.8, markdownlint-cli2, editorconfig, comment-hygiene — clean on changed files

Out of scope (tracked separately)

Related

Closes #466

🤖 Generated with Claude Code

https://claude.ai/code/session_01Aac8xjCjMxFsXGHCXKHY4W

…istinct pull requests

A rate-limit-only outage was invisible by construction: rate-limit is
deliberately outside ESCALATING_CLASSES (a singleton 429 is weather), so a
cycle whose every observation is rate-limit classified clean, opened no
incident, and rendered nothing. On 2026-08-13 an exhausted shared seat
429'd every lane execution across the fleet for ~3 hours — 7 PRs in 2
repositories merged with zero completed reviews behind green checks — and
all five aggregator cycles in the window logged cycle=clean action=none.

Escalate on density, not presence: a cycle whose tally shows rate-limit on
RATE_LIMIT_STORM_THRESHOLD (3) or more DISTINCT pull requests is an
incident cycle, exactly as an auth or runner observation is. The weather
rationale is refined rather than reversed — one or two throttled PRs still
never escalate, and per-pull deduplication means one stuck PR re-observed
all day can never sum its way to a storm. The comparison is intra-cycle
only, so no new cross-cycle state exists and the state-block, coverage,
and close machinery are untouched: a storm-opened incident closes by the
existing three-covered-clean-cycles path once the usage window lifts.

The per-class Escalating column now derives from what actually escalates
rather than membership alone — a storm-opened incident renders
'storm (>=3 PRs in one cycle)' instead of claiming 'no' — and the
remediation list names the storm posture (restore the seat's usage
headroom; re-review what merged unreviewed). The byte-pinned write job's
escalation-marker prose no longer claims incidents open only on an
escalating class; the pin file and every write-gate fixture carry the
same bytes.

Closes #466

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aac8xjCjMxFsXGHCXKHY4W
@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 51s —— View job


Claude finished the code review

Tasks

  • Gather context (PR body, changed files list, CLAUDE.md, REVIEW.md)
  • Understand the request (invoke /review:code-review)
  • Run the code-review procedure against this PR
  • Post inline findings (none met the high-signal bar)
  • Post final summary

Scope note

This repo carries a dedicated claude-security-review.yml lane, so per REVIEW.md this code-review pass is scoped to correctness/design/tests/docs and omits security findings.

Summary

This is a well-scoped, thoroughly tested change. I traced the core logic end-to-end:

  • tallyObservations (claude-lane-incident.cjs#L211-L272) dedups by <repo>#<pull> per class before computing escalating, so the storm threshold genuinely measures distinct-PR density, not annotation count or re-observation across cycles — confirmed this is what the "one stuck PR re-observed many times is not a storm" test exercises.
  • mergeCounts (claude-lane-incident.cjs#L283-L289) takes the max across cycles (never sums), so the rendered "storm (>=3 PRs in one cycle)" label in renderIssueBody correctly reflects peak-per-cycle density rather than a cross-cycle accumulation — this matches the "purely intra-cycle" claim in the PR description.
  • claude-lane-incident-write-gate.cjs is untouched by this diff (git diff confirms zero changes), and I spot-checked several of the 46 mechanically-touched fixtures plus the pinned write-job file — the escalation-marker prose edit is byte-identical across the pin file, the workflow, and the fixtures, consistent with the "write gate enforces lockstep" claim.
  • The remediation-step renumbering (4→5, 5→6) in renderIssueBody is consistent everywhere I could find a reference to the old numbering (workflow file, test file's countingRuleOf regex extraction) — no stale "step 4"/"step 5" references left behind.
  • New tests (claude-lane-incident.test.cjs, claude-lane-incident-aggregator.test.cjs) cover the storm-escalates, below-threshold-never-escalates, re-observation-isn't-density, rider-on-auth-incident, and full open→render→close lifecycle cases, plus an end-to-end run through the shipped runPoll simulation. The test logic checks out against the implementation.

Verification caveat: I could not execute node --test in this sandbox (no permission for arbitrary node invocation), so the "714/714 pass" and other gate results in the PR description are author-claimed and were not independently re-run by me — I verified correctness by static reading of the implementation against the tests instead.

Minor, non-blocking observation: a couple of docstrings elsewhere in claude-lane-incident.cjs still say "escalating class" in places that now also cover storm density — e.g. claude-lane-incident.cjs#L357 ("no escalating class") and claude-lane-incident.cjs#L488 ("an escalating class was seen"). This is purely a documentation-precision nit on a boolean-typed parameter (escalating) whose semantics already changed correctly — not worth blocking on, just flagging in case it's a two-word fix while this file is open.

No correctness bugs, no test gaps, and no design concerns found. Nothing rose to the level of a blocking or inline finding.
· Branch: feat/rate-limit-storm-escalation

@claude

claude Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Security review in progress

  • Gather context (PR body, diff, changed files)
  • Read CLAUDE.md and repo security review conventions
  • Review .github/scripts/claude-lane-incident.cjs changes (storm density logic)
  • Review workflow changes (claude-lane-incident-aggregator.yml)
  • Review pinned/fixture file changes (mechanical vs. semantic)
  • Post findings

View job run

…ount

The classifyCycle/nextState doc comments and the role-label test's
rationale still said an incident opens only on an escalating CLASS; a
rate-limit storm now opens one too, so the prose names the union.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aac8xjCjMxFsXGHCXKHY4W
@claude

claude Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 47s —— View job


Security review complete

Tasks

  • Gather context (PR body, diff, changed files)
  • Review .github/scripts/claude-lane-incident.cjs changes (storm density logic)
  • Review workflow changes (claude-lane-incident-aggregator.yml)
  • Review pinned/fixture file changes (mechanical vs. semantic)
  • Post findings

(Note: the /review:security-review skill invocation didn't return runnable instructions in this environment, so this review was conducted manually against the diff and prior security-review conventions in this repo.)

Findings

No blocking security issues. This is a well-scoped, well-tested behavioral change with no permission, token-scope, or trust-boundary modifications.

Verified:

  • Dedup is real, not just claimed. tallyObservations keys on distinct <repository>#<pullNumber>, so RATE_LIMIT_STORM_THRESHOLD (3, L69) cannot be reached by re-observing one stuck PR across cycles or by duplicate annotations on one head — confirmed by one throttled pull request re-observed many times is not a storm in the test diff, and pullNumber in the real poll always comes from the enumerated open-PR list (claude-lane-incident-aggregator.yml#L448), not attacker-supplied text.
  • No permission or token changes. The workflow diff (claude-lane-incident-aggregator.yml) is prose-only (comments and issue-body copy); the two-credential/disjoint-role token matrix, permission blocks, and the escalation-marker post-once-per-incident logic are byte-for-byte untouched.
  • Rendering has no injection surface. escalationLabel in renderIssueBody (L659-L666) only interpolates a fixed enum token (already filtered through RECOGNIZED_CLASSES) and integer counts — no attacker-controlled string reaches the rendered issue body via this path.
  • 46-file mechanical claim holds. Spot-checked and hash-compared multiple fixtures (base.yml, yaml-anchor.yml, mint-with-write-permission.yml, secret-tojson-dump.yml, write-job-script-edited.yml, plus the four +1/-1 files) against claude-lane-incident-write-job.pinned.yml — all carry the identical prose edit, and claude-lane-incident-write-gate.cjs (the script that enforces write-job/fixture lockstep) is untouched, consistent with the PR's description.
  • Threshold constant is a hardcoded module value (not workflow input/config-driven), so there's no path for external configuration to widen or narrow it at runtime.

One informational note (not a blocker, already addressed in the PR description): the storm path is a new escalation trigger reachable purely from class=rate-limit annotation content across ≥3 distinct PRs. If a consumer-repo actor could forge that annotation on 3 PRs, they could force a human-paging incident open. The PR body explicitly discusses this ("forging a storm needs three distinct PRs, which is strictly harder" than the pre-existing single-PR auth forge) — flagging for visibility since it's a new escalation reason, but it doesn't lower the existing bar, and it's the same trust model already accepted for auth/runner membership escalation.

No changes requested.

Branch ·

@github-actions

Copy link
Copy Markdown

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

@github-actions

Copy link
Copy Markdown

Last security-reviewed head: 6466b7659fb3c383c2ca0253953dc81db04d1c06. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incident aggregator is blind to a rate-limit-only outage: 3-hour fleet-wide 429 wave opened no incident

1 participant