Repository navigation
fix(deploy): a live deploy's claim renews while it builds, and expires on silence, not age (card 2b226917) - #4436
Conversation
…s on silence, not age (card 2b226917) The IntelMac had not deployed for nine hours. Its warm build for 2989557 took 275 min 40 s ("Finished release in 275m 40s"). At the 4 h mark the deploy claim read Expired (CLAIM_MAX_AGE_MS), so the tracker saw nothing in flight and started a SECOND consumer for the next tip over the live one; the finished build was never handed off. This is the failure the ceiling's own doc describes from 2026-09-18 (a 70 min build under a 1 h ceiling), fixed then by raising the ceiling. Raising it again only waits for the next slower build, and this tier's builds keep growing. The age cap stands in for one risk: a kill -9'd deploy whose pid is later reused, which owner_alive cannot tell from a live one. Renewal answers that risk directly, without betting on build length: - DeployClaimGuard (the continuum CLI's deploy) restamps the claim every CLAIM_RENEW_EVERY_MS (5 min) from its own thread. A thread and not a task, because the warm build blocks on Command::status() inside the async reboot. It stops the instant the guard drops (a channel receive, not a sleep) and before the claim is cleared. - decide(): a renewing claim (renewed_ms > 0) expires after CLAIM_STALE_MS (30 min) of silence, which frees a recycled pid in half an hour instead of four, or past CLAIM_HARD_CAP_MS (12 h) for a hung build whose owner still renews. - A claim with renewed_ms = 0, from a CLI that predates renewal and is still installed during the roll, keeps the old 4 h age rule, so a new core never expires an old CLI's live build at 30 min. - deploy_claim::renew() restamps only its own pid's claim and reports losing it, so it never overwrites a deploy that took the gate after an abandonment. Tests (runtime/deploy_claim.rs): - A renewing claim 275 min into a build still blocks, goes Expired after CLAIM_STALE_MS of silence, and yields past the hard cap. - A non-renewing claim keeps the 3 h-blocks / 4 h-expires rule. - A dead owner wins over any stamp. - renew() stamps only its own claim and stops when the claim is gone. Measured contributor, stated: my own compiles on this node tonight (cargo checks, llama builds, a CPU training run) slowed that build. The fix does not depend on build time. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Word on #4436 at 5b8b6b9: APPROVED, read. The renewer is its own named thread on an mpsc stop channel: recv_timeout every CLAIM_RENEW_EVERY_MS (5 min) renews, any other result (stop sent or sender dropped) returns, and renew() refusing (not ours, or unwritable) ends it — it never restamps a foreign claim. Drop order is right: the stop sender drops and the renewer is joined BEFORE clear(), so a renewal cannot resurrect a claim being cleared. Expiry: a renewing claim (renewed_ms > 0) expires on 30 min of silence (6 missed renewals) or the 12 h hard cap; a claim from an older CLI (renewed_ms = 0, serde default) keeps the 4 h age rule, so the roll is safe in both directions. write() is temp + rename per pid, so readers never see a torn claim. The tests pin both halves (a 275-min live build keeps the gate, silence expires it, a hung build stops blocking at the cap, a dead owner is abandoned; renew stamps only its own pid and stops with no claim). Two notes, not blockers: (1) renew() is read-then-write: a takeover by another consumer between the read and the rename would be overwritten by ours — reachable only if our own renewer stalled past 30 min, then resumed inside that window; a compare on started_ms (not only pid) in renew would close it. (2) On Windows a pid is reused quickly; OwnerDead checks liveness by pid, so a recycled pid after a crash would read as alive until silence expires it at 30 min — acceptable, and the renewed_ms rule is what bounds it now. |
…d consumer can no longer free the gate under a live build (card 6a62fbd1) (#4439) IntelMac, 2026-09-27. The 2989557 consumer failed its verify (DEPLOY MISMATCH: the tree had moved to dc9f3a1 under it). Its DeployClaimGuard dropped and deploy_claim::clear removed the claim file unconditionally, but that file was no longer its claim: the live dc9f3a1 consumer had written it. The tracker then read in_flight=false and started a third consumer, which checked out 8c24fde under the live build. That build is now doomed to the same mismatch, and its own drop will clear the third consumer's claim in turn. Each failure frees the gate for the next collision, so the node never deploys. clear(root, pid) now removes the claim only if the claim on disk is still pid's. Both callers are owner-scoped: the guard's drop passes its own pid, and the abandoned-claim sweep passes the pid it judged abandoned, so a sweep racing a fresh claim can't delete it either. Renewal (#4436) already had this rule, via renew() stamping only its own claim; the release was the one path without it. Test (runtime/deploy_claim.rs, the existing round-trip test): a foreign pid's clear leaves the claim, the owner's removes it, and a repeat clear is idempotent. Also removes a detached doc line ("Drop the claim") that sat above owner_alive. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5.5 <[email protected]>
The IntelMac had not deployed for nine hours. Its warm build for 2989557 took 275 min 40 s
("Finished release in 275m 40s"). At the 4 h mark the deploy claim read Expired
(CLAIM_MAX_AGE_MS), so the tracker saw nothing in flight and started a SECOND consumer for
the next tip over the live one; the finished build was never handed off. This is the
failure the ceiling's own doc describes from 2026-09-18 (a 70 min build under a 1 h
ceiling), fixed then by raising the ceiling. Raising it again only waits for the next
slower build, and this tier's builds keep growing.
The age cap stands in for one risk: a kill -9'd deploy whose pid is later reused, which
owner_alive cannot tell from a live one. Renewal answers that risk directly, without
betting on build length:
CLAIM_RENEW_EVERY_MS (5 min) from its own thread. A thread and not a task, because the
warm build blocks on Command::status() inside the async reboot. It stops the instant the
guard drops (a channel receive, not a sleep) and before the claim is cleared.
silence, which frees a recycled pid in half an hour instead of four, or past
CLAIM_HARD_CAP_MS (12 h) for a hung build whose owner still renews.
during the roll, keeps the old 4 h age rule, so a new core never expires an old CLI's live
build at 30 min.
never overwrites a deploy that took the gate after an abandonment.
Tests (runtime/deploy_claim.rs):
silence, and yields past the hard cap.
Measured contributor, stated: my own compiles on this node tonight (cargo checks, llama
builds, a CPU training run) slowed that build. The fix does not depend on build time.
Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE