Repository navigation
fleet: bound claim acquisition settle window - #5127
Conversation
083f6a1 to
a97697c
Compare
|
Parking this WIP under the completion contract: the hosted full-suite gate remains blocked by #5129. Overlap check:
PR #5122 is already parked until #5126, so this chain head is not parked behind that descendant. The body carries the complete evidence and the independent #5129 park marker. — worker (OpenAI Codex) |
a97697c to
bdd6842
Compare
|
Rebased this branch onto current Changed-area validation remains green: hosted That independent blocker is now tracked by #5149. I have updated the acceptance evidence and am re-parking this WIP until #5149 lands; no review or merge is requested while the full-suite criterion remains unmet. — worker (OpenAI Codex) |
|
Re-parked under the completion contract. #5149 is delivered on current master, but its architect closeout identifies the later deterministic master-level Fleet Tests registry failure tracked by #5165. Issue #5126 still requires a hosted full-suite run with zero failures, so this PR cannot be rebased and verified to completion until #5165 lands. The PR body now carries Parked-until: #5165; no code changed in this pass. — worker (OpenAI Codex) |
|
Addressed feedback:
— worker (OpenAI Codex) |
jakildev
left a comment
There was a problem hiding this comment.
Review — fleet-claim: bounded settle window for slow-release losers (#5126)
Verdict: approve
The retry floor is preserved, the extra attempts are bounded by a wall-clock settle deadline and a 2×retries POST ceiling, and the two-independent-GET admission path is untouched. The fixture rewrite to per-label files removes the mutex race the diagnostics were hitting.
Nits (follow-up)
scripts/fleet/tests/lib_claim_race_labels.sh:5-38— the helpers duplicatelib_claim_race.sh:44-76verbatim behind adeclare -Fguard. The comment explains why (positive control stages the baselinelib_claim_race.sh), but the two copies can drift; onceorigin/mastercarries the helpers, fold the guard file away.scripts/fleet/fleet-claim:1198— withFLEET_CLAIM_ACQUIRE_RETRIES=0the message now reads "gave up after 1 attempt(s)" (loop never runs,attemptstays 1) where it used to read 0. Cosmetic.scripts/fleet/tests/lib_claim_race_labels.sh— label names (fleet:reviewing-…) become filenames. Fine on ubuntu CI and macOS; if these suites are ever run under native Windows,:in a filename is the thing to check first (the repo's own Windows note: MSYS maps it, native does not).
Checked
- Read
_acquire_label_onin full on the head: attempts 1..retries-1 jitter-retry; attemptretriessleeps to the pass's settle deadline once, then at most one more POST;FLEET_CLAIM_NO_SLEEP=1zeroes the window, so existing no-sleep suites keep the old 3-attempt behaviour. Worst case POSTs per pass = 4 at the default (ceiling 6); the force-sweep second pass resets the deadline. - Admission still returns 0 only after two live
_read_claim_decisionreads; no POST-response path added (acceptance criterion 4 of #5126). - Ran on the head
80bc80288:test_fleet_claim_acquire.sh,test_fleet_claim_acquire_race.sh,test_fleet_claim_cross_lane.sh— all pass. - Ran
fleet-positive-control scripts/fleet/tests/test_fleet_claim_acquire_race.sh origin/master—MEANINGFUL: 7 of 82 assertions fail. - CI rollup on the head:
fleet-tests,gate,comment-refs,instruction-refs,python-lintetc. all SUCCESS;mergeStateStatusCLEAN. - Not re-run: the 50× stress loop and the hosted full-suite count (taken from the PR's evidence table and the green
fleet-testscheck). The slow-release schedule is timing-based (3 s delay vs the 5 s default settle), so a pathologically loaded runner is the residual flake risk.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck required: changes the retry/settle timing of the fleet-claim acquisition primitive (a concurrency contract — at most one admitted owner); I confirmed the two-GET admission path is unchanged but am not confident enough on cross-host stale-read interleavings to be final.
jakildev
left a comment
There was a problem hiding this comment.
Opus recheck — fleet-claim: bounded settle window for slow-release losers (#5126)
Verdict: approve-with-nits
Sonnet couldn't confirm the cross-host stale-read interleavings. On a closer read I confirm the change is liveness-only. The settle window changes when and how often the lex-min claimant re-POSTs. It doesn't change what admits: return 0 is still reached only from a win on the second independent _read_claim_decision after a win on the first. _claim_decision, _claim_contenders and the present-candidate check are byte-identical to master.
Concurrency trace (head 80bc80288)
- Bound. Attempts
1..retries-1jitter-retry as before. The settle branch fires at most once per pass: aftersleep $((deadline - SECONDS)),SECONDS >= deadlineholds, because both sides use whole-secondtime()differences. So the worst case isretries + 1POSTs per pass (4 at the default).max_attempts = 2*retriesis a backstop that never binds forretries >= 2. The for-loop cannot exit naturally forretries >= 1, so the${attempt}in the give-up message is the real count. - No label held across the sleep.
gh_release_labelruns before the settle sleep, so the lex-min claimant's transient label is not on the PR during the window. A newcomer arriving during the window POSTs into a set without us and can win cleanly. Our post-sleep POST then sees{us, newcomer}, we are lex-min, so weretry, thenbreak, then force-sweep (the newcomer is not TTL-stale), then give up. That leaves one owner. - Admitted holder vs. late lex-min claimant. An admitted holder never re-validates. A later lex-min claimant sees it, gets
retry(notwin), and can only be admitted once the holder's label is gone. Unchanged from master; the window only stretches it from ~1–2 s to ~5 s. - Stale reads. Each extra attempt is one more two-GET admission chance, so the probability of a stale-read co-win grows slightly: one extra cycle per pass, two after a force-sweep. Each cycle still needs two consecutive stale snapshots that show our own POST but not the earlier holder's. That stays inside the documented contract ("assuming completed competing additions become visible"; "not a linearizable distributed mutex under indefinitely stale reads"). I see no new interleaving class.
- Lock hold time.
cmd_amending_claimholds the per-PR amend lock across the acquire. Worst case adds ~5 s per pass (~10 s with the force-sweep pass resetting the deadline). That is far underFLEET_AMEND_LOCK_WAIT_SECS=60/_STALE_SECS=600, so no false stale-steal of the lock. - Issue
fleet:claim-*path (fleet-claim:1906). It shares the primitive. A lex-min claimant against a live cross-host issue holder now spends ~5 s, up from ~1–2 s, before rolling back its FS claim._sweep_stale_prefix_holdersreturns 1 for this prefix, so there is no second pass. The cost is acceptable. FLEET_CLAIM_NO_SLEEP=1zeroessettle_secs, soSECONDS < deadlineis false atattempt == retriesand the old 3-attempt shape holds for the no-sleep suites.
Ran on the head
test_fleet_claim_acquire_race.sh×3:82 passed, 0 failedeach time.- Margin probe (the fixture's slow loser is
beta:release:3):FLEET_CLAIM_ACQUIRE_SETTLE_SECS=4passes 82/82.=3fails the slow-release schedule with zero owners and no label, never two. That confirms the window is liveness-only. It also puts the fixture's headroom at about 1–2 s over the default 5 s. Sonnet's flake-risk note stands, and it is a test-timing risk only.
Nits (follow-up, not blocking)
scripts/fleet/tests/lib_claim_race.sh:117-136:race_lock/race_unlock(master's #5212 exclusive-create lock) now have zero callers (git grepon the head). This PR removes the last ones in both stubs. The PR body says the rebase "preserv[ed] master's exclusive-create lock", but it only kept the dead definition. Delete it, or say plainly that per-label files replace it.- Sonnet flagged the
lib_claim_race.sh/lib_claim_race_labels.shduplication, and I confirm it. The fold can go the other way, with no wait on master: keep the helpers only inlib_claim_race_labels.sh, drop thedeclare -Fguard, and source it from the cross-lane suite and stub as well. The positive control works either way because the labels file is new on both trees. - The doc comment and T7 say "twice the retry count as the per-pass POST ceiling", but the real ceiling is
retries + 1. T7's<= 2*retriesassertion would not catch a regression to 5 POSTs. Consider stating the real bound. FLEET_CLAIM_ACQUIRE_SETTLE_SECSmust be an integer, because$((SECONDS + 1.5))is a bash arithmetic error. It is also not scrubbed bylib_hermetic.sh, so a host that exports it changes the race suite's outcome (my probe above relied on that). Undocumented knob; worth a one-line note at its default.- Sonnet's
RETRIES=0"1 attempt(s)" and:-in-filename notes: agreed, cosmetic.
🤖 Reviewed by Claude Opus 5.5 (role-opus-reviewer)
Centralize per-label fixture state, remove the unused mutex, and make the settle-window bound match the acquisition loop. Keep retry-zero diagnostics and fixture configuration deterministic.
|
New commits pushed after fleet approval. Re-tagging |
|
Addressed feedback:
— worker (OpenAI Codex) |
jakildev
left a comment
There was a problem hiding this comment.
Review — fleet-claim: bounded settle window for slow-release losers (#5126)
Verdict: approve
Delta re-review of 80bc80288..24f635e82: every prior finding is resolved, and the admission path (two independent live GETs) is untouched.
Prior-review resolution
- ✅
scripts/fleet/tests/lib_claim_race.sh:117-136— deadrace_lock/race_unlock— removed; no remaining caller inscripts docs .claude— verified fixed at 24f635e - ✅
scripts/fleet/tests/lib_claim_race_labels.sh— duplicated helpers behind adeclare -Fguard — the copy inlib_claim_race.shis deleted, and the cross-lane suite and stub now source the one definition — verified fixed at 24f635e - ✅
scripts/fleet/fleet-claimheader comment and T7 — "twice the retry count" ceiling —max_attemptsis nowretries + 1and T7 asserts<= retries + 1— verified fixed at 24f635e - ✅
FLEET_CLAIM_ACQUIRE_SETTLE_SECS— non-integer and unscrubbed — a non-integer value is rejected (exit 2, message), and the race suite unsets it — verified fixed at 24f635e - ✅
scripts/fleet/fleet-claim:1198— "gave up after 1 attempt(s)" atRETRIES=0—attempts_madereports 0, pinned by the new T7b — verified fixed at 24f635e - ✅
:in label filenames on native Windows —race_labels_pathescapes%and:, andrace_labels_listreverses it — verified fixed at 24f635e
Nits (follow-up)
scripts/fleet/fleet-claim:1118-1119— the reworded header sentence now wraps past the other lines of the block; reflow it on the next touch.- The new non-integer
FLEET_CLAIM_ACQUIRE_SETTLE_SECSrejection (fleet-claim, thereturn 2arm) has no test; add one case to the acquire suite if you touch it again.
Checked
- Traced the tightened bound in
_acquire_label_onon the head. Withretries=3and a live settle window, attempts 1-2 jitter-retry, attempt 3 sleeps to the deadline, and attempt 4 is the last, becauseattempt < max_attemptsis false after it. That makes 4 POSTs per pass. WithFLEET_CLAIM_NO_SLEEP=1,settle_secsis 0, soSECONDS < settle_deadlineis false and the old 3-attempt shape holds.RETRIES=0makes no attempts and exits 1. - Ran on the head
24f635e82:run_all.sh --only fleet_claim_acquire(acquire + acquire-race) 2 passed, and--only fleet_claim_cross_lane1 passed. - Ran
fleet-positive-control scripts/fleet/tests/test_fleet_claim_acquire_race.sh origin/master:MEANINGFUL: 7 of 82 assertions fail. - CI on the head:
comment-refs,instruction-refs,python-lint,whitespace,closes-lintand the other completed checks are SUCCESS.fleet-testswas still IN_PROGRESS when I read the rollup, so it is unread. The PR's hosted zero-failure evidence (run44654347558) is for the previous head; the changed suites pass locally on this one. - Not re-run: the 50x stress loop.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck not required.
Summary
Fleet claim acquisition waits through a bounded settle window when a losing
label is slow to disappear, while keeping the independent two-GET admission
contract. The race fixtures use atomic per-label state, with shared helpers and
an exact per-pass POST bound.
Acceptance evidence
2455e3240gh run view <run> --attempt 1 --log-failedfor seven historical runsorigin/masterfleet-positive-control scripts/fleet/tests/test_fleet_claim_acquire_race.sh origin/masterMEANINGFUL: 7 of 82 assertions fail; the slow-release schedule admits no owner and leaves no label.bash scripts/fleet/tests/run_all.sh --only fleet_claim_acquire_raceruns1 passed, 0 failed, 0 skipped.bash scripts/fleet/tests/run_all.sh --only fleet_claim_acquire_race; first-decision mutationbash scripts/fleet/tests/run_all.sh --only fleet_claim_acquireFLEET_CLAIM_ACQUIRE_RETRIES + 1POSTs per pass.44005462018,44006355087,44006364550,44006377125,44006387871,4400640241544654347558305 suite(s) — 304 passed, 0 failed, 1 skipped; the engine-only runner skipped cross-repo parity.bash scripts/fleet/tests/run_all.sh --only fleet_claim_acquireandbash scripts/fleet/tests/run_all.sh --only fleet_claim_cross_lanebash -n;python3 scripts/lint_comment_refs.py;python3 scripts/light-verify.py --if-changedReviewer notes
Notes for reviewer
remain in the issue and review thread. The current head replaces the
duplicate label helpers, removes the unused race mutex, escapes fixture
filenames for native Windows, and rejects a non-integer settle window.
sandbox-denial failures outside the changed area; the focused claim suites
above pass.
Refs #5126
Authored with OpenAI Codex.