Skip to content

feat(cd): freshness reads D2 skip reasons, quiet slots need live evidence (CHE-9956) [squash] - #177

Draft
congvc-bot-x99[bot] wants to merge 8 commits into
cheese/mainfrom
agent/x99-claude-haiku/che-9956-ab37bb21f135
Draft

congvc-bot-x99[bot] wants to merge 8 commits into
cheese/mainfrom
agent/x99-claude-haiku/che-9956-ab37bb21f135

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Summary

CHE-9956 (S2 of the hands-off deploy train, parent CHE-9850).

  • freshness() reads the D2 skip_reason. suspended and unreadable alarm at once and never dispatch. busy and armed send nothing while a D2 run is active, and exactly one dispatch after it ends if the slot is still undelivered.
  • Confirmed deployment delivers the slot (review round 2, P1a). When the candidate equals the deployed SHA, the watcher first reads the D2 evidence of the runs since the slot (confirmedSinceSlot): outcome confirmed, candidate_sha = the slot target (full SHA), confirmation time after the slot. That covers a normal scheduled deploy and a busy slot recovered by the one dispatch: idle, no live evidence needed, no current skip needed. Only a slot with no such confirmation is a quiet slot:
  • Quiet slot (option A): candidate equals deployed and no run since the slot confirmed it counts as delivered only with fresh, healthy live evidence bound to the slot: observed after the slot, full revision = slot target, ok, and it names the run and attempt that observed it, which must equal the live run it was downloaded from; and the slot's own D2 run skipped with current. Missing facts fail closed. Otherwise alarm at slot + 90 min (owner c00-hermes-devops if the X99 runner is down, else the CD lane). cd-live-revision uploads live-evidence.json (full revision, ok, observed_at, run id, run attempt).
  • busy and armed get their one dispatch after the blocking run ends at any age; past slot + 90 min the same tick also alarms (dispatch with alarm: true), so the alarm no longer swallows it.
  • FP-05, candidate bound to the slot (coordinator amendment). slotCandidate() picks the newest successful D1 push run created at or before the slot. The fact used is the D1 run's created_at (a push run is created by the push that put the commit on cheese/main). A candidate that only exists after the slot is idle with candidate <sha> merged after the slot; due at the next slot: no alarm, no dispatch. If D2 already deployed a later candidate (a dispatch), that later run is the candidate, so the older slot commit is not called undelivered; its delivery is checked like a quiet slot (fresh bound live evidence, else alarm at slot + 90 min), it does not bypass the alarm.
  • Alarms carry diagnosis {step, reason, owner}: D1 red -> PR author; C00 job queued > 10 min -> c00-hermes-devops (measured by c00QueuedMinutes() from the active D2 run's jobs, label cheese-c00-deploy); marker suspended -> Cheese.
  • Moved to S4: confirm inconclusive. D2's evidence has no inconclusive outcome (outcomeOf in deploy-evidence.mjs yields confirmed, failed, rolled_back, ...), so nothing can measure it. I removed the dead branch instead of shipping it.

Tests

Command: bunx vitest run tests/cdWatch.test.ts tests/cdWatchWorkflows.test.ts tests/cdWatchTrigger.test.ts

Green on the exact PR head 5623086562a2c1ce628b83feaf0b03b19cfc7734 (run locally on that checkout; bun run typecheck, eslint --max-warnings 0, oxlint --type-aware --deny-warnings and prettier --check exit 0; all 11 GitHub checks on this head are SUCCESS):

$ bunx vitest run tests/cdWatch.test.ts tests/cdWatchWorkflows.test.ts tests/cdWatchTrigger.test.ts
 Test Files  3 passed (3)
      Tests  138 passed (138)
$ bunx vitest run tests/cdWatch.test.ts -t "FP-02"
      Tests  7 passed | 105 skipped (112)
$ bunx vitest run tests/cdWatch.test.ts -t "FP-03"
      Tests  21 passed | 91 skipped (112)
$ bunx vitest run tests/cdWatch.test.ts -t "FP-05"
      Tests  7 passed | 105 skipped (112)
$ bunx vitest run tests/cdWatch.test.ts -t "P1a"
      Tests  7 passed | 105 skipped (112)

New in review round 2:

  • P1a, pure: a confirmed run delivers the slot at +100 with no live evidence; a busy run then a confirmed run does too; confirmations that do not count (another SHA, confirmed before the slot, no time, outcome failed or skipped, schema 2, no evidence) fall back to the quiet-slot alarm; a confirmed target does not hide a candidate that is still behind.
  • P1a, real freshness CLI (fake gh, fixed clock): scheduled deploy confirmed (run 50) is none at +100; busy run 50 then dispatch run 51 confirmed is none at +100; a run that skipped current with no live run still alarms.
  • FP-03 behaviour (P1b), real freshness CLI only, evidence artifact written by hand so nothing added later is needed: fresh bound evidence is none at +100; absent, stale (observed before the slot) and wrong-revision evidence each must alarm with exit 1: four tests, one CLI run each, explicit 30 s timeout since each run spawns the real watcher.

New in this round (review round 1, three P1s):

  • FP-02 busy/armed run through deploy-evidence.mjs output (the real Write the evidence step env), and a late case: ended at slot + 120 min dispatches once with the alarm; still active alarms without dispatch; already dispatched alarms without a second one; at +89 the dispatch has no alarm.
  • FP-03 through the real CLIs: cd-watch live writes LIVE_EVIDENCE_OUT, the file is served as the live-evidence artifact by a fake gh, and cd-watch freshness reads it (fixed clock and /healthz, fake gh on PATH). Positive control delivers at +100; evidence of another run, of another attempt, a slot whose D2 run skipped busy, and unhealthy evidence each alarm with exit 1. Unit cases cover missing run identity and every non-current skip.
  • FP-03 later deployed candidate: no evidence alarms at +100 (idle at +89), fresh bound evidence is idle, evidence of the older SHA does not deliver it, and a later candidate D2 has not deployed stays idle.

Red/green receipts

The PR-head test file run against the older scripts/, selector by selector.

On the previously reviewed head 5bb8c521, assertion level (each one is a finding):

  • FP-02 (1 failed): a busy or armed run that ends after slot+90 min still gets its one dispatch: expected 'alarm' to be 'dispatch'.
  • FP-03 (6 failed): run identity expected true to be false; slot skip expected true to be false; later deployed candidate expected [ 'none', false ] to deeply equal [ 'alarm', true ]; three real-CLI cases expected +0 to be 1 (the freshness CLI exited 0 on evidence of another run, another attempt and a busy slot).
  • FP-05 (1 failed): the later deployed candidate case, same assertion as above.

Review round 2, on the round-1 head 609c9154 with the new tests and the old scripts/: P1a 6 failed. The two real-CLI cases fail at the assertion, the freshness CLI answered cd-watch freshness: alarm: candidate aaaaaaa is already deployed, but the slot has no fresh live evidence: no live evidence since the slot; owner c00-hermes-devops for a confirmed deployment (the false alarm). The four pure cases fail with TypeError: confirmedSinceSlot is not a function.

On pinned head 19e83e20 (new test file, git worktree of the pin): FP-02 5 failed, 2 passed; FP-03 18 failed (the file as of that run; the 4-test split of the behaviour test has since raised FP-03 to 21 tests, and its 3 alarm cases were re-run on the pin: 3 failed, 1 control passed); FP-05 7 failed. The new FP-03 behaviour test reaches the watcher assertion there: its fresh-evidence control passes (none) and the first absent-evidence case fails with AssertionError: expected 'cd-watch freshness: none: candidate a…' to contain 'cd-watch freshness: alarm:'. The P1a CLI cases there fail with expected 'cd-watch freshness: none: candidate a…' to contain 'D2 run 50 confirmed' (and 51). Assertion level: FP-02 suspended/unreadable expected 'dispatch' to be 'alarm'; busy and armed expected 'dispatch' to be 'none'; late busy expected 'alarm' to be 'dispatch'; FP-05 expected 'alarm' to be 'none', expected 'alarm' to be 'dispatch' and expected 'dispatch' to be 'none'. The rest fail with TypeError: quietSlotProof / liveEvidence / diagnose / slotCandidate is not a function (those functions do not exist there) or, for the real-CLI cases, ENOENT because the pinned CLI writes no live evidence file.

FP-03 includes the two-slot no-new-merge case (evidence after slot 2 delivers it; evidence only before slot 2 alarms at + 90 min).

Known limits

  • A busy slot recovered by a dispatch of the slot target is delivered by the confirmation (P1a, fixed). A later candidate (a newer SHA than the slot's) deployed after a busy skip, with no confirmation of the slot's own SHA, is still a quiet-slot case: it needs bound live proof or alarms at slot + 90 min.
  • Confirm inconclusive stays in S4.

Not done here

  • Cross-lab review round 3 (OpenAI-lab signer, RGS-1) and the merge receipt come after this push.

Changelog

Changelog: none

congvc-bot[bot] added 8 commits November 27, 2026 16:10
…lict

Keep the S2 skip-reason, candidate-slot and diagnosis logic; carry main's
alarm field and CHE-10498 backup dispatch into freshness().
…receipt (CHE-9956)

A deployed candidate was always treated as a quiet slot, so a normal slot that deployed
and confirmed, and a busy slot recovered by the one dispatch, false-alarmed at +90 min.
The watcher now reads the D2 evidence since the slot: a run that confirmed the target
after the slot delivers it. Only a slot with no such confirmation needs the current skip
and bound live proof. Adds a behavioural FP-03 test that reaches the alarm assertion on
the pinned 19e83e2 head.

This branch has not been deployed

No deployments
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.

0 participants