Skip to content

A reopened change and a later alert recovery reach their waiting runs at once - #986

Merged
nambok merged 1 commit into
mainfrom
waits-end-when-the-event-arrives
Dec 5, 2026
Merged

nambok merged 1 commit into
mainfrom
waits-end-when-the-event-arrives

Conversation

@nambok

@nambok nambok commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two waits from #924 could outlast what they waited for. A run stopped because the change it built on closed was only taken back to waiting by the 15-minute sweep after the change was reopened. A recovery posted after an alert route's quiet window never closed the run waiting on a person for that alert. Both now reach the run as soon as the event happens.

Changes

  • Reopened change, at once (gateway/routes/github_webhook.rs, worker/passes/change_wait.rs, common::change_wait): the pull request handler sends the team's change check for a close or a reopen (change_wait_check, event_moves_change) before any return a reopen reaches. Before this, a reopen went on to the review triggers and returned, and the check sent on a close never read stopped runs (check_closed ran only in the sweep). The check message now names the pull request (repo, pr), and the worker's check_change reads that team's runs stopped by that change's close (moved_is). A reopen takes them back to waiting for the merge, and a merge sends them on. The 15-minute sweep still reads every team's stopped runs as the backstop.
  • Later recovery closes the run (common::run_wake, worker/passes/alert_episodes.rs, gateway/routes/run_wake.rs): the close of a waiting alert run moved to common::run_wake::alert_cleared (with close_cleared, newest_of_ticket and alert_ticket_id). The gateway's alert_delivery now calls it for a recovery posted at once, and the worker's episode check calls it right after post_cleared when the quiet window ends. One path, no copy. An ALARM that arrives after the window still resumes the waiting run as before.
  • Incident case xx_waits_never_outlive_their_event with its page. wz now asserts the new team-scoped check_closed call.

Verification

  • cargo fmt --all --check, rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs
  • cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings
  • cargo test -p common -p worker -p gateway (all pass)
  • brand_spelling.py, domain_examples.py
  • New tests: change_wait::a_reopen_or_close_reaches_only_the_runs_of_that_change, github_webhook::change_wait_check_tests, run_wake::a_cleared_alert_closes_its_waiting_run_however_the_recovery_posts, and the two xx cases.

… at once

A run stopped because the change it built on closed now goes back to
waiting as soon as GitHub reports the change reopened, not at the
15-minute sweep. The pull request handler sends the team's change check
for a close or a reopen before any return a reopen reaches, naming the
change, and the worker reads the runs that change's close stopped (the
sweep stays the backstop for every team).

A recovery posted after an alert route's quiet window now closes the
run waiting on a person for that alert, through the same path a
recovery posted at once uses (common::run_wake::alert_cleared, which
the gateway's alert_delivery now calls too).

Incident case xx_waits_never_outlive_their_event.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 5, 2026

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes e30f52f (merged)

@coderhelm

coderhelm Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Auto-merge
Merged by hand. Nothing left to do.
Commit into main. Merges on its own once every item is done.

@nambok
nambok merged commit 6b8684b into main Dec 5, 2026
21 checks passed
@nambok
nambok deleted the waits-end-when-the-event-arrives branch December 5, 2026 21:09
coderhelm Bot pushed a commit that referenced this pull request Dec 5, 2026
* The org's pull requests in one answer: GET /api/prs/overview

Every pull request in the team's repositories counts, people's, CoderHelm's
and other bots'; CoderHelm's are one slice. Computed facts only, with
thresholds from the scope's own percentiles, no rate on fewer than 10
events, and what isn't stored yet named in `missing`. No per-person
ranking, count or duration; a login appears only as one item's owner.
The summary's numbers are all facts. GET /api/prs takes the overview's
drill-down (stage, past p85/p95). Incident case xz pins it.

* Overview: clippy's shapes, and words without hand-off phrases or loose numbers

The stability line says "over the last month" so every number in the summary
is a fact; the incident case reads the route's source without whitespace, so
formatting can't hide a read.

* A reopened change and a later alert recovery reach their waiting runs at once (#986)

A run stopped because the change it built on closed now goes back to
waiting as soon as GitHub reports the change reopened, not at the
15-minute sweep. The pull request handler sends the team's change check
for a close or a reopen before any return a reopen reaches, naming the
change, and the worker reads the runs that change's close stopped (the
sweep stays the backstop for every team).

A recovery posted after an alert route's quiet window now closes the
run waiting on a person for that alert, through the same path a
recovery posted at once uses (common::run_wake::alert_cleared, which
the gateway's alert_delivery now calls too).

Incident case xx_waits_never_outlive_their_event.
nambok added a commit that referenced this pull request Dec 6, 2026
… gates and the new pull requests view (#985)

* Every open pull request has a record and one state, read by the merge gates and the new pull requests view

A durable record per open pull request in the team's connected repositories,
written from the webhooks already received for every author and kept honest by
a bounded GraphQL sync under the shared GitHub budget (sweep:dashboard_prs).
One function (pr_needs::decide) decides each pull request's state, its turn and
what it needs next from whom; the run's watch stores its standing and the
reviewer's auto-merge gate merges only what it calls ready. GET /api/prs and
GET /api/prs/detail serve the dashboard's pull requests page under the "view"
capability. Incident case xw holds it.

* Format the pull requests route

* Keep each pull request's history, change log and nightly percentiles for the org overview

Every duration starts at ready for review, and human review leaves out
the author and every bot. Records keep their state and turn change log,
people's reviews and review requests, and check transitions. A merged or
closed pull request leaves a history row kept 400 days with its run and
session links and revert and follow-up links. A nightly job writes each
org's and repository's snapshot and percentiles, team-scoped and bounded.

* Every pull request, whoever wrote it: history backfill and health signals

A resumable 14-month backfill reads each organization's closed and merged
pull requests into history under the shared budget, pausing on a held
budget or rate limit and showing its progress per repository. Records
keep separate author, reviewer and bot clocks, drift against the base,
every check attempt (flaky reads as flaky), category and severity; history
adds review coverage, bypass merges, suspect follow-ups with their reason,
and CoderHelm's last run outcome and stop reason.

* The org's pull requests in one answer: GET /api/prs/overview (#988)

* The org's pull requests in one answer: GET /api/prs/overview

Every pull request in the team's repositories counts, people's, CoderHelm's
and other bots'; CoderHelm's are one slice. Computed facts only, with
thresholds from the scope's own percentiles, no rate on fewer than 10
events, and what isn't stored yet named in `missing`. No per-person
ranking, count or duration; a login appears only as one item's owner.
The summary's numbers are all facts. GET /api/prs takes the overview's
drill-down (stage, past p85/p95). Incident case xz pins it.

* Overview: clippy's shapes, and words without hand-off phrases or loose numbers

The stability line says "over the last month" so every number in the summary
is a fact; the incident case reads the route's source without whitespace, so
formatting can't hide a read.

* A reopened change and a later alert recovery reach their waiting runs at once (#986)

A run stopped because the change it built on closed now goes back to
waiting as soon as GitHub reports the change reopened, not at the
15-minute sweep. The pull request handler sends the team's change check
for a close or a reopen before any return a reopen reaches, naming the
change, and the worker reads the runs that change's close stopped (the
sweep stays the backstop for every team).

A recovery posted after an alert route's quiet window now closes the
run waiting on a person for that alert, through the same path a
recovery posted at once uses (common::run_wake::alert_cleared, which
the gateway's alert_delivery now calls too).

Incident case xx_waits_never_outlive_their_event.

* Answer the review: the gate never waits on what GitHub does not require, the sync never undoes events, history is never thinned

The repository's approval rule is GitHub's own review decision and the
team's rule is a person's approval; a review no rule requires is named,
never a hold. The sync never reopens a closed record, yields to events
newer than its read, replaces the reviews and requests it lists, and marks
lists cut by their page size. History rows merge by source, so the
backfill never thins a row written from events. The review decision is
worked out at review events and used for bypass only when fresh. Stacks
join within one repository, and the detail decides with the list's own
linked records.

* The sync writes each field only when its search was read after the last event that wrote it

A page read before an event could undo that event's queue entry, auto-merge
or review decision. Every field both events and the sync write (state,
title, draft, head, base, labels, review requests, reviews, review decision,
checks, mergeability, auto-merge, the merge queue, size) now keeps the time
an event last wrote it, and the sync writes that field only when its read
is newer. Tests cover a queue, an auto-merge and a review decision event
landing after the read and surviving the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant