Skip to content

📊 telemetry: restore round-level gauges on journal recovery (schema v3) - #200

Merged
george-connito merged 1 commit into
masterfrom
feat/restore-round-telemetry-on-recovery
Jul 31, 2026
Merged

📊 telemetry: restore round-level gauges on journal recovery (schema v3)#200
george-connito merged 1 commit into
masterfrom
feat/restore-round-telemetry-on-recovery

Conversation

@george-connito

Copy link
Copy Markdown
Collaborator

The per-miner families re-emit via finalize_round_scores (which recovery replays), but validator_round_miners_{scored,pending,failed}, lifecycle_step and current_round_id are written only by the live eval workers — so after every restart the dashboard's "Evaluated N of M" column blanks for a full cycle (~1h45m) until the next Submission freeze.

Journal schema v3 adds two ints: roster_size (= len(foreground_uids) + len(background_uids), the one input Round.stats() needs that wasn't persisted) and lifecycle_step (the last live step the round reached). from_json still accepts v1/v2 (missing fields default to 0). Round now carries lifecycle_step, set alongside the gauge at the three run.py sites; the finalize journal-rewrite preserves both via the recovery stub.

On startup recovery, for each replayed journal we now also set validator_round_miners_scored/failed/pending{round_id} (pending = roster_size - scored - failed, clamped ≥0), lifecycle_step, and current_round_id (journals scan ascending, so it lands on the most recent recovered round), registering each round_id for normal eviction. Pre-v3 journals have roster_size=0 so pending clamps to 0 rather than inventing a denominator — graceful for the first restart after deploy.

Not covered (documented for the backend): validator_miner_val_loss is set at eval time and not journaled; it repopulates when miners are next evaluated. Per-miner cohort_group/assignment_role gauges likewise remain a live-only signal — M is still recoverable from the round_miners_* counters (scored+pending+failed) without them.

Tests: journal v3 round-trip, v2 back-com
pat (roster_size=0), recovery
stub carries the fields, finalize rewrite preserves them. Full telemetry

  • journal suite (26) green in the stable image.

…chema v3)

Startup recovery restored telemetry at most ONCE, and `val_loss` had no
recovery path at all. Two Watchtower restarts 25 minutes apart on
2026-07-31 left every per-miner family at zero series for 17 minutes and
lost cycle 16684's losses permanently.

Three coupled gaps, one schema bump:

1. `val_loss` is journaled (v3 `uid_to_val_loss`). It is published at eval
   time and is NOT derivable from `scores`: `delta = max(0.0, baseline -
   val_loss)` clamps at zero, so every miner scoring 0 — the majority in
   many rounds — would be underivable. Plumbed through `MinerEvalJob.val_loss`
   → `Round.mark_scored(..., val_loss=)` → `Round.val_losses` → journal;
   both eval paths (foreground + background) pass it.

2. Recovery now re-emits telemetry on EVERY restart, not just the first.
   The replay loop only touches unfinalized journals, and replaying one
   marks it finalized — so the second restart found nothing and emitted
   nothing. New `republish_telemetry_from_journal` reads the newest
   finalized journal and sets the gauges directly.

   It is deliberately METRICS-ONLY. Re-running `finalize_round_scores`
   would keep the aggregator's point set correct (`drop_round` runs first)
   but re-stamp those points with fresh `_utc_now()` timestamps, shoving
   them to the end of the time-ordered series — and the rolling average is
   "last N by timestamp", which is what drives weight submission. A
   re-finalize would therefore silently reshuffle the scoring window. A
   test asserts the pass makes zero mutating aggregator calls.

3. The round-level counters (`validator_round_miners_{scored,pending,
   failed}`, `lifecycle_step`, `current_round_id`) now restore via that
   same pass, so they cover the finalized path too rather than inheriting
   the once-only limitation. `roster_size` + `lifecycle_step` are journaled
   (v3) to feed them; pre-v3 journals clamp pending to 0 rather than
   inventing a denominator.

`verdict_uids` mirrors finalize's entry set exactly — scored ∪
validation-failed ∪ freeze-zero, excluding operational failures, which get
no aggregator entry so telemetry must not imply they were judged.

`from_json` still accepts v1/v2 (missing fields default). Verified against
the v0.3.4 image: the suite's failure set is byte-identical before and
after this change (4 pre-existing failures, unrelated), and the 49 tests
across the journal/telemetry suites pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@george-connito
george-connito force-pushed the feat/restore-round-telemetry-on-recovery branch from 0341d15 to 3d42f2f Compare July 31, 2026 18:13
@george-connito
george-connito merged commit c43fdac into master Jul 31, 2026
1 check passed
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.

1 participant