Repository navigation
Bound coordination-blocked template refresh watchdog - #90
Conversation
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.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0e67bc2. Configure here.
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
* Close the accepted-block blind spot behind lost submitblock acks qbitd can accept a submitted PRISM block while the submitblock ack is lost in transport: acceptance then arrives only as a blockwait tip observation of the pool's own candidate hash, the accepted success tail never runs, and #89's protections both miss -- the accounted registry is only written in the direct-accept tail, and the retry disposition trusts one instantaneous chain snapshot in which the tip has already raced past the candidate and the header probe cannot prove it active. The stale-job abandon then terminally discards the pool's own on-chain block, withdraws its landed payout preview, fences payout publication, and leaves template refreshes coordination-blocked until the #90 watchdog restart (observed three times on mainnet 2026-07-25). Every tip-observation channel now registers an outstanding candidate hash seen as the chain tip as acceptance evidence, and every disposition/abandon-capable path re-checks fresh chain state plus that evidence before committing a terminal abandonment: candidates that are (or were recently observed as) active defer and retry until the accepted tail finalizes them as submitted; hashes provably absent from the active chain past the observation window stay terminally stale. Co-Authored-By: Claude Fable 5 <[email protected]> * Address Codex/Bugbot round 1: order acceptance checks before durable rejection - check acceptance evidence BEFORE reject_prepared_block on the post-persist stale-chain path, and commit that abandon terminally (recheck_acceptance=False) once prepared rows are rejected -- a rejected row cannot be confirmed by a later settled view - consult tip-observation evidence again after the blocking payout-preview withdrawal, atomically with the terminal counts, so evidence arriving during the withdrawal window still defers - require a probe-proven active block (not observation evidence alone) to open the pool-closed gate, so a closed pool can never fall through to submitblock on stale evidence; unprovable views defer via the abandon path instead Co-Authored-By: Claude Fable 5 <[email protected]> * Address Codex round 2: seal the terminal decision before rejecting prepared rows Reorder the post-persist stale-chain path to decide-then-reject: the abandon runs first (its terminal commit reads tip-observation evidence atomically with the counts under the coordinator lock, so no observation can land between the decision and the rejection unseen) and the prepared payout rows are rejected only after a sealed terminal outcome. Live evidence defers with the rows untouched; a crash between the sealed decision and the rejection leaves the outbox row pending for restart replay. The recheck_acceptance escape hatch is gone -- every abandon path now takes the full evidence check unconditionally. Co-Authored-By: Claude Fable 5 <[email protected]> * Address Codex round 3: seal terminal dispositions against late observations The terminal commit in _abandon_block_candidate now drops the hash from the outstanding-candidate set inside the same critical section that commits the abandonment counts. Observation registration takes the same lock and only matches outstanding hashes, so acceptance evidence is structurally excluded from the gap between a sealed terminal decision and the follow-up durable rejection of prepared payout rows -- no evidence can register mid-rejection and contradict the sealed disposition. A crash before the durable outbox update still replays the candidate, which re-registers the hash and re-evaluates from live chain state before rejecting. Co-Authored-By: Claude Fable 5 <[email protected]> * Address round 4: independent acceptance probes; restore barrier on late defer - probe getbestblockhash and the active header independently so a best-tip lookup failure no longer suppresses the header check, which subsumes it and can prove acceptance (or wrong-height staleness) alone (Codex) - when acceptance evidence arrives during the payout-preview withdrawal, re-begin and re-land the preview before deferring: the restored barrier pops the fail-closed tombstone so descendant builders wait on the preview instead of fencing template refreshes while retries defer on observation evidence (Cursor) Co-Authored-By: Claude Fable 5 <[email protected]> * Address round 5: restore replay acceptance evidence; heal fenced withdrawal - startup replay restores acceptance evidence for durable candidates whose prepared/confirmed pool-block row proves a prior process's submitblock succeeded, so a replay disposition racing a transient fork view cannot terminally abandon the accepted block after a restart dropped the in-memory observation registry (Codex) - the late-acceptance defer republishes the withdrawn preview after restoring the landed barrier: a withdrawal whose own publication lost its race had fenced delivery, and the deferral cycles must not leave template refreshes coordination-blocked until the accepted tail republishes (Cursor) Co-Authored-By: Claude Fable 5 <[email protected]> * Address Bugbot round 6: probe verdict wins both directions in the late check The late-acceptance gate now reuses the pre-check chain-probe verdict: a candidate the probe proved active at the wrong height stays terminally abandonable even when a tip observation registers during the payout-preview withdrawal. Header heights are immutable, so the wrong-height verdict cannot be overtaken by later evidence, and a corrupt-height candidate no longer defers until window expiry. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: admin <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>

Summary
Validation
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes when the PRISM coordinator self-restarts during template publication stalls; mis-tuning the new bound could restart a healthy process or delay recovery on sustained payout-confirmation churn.
Overview
Adds
PRISM_COORDINATION_BLOCKED_EXIT_SECONDS(default 900s) so brief coordination-only template-refresh deferrals still skip the ordinaryPRISM_TEMPLATE_REFRESH_FAILURE_EXIT_SECONDSbudget, but a continuous streak eventually triggers the publication-progress watchdog toos._exit(1)for supervised restart.The coordinator tracks coordination-blocked streak age, clears it on successful refresh, and arbitrates coordination vs ordinary publication deadlines under lock so a newly recorded coordination pause cannot lose to a stale ordinary-deadline decision. Payout-confirmation fences and some pre-publication payout races are classified as coordination (
_PayoutStatePublicationBlocked/TemplateRefreshSuperseded) instead of arming the short failure clock.Operators get
qbit_prism_template_refresh_coordination_blocked_age_secondson/metrics, plus wiring in Compose,.env.example, PRISM.md, and mainnet-deployment.md.Reviewed by Cursor Bugbot for commit dcadb1a. Bugbot is set up for automated code reviews on this repo. Configure here.