Repository navigation
fix(temporal): page for a CI maintenance coordinator that never inspected - #5489
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review Automated re-review request for |
Action performed
|
|
@coderabbitai review Automated re-review request for |
Action not completed
|
|
@codex review Automated re-review request for |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…cted
Why
CiMaintenanceCoordinatorStalled skipped any memo without `inspectedAt`, and
only a successful inspection writes that field. Production's
ci-maintenance-coordinator has failed every inspectCiMaintenance since
2026-11-28T03:45Z ("GitHub source tree was truncated", fixed separately in
#5450). It has never completed one on the code that dates inspections, so
its memo has no `inspectedAt` and the alert could never fire. Health
publishing itself runs: Alertmanager shows only CiMaintenanceStreamBlocked.
What
- Behind the `ci-maintenance-inspection-tracking-v1` patch, the first tick
without the field records `inspectionTrackedSince` (workflow time) and
writes it to the memo before scheduling the inspection. An inspection that
fails, or never finishes because no poller or slot takes it, still leaves
the field durable. Continue-as-new keeps it.
- CiMaintenanceCoordinatorStalled now judges a memo without `inspectedAt`
from `inspectionTrackedSince`, with the same 30-minute bound and confirming
read. Once an inspection succeeds, `inspectedAt` takes over. Only a memo
with neither field, written before tracking, stays exempt.
- The health memo schema reads the new field, and the README documents it.
- A frozen fixture of the deployed coordinator, with its shared state logic
copied verbatim, records histories that the new code replays in three
upgrade tests. They cover both marker orders and a first tracked tick
whose inspection never finishes. The jscpd baseline records the fixture's
deliberate duplication.
The field could not be written from an activity. When an inspection fails or
hangs, only workflow code can still write the memo. The memo is workflow
state, and the health activity only reads it, so it keeps paging while the
coordinator is wedged. Core does not compare memo payloads on replay, so an
ungated write would also replay cleanly. But replaying an existing run would
then backdate the field to that run's first recorded tick, and the replayed
state would differ from the recorded memo. The patch starts tracking at a
point recorded in history and leaves pre-patch histories unchanged. The
early memo write adds commands only inside the patched branch.
Verification
- Live, read-only: describe and show of prod ci-maintenance-coordinator run
8ee56942. The memo has no inspectedAt. All 96 inspectCiMaintenance
attempts failed with "GitHub source tree was truncated", and the run has
no patch markers. Previous run 13aacb6e: all 100 attempts failed.
- vitest for the alert, health and shared state tests: 49 passed. With the
old exemption restored, the new never-inspected alert and health cases
fail.
- test:workflows src/workflows/ci: 6 files, 36 tests passed. bundle.test.ts
also passed. Histories recorded by the fixture and then by the new code
replay cleanly. Without the early memo write, the hung-inspection test
fails.
- typecheck and lint for @shepherdjerred/temporal, run directly in the
package: pass.
- bunx turbo run jscpd quality-ratchet knip --filter=//: pass.
- bunx turbo run test:extended --filter='...[origin/main...HEAD]'
--continue (temporal only) passed on the previous revision of this
change: integration 45 files and 152 tests, workflows 89 files and 462
tests. Since then only CI-maintenance workflow code and its tests changed,
and those were rerun above.
- Not run (freeze FM-385): Woodpecker CI, deployment, and the live alert
firing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3ca68be to
5c03df1
Compare
Why
CiMaintenanceCoordinatorStalled(from #5345) skipped any memo withoutinspectedAt, and only a successful inspection writes that field. Production'sci-maintenance-coordinatorhas failed everyinspectCiMaintenancesince 2026-11-28T03:45Z ("GitHub source tree was truncated"; #5450 fixes that). It has never completed an inspection on the code that dates inspections, so its memo has noinspectedAtand the alert could never fire. Health publishing itself still runs: Alertmanager shows onlyCiMaintenanceStreamBlocked(release-notes).What
workflows/ci/maintenance.ts): behind the newci-maintenance-inspection-tracking-v1patch, the first tick without the field recordsinspectionTrackedSince(workflow time). It writes the field to the memo before scheduling the inspection, so it is durable even when the inspection fails, or never finishes because no poller orrepo-automationslot takes it. Continue-as-new keeps it.shared/alerts/ci-maintenance-alert.ts): a memo withoutinspectedAtis now judged frominspectionTrackedSince, with the same 30-minute bound and the health activity's confirming read a minute later. Once an inspection succeeds,inspectedAttakes over. Only a memo with neither field, written before tracking, stays exempt. The summary and description say "has not completed an inspection since it began tracking them at ..." for this case.workflows/ci/fixtures/ci-maintenance-before-inspection-tracking.tsfreezes the deployed coordinator (bounded stalls and health, no tracking). Its shared state logic is copied verbatim, not imported, so later shared changes cannot alter what it records. Three upgrade tests record a history with it, swap in the new code and replay the whole history. They cover both marker orders and a first tracked tick whose inspection never finishes..jscpd-baseline.jsonrecords the fixture's deliberate duplication; every changed pair involves the fixture.Why a patch, not activity or shared code
When an inspection fails or hangs, only workflow code can still write the memo. The memo is workflow state, so no activity can write it. The health activity only reads the memo, which is what lets it page while the coordinator is wedged. Core does not compare memo or continue-as-new payloads on replay: a probe with the write ungated replayed cleanly. Ungated, though, replaying an existing run would backdate the field to that run's first recorded tick, and the replayed state would differ from the recorded memo. The patch starts tracking at a point recorded in history and leaves pre-patch histories unchanged. The early memo write adds commands only inside the patched branch. Its cost is one marker per run, plus one memo upsert when tracking starts.
Demo
Live mechanism (prod, read-only).
toolkit temporal --namespace prod workflow describe --workflow-id ci-maintenance-coordinator, run8ee56942, build986a0d6b(contains #5345):{"blocked":{"release-notes":{"reason":"Pipeline 14708 ended failure; inspect before retrying","requestId":"68644c4f-93d1-4fb1-96cd-60fd7205b988"}},"completed":{...},"goldenSnapshot":null,"lastKind":"workspace-golden","observation":"Maintenance inspection failed; no new submission","pending":null}There is no
inspectedAt. History shows 96/96inspectCiMaintenanceattempts failed withGitHub source tree was truncatedand no patch markers, because the bounded patch is only evaluated after a successful inspection. The previous run,13aacb6e, failed all 100 attempts.Before and after for that memo. The live memo was evaluated with main's alert builder and memo parser, then with this branch's. Assume this code's first tick lands at 20:10Z:
Patch markers recorded across an upgrade. Taken from the upgrade tests' histories:
ci-maintenance-inspection-tracking-v1,ci-maintenance-bounded-stalls-v1ci-maintenance-bounded-stalls-v1,ci-maintenance-inspection-tracking-v1ci-maintenance-inspection-tracking-v1; the memo already holdsinspectionTrackedSinceand the stalled alert fires at +31 minci-maintenance-inspection-tracking-v1,ci-maintenance-bounded-stalls-v1Verification
vitestforsrc/shared/alerts/ci-maintenance-alert.test.ts,src/activities/ops/ci-maintenance, andsrc/shared/ci-maintenance.test.ts: 49 passed. The new cases are:With the old exemption restored, the new firing cases fail.
bun run --cwd packages/temporal test:workflows src/workflows/ci: 6 files, 36 tests passed.src/workflows/bundle.test.tsalso passed. Fixture-then-new-code histories replay cleanly throughWorker.runReplayHistory(maintenance-stalls.test.ts). Without the early memo write, the hung-inspection test fails.bun run --cwd packages/temporal typecheckandlint, run directly to bypass the turbo cache: pass.bunx turbo run jscpd quality-ratchet knip --filter=//: pass.Exact-head CI on the earlier head
3ca68befb8(pipeline 20661): 93 of 94 verify tasks passed. The only failure was knip's@base-ui/reactfinding inpackages/mail, inherited from main (feat(mail): shared console shell, banner, description list and email preview #5483) and fixed there by fix(mail): drop unused @base-ui/react dependency #5490.Final head
5c03df1304, restacked onto main79685e6ab8; main changed only.jscpd-baseline.jsonand the README among this PR's files, and the restack applied cleanly. Rerun on this head, all passing:src/workflows/ciplusbundle.test.ts(7 files, 37 tests).Extended tier on head
78e349b932(before the restacks, which brought in only main's commits):bun run verify:extended -- --filter='...[origin/main...HEAD]'(only@shepherdjerred/temporalis affected): pass. Integration: 45 files, 152 tests. Workflows: 89 files, 463 tests.Independent review of
427d58713dwas clean: no P0–P2 findings, determinism verified for both history shapes, alert timing (about 35 minutes) correct. Its three P3s are applied in this head:inspectionTrackedSinceis written to the memo before the inspect activity is scheduled, so a hung first tracked tick still pages. A new test covers that case.Not yet verified: artifact publication, ArgoCD and Delivery rollout, and live alert behavior. fix(temporal): fingerprint CI maintenance inputs without main's whole tree #5450 has deployed and the coordinator inspects successfully, so after this deploys its memo should gain
inspectionTrackedSince, keep advancinginspectedAt, andCiMaintenanceCoordinatorStalledshould stay quiet.🤖 Generated with Claude Code