Complete PRISM coordinator ownership cleanup - #80
Conversation
This comment has been minimized.
This comment has been minimized.
ffb0ff8 to
7a18a8b
Compare
132e880 to
4bb1f0b
Compare
2410870 to
8453bc5
Compare
7711ebb to
3172e85
Compare
020f800 to
f71730b
Compare
3172e85 to
e801c57
Compare
e801c57 to
bccba5a
Compare
f71730b to
59913ce
Compare
59913ce to
867781e
Compare
bccba5a to
584a1f1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 867781e. Configure here.
| except Exception: | ||
| inactive_blocks_total += inactive_blocks | ||
| reactivated_blocks_total += reactivated_blocks | ||
| matured_payouts_total += matured_payouts |
There was a problem hiding this comment.
Reorg error path double-counts
Medium Severity
When reconciliation uses reorg_watch_blocks, a successful pass adds the attempt’s inactive, reactivated, and matured counts to the running totals, then any exception afterward (for example from prepared_candidate) adds the same attempt counts again before updating service counters and re-raising. Reorg error metrics can be overstated even though ledger work ran once.
Reviewed by Cursor Bugbot for commit 867781e. Configure here.


Position in the stack
PR 8 of 9. Base:
prism-observability-http. Depends on PR 79. Next: PR 81.Review this PR against its configured base. See the stack guide for the complete order.
Why this slice exists
The earlier slices establish domain owners, but temporary mirrors, magic forwarding, inline metrics rendering, reorg bodies, and the watchdog loop would leave ambiguous ownership if retained. This slice completes the boundary and removes scaffolding that was useful only during extraction.
What changes
reorg_reconciler.metrics.Why the diff is sizeable
The roughly 1,880 additions and 1,370 deletions are dominated by extracting metrics and reorg owners while deleting more than 1,160 coordinator lines. Explicit ports add some wiring, but they replace implicit
__getattr__/__setattr__behavior and make dependency direction reviewable.Review the reorg owner, metrics renderer, and watchdog ports first. Then inspect coordinator deletions and the remaining compatibility surface to verify that mutable state has exactly one owner.
Structural result
prism_coordinator.pyfalls from 19,165 to 8,630 lines across the complete refactor.__getattr__or__setattr__forwarding.Validation
Operator impact
No schema or required configuration change is introduced by this cleanup slice.
Note
Medium Risk
Large structural refactor on accepted-block finalization and process-exit watchdog paths; behavior is intended to be equivalent but explicit port wiring increases review surface for subtle delegation bugs.
Overview
This slice finishes PRISM coordinator boundary cleanup by moving process supervision, metrics assembly, and finalization wiring into dedicated owners instead of inline coordinator logic.
Watchdog — The publication-progress and liveness loops now live in
WatchdogServiceinbackground_services.py, driven by injectableWatchdogPorts(stop wait, budgets, heartbeats,exit_process). The coordinator wires ports and registers the loop like other background services.Block finalization —
BlockFinalizationServiceno longer forwards unknown attributes to the coordinator via__getattr__/__setattr__. It takes aBlockFinalizationPortprotocol and callsself.runtime.*for RPC, ledger, payout, reorg, and shutdown hooks. Finalization behavior is unchanged; dependencies are explicit.Metrics — Full Prometheus document generation moves to new
lab/prism/metrics.py:MetricsPortlists read capabilities andMetricsRenderer.render()assembles the scrape body (coordinator delegates via_ensure_metrics_renderer()).Smaller cleanups —
job_build_benchmarkimportsdefault_prism_coinbase_tag_hexfromcoordinator_config. Observability drops generic “compatibility” setters in favor of*_for_testhelpers on health snapshot and loop state.Reviewed by Cursor Bugbot for commit 867781e. Bugbot is set up for automated code reviews on this repo. Configure here.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.