Skip to content

Fix PRISM latest-tip refresh supersession - #84

Draft
Anatolie wants to merge 2 commits into
1.x.xfrom
prism-tip-supersession-fix
Draft

Fix PRISM latest-tip refresh supersession#84
Anatolie wants to merge 2 commits into
1.x.xfrom
prism-tip-supersession-fix

Conversation

@Anatolie

@Anatolie Anatolie commented Jul 22, 2026

Copy link
Copy Markdown
Member

Problem

During rapid tip changes, a canceled PRISM bundle build kept logical refresh ownership until its executor physically exited. A newer tip was selected correctly but could not start, so repeated B → C → D changes left miners on stale work while B unwound.

What changed

  • Separate logical cancellation from physical executor cleanup. Superseded waiters complete immediately while the old build retires in the background.
  • Admit the newest replacement without waiting for one obsolete executor, while keeping a hard bound of two physical builds and one latest pending request.
  • Replace intermediate pending generations so B → C → D publishes D rather than C.
  • Carry generation-bound cancellation through payout preparation, expensive serialization and copy steps, scheduler admission, and result handoff.
  • Fence promise completion and cache publication so a retired build's late result cannot publish, populate cache state, or satisfy a newer request.
  • Preserve refresh retry ownership, pending tokens, block-candidate retries, PR Isolate PRISM share hot-path locking #83 lock separation, and existing timeout values.

Expected outcome

  • The latest tip can begin and publish while obsolete work is still exiting.
  • Current-tip job coverage should recover quickly during short reorgs or rapid block bursts, reducing stale and unknown-job rejects.
  • Repeated tip churn remains bounded and cannot create an executor or promise storm.

Validation

  • 192 focused refresh, cache, and publication tests passed.
  • 179 PR Isolate PRISM share hot-path locking #83 hot-path, share-ledger, initial-job, and reconnect tests passed.
  • 275 Vardiff and block-candidate retry tests passed.
  • Full Python suite: 1,231 tests passed.
  • Python compilation, Ruff, shell syntax, ShellCheck, and diff checks passed.

Monitor after merge

  • Current-tip coverage and stale/unknown-job reject rates.
  • Refresh first-delivery, last-delivery, replacement-start, and cancellation duration.
  • Active/pending builds, supersession and obsolete-result counts, and builder terminations or restarts.
  • Watchdog exits, candidate backlog/retries, and coordinator lock-wait latency to confirm the existing hot-path behavior remains stable.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

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