Repository navigation
Settle ambiguous lease requests and keep showing launch progress - #43
Conversation
A refusal now lets the client ask the next cloud peer only when it answers the request's first attempt; a 404 from a cloud peer that dropped its offers counts as one. A request whose answer was lost and whose retry did not bring the lease back is withdrawn, since the cloud peer may hold a launching lease for it. Leases number their progress lines, so a client following a launch keeps printing new lines after the bounded tail fills. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
Generated by Claude Code |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1597348425
ℹ️ 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".
A withdrawal can overtake a lost acquire attempt still on its way to the cloud peer. The broker now remembers, in memory and bounded by count and age, requests withdrawn before any lease was handed to them, and refuses them with 410 if they arrive later, so they start no lease nobody waits for. Clients count 410 as a refusal. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60ed203074
ℹ️ 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".
One caller's flood of withdrawals for unknown requests could evict another owner's live record of a withdrawn request. Each owner now has its own cap, and evictions stay within that owner's entries; the number of owners is capped separately so memory stays bounded. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccfe22a10e
ℹ️ 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".
Owners include whoever the tailnet policy grants the lease action, which the runner does not bound, so any eviction of a live record could be forced by others. The record now drops entries only once they expire. A withdrawal that finds no room (128 per owner, 4,096 in all) is refused with 503 instead of being acknowledged; the client asks again within its withdrawal budget and otherwise reports that the lease may exist. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
An aborted first attempt's handler can still be running when the retry arrives, so the counter they share must be atomic. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c350d5345
ℹ️ 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".
| if l == nil { | ||
| // The request may still be on its way: unless it is remembered, | ||
| // the withdrawal settles nothing. | ||
| full := requestID != "" && !b.withdrawn.add(owner, requestID, time.Now()) |
There was a problem hiding this comment.
Tombstone requests even when their first lease exists
Fresh evidence beyond the earlier tombstone fix is this l == nil guard: if the first POST created a lease but lost its response, a timed-out retry may still be executing when DELETE finds that first lease. The withdrawal removes the request without recording a tombstone, so the delayed retry can subsequently enter Acquire; it can rejoin a shared launch or, after the first lease starts releasing and capacity permits, create another paid lease after the client has exited. Record the withdrawn request even when a matching lease was found, with ordering that prevents a concurrent acquire from re-adding it.
Useful? React with 👍 / 👎.
Before: if a cloud peer had dropped its offers, a lease request it answered with 404 stopped placement instead of moving on to the next cloud peer. If the answer to a lease request was lost and the retry was refused (for example with 403), the client asked another cloud peer while the first one might already be launching a machine for it. If both attempts went unanswered, the client gave up without withdrawing, so a launch it never heard about kept running until idle. Once a launch printed more than 100 progress lines, the client stopped showing new ones.
After: a 404 from a cloud peer with no offers is a refusal like 403, 412 and 429, and the next cloud peer is asked. A refusal only counts when it answers the request's first attempt. When an attempt's answer was lost and the retry does not bring the lease back, the run withdraws the request (which cancels a launch no other run waits for), says what became of it, and asks no other cloud peer. Launch progress keeps printing however long the launch log grows.
How:
AcquireLeasemarks a failure that follows an unanswered attempt as uncertain (client.LeaseUncertain), whichLeaseRefusednever treats as a refusal;leaseRunnerwithdraws on it.WithdrawLeaseRequestreads a 404 as "no lease recorded for this request". Leases carry an internalprogress_seq(the broker counts every progress line it adds), andfollowLeaseprints the lines numbered after the last one it showed instead of tracking the tail's length. Nothing changes for runs without--whereor with no cloud peers, and there are no extra round trips on a successful acquire. A withdrawal request (up to 15s) is added only after an acquire whose answer was lost.Closes items in #33: "A broker that dropped its offers stops placement", "A 403 on a retried acquire counts as a safe refusal", "No withdrawal after an ambiguous acquire failure", "progress tail rotation" / "Launch progress stops showing after 100 lines".
🤖 Generated with Claude Code
https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
Generated by Claude Code