Repository navigation
Make payout-ledger-artifact reuse anchor-scoped so it survives production share rates - #102
Conversation
Production telemetry (2026-07-29) showed zero artifacts ever publish under ~35 accepted shares/s: the background build aborted at its pending-commit anchor clamp or its accepted_before != accepted_after fence, and the exact-count reuse fence rejected any artifact the moment one more share became durable. The #99 spool + serve daemon sat idle while every tip-refresh build kept paying ~3.5s ledger_snapshot + ~1.2s serialization_copy. An artifact's window is already exact at its own clean snapshot anchor: _job_snapshot_anchor_ms keeps the anchor strictly below every pending commit, so every covered share is durable and shares stamped above the anchor deterministically belong to the next window (the reproducibility contract documented at PayoutLedgerArtifact.snapshot_anchor_ms, which reused bundles declare as anchor_job_issued_at_ms). Operationalize that contract instead of fencing on global counts: - Background build: the pending-commit clamp is anchor SELECTION (build at the clamped floor) rather than an abort; the before/after count fence is gone. The only abort left is a floor so old the artifact would arm past the staleness bound (wedged writer), which keeps the re-arm backoff meaningful. accepted_share_count is recorded as diagnostics only. - _usable_payout_ledger_artifact: exact-count comparison replaced by a bounded anchor-staleness check (PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, default 10s) alongside the unchanged generation/difficulty checks and the untouched prior_balances sha256 fence. In-flight builds re-validate with ignore_anchor_age so queue delay past the bound cannot scrap a reuse that was fresh at selection into the full snapshot it was armed to avoid. - Synchronous seeding: the anchor-count bracket capture and mid-read count fences are gone; ready builds always seed their anchored window, with a single informational count read. - _install_payout_ledger_artifact orders snapshots by anchor (counts are unfenced reads now); a same-window rebuild at a fresher anchor keeps the armed generation but advances the staleness clock in place so quiet streams do not cycle identical rebuilds forever. Tests updated from count-fence to anchor semantics, plus new coverage: clamped-floor builds publish, pathological floors refuse before the window walk, reuse survives commits landing after the anchor, the staleness bound retires and re-arms, and a reused-anchor bundle produces byte-identical payout-preview output to a fresh build at the same anchor driven through the #50 issued-vs-verified preview guard (with a divergent-anchor negative proving the guard discriminates). Metric names are unchanged. Full unittest suite: failure set byte-identical to base 59a3d9d in this environment (20 pre-existing sandbox failures, zero regressions). cargo test -p qbit-prism: 182 passed. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9d6eebe4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c9d6eeb. Configure here.
Codex P1 + Bugbot (clamp-to-snapshot race): a share stamped right after _job_snapshot_anchor_ms returns can land in the same millisecond as the clamp instant, unprotected by the pending floor; an anchor equal to that instant would cover it on replay (the window predicate is anchor-inclusive) while the snapshot never contained it. Select anchors strictly below the clamp-time millisecond -- min(now - 1, floor - 1) -- so every stamp assigned after selection sits above the anchor on both sides of the replay. This also hardens the job-issue anchor freeze, which shared the same tie under the old count fences. Bugbot (in-place advance breaks reuse identity): the same-window anchor refresh swaps the armed instance, so the in-build re-validation now compares artifact identity fields (payout generation, artifact generation -- the re-key authority -- and window sha) instead of object identity; an in-flight build holding the pre-refresh instance completes its reuse instead of being scrapped into the full snapshot it was armed to avoid. Bugbot (retarget guard misses fresher anchors): the live-difficulty retention guard now applies whether the delayed pre-retarget build's anchor ties or leads; a wrong-difficulty install would fail every reuse probe on the difficulty check, which never re-arms. Tests: anchor selection strictly below the clamp instant (bare and floor-clamped); in-flight build survives a same-window anchor refresh; fresher-anchor pre-retarget install refused; vardiff clamp expectations updated for the strict-below-now bound. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fcb6fbe56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| not ignore_anchor_age | ||
| and now_ms() - int(artifact.snapshot_anchor_ms) | ||
| > self._payout_artifact_max_anchor_age_ms() |
There was a problem hiding this comment.
Enforce the anchor-age bound on cached bundles
When a ready bundle remains within PRISM_JOB_BUNDLE_CACHE_SECONDS—particularly when that TTL exceeds the anchor-age setting or the initial bundle took significant time to build—this check retires only the artifact. shared_job_bundle can subsequently serve the generation-zero bundle that originally seeded it, while a same-window re-anchor also preserves the artifact generation and leaves bundles carrying the old anchor cache-usable. Consequently, jobs can continue declaring a window older than PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, postponing newer shares beyond the configured bound; cached ready bundles need an anchor-age or current-artifact-anchor check as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1b50099. _job_bundle_entry_usable — the single re-validation choke point for cache probes, subscribed results, and both lookup paths — now rejects a ready bundle whose declared anchor_job_issued_at_ms has aged past PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, so neither a bundle TTL that outlives the bound nor a same-window re-anchor (which keeps the artifact generation) can keep serving an over-age window; collection bundles carry no payout window and are unaffected. With the default TTL equal to the default bound this is behavior-neutral. Covered by test_cached_ready_bundle_respects_anchor_age_bound.
Codex round-2 P2: the staleness bound retired only the armed artifact. A cached ready bundle could keep serving past the bound whenever the bundle cache TTL outlives it, and a same-window re-anchor keeps the artifact generation while older-anchored bundles sit cache-usable, so issued jobs could keep declaring a window anchor older than PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS. _job_bundle_entry_usable -- the single re-validation choke point for cache probes, subscribed results, and lookups -- now rejects a ready bundle whose declared anchor_job_issued_at_ms has aged past the bound; collection bundles carry no payout window and are unaffected. With the default TTL equal to the default bound this is behavior-neutral; it closes the operator-mismatch corner and makes the invariant total: no served job declares an anchor older than the configured limit. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcc2c3e41e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| not ignore_anchor_age | ||
| and now_ms() - int(artifact.snapshot_anchor_ms) | ||
| > self._payout_artifact_max_anchor_age_ms() |
There was a problem hiding this comment.
Handle backward clock steps before reusing anchored snapshots
When the host wall clock steps backward after an artifact is installed, this subtraction becomes negative and treats the artifact as fresh. Because new shares are also stamped with now_ms(), they can then receive accepted_at_ms <= snapshot_anchor_ms even though they were absent from the artifact; a later audit or landing-time rebuild at that anchor includes those shares and no longer reproduces the issued payout window. The removed accepted-share-count fence previously invalidated the artifact in this case, so reuse now needs an explicit clock-regression/durability fence rather than assuming time.time() never decreases.
Useful? React with 👍 / 👎.
… re-land) (#103) * Survive production build latency in payout-artifact reuse (2026-07-29 re-land) The 2026-07-29 deploy of #102 rolled back after ~15 minutes: at 100k+ share reward windows the window walk takes multiple seconds, and reuse freshness measured from the wall-clock snapshot anchor -- which is stamped BEFORE the walk -- declared every artifact born expired on arrival. Installs unconditionally reset the re-arm backoff, so the single preparation worker re-walked the reward window continuously while holding the prepare lock every synchronous ready build needs; generation churn superseded in-flight builds and the cached-bundle anchor gate declared rebuilt bundles dead once their template generation outlived the bound. Tip refreshes went 1-6s -> 27s mean, initial jobs parked silently to the 90s client timeout, and the artifact lifecycle logged nothing. Fixes, per the incident brief: - Reuse freshness is measured from install (prepared_monotonic), never from the anchor: PRISM_PAYOUT_ARTIFACT_REUSE_STALENESS_SECONDS (default 10s). The wall-clock anchor bound becomes a separate, deliberately loose audit ceiling (PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, now 300s) on how far a served window may trail the live ledger. - Born-expired installs (anchor past the ceiling after a slow walk) are discarded and pace the re-arm backoff like failed preparations -- _install_payout_ledger_artifact returns arming success, and only success resets the backoff -- with a warning log and metric. - Generation bumps no longer scrap valid work: the in-build re-validation checks only the payout generation and the published balances fence (the selected window stays audit-reproducible at its declared anchor), and cached ready bundles gate on artifact-generation currency or built_monotonic freshness instead of the wall-clock anchor, which is frozen per template generation and predates the walk. - The routine/initial admission park behind publication priority is bounded by PRISM_ROUTINE_ADMISSION_DEADLINE_SECONDS (default 15s): expiry raises JobBuildAdmissionDeadlineExceeded (a TemplateRefreshBlocked, so callers retry with normal pacing), logs, and counts under initial_job_prepared_work_total. - Artifact lifecycle observability: structured single-line JSON logs for build/install/refresh/discard/born-expired/re-arm with durations, ages, and window sizes, plus a new qbit_prism_payout_artifact_events_total counter family. Existing metric names unchanged. Tests close the gap that let this through -- nothing had modeled walk duration against the bound: a slow-walk build (clock advanced past the freshness budget mid-walk) must still arm, serve reuse, and reset backoff; a glacial walk past the ceiling must pace backoff without arming; a generation bump mid-build must not scrap the build; rebuilt bundles must serve under template generations older than the budget; the admission deadline must fail fast and visibly. Full unittest suite: failure set byte-identical to base fcc2c3e in this environment (20 pre-existing sandbox failures, zero regressions). cargo test -p qbit-prism: 182 passed. Co-Authored-By: Claude Fable 5 <[email protected]> * Stamp reuse freshness at every artifact install site PR #103 round-1 review (Cursor + Codex P1): prepared_monotonic was stamped at build completion, but the freshness budget must run from the moment the window becomes reusable. - Equal-anchor re-proves now credit freshness: a pending-commit floor pins the snapshot anchor, so a fence-failure rebuild re-proves the same window at the same anchor; without the credit the prep worker re-walked the reward window (resetting backoff each round as an already-current success) until the audit ceiling. - The atomic payout publication restamps the candidate artifact at its pointer-swap install: the delivery-gate drain between candidate build and publication can outlive the reuse budget, and a freshly published generation must never arm an already-stale artifact. - The ordinary install path restamps too, covering the sync-seeded artifact whose construction happens mid-bundle-build, before the audit builder runs. Co-Authored-By: Claude Fable 5 <[email protected]> * Admit equal-window restamps in probes; gate publication on anchor age Round-3 review fixes: Cursor: an equal-window freshness restamp (already_current/refreshed) replaces the armed artifact object while a reuse probe hashes balances outside the cache lock, so the probe failed closed on object identity and fell through to a synchronous reward-window walk without scheduling a re-arm -- routine under a pinned pending-commit floor, where the restamp is the intentional recovery path. The probe now re-reads the armed slot and admits the restamped copy as the same armed window (same generation, window sha, and balances object; freshness and anchor only move forward under a restamp) while any real re-key still fails closed. Codex P1: the atomic payout publication armed the candidate ledger artifact with no anchor-age admission, so a candidate whose declared anchor crossed the audit ceiling during construction plus the delivery-gate drain armed born-expired: every reuse probe rejected it on anchor age while accepted-preview durability suppressed the re-arm, forcing repeated synchronous walks. Publication now applies the same born-expired rule as _install_payout_ledger_artifact -- discard, count born_expired, log with during_publication -- and the existing post-publication probe schedules recovery. Both fixes carry regression tests that fail against the previous commit. Co-Authored-By: Claude Fable 5 <[email protected]> * Count publication-path installs in the artifact event family Codex round-3 P2: the atomic payout publication arms the candidate artifact through its own pointer swap, bypassing _install_payout_ledger_artifact, so successful publication installs never incremented the installed lifecycle counter or emitted the install log -- the critical publication path was invisible to the observability this change introduced. Thread the successful arm out of the locked section and record the installed event plus lifecycle log (tagged during_publication) after the coordinator locks release, the same shape as the born-expired publication path. The regression test fails against the previous commit. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
* Revert "Survive production build latency in payout-artifact reuse (2026-07-29 re-land) (#103)" This reverts commit cd32c13. The re-land brownouted mainnet on 2026-07-30 (generation-churn brownout); the payout-artifact reuse line is abandoned and 1.x.x returns to the #101 (e2fb33d) behavior. Co-Authored-By: Claude Fable 5 <[email protected]> * Revert "Make payout-ledger-artifact reuse anchor-scoped so it survives production share rates (#102)" This reverts commit fcc2c3e. Anchor-scoped reuse livelocked mainnet payouts on 2026-07-29 (born-expired artifact livelock); together with the #103 revert this restores the payout-artifact machinery to its #101 (e2fb33d) state: exact-count fence semantics, no staleness/rearm/anchor-age knobs, no admission-deadline machinery. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
…witch (#107) * Revert "Revert the anchor-scoped payout-artifact reuse line (#103, #102) (#104)" This reverts commit 1c474c5. * Make payout-artifact reuse event-driven below the audit ceiling The 2026-07-29 rollback and the 2026-07-30 brownout were the same arithmetic error at different anchors: a wall-clock validity budget shorter than the production interval between consecutive shared builds, on an object whose rebuild pays a multi-second reward-window walk. Round 1 measured the budget from the pre-walk anchor, so every artifact arrived born expired; round 2 moved it to install time, so the budget expired between consecutive builds and every build fell back to the synchronous walk while the re-arm worker walked the same window in parallel. Wall-clock time is no longer a validity input below the audit ceiling: - The reuse probe serves any armed artifact whose payout generation, difficulty, and balances fences hold and whose declared anchor is inside PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS. Past the new PRISM_PAYOUT_ARTIFACT_REANCHOR_SECONDS floor it schedules the debounced background re-anchor and KEEPS SERVING; post-anchor shares settle in the next window by construction, so a re-anchor is freshness maintenance, not correctness. - PRISM_PAYOUT_ARTIFACT_REUSE_STALENESS_SECONDS is removed. Cached no-artifact ready bundles gate on the re-anchor floor instead (their declared anchor is already ceiling-gated, and the bundle-cache TTL bounds them tighter in production). - PRISM_PAYOUT_ARTIFACT_REUSE (default on) is a master kill-switch: off restores the pre-reuse deployment exactly -- probe refuses, no background walks -- so a production regression is an env flip instead of an emergency rollback (both prior incidents required redeploys). Test changes mirror the semantics: install-age rejection tests become serve-past-install-age brownout regressions, rearm/debounce and landed-preview suppression drive aging through the anchor, in-flight retention ages through the ceiling, and the kill-switch has dedicated coverage. Co-Authored-By: Claude Fable 5 <[email protected]> * Add reuse probe outcomes, semantic work-currency gauge, slow-wave log Three observability gaps the incident review had to work around: - The reuse probe was invisible: nothing distinguished served reuse from ceiling rejections. served_reuse / probe_rejected_ceiling join the payout-artifact event family (recorded outside the cache lock, matching the family's lock ordering). - current_tip_job_coverage demands template-generation equality and template object identity, so under generation churn it reads 0.0 essentially continuously even while every miner holds semantically current work. The new semantic_current_work_ratio gauge compares template fingerprint and payout generation only. The strict gauge is untouched -- it drives mining-health gating and stays fail-closed. - Slow waves logged nothing attributable: latency had to be reconstructed by pairing tip-observation lines with "refreshed N client job(s)" lines, which cannot see superseded passes. Waves over 1s now log outcome, refreshed count, pass count, and elapsed time in one line. Co-Authored-By: Claude Fable 5 <[email protected]> * Flush worker-thread build phases into the exported counters The job-build executor and payout-artifact preparation workers never pass through the per-client delivery entry points that clear and flush the thread-local phase dict, so every wave-level phase they accrued -- template, ledger, assembly, bundle, payout_artifact -- exported as exactly 0.0 forever despite continuous template fetches and multi-second window walks. The bundle-build cost had to be discovered from the separate tip_refresh_bundle_phase histograms and ad-hoc profiling because this family was blind. _flush_job_build_phases folds phase seconds only (build counts and the duration histogram stay per-delivery) and clears the dict so a long-lived worker cannot double-report an earlier request's accruals. Wired at the two worker boundaries: _execute_job_build_request and each _payout_artifact_preparation_loop iteration. Co-Authored-By: Claude Fable 5 <[email protected]> * Harden the reuse re-land per adversarial review Review verdicts: the revert purity, round-2 diagnosis, serve-window correctness, test archaeology, and zero-regression claims survived; the kill-switch equivalence claim was refuted as written, and the review surfaced one genuinely dangerous miss plus four smaller ones. This commit addresses all of them: - Startup validation (the dangerous miss): a ceiling at or below what the background re-anchor can beat re-creates the 2026-07-30 walk-per-build shape with a single env var. __init__ now refuses MAX_ANCHOR_AGE <= 2x REANCHOR via validate_payout_artifact_age_bounds, with direct test coverage. - Kill-switch now gates ARMING too: _install_payout_ledger_artifact, the payout-publication pointer swap, and sync-build window seeding all no-op while disabled. Previously artifacts kept arming with the switch off, churning install events and re-keying the idle-bundle fast path to a generation the probe refuses -- a permanent idle cache miss in the disabled state. Comments and the PR description no longer claim the disabled state matches the pre-reuse deployment "exactly": it restores pre-reuse delivery economics while the synchronous path keeps the re-landed anchor-selection semantics. - prior_balances_sha256 is memoized on the artifact at construction and re-derived at the accepted-preview balance patch; the reuse probe and both reused-build fences stop paying O(accounts) JSON canonicalization per serving decision. The restamp-race test now drives the un-memoized fallback path it was written to protect. - The idle issuance path enforces the anchor ceiling like every other NEW serving decision (it was the one route that could issue a window past the ceiling), and the probe docstring states the in-flight-retention exception instead of overselling the ceiling. - probe_past_floor joins the event family so the canary can distinguish serving-past-floor from never-crossing-the-floor; rearm_scheduled alone under-counts through debounce/suppression. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>

Problem
#99 shipped the payout-ledger-artifact re-arm + spool + serve daemon, but production telemetry (2026-07-29) shows zero artifacts ever publish. At ~35 accepted shares/s no multi-second window is ever share-free, so:
accepted_before != accepted_afterfence;_usable_payout_ledger_artifactrejects any artifact the moment one more share becomes durable;serve_builderrequests=1, cache hits=0, fallbacks=0) and every tip-refresh build still pays ~3.5sledger_snapshot+ ~1.2sserialization_copy.Change
Artifact validity switches from exact-count to anchor-scoped semantics, operationalizing the reproducibility contract documented at
PayoutLedgerArtifact.snapshot_anchor_ms:_job_snapshot_anchor_mskeeps the anchor strictly below every pending commit, so every share at or below the anchor is already durable, the window read at that anchor is exact and replayable from the durable ledger, and shares stamped after the anchor deterministically belong to the next window — they are never lost. Reused bundles already declare the artifact's own anchor asanchor_job_issued_at_ms._build_payout_ledger_artifact): the clamp is now anchor selection (build at the pending-commit floor) instead of an abort, and the before/after count fence is removed. The only remaining abort is a floor so old the artifact would arm already past the staleness bound (wedged writer), which keeps the re-arm backoff meaningful.accepted_share_countis recorded as diagnostics only._usable_payout_ledger_artifact: exact-count comparison replaced by bounded anchor staleness (PRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, default 10s) plus the existing generation/difficulty checks. Theprior_balancessha256 fence is untouched. In-flight builds re-validate withignore_anchor_age=True: supersession and the balances fence still apply, but aging out mid-queue must not scrap a reuse that was fresh at selection into the full snapshot it was armed to avoid._job_build_anchor_counts) and mid-read count fences are gone; ready builds always seed their anchored window with a single informational count read._install_payout_ledger_artifactorders snapshots by anchor (counts are unfenced reads now). A same-window rebuild at a fresher anchor keeps the armed generation (no lookup re-key) but advances the staleness clock in place — otherwise a quiet share stream would cycle identical rebuilds forever against a permanently stale artifact.The serve daemon needs no changes: its window cache is keyed purely on the share-snapshot sha256, so reuse engages it as soon as artifacts arm. All metric names are unchanged.
Tests
Count-fence tests updated to anchor semantics (clamped-floor builds publish; mid-read commits and post-anchor durable shares no longer block publication; install ordering by anchor; age-based fence-failure re-arm/debounce/backoff; landed-preview suppression). New coverage:
canonical_json_text) preview output to a fresh ledger read at the same anchor, driven through the issued-then-verified_publish_accepted_block_payout_previewequality sequence, plus a divergent-anchor negative proving the guard discriminates.All event-driven — anchors are manufactured timestamps, no sleeps.
Validation
cargo test -p qbit-prism: 182 passed.Expected mainnet outcome (verifiable within minutes of deploy)
serve_builderrequests/hits climbing with generations,window_uploads~1 per payout generation,ledger_snapshotcalls/refresh falling toward ~0 between payout events,serialization_copymean collapsing to the daemon's per-request deser cost, first-delivery p50 dropping toward ~1–2s.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
High Risk
Changes payout window anchoring, artifact reuse fences, and job bundle audit anchors—areas that affect reward-window reproducibility and payout preview correctness; extensive test coverage mitigates but production share rates were the original failure mode.
Overview
Payout ledger artifact reuse no longer depends on exact accepted-share counts, which blocked artifact publication at high share rates. Validity is anchor-scoped: the snapshot at a clamped
snapshot_anchor_msis exact for shares at or below that anchor; shares stamped after belong to the next window and do not invalidate reuse.Coordinator changes:
_build_payout_ledger_artifactbuilds at the pending-commit floor instead of aborting on clamp (only aborts when the floor is older thanPRISM_PAYOUT_ARTIFACT_MAX_ANCHOR_AGE_SECONDS, default 10s)._usable_payout_ledger_artifactretires artifacts by anchor age instead of count; in-flight builds useignore_anchor_age=True._job_build_anchor_countsand count bracket fences on sync builds are removed._install_payout_ledger_artifactorders by anchor and refreshes the staleness clock on same-window re-anchors without re-keying._job_snapshot_anchor_msalways returns strictly below the clamp instant (and pending floors) so same-millisecond stamps cannot tie the anchor. Cached ready bundles also honor the anchor-age bound.Tests are updated and expanded for anchor semantics, staleness env tuning, in-flight reuse, and payout-preview guard byte equality for reused vs fresh builds at the same anchor.
Reviewed by Cursor Bugbot for commit 1b50099. Bugbot is set up for automated code reviews on this repo. Configure here.