openai / gpt-6-luna / xhigh / xhigh effort preferred over openai / gpt-6-luna / low / low effort · clear win.
Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.
Reviewed public evidence
Task goal
Review the worker-queue claim and completion lifecycle for stuck work, duplicate execution, or incorrect capacity accounting after retries and worker interruption. Trace an exact plausible failure state through the provided code, identify whether the queue recovers, and recommend the smallest safe change plus focused failure-injection checks.
openai / gpt-6-luna / xhigh / xhigh effort answer
## Conclusion
**A lost `/claim` response can be unrecoverable by idempotent replay while the API-key lease cap is full.** The cap check runs before the code recognizes a replay, even though replay does not add a lease or increment `attempt_count`.
Example: with `MAX_ACTIVE_LEASES_PER_API_KEY=1`, a claim commits job J as running, but its response is lost. The worker retries with the same idempotency key. J itself makes the active count 1, so `/claim` returns 429 at `worker_queue.py:2993–3017`, before replay matching at `3022–3047`. The worker cannot recover J’s claim token that way; J remains running and occupies capacity until its lease expires.
After expiry, this snapshot does **not** itself recover J: the same-worker self-heal only examines a running job with a live lease (`3022–3086`), and fresh selection only selects `pending` jobs (`3105–3116`). Recovery therefore depends on the external lease reaper, whose implementation is outside this packet. Without it, the job remains unclaimable; with it, the job can eventually be requeued and claimed again, charging another attempt.
**Smallest safe change:** identify a valid same-worker idempotent replay before enforcing the active-lease cap, and exempt that replay from the cap. Apply the cap to fresh claims after stale-lease cleanup, so reclaiming a stale lease also stops counting the old running row. Keep the cap for genuinely new leases.
## Other capacity observations
- The municipality rate limit is not an atomic admission check. `/claim` reads blocked municipalities before selecting work (`worker_queue.py:3143–3158`) and records the successful claim only after commit (`3532–3540`). Those operations are separate from the locked check and append in `worker_claim_rate.py:48–80`. Two concurrent claims can both pass a limit of one before either records its claim; a process interruption after commit but before recording also loses that claim from the window. The in-memory state is additionally local to one process and resets on restart (`worker_claim_rate.py:17–30, 113–115`). Treat this as a **best-effort** limiter unless it is made atomic and shared; the packet does not establish the deployment’s process count.
- The API-key lease count is also a check-then-claim sequence (`worker_queue.py:2993–3017`); no per-key serialization is shown for distinct workers. Concurrent requests can both observe capacity before either commits. The optional advisory lock is keyed by `worker_id`, not API key (`2976–2990`), so it does not serialize those requests. If the cap must be strict, serialize or reserve capacity per API key.
- The completion-slot context manager appears to release counts on normal exit and exceptions, and maps wait timeout to 503 (`worker_complete_slots.py:64–112`; `worker_queue.py:5969–5998`). Its counters are process-local; the code describes them as process-wide, not cluster-wide. I found no demonstrated slot leak in this snapshot.
Normal completion retries are better protected: completion first returns terminal jobs idempotently (`worker_queue.py:7825–7920`), and failure/release paths clear lease state before requeueing or terminalizing (`8145–8192`, `8680–8720`). An interrupted worker without a successful release still requires the external reaper to move its expired `running` job back to `pending`.
## Focused checks
1. With cap 1, commit a claim and simulate losing its response; retry with the same worker and idempotency key. Verify replay succeeds, returns the same job, rotates the token, and does not increment `attempt_count`.
2. With an expired running lease, verify the claim endpoint alone does not make it claimable; then inject the reaper and verify it becomes pending and can be claimed.
3. Synchronize two same-municipality claims after the rate-limit read but before either records success; verify whether the configured limit can be exceeded. Also inject interruption between claim commit and rate recording.
4. Saturate completion slots; test waiter timeout/cancellation and exceptions inside the slot, asserting `in_flight_counts()` returns to zero.
5. Commit completion but drop the response; replay `/complete` and verify it returns the terminal result without re-ingesting or changing attempt accounting.
**Uncertainty:** the packet references a lease reaper but does not include it, and does not show worker handling of 429 or deployment topology. The recovery and operational impact of those paths depend on those external behaviors.
openai / gpt-6-luna / low / low effort answer
**Assessment:** The shared claim/complete/fail/release paths mostly contain the expected recovery safeguards: fresh claims increment `attempt_count`, retryable failures clear lease state and requeue until the attempt cap, completion clears lease/token state, and late terminal callbacks cannot resurrect a completed job (claim: `worker_queue.py` lines 3233–3247; failure: 8145–8191; completion: 7713–7732; release: 8656–8678).
**Plausible stuck-work case:** A worker claims a job, then is interrupted without delivering `/fail` or `/release`. The job remains `running`; the per-API-key capacity query counts it while `leased_until > now` (lines 2993–3018). It is not immediately reclaimable because the pending selection requires `status == "pending"` (3110–3120). This is a temporary stall, not a permanent one: the claim path has same-worker stale-lease recovery after 150 seconds without heartbeat (3023–3079), and the packet’s endpoint documentation describes a lease reaper. However, the reaper implementation is outside this snapshot, so its timing and treatment of other workers’ abandoned leases cannot be verified here. Capacity accounting self-excludes the abandoned lease once it expires; the claim path’s API-key cap does not itself recover it.
**Smallest safe recommendation:** Verify that the out-of-packet reaper reliably changes *any* expired `running` job to `pending` (or terminal-failed at the retry ceiling), clears all lease fields, and does so atomically. If it does not, fix that transition rather than changing the active-lease count: counting only live leases is consistent with the stated cap, and counting expired leases would make abandoned work consume capacity indefinitely.
**Focused failure-injection checks:** Interrupt a worker after claim with no heartbeat or callback; assert recovery after the intended stale/expiry threshold, eventual reclaim by a different worker, and correct API-key active-lease counts before and after expiry. Also inject retryable `/fail`, graceful `/release`, attempt-ceiling exhaustion, and a lost `/complete` response followed by `/fail` or `/release`; assert retries preserve the claim-charged attempt count, terminal states stay terminal, and capacity is released. The complete-slot context manager uses `finally` to decrement counters on cancellation/exception (worker_complete_slots.py lines 65–110); test cancellation while holding a slot and timeout while waiting to detect accounting leaks.
**Alternatives / uncertainty:** Same-worker stale recovery is not a general reaper: another worker’s abandoned job is not selected while it remains `running`. The packet references a reaper but does not include its code, so it cannot establish whether that gap is actually covered. No defect in the supplied complete-slot counter’s normal exception/cancellation cleanup is evident.
Primary judge's stated reason
A provides a clear task-relevant advantage: maintainers can reproduce and fix a lost-response recovery failure entirely within the supplied code while preserving admission limits for fresh leases. This supports a clear preference, not merely a forced slight preference; it does not establish that the proposed change was implemented or tested.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: bc72a6bd-1168-4bad-b5a9-fbf90203e5d7. Pair: brp1_0a82aa8284dc661db501a748976cc05df8b6b8a4bda0425705634022bb96ea06. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.