GeezerVison is showing github.com — fix(fleet-queue): claim by explicit id; pin claim lease + lane storage (#7617) by developing-today[bot] · Pull Request #7882 · developing-today/code
Conversation
developing-today
Bot
commented
Nov 9, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #7617
What was wrong
verb_claim (Turso queue broker) claimed a task via a subquery, then re-read the result as "the newest claimed row for (queue, worker_id)". Every lane shares worker_id = repo-worker-code, so under concurrent claims that re-read can return another lane's just-claimed task:
The lease contract was also one literal away from the same class of bug: 2700 (claim default) and 900 (heartbeat extension default) were bare literals in different verbs.
Fix
- Pick the candidate id first, claim THAT row with a conditional
UPDATE ... WHERE id = ? AND status IN ('queued','parked') (status re-check keeps the claim atomic; a lost race re-picks), read the claimed row back by id. The leases row insert now provably names the same task the caller is handed.
- Named constants
CLAIM_DEFAULT_LEASE_SECONDS = 2700 and HEARTBEAT_DEFAULT_EXTEND_SECONDS = 900; claim_lease_until() is the single source for the stored lease_until (tasks row and leases row), computed from one clock read with claimed_at.
Regression tests (oracle: #7617 acceptance)
claim_lease_is_the_requested_lease_not_the_heartbeat_default — stored lease is claimed_at + requested lease (2700), never + the 900 s heartbeat default; the two defaults are pinned distinct.
claim_lane_argument_is_stored_verbatim — the lane passed at claim reaches the UPDATE verbatim; a lane-less claim stores NULL, never another lane's id.
Verified on the laptop: cargo test -p fleet-queue --features queue-broker --lib claim_ → 10 passed incl. both new tests; full turso_queue suite 20 passed. Queue task 14226.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
#7617)
verb_claim claimed via a subquery and re-read the result as the newest claimed row for (queue, worker_id). Every lane shares worker_id repo-worker-code, so under concurrent claims that re-read could return another lane's just-claimed task: the caller was handed a row stamped with a foreign lane_id (live repro 2026-11-08: lane code-u claims returned tasks stamped code-e and code-t), worked a task it did not own, and the claim guard could quarantine a live foreign claim. This is the writer that can release/displace a live claim named in #7617, alongside the lease contract confusion.
- Pick the candidate id first, claim THAT row with a conditional UPDATE by id (status re-check keeps it atomic; a lost race re-picks), and read the claimed row back by id.
- Split the lease defaults into named constants: CLAIM_DEFAULT_LEASE_SECONDS=2700 for claims, HEARTBEAT_DEFAULT_EXTEND_SECONDS=900 for heartbeats, with claim_lease_until() as the single source for the stored lease_until on both the tasks and leases rows.
- Regression tests (oracle: #7617 acceptance): claim_lease_is_the_requested_lease_not_the_heartbeat_default and claim_lane_argument_is_stored_verbatim.
Tests: cargo test -p fleet-queue --features queue-broker --lib claim_ -> 10 passed incl. both new tests; turso_queue suite 20 passed.
coderabbitai
Bot
commented
Nov 9, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Important
Review skipped
Bot user detected.
To trigger a single review, invoke the @coderabbitai review command.
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e33b74e6-481d-4b23-966c-4e0252c438c7
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…stant (#7617)
Review catch on PR #7882: between the pick SELECT and the claim UPDATE, the picked row could be parked into the future (or hit its attempts cap); the UPDATE must re-verify status/attempts/not_before for the picked id, not just status membership.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 9, 2026
This was referenced Nov 10, 2026
This was referenced Nov 21, 2026
Reviewers
dezren39
Awaiting requested review from dezren39
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|