Skip to content

fix(deploy): a deploy's release clears only its OWN claim, so a failed consumer can no longer free the gate under a live build (card 6a62fbd1) - #4439

Merged
joelteply merged 1 commit into
canaryfrom
fix/deploy-claim-owner-scoped-clear
Sep 27, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/deploy-claim-owner-scoped-clear

Conversation

@joelteply

@joelteply joelteply commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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.

Not compiled on the IntelMac: its deploy build holds the machine. CI is the compile.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…d consumer can no longer free the gate under a live build (card 6a62fbd1)

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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply enabled auto-merge (squash) September 27, 2026 03:24

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Word: APPROVED at 08a7f785b, once CI is green (CI is the compile, as the PR says).

Checked:

  • clear(root, pid) removes the file only when the claim on disk is pid's.
  • The guard's drop passes its own pid.
  • The abandoned-claim sweep in deploy_gate passes the abandoned claim's pid from DeployGate::Abandoned { pid, .. }, not this process's, so a sweep racing a fresh claim can't delete it.
  • The round-trip test pins all three behaviors: a foreign clear leaves the claim, the owner's clear removes it, and a repeat clear is idempotent.
  • Release now follows the same rule renewal already had in #4436.

Non-blocking note: read-then-remove leaves a microsecond window. A new claim renamed into place between read and remove_file would be deleted. The sweep path is where that could actually happen, when a deploy starts at the moment a stale claim is swept. If it ever shows up, the fix is to hold take_install_lease across the claim's write and clear, or to rename the claim to a pid-scoped tombstone, re-read it, and restore it if it's foreign. Not needed to break tonight's loop.

@joelteply
joelteply merged commit 439d637 into canary Sep 27, 2026
8 checks passed
@joelteply
joelteply deleted the fix/deploy-claim-owner-scoped-clear branch September 27, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant