Repository navigation
fix: fence compact publication and replacement lease authority - #377
Conversation
Capture cold build authority before construction and revalidate node, revision, balances, epoch and expiry before atomic publication. Bind replacement leases to the exact issued publication and coherent current balance state across issue, resume and share admission. Refs #273.
|
@cursor review |
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.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit feba828. Configure here.
Refresh external payout authority after local publication lock backpressure without holding state locks through I/O or renewing the original expiry clock. Preserve backend unavailability for an unready current publication while returning deliberate misses for retired requested work.
A proof started during replacement may finish after the node returns to the published parent. Accept only with the original current revision and fresh polling, and keep the digest override restricted to active replacement leases.
Track actual prepared publications separately from tip observation ordering. Cached refreshes retain the original proof while new prepared installations still revoke it, even at the same parent and revision. Exercise real issue, persist, resume and compact publication across both transitions.
Preserve the established no-credit response reason while identifying a refused local gate separately from database failure. Authority loss and lock contention both prove COMMIT was not sent; neither changes unknown-outcome reconciliation.
|
Final verification and all dispositions: complete review ledger. The progress record below describes the earlier stage; the final ledger retains the unresolved diagnostic explicitly. Independent review findings and current dispositionsClaude Fable 5.1 completed the full adversarial review at
The fixes and Ordinary resumed-work expiry: compatibility rebuttalDisposition: reject the proposed ordinary pre-COMMIT expiry requirement. The reported timing is possible, but the approved ordinary contract admits work at the request boundary and then applies the share-commit acknowledgement budget. PR #377 adds a stricter fence to replacement leases; applying it to ordinary current-tip credit would change that contract.
Current-head CI executed the named ordinary/lease regressions, including late lease expiry, original proof handoffs, duplicate retry and post-COMMIT unknown outcomes. The PostgreSQL shard and executed-test manifest also prove execution of the real-ledger order-lock, duplicate gate and commit-reconciliation tests. Claude Fable 5.1 independently reviewed the full diff at |
Review ledger at
|
| Lane | Actual reviewer / reviewed head | Result and evidence |
|---|---|---|
| Native code review, medium | GPT-5.6-sol, medium; feba828, then deltas at 8aff0e4, d78cbae, and f770555 |
Original review clear; the first delta found stale poll reuse, fixed in d78cbae; subsequent recorded reviews clear. |
| Adversarial, initial | GPT-5.6-sol, high; feba828 |
Four findings: three fixed, one compatibility rebuttal below. |
| Adversarial, follow-up | GPT-5.6-sol, high; d78cbae |
Three original-proof/duplicate findings, all fixed in 8238087. |
| Adversarial, latest delta | GPT-5.6-sol, high; f770555 |
Ordinary resumed-work expiry claim; source-based compatibility rebuttal below. |
| Thermo-nuclear quality review | Claude Fable 5.1; feba828 |
Eight findings: five fixed/documented and three rebutted. The reviewer reported 279 library passes with 42 internal database skips and two ignored tests; this lane supplies no real-ledger execution claim. |
| Independent full-head adversarial verification | Claude Fable 5.1; f770555 vs 8bea677 |
Completed: F1 publication-stamp regression, F2 compatibility clarity, F3 gate reporting; independently confirmed the ordinary-expiry rebuttal and immutable/duplicate fences. Reported 304 library passes, 2 failures, 2 ignored on PostgreSQL 16, and seven discriminating controls; the two failures remain recorded below. Original earlier Fable attempts did not complete and are not credited. |
| Independent corrected-head delta verification | Claude Fable 5.1, high; exact public head 39f0b6c, tree 6ca066c |
Completed: no merge blocker in the delta; F1 fixed, F2 accurate, F3 fixed as scoped. PostgreSQL 16.15 with fsync on: focused 134/0; full library 311 passed, 1 log-capture assertion failed, 2 ignored; failing case passed 5/5 isolated reruns. Forty labeled expiry runs under concurrent load passed. Controls A/B discriminate cached refresh versus real publication; control C exposes the F3 test-coverage limitation. |
| Cursor Bugbot | Cursor high-effort review; feba828 |
One finding fixed in 8aff0e4; reply posted. |
| CI | GitHub Actions at f770555, then 39f0b6c |
Prior head: 19 successful checks, one optional skip, manifest re-read. Combined-head CI: 19 successful checks, one optional skip; all 296 expected gated tests executed. |
| Author review / qualification triage | Implementing agent; model not recorded in the retained finding entries | Two author findings fixed; qualification/CI triage has four fixed and one rebutted observation. These are not independent review lanes. |
| Close-out implementation / evidence verification | Codex GPT-6-astra; f770555 then 39f0b6c |
Verified prior source and CI evidence, implemented F1/F3, preserved original proof and outcome contracts, integrated 553fa35, and qualified the combined source. This is the implementing lane, not an independent reviewer. |
| tenki / Codex on GitHub | No report or comments observed at close-out | No completed review is credited to either service. |
Earlier native/adversarial/thermo completions and their model identities are recorded in the retained review ledger. Original local reviewer stdout and mutation-control logs were not recovered during close-out; their earlier results are reported evidence. Current source, pushed fixing commits, GitHub comments and CI execution were independently rechecked, and both completed independent Fable reviews are accounted for separately above. The final verifier did not run qbitd integrations, other test binaries, or an additional Codex cross-check; current CI covers the integrations, and earlier Codex lanes are listed at their actual reviewed heads.
Finding ledger
“Fixed/addressed” names a pushed correction or published clarification. “Rebutted” gives the concrete reason the proposed change is not required by the approved contract.
| # / source | Finding | Disposition / evidence |
|---|---|---|
| 1 · qualification | Retired stored-parent resume became backend unavailable | Fixed in feba828, refined in d2a8663: retired work is a miss while unavailable current publication remains an error. |
| 2 · qualification | One fake-backend TCP-reset test initially observed an accepted ACK | Rebutted as a PR regression: the unchanged accepted_share_with_failed_tcp_response_has_no_ack_or_rejection fixture uses the protocol test backend, not the changed coordinator path; earlier exact/full reruns passed, and current CI passes the protocol suite. The first observed failure remains recorded, without claiming a reproduced defect was fixed. |
| 3 · author review | Economic state could change during the final node RPC | Fixed in feba828: coherent economics now follow the final node check; the gated economics regression passes in current CI. |
| 4 · initial adversarial | Leased append could cross same-revision publication after admission | Fixed in d78cbae: exact identity/epoch and fixed expiry are revalidated at pre-COMMIT. |
| 5 · initial adversarial | Issued save could cross publication before delivery | Fixed in d78cbae: final issued delivery revalidates after storage/repair waits. |
| 6 · initial adversarial | Cold publication could wait on a local lock after economic proof | Fixed in d2a8663: lock contention causes a new external proof while retaining the first expiry. |
| 7 · initial adversarial | Retired-parent lookup still reads payout revision before returning a miss | Rebutted: base code and resume_stale_payout_returns_unknown_while_revision_outage_remains_unavailable intentionally give a failed database observation priority over a cached miss; current CI passes that contract. |
| 8 · CI | Unavailable current publication must remain a backend error | Fixed in d2a8663; current-publication/retired-work and live-regtest coverage pass. |
| 9 · Bugbot | A returning tip incorrectly rejected ordinary current work | Fixed in 8aff0e4; thread reply and issue/resume/submit tests cover unchanged/changed revisions. |
| 10 · medium delta | Returned-tip submit reused the pre-wait poll | Fixed in d78cbae; refreshed-poll regression passes. |
| 11 · thermo | Each lease proof reads/hashes the full balance set | Addressed/documented in d78cbae, counted as fixed under the review's offered documentation alternative: a fresh coherent proof is intentional; caching requires a transactionally versioned digest. This is not a performance improvement claim. |
| 12 · thermo | Ordered authority lock acquisition was duplicated | Fixed in d78cbae: shared guard helpers preserve ordinary submit's narrower prepared/tip lock scope. |
| 13 · thermo | Absolute expiry arithmetic was duplicated | Fixed in d78cbae: checked AbsoluteDeadline conversion is shared across authority boundaries. |
| 14 · thermo | Lease admission appeared to need removal of an unused scalar revision read | Rebutted: the read preserves the same tested database-error priority as #7; the coherent proof supplies the actual lease transaction revision. |
| 15 · thermo | Optional pre-build proof should be replaced with typestate | Rebutted: the API supports existing persistence and cold publication; the cold boundary requires the captured proof and fails closed when absent. A different type design is not evidence of unchecked cold admission. |
| 16 · thermo | Repeated authority checks should be collapsed | Rebutted: the checks cover separate node/database waits, local lock contention, publication identity and synchronous expiry. Collapsing them without preserving these boundaries changes the validation contract; shared guards/deadlines already centralize primitives. |
| 17 · thermo | Identity equality cloned strings under locks | Fixed in d78cbae: borrowing identity comparisons replace those clones. |
| 18 · thermo | Error/miss distinctions were unclear in the PR description | Fixed in the PR description accompanying d78cbae: retired miss, unavailable current publication, lookup failure and changed-digest refusal are explicit. |
| 19 · qualification | Full shared guards changed ordinary submit's lock scope | Fixed in d78cbae: restored the original prepared/tip subset; unchanged deterministic interleaving coverage passes. |
| 20 · author review | Pending operations could borrow a renewed lease interval | Fixed in d78cbae: retain the first lease deadline; a new admission may obtain a new interval. |
| 21 · follow-up adversarial | Build-to-persistence handoff dropped original issuance proof | Fixed in 8238087: opaque original authority travels in JobContext; real build-to-persist coverage tests epoch/publication/lease changes. |
| 22 · follow-up adversarial | Resume reconstruction could adopt a renewed lease | Fixed in 8238087: first authority and minimum original absolute/monotonic expiry survive reconstruction/clock waits. |
| 23 · follow-up adversarial | A closed gate discarded a known durable duplicate | Fixed in 8238087: only exact immutable prior-row equality with no candidate write preserves the duplicate after rollback. No new share/clock/hash write qualifies; real-ledger and fake late-invalidation cases pass. |
| 24 · integration qualification | Cold test fixture omitted merged original build inputs | Fixed in f770555: retained original inputs in the owned fixture; current 306-test PostgreSQL library suite passes. |
| 25 · latest adversarial | Ordinary resumed share admitted before expiry can commit after expiry during a ledger wait | Rebutted after independent full-source verification: expiry gates ordinary request admission; the existing acknowledgement gate governs later persistence. The detailed source-based compatibility argument follows. |
| 26 · final Fable | Poll sequence invalidates unchanged ordinary issue/persist/resume and compact proofs | Fixed in 2667be1: track prepared-publication generation independently of poll ordering. Two unchanged refreshes preserve issue/persist/resume and compact original proofs; real same-parent/revision replacements still refuse. New tests fail before and pass after the fix. |
| 27 · final Fable | Exact identity narrows lease-time credit/resume across generations/frontends | Addressed/documented in the PR description and compatibility disposition: only the exact selected publication can borrow the replacement lease. Same parent/revision/balances alone are insufficient. Ordinary current-tip semantics are retained. |
| 28 · final Fable | Late gate refusal is reported like a database error | Fixed in f39f9a5: definite no-COMMIT gate-refusal log/message with the established ledger-confirmation-failed reason. A gate can fail from lock contention as well as stale authority, so it does not claim stale-job or unknown outcome. Limit: the new event is INFO; the executable's unset-environment filter is ERROR, which also filtered the previous WARN. No default-visible log improvement is claimed. Control C found no test that distinguishes the F3 message/log change; the source and returned reason were reviewed directly. |
| 29 · final Fable qualification | Expiry test unexpectedly accepted once in the full library run | Unresolved nonblocking diagnostic, retained explicitly. The original f770555 run panicked at authority_lease.rs:682 with unwrap_err() on Ok(()). Its loop branch was not labeled and cannot be recovered. Six instrumented full runs and 8/8 isolated reruns did not reproduce it; the final verifier also passed 40/40 labeled runs under concurrent load. At both heads the expiry mutation precedes the memory-store pre-COMMIT hook; independent source review found no accepting path, and removing the expiry fence makes this assertion fail. The original acceptance remains unexplained. A recurrence at head would still lack the loop label; neither a runtime fix nor a proven harness cause is claimed. |
| 30 · final Fable qualification | A second library test failed in the same run and passed in isolation | Rebutted as a PR behavior regression. The recovered failure was tools::configuration_tests::audit_root_env_and_cli_precedence, where command.output().unwrap() returned OS NotFound while launching the current test executable. This unchanged subprocess path does not exercise the changed admission code. The missing-path cause is not inferred, and no code fix is claimed. |
| 31 · final Fable qualification | SharedLog assertions failed while COMMIT/candidate outcomes were unknown | Rebutted as a new outcome-contract regression. At f770555, one of six instrumented full runs failed only the share-ID log assertion after tracing unknown:commit-in-flight. At 39f0b6c, the full run failed only the block-only pending case's empty-log assertion; 5/5 isolated reruns passed. Both tests verify the unknown response before inspecting captured text, and their source is unchanged by the delta. The log-capture failure is retained; it is not evidence that unknown COMMIT became a definite rejection or duplicate credit. |
Verification
Independent qualification is not described as a clean full-suite run: the first Fable run was 304/2/2 and the corrected-head run was 311/1/2, with the failures dispositioned above. Three other old logs showed 40–41 PostgreSQL shared-memory-segment failures caused by the sandbox environment; these runs are excluded from PR behavior evidence. Earlier cold-stamp control NC7 predates the corrected unchanged-refresh contract; final controls A/B supersede it for F1. Local disposable PostgreSQL was stopped and its owned data/socket directories removed after qualification.
Combined-head CI has 19 successful checks and one optional skip. Its PostgreSQL library shard reports 312 passed, 0 failed, 2 ignored. The gate proof and downloaded manifest confirm 296/296 expected gated tests executed (410 manifest lines, 42 test names repeated). Re-running the unchanged checker against the downloaded manifest and required PostgreSQL logs passed with no skipped-gate evidence.
Local combined-head qualification at 39f0b6c completed with PostgreSQL 16 and integration execution required: 312 library passes, 0 failures, 2 existing ignored. Selected integrations passed: audit body/durable range/acquisition metrics 15 (1 existing ignored), audit completeness 3, compact repair/cleanup 25, readiness RPC 6, Stratum admission 5, PostgreSQL admission 1 (1 existing ignored), and protocol 22. Strict server Clippy across all targets, formatting and whitespace checks passed. The cached-refresh ordinary and compact regressions failed on the previous source and passed after 2667be1; genuine replacement controls also passed. These local results are implementing-lane evidence, separate from corrected-head CI and the completed independent review.
The prior-head (f770555) PostgreSQL library run reports 306 passed, 0 failed, 2 ignored. The gate checker confirms all 272 expected gated tests executed, with the manifest. That prior-head CI also passed readiness RPC (6), Stratum admission (5), Stratum protocol (22), formatting and Clippy.
The real-ledger commit_reconcile_ledger_hook_refusal_sends_no_commit case now checks an exact duplicate, mismatched payload and unchanged clock/credit; the other commit-reconciliation cases cover blocked appends, confirmed commits, lost replies and candidate handling. Original-proof forwarding, first-lease retention and late duplicate handling all execute in the current-head library suite. Earlier author qualification reported four final-source removal controls and the preceding economic/digest/lease controls; those unavailable local logs are not counted as independently replayed evidence in this close-out.
Ordinary resumed-work expiry: compatibility rebuttal
Disposition: reject the proposed ordinary pre-COMMIT expiry requirement. The reported timing is possible, but the approved ordinary contract admits work at the request boundary and then applies the share-commit acknowledgement budget. PR #377 adds a stricter fence to replacement leases; applying it to ordinary current-tip credit would change that contract.
- Expiry is checked before coordinator submission. The unchanged Stratum request path resumes missing work, checks its original
resume_expires_atafter the await, and rejects expired work before callingsubmit. Session pruning removes expired work as well. No expiry is renewed. The existingslow_resume_crossing_absolute_expiry_is_rejected_before_coordinator_submitregression covers the admission boundary. - Ordinary persistence has an explicit, separate budget. The base implementation at
8bea677documents and enforcesshare_commit_timeoutplus reconciliation grace, or the candidate acknowledgement timeout. It uses the default commit gate. At the reviewed head, onlyselected.share_leasereceives the extra lease fence; a gate without a lease retains the same atomic open/committing/closed arbitration. An ordinary share admitted while its restored job is live may therefore finish after that job's expiry, provided its persistence gate permits COMMIT. Adding a second ordinary expiry veto would reject previously accepted work solely because storage waited. - Returning to ordinary authority is intentional and constrained. Lease selection requires the exact publication, readiness epoch, original current revision and fresh polling when the node returns to the published parent.
tip_return_during_lease_state_wait_uses_ordinary_current_work_checkscovers issue/resume/submit with both unchanged and changed revisions;changed_balances_refuse_issue_resume_and_share_only_on_replacement_leaseexplicitly pins the ordinary transaction-revision contract. A pending operation that still uses replacement-lease authority retains its first lease interval and the additional resumed-wire expiry fence. - No unbounded credit or outcome rewrite follows. The database transaction still locks and checks the current payout revision. Ordinary share-only appends whose acknowledgement gate closes before COMMIT are cancelled; already-started COMMITs retain accepted/unknown reconciliation, and candidate-bearing appends retain their existing contract. Deduplication matches the prior immutable payload or rejects a mismatch/global duplicate before new credit. This rebuttal does not classify a possibly committed append as a rollback or grant another credit.
Current-head CI executed the named ordinary/lease regressions, including late lease expiry, original proof handoffs, duplicate retry and post-COMMIT unknown outcomes. The PostgreSQL shard and executed-test manifest also prove execution of the real-ledger order-lock, duplicate gate and commit-reconciliation tests. Claude Fable 5.1 independently reviewed the full diff at f770555, compared the base admission path and documented contract, and confirmed this ordinary-expiry timing is a non-regression rather than a contract violation. The separate unexpected replacement-lease expiry test observation remains open in the finding ledger.
…o publications faster than one fan-out no longer starve job delivery (#598) (#616) Each Stratum session builds and saves its own job. The build's admission proof compared the published tip's publication stamp, (tip hash, publication generation), by equality after the build and before and after the save, and every publication bumps that generation, including a reanchor, new shares or a template change on the same tip with the same payout revision. With 2,000 sessions on one frontend and a 1 s reanchor, almost every build was overtaken before it was saved and was thrown away ("payout snapshot stale"), so a new tip, and some first jobs, reached no session. Fresh work now keeps its admission across a later publication that kept the same published tip, parent, payout revision, prior balances and fee, and is delivered exactly as the jobs other sessions already hold from its publication; the session's next pass brings it up to date. The published tip now carries a tip generation that changes only when the published hash does, so a tip change, including A -> B -> A, still revokes the build, as do a payout revision change (still re-proved against the database at every step and inside the save transaction), a prior-balances change and a fee change. Resumed work and replacement leases keep the exact publication stamp. #377's authority tests now expect a reanchor republication to admit issue and persist, and a balances republication to refuse them. A gated test holds a real coordinator's build between build and revalidation while it republishes: a reanchor, new shares or a template change delivers and saves the build, byte-identical in its payout outputs to the live job of its publication; a new tip, A -> B -> A, a revision change with or without a republication, and a fee change discard it. Closes #598 Co-authored-by: Claude Opus 5.5 <[email protected]>

Refs #273.
Prepared-publication generation is now separate from tip polling order. Two unchanged cached refreshes preserve in-flight issue, persist, resume and compact-build proofs; installing new prepared work still invalidates the original proof, including at the same parent and revision.
Replacement-lease admissions authenticate a coherent current revision against the as-issued balance digest and exact publication identity. Original authority, epoch, first lease interval and fixed expiry survive build, storage, repair and resume waits. During replacement leases, previous-generation or other-frontend work cannot borrow that authority merely because parent, revision and balances match; this is an intentional lease-time compatibility boundary.
Cold compact work reserves and publishes through authority captured before its original build. Final validation precedes atomic installation of prepared work, readiness and generation. Compact storage remains preparatory and unwired; this does not claim the scale acceptance criteria in #273. Each lease proof still reads/hashes the balance set; caching requires a transactionally versioned digest.
Ordinary current-tip/candidate credit keeps its existing contract. Restored work must pass expiry at request admission; the existing acknowledgement gate governs an admitted append. Replacement-lease shares additionally revalidate at pre-COMMIT. A refused local gate returns a definite
ledger-confirmation-failedwith an explicit gate-refusal message; its INFO event requires a suitable log filter. Once COMMIT starts, confirmed/unknown reconciliation remains intact. A closed gate preserves an already durable duplicate only after the full immutable row matches and no candidate or share/clock/hash write was attempted; it cannot grant new credit.Base
553fa35is integrated, preserving landed original-input compatibility, durable-window verification, bounded cleanup and audit-acquisition contracts. Known retired work remains a miss, unavailable current publication or a failed lookup remains an error, and changed lease balances reject admission.Validation and review
On pushed head
39f0b6c45929e87a81ff430c359cac2c82bce002:The complete review ledger records all 31 findings/observations, actual review models and heads, the source-based ordinary-expiry rebuttal, and evidence limits. One original expiry-test acceptance remains unexplained and is retained as a nonblocking diagnostic. It did not recur in the instrumented or labeled load runs; no harness cause or runtime fix is claimed. Independent full-suite log-capture failures and the F3 message/log test-coverage limitation are recorded separately. No deployment or PR merge is part of this change.