Repository navigation
fix(fleet-agent): agent next claims with a 4-hour lease (#12618) - #12690
Merged
Merged
Conversation
Failing-first oracle for the #12618 fix: a claim taken by fleet agent next must carry --lease-seconds 14400 explicitly (never the queue 2700s default that evaporates mid-task), and the handed-out task must name the lease. Updates the existing claim-argv pin in an_empty_mailbox_falls_to_a_queue_claim.
fleet agent next built its queue claim with no --lease-seconds, so every claim carried the queue default lease of 2700s (45 minutes). Agent work runs 1-3 hours and nothing in the agent-next flow heartbeats, so the lease lapsed mid-task: expire_leases returned the task to the queue, it was re-served to the next caller, and the workers complete was refused as not claimed. Completions were recorded through queue cancel instead, which has no claimed-by guard (epic #1233 criterion 2 is written against exactly that). The claim now carries --lease-seconds 14400 explicitly (AGENT_CLAIM_LEASE_SECONDS: four hours covers the observed 1-3h range with headroom, inside the queues one-day maximum), and the handed-out task names the lease: a lease_seconds field plus the deadline stated in its instructions. Client-side claim parameters only; the broker is unchanged.
Codex Review Summary: ✅ CompletedThis 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. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What
fleet agent nextnow takes its queue claim with an explicit lease —--lease-seconds 14400(AGENT_CLAIM_LEASE_SECONDS, 4 hours) — and the task it hands the worker names that lease: alease_secondsfield plus the deadline stated in the instructions.Why (#12618)
Agent-next built its claim with no
--lease-seconds, so every claim silently carried the queue's 2700s (45-minute) default. Lane work runs 1–3 hours and nothing in the agent-next flow heartbeats, so the lease lapsed mid-task:expire_leasesreturned the task to the queue, it was re-served to the next caller, and the worker'sfleet queue completewas refused as "not claimed by archer". Completions were recorded throughqueue cancelinstead (no claimed-by guard) — the uncertified-delivery shape epic #1233's criterion 2 is written against. Lane AI's drill record on #12618 (comment 7085601397) established there is no identity mismatch: a live claim completes fine; only the lapsed one refuses.The lease size: 4 hours covers the observed 1–3h lane-work range with headroom and stays well inside the queue's one-day maximum (
LEASE_SECONDS_MAX86400). Client-side claim parameters only — the broker is unchanged, no redeploy.Tests (failing first)
New oracle test
a_queue_claim_carries_the_agent_lease_and_the_handout_names_itpins the claim argv and the hand-out; the existing pin inan_empty_mailbox_falls_to_a_queue_claimis updated. On the tests-only commit (71415a0): 80 passed, 2 failed — exactly those two, the recorded claim argv showing no--lease-seconds. With the fix (laptop,nix develop .#fleet, build lock):cargo test --locked -p fleet-agent --lib→ 82 passed, 0 failedcargo test --locked -p fleet-queue --lib --features client,queue-broker→ 467 passed, 0 failedDrill (the built binary, scratch queue
scratch-lane-ai2-12618)agent next: hand-out carrieslease_seconds: 14400and names it in the instructions; the row's lease span is exactly 14400s (claimed 2026-11-22T22:13:15Z,lease_until2026-11-23T02:13:15Z).fleet queue completeby the claiming worker then landed (rc=0) with a verified disposition + evidence reference; the broker's earlier gate refusals on that task confirmed "the task remains claimed" — the claimed-by guard recognized the worker throughout.--lease-seconds 5: after the lapse and a sweep, completion was refused with broker exit 5 — "lane-ai2-drill's lease expired … and the task went back to the queue" — the fleet: queue complete cannot close tasks claimed via fleet agent next (claim worker identity mismatch) #12618 shape, reproduced on demand.What the drill does not wait out: a completion at hour 2. That follows from the row's recorded
lease_until(+14400s) and the broker expiring only leases past it, both observed above.Closes #12618
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.