Repository navigation
fix(temporal): fingerprint CI maintenance inputs without main's whole tree - #5450
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. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@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. More of your lovely PRs please. 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". |
… tree Why Since 2026-11-28T03:45Z every ci-maintenance-coordinator tick has failed in inspectCiMaintenance with "GitHub source tree was truncated". Main now has about 54.9k tree entries, and GitHub truncates a recursive getTree of the whole commit (54,113 entries returned for 33b799c). So no golden workspace, ci-images or workspace-seed refresh can be selected. What - New sourceTreeEntries reads only the entries at and under the fingerprint inputs. It lists each distinct ancestor directory once, non-recursively and level by level from the commit's root, then fetches each directory input's subtree recursively. Paths are rebuilt to the repo-relative form the whole-tree call returned, with the same mode, type and sha. - A truncated listing or subtree fails with its path. An input that does not exist is absent, as it was from the whole tree, so the fingerprint still throws "Missing <label> <path>". - maintenanceCandidates reads the union of the image and golden inputs. That is five getTree calls per tick: the root, ci, ci/ci-image and ci/ci-playwright listings, and the recursive patches subtree. It never asks for the whole recursive tree. Workflow code is unchanged. Verification - A new ci-maintenance-source-tree.test.ts runs a real Octokit against a fake GitHub trees API. Both the old whole-tree path and maintenanceCandidates produce identical ci-images and workspace-golden fingerprints. The test asserts the exact five requests, and that the subtree entries deep-equal the whole tree filtered to the inputs. It also covers a truncated whole tree (old code: "GitHub source tree was truncated"; new code: same fingerprints), a truncated patches subtree failing with its path, and a missing input failing exactly as before. - Live, read-only, against main 33b799c: fingerprints from the full `git ls-tree -r -t` (54,889 entries) equal the subtree reads from GitHub for both kinds, in 5 requests. - bunx turbo run build typecheck test lint --filter=@shepherdjerred/temporal: build, typecheck and lint pass. test passes for every maintenance file; its 28 failures are all CI-excluded *.integration.test.ts suites or git-backup 5 s timeouts under host load (git-backup passes alone). - bunx turbo run jscpd quality-ratchet knip --filter=// passes, and so does the full lefthook pre-commit (jscpd, package-quality typecheck and lint) on this base. - bun run verify:extended -- --filter='...[origin/main...HEAD]' passed 37/37 tasks on the identical diff over b8dc318. - Not run: no production tick after deploy yet. The worker picks this up only after main publishes and Delivery deploys temporal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35db2ae to
279877f
Compare
…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>
…cted (#5489) 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>
Why
Since 2026-11-28T03:45Z every
ci-maintenance-coordinatortick has failed ininspectCiMaintenance.maintenanceCandidatesasked GitHub for main's whole recursive tree. Main now has about 54.9k entries, so GitHub truncates the response and the activity throwsGitHub source tree was truncated. Until this is fixed, no golden workspace, ci-images or workspace-seed refresh can be selected (FM-372).What
sourceTreeEntries(ci-maintenance-source-tree.ts) reads only the entries at and under the fingerprint inputs. It never asks for the whole recursive tree:path,mode,typeandshathe whole-tree call returned.getTreecalls per tick: the root,ci,ci/ci-imageandci/ci-playwrightlistings, plus the recursivepatchessubtree. They run in three sequential rounds, well inside the 2-minute activity timeout.GitHub source tree patches at <sha> was truncated. There is no fallback to a partial tree.Missing <label> <path>.maintenanceCandidatesreads the union ofIMAGE_INPUTSandGOLDEN_INPUTS. Fingerprint functions and workflow code are unchanged.Demo
Before. The production failure, read-only from
temporal workflow show --workflow-id ci-maintenance-coordinator:The new test file run against the old
ci-maintenance-client.tsreproduces it: 3 of 5 tests fail, includinginputs still fingerprint when GitHub truncates the whole recursive treewithError: GitHub source tree was truncated.After. The fingerprint-equality tests. A real Octokit runs against a fake GitHub trees API. The old whole-tree path and
maintenanceCandidatesuse the same content-addressed objects.Live, read-only, main
33b799c3. The old fingerprint comes from the full localgit ls-tree -r -t, which is what an untruncated recursive call would return. The new fingerprint comes fromsourceTreeEntriesagainst the real GitHub API:6998bcaf0197c3816998bcaf0197c381b2ae7787c839fcceb2ae7787c839fcceVerification
bunx vitest run src/activities/maintenance(temporal): 30 files, 319 tests pass, including the 5 newci-maintenance-source-tree.test.tstests.ci-maintenance-client.tsfails 3 of 5 new tests (the truncated whole tree throwsGitHub source tree was truncated), and dropping the path prefix fails 4 of 5.bunx turbo run build typecheck test lint --filter=@shepherdjerred/temporal:testpasses every maintenance file. Its 28 failures, in 11 files, are 10 CI-excluded*.integration.test.tssuites (Temporal test server and real-git, 60 to 90 s timeouts under host load) plusgit-backup.test.ts5 s timeouts.git-backup.test.tspasses when run alone, and none of these files import maintenance code (see AI-1133).bunx turbo run jscpd quality-ratchet knip --filter=//: passes, knip included. The feat(scout-for-lol): add the Live games list and the Live game lobby to the app #5419 knip failure did not reproduce on this base.bunx lefthook run pre-commiton683effaaaa, all hooks including jscpd, directory-file-counts and package-quality: passes.bun run verify:extended -- --filter='...[origin/main...HEAD]'passes on35db2ae566, the identical diff overb8dc31835cbefore the restack onto683effaaaa: 37/37 tasks in 44m53s. Temporal extended vitest has 45 files and 152 tests; the extended workflow tests have 89 files and 460 tests.temporal workflow showconfirms the failure above. The live fingerprint comparison against main33b799c3is in Demo.🤖 Generated with Claude Code