The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(release): rerun failed stable runs on the failure event, drop the cron
ethernet845b61f2b87a
diff --git a/.github/workflows/stable-release-publication.yml b/.github/workflows/stable-release-publication.ymlindex 5425975575a..10a8293947e 100644--- a/.github/workflows/stable-release-publication.yml+++ b/.github/workflows/stable-release-publication.yml@@ -8,14 +8,15 @@ on:required: falsetype: stringdefault: ''+ # The success path publishes from Stable Release's own final job; only a+ # failed run needs this pass, which reruns its failed jobs immediately.workflow_run:workflows: ['Stable Release']types: [completed]- schedule:- # Failed attempts become retry-eligible after 15 minutes. Quarter-hour- # reconciliation applies the retry without occupying a runner for the backoff.- - cron: '*/15 * * * *'+# Shared with Stable Release so publication never races a build. The requested+# rerun waits as pending behind this job instead of deadlocking it: the+# sequencer only confirms the new attempt is queued, never that it finished.concurrency:group: stable-releasecancel-in-progress: falsediff --git a/scripts/releases/sequencer.py b/scripts/releases/sequencer.pyindex 671c76ae3c7..cad2bdc0c08 100644--- a/scripts/releases/sequencer.py+++ b/scripts/releases/sequencer.py@@ -24,7 +24,6 @@ from scripts.releases.versioning import (SHA256 = re.compile(r"[a-f0-9]{64}")DOCKER_DIGEST = re.compile(r"sha256:[a-f0-9]{64}")MAX_ATTEMPTS = 3-RETRY_BACKOFF = timedelta(minutes=15)CLAIM_GRACE = timedelta(hours=1)@@ -112,13 +111,6 @@ def _workflow_runs(repository: str, run=output) -> list[dict]:return rows-def _utc(value: str) -> datetime:- parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))- if parsed.tzinfo is None:- raise ValueError("Workflow timestamp must include a timezone")- return parsed.astimezone(timezone.utc)--def classify_runs(runs: list[dict], *, claimed_at: datetime | None = None,now: datetime | None = None, has_draft: bool = False) -> tuple[str, dict | None]:"""Keep failed claims live until two failed-job retries are exhausted.@@ -147,24 +139,20 @@ def classify_runs(runs: list[dict], *, claimed_at: datetime | None = None,return "green", Noneif attempt >= MAX_ATTEMPTS:return "burned", None- updated_at = latest.get("updated_at")- if not isinstance(updated_at, str):- raise ValueError("Failed stable workflow has no completion time")- return "running", {- "run_id": latest["id"],- "attempt": attempt,- "due_at": _utc(updated_at) + RETRY_BACKOFF,- }---def retry_due(records: list[dict], *, now: datetime | None = None) -> list[dict]:- """Return the oldest unresolved retry once its backoff has elapsed."""- now = now or datetime.now(timezone.utc)+ return "running", {"run_id": latest["id"], "attempt": attempt}+++def retry_due(records: list[dict]) -> list[dict]:+ """Return the oldest unresolved claim's retry, if it is waiting on one.++ No backoff: the failure event's own reconcile pass reruns the failed jobs,+ because nothing else wakes the reconciler to apply a delayed retry.+ """for record in records:if record.get("state") != "running":continueretry = record.get("retry")- if retry is None or retry["due_at"] > now:+ if retry is None:return []return [{"version": record["version"], "run_id": retry["run_id"],diff --git a/tests/ci/test_stable_release_graph.py b/tests/ci/test_stable_release_graph.pyindex 37dd0a967b3..67415702659 100644--- a/tests/ci/test_stable_release_graph.py+++ b/tests/ci/test_stable_release_graph.py@@ -209,7 +209,7 @@ def test_publication_reconciler_has_every_recovery_trigger_and_shared_lock():assert stable["concurrency"] == publication["concurrency"] == {"group": "stable-release", "cancel-in-progress": "false",}- assert {"workflow_dispatch", "workflow_run", "schedule"} <= set(publication["on"])+ assert {"workflow_dispatch", "workflow_run"} <= set(publication["on"])assert publication["on"]["workflow_run"] == {"workflows": ["Stable Release"], "types": ["completed"],}@@ -220,7 +220,6 @@ def test_publication_reconciler_has_every_recovery_trigger_and_shared_lock():checkout = reconcile["steps"][0]assert checkout["with"]["ref"] == "${{ github.event.repository.default_branch }}"assert checkout["with"]["persist-credentials"] == "false"- assert publication["on"]["schedule"] == [{"cron": "*/15 * * * *"}]assert not any(step.get("run", "").startswith("sleep ") for step in reconcile["steps"])diff --git a/tests/scripts/test_release_sequencer.py b/tests/scripts/test_release_sequencer.pyindex a9f97871c29..d043195f9e0 100644--- a/tests/scripts/test_release_sequencer.py+++ b/tests/scripts/test_release_sequencer.py@@ -82,20 +82,14 @@ def test_unstarted_claim_waits_for_its_grace_period_before_burning():)-def test_failed_run_retries_twice_after_backoff_before_burning():- from datetime import datetime, timezone-+def test_failed_run_retries_twice_before_burning():from scripts.releases.sequencer import classify_runs, retry_due- now = datetime(2026, 9, 22, 1, 30, tzinfo=timezone.utc)- failed = {- "id": 42, "status": "completed", "conclusion": "failure",- "run_attempt": 1, "updated_at": "2026-09-22T01:14:59Z",- }+ failed = {"id": 42, "status": "completed", "conclusion": "failure", "run_attempt": 1}state, retry = classify_runs([failed])assert state == "running"assert retry is not None- assert retry_due([{"version": "0.21.5", "state": state, "retry": retry}], now=now) == [{+ assert retry_due([{"version": "0.21.5", "state": state, "retry": retry}]) == [{"version": "0.21.5", "run_id": 42, "attempt": 2,}]newer = dict(retry)@@ -103,14 +97,50 @@ def test_failed_run_retries_twice_after_backoff_before_burning():assert retry_due([{"version": "0.21.5", "state": state, "retry": retry},{"version": "0.21.6", "state": state, "retry": newer},- ], now=now) == [{"version": "0.21.5", "run_id": 42, "attempt": 2}]+ ]) == [{"version": "0.21.5", "run_id": 42, "attempt": 2}]failed["run_attempt"] = 2state, retry = classify_runs([failed])- assert retry_due([{"version": "0.21.5", "state": state, "retry": retry}], now=now)[0]["attempt"] == 3+ assert retry_due([{"version": "0.21.5", "state": state, "retry": retry}])[0]["attempt"] == 3failed["run_attempt"] = 3assert classify_runs([failed]) == ("burned", None)[email protected](("attempt", "reruns"), [(1, True), (3, False)])+def test_the_pass_that_observes_a_failure_reruns_it_unless_burned(attempt, reruns):+ """No cron re-wakes the reconciler, so the failure event's own pass must rerun."""+ from datetime import datetime, timezone++ from scripts.releases.sequencer import reconcile++ commit = "a" * 40+ tags = {"rc.1-v0.21.5": ("1" * 40, commit, _claim_message("0.21.5", 1, commit))}+ failed = {+ "id": 42, "status": "completed", "conclusion": "failure", "run_attempt": attempt,+ # Completed this instant: the pass observing the failure event.+ "updated_at": datetime.now(timezone.utc).isoformat(),+ "head_branch": "rc.1-v0.21.5", "head_sha": commit,+ }+ discover_run = _discover_run(tags, workflow_runs=[failed])+ posted = []++ def run(argv):+ if argv[:4] == ["gh", "api", "--method", "POST"]:+ posted.append(argv[-1])+ return ""+ if argv == ["gh", "api", "repos/example/project/actions/runs/42"]:+ return json.dumps({"id": 42, "run_attempt": attempt + 1, "status": "queued"})+ return discover_run(argv)++ steps = reconcile({"GITHUB_REPOSITORY": "example/project"}, run=run,+ read_head=lambda: None, advance_head=lambda record: None)+ if reruns:+ assert posted == ["repos/example/project/actions/runs/42/rerun-failed-jobs"]+ assert steps == [{"retry": "0.21.5", "attempt": 2}]+ else:+ assert posted == []+ assert steps == []++def test_a_succeeded_run_is_green_only_with_its_draft():from scripts.releases.sequencer import classify_final_release, classify_runsdiff --git a/website/docs/developer-guide/stable-releases.md b/website/docs/developer-guide/stable-releases.mdindex fb506309107..ff68f6f45b3 100644--- a/website/docs/developer-guide/stable-releases.md+++ b/website/docs/developer-guide/stable-releases.md@@ -110,14 +110,15 @@ original claim ref, object SHA, commit, draft database ID, and autopublish polic## Failure and recovery-A failed stable run becomes retry-eligible after 15 minutes, then reruns only-failed jobs in the same GitHub Actions run. The quarter-hour reconciler applies-only the oldest unresolved eligible retry, because GitHub keeps only one pending-run in the shared stable-release concurrency group. It does not occupy a runner-during the backoff. At most two retries are admitted (run attempts 2 and 3).-After attempt 3 fails, the claim is burned and the sequencer may resolve later-claims. The same controller recovers a lost retry request or a crash between any-publication mutations.+When a stable run fails, its completion event starts `Stable Release+Publication`, which at once reruns only the failed jobs in the same GitHub+Actions run. There is no backoff and no schedule. The pass applies only the+oldest unresolved retry, because GitHub keeps only one pending run in the shared+stable-release concurrency group. The rerun waits in that group until the pass+ends. At most two retries are admitted (run attempts 2 and 3). After attempt 3+fails, the claim is burned and the sequencer may resolve later claims. A lost+retry request, or a crash between publication mutations, is recovered by the+next failure event or by dispatching `Stable Release Publication` by hand.A newly pushed claim with no observed workflow run remains unresolved for onehour. This grace window covers the non-atomic draft and dispatch steps. After the