Repository navigation
3.x.x: take the settlement-lock fault's lock only on current work and a quiet cluster, whichever fault landed a block before it (#692) - #699
Merged
RobertClarke merged 5 commits intoOct 6, 2026
Conversation
… serves current work, whichever fault landed a block before it (#692) #691 made the SIGTERM drain wait, before the next fault, until its block had landed and every frontend served work at the payout revision the landing committed. Other faults land a block too: frontend-sigkill, block-failover and candidate-backlog. None waits for the republication, so a settlement-lock straight after one took SETTLEMENT_LOCK while the landing's work was still unpublished, blocked that publication as well, and every retained-work share in the first half of its hold was refused stale-job, the same failure as #686. The settlement-lock fault now waits, from the start of its injection, until every frontend is ready, publishes payout_state_generation equal to the cluster's payout_revision, and has delivered that work to every authorized session. Only then does it start the lock holder. The wait is bounded at 60 s; the phase's time bound includes it, and the holder starts anyway once it passes. A new check fails the fault when the lock had to be taken without current work, and the evidence records when the work was current and the last reading. The ACK summary over the hold is now taken from the lock's acquisition rather than the injection's start. The wait is the drain's work half, moved into a WorkCurrentWait that both use, with unit tests for its states: current, read again after the interval, a failed or lost read replaced, a reading past the bound, and a read still in flight at the bound. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the revision it keeps (#692) Review follow-ups. The settlement-lock fault's wait now also needs no unfinished found block and no backend holding or waiting for SETTLEMENT_LOCK. A landing still to come would bump the revision again mid-hold, and a holder queued behind a settlement under way started its hold in the middle of it: in one local run that queueing (1.75 s) left the hold's answers at a p99 of 1.4 s. The holder reads the payout revision in its own transaction once it has the lock; every bump takes SETTLEMENT_LOCK, so that is the revision the hold keeps, and the check now fails unless it is the one whose work every frontend served. A read still in flight when the wait's bound passes is cancelled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd go ahead on current work when the cluster never goes quiet (#692) Second review round. Every bump of the payout revision takes SETTLEMENT_LOCK, so a found block still to land cannot move the revision under the lock; the wait no longer counts unfinished candidates, which a row left behind by an earlier fault would have kept above zero for the whole bound. A quiet cluster, with no backend holding or waiting for SETTLEMENT_LOCK, is now preferred rather than required: once the bound passes the lock is taken on the work every frontend then serves, and the check passes when the last reading before the lock was current and the lock kept its revision. The revision read under the lock keeps its error for the verdict, the evidence gives the wait from the injection's start, and a phase that ends during the wait cancels its read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 890bd5280e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
…fail a hold whose work was not current there (#692) Codex review. The wait's last reading is a snapshot taken before the holder connects: a tip that reaches the frontends in between leaves the payout revision as it was but not their work, and the hold then blocks the rebuild. Once the lock is held nothing can publish, so the fault now reads every frontend's /healthz once more before the hold starts, and the check passes only when each one is ready and publishing work at the revision read under the lock. A session still waiting for its first job has nothing to submit and is not counted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #692 (close by hand: base is not the default branch).
#691 made the SIGTERM drain wait until its block had landed and every frontend served work at the payout revision the landing committed. Other faults land a block too:
frontend-sigkill,block-failoverandcandidate-backlog. None of them waits for the republication. Asettlement-lockstraight after one tookSETTLEMENT_LOCKwhile the landing's work was still unpublished, and blocked that publication as well. Every retained-work share in the first half of its hold was then refused stale-job, the same failure as #686.What changes
Before the lock. The settlement-lock fault waits, from the start of its injection, until both of these hold:
payout_state_generationequal to the cluster'spayout_revision, and has delivered that work to every authorized session;SETTLEMENT_LOCK(a quiet cluster), so the holder is not queued behind a rebuild, a job build or a landing still settling.The wait is bounded at 60 s, and the phase's time bound includes it. A cluster that never goes quiet gets the lock at the bound anyway.
A found block that has yet to land does not hold the wait. Every bump of the payout revision takes
SETTLEMENT_LOCK, so a landing cannot move the revision under the lock.Under the lock. The holder reads the payout revision in its own transaction; that is the revision the whole hold keeps. Then the fault reads every frontend's
/healthzonce more before the hold starts. A tip that reached the frontends after the last reading leaves the revision as it was, but not their work, so this reading catches it.The verdict. A new check, "every frontend served work at the revision the lock kept", passes only if every frontend was ready and publishing work at that revision under the lock. The evidence records:
The hold's ACK summary is now taken from the lock's acquisition, not from the injection's start.
The shared wait. The wait is the drain's work half, moved into a
WorkCurrentWaitthat both faults use; the drain keeps #691's condition. A read still in flight is cancelled when the bound passes or the phase ends. Unit tests cover:Scope. Only the harness changes, in
crates/qbit-prism-load, plus the README fault table and thefault-settlement-lock-holdercriteria intest/e2e-scenarios.toml. There is no server change.Evidence
The loops ran a preset copy with
frontend-sigkill,settlement-lock;baseline=0;hold=6;recovery=4: the SIGKILL's block lands through the candidate lease, and the lock comes straight after. As infaults-pr-smoke, that is one debug frontend, 40 sessions and the fake node. Each loop was pinned to two CPUs.c95febb3)508a7523)9fad6fc2)890bd528)c41618f8)One
890bd528run failed itsfrontend-sigkillfault, whose block offer never reached the relay; its settlement-lock passed. One before-run failed the same way, so it is independent of this change.A real-node check ran
pool-exhaustion,settlement-lock;baseline=10;hold=30;recovery=20: two frontends, 500 sessions, regtest qbitd, asfaults-short-real-node. The settlement-lock passed at9fad6fc2,890bd528andc41618f8. Each time the cluster was quiet at once and the lock kept revision 3. Hold p99 was 506, 171 and 11 ms. Atc41618f8, every frontend served work at revision 3 under the lock.cargo test -p qbit-prism-loadpasses on9fad6fc2,890bd528and the headc41618f8, includingfaults_under_load_drain_an_offer_in_flight_and_outlast_a_settlement_lock_holder. On the head,cargo clippy --all-targets -D warningsandscripts/check_e2e_scenarios.pyare clean.🤖 Generated with Claude Code