You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WaitQueue's #armTimeout comment names a timeoutMs gap that its own callers do not have #666
The doc comment on `WaitQueue##armTimeout` (`src/leasing/wait-queue.ts:365-369`) states:
`markNew` (below) is a public path back to `queued` that arms no timer at all -- a waiter it returns to `queued` sits with no deadline until some other `enqueue` call re-arms it, which is a real gap in `timeoutMs` enforcement for whichever caller uses that path (`LeaseAcquisitionCoordinator`'s own eviction and provision-retry callers, not this module's problem to close on its own).
The named gap does not exist. `markNew` has exactly two callers on `main`, and each re-decides the waiter in the same synchronous decision section, and every branch of that re-decision runs the deadline check:
`#provision`'s first-failure retry (`src/leasing/lease-acquisition-coordinator.ts:849`) returns `true` and calls `#drive` on the next line.
`#continueAfterEviction` (`src/leasing/lease-acquisition-coordinator.ts:1008`) calls `#decide` inside the same `decisions.run`.
`#decide` reaches `markProcessing` (`:886` or `:900`) or `#defer` → `#enqueue`, and `markProcessing` checks the deadline (`wait-queue.ts:254`) exactly as `enqueue` does (`:236`). Both paths were driven to the `markNew` line in unit tests with the armed deadline falling due mid-attempt; in both the caller received `QueueTimeoutError` and the stored request settled `failed` — see #657 for the reproductions.
So the comment asserts a defect in named code that is not there, and tells a later reader the case is known-and-accepted. It should say what is actually true: `markNew` arms nothing because every caller of it decides the waiter again immediately, and the two paths back into `queued`/`processing` both check the fixed deadline.
Confirmed: the defect is the comment, not the code. No caller, test, or future markNew-era branch on main can produce the state the paragraph names, so nothing is wrong in timeoutMs enforcement — and the paragraph asserts a defect that is not there and tells the reader it is known-and-accepted (rule 13: a false claim in a comment is a defect). The fix is comment-only: no test artifact, no bug/666-repro branch — there is no assertion that can fail against a comment, exactly as in #657 ("nothing to reproduce means no failing test").
Reproduction
Comment-only, so the reproduction is the demonstration that the named state is unreachable and both real deadline re-checks are already pinned. On 7bbc22e5:
$ pnpm exec vitest run --project unit src/leasing/wait-queue.test.ts \
src/leasing/lease-acquisition-coordinator.test.ts
Test Files 2 passed (2) Tests 178 passed (178)
Deleting markProcessing's deadline check (wait-queue.ts:254) goes red on a named test — wait-queue.test.ts > WaitQueue > rejects QUEUE_TIMEOUT instead of marking processing past the original deadline — and enqueue's check (:236) is pinned by rejects immediately on a re-enqueue past the original deadline…. Both markNew call sites (lease-acquisition-coordinator.ts:849, :1008) re-decide the waiter inside the same synchronous decisions.run, and every branch that keeps the waiter alive passes one of those two checks; #657 drove both sites with the armed deadline falling due mid-attempt and got callerError: 'QueueTimeoutError', stored failed, queueDepth: 0. The waiter does land back in queued (a processing waiter stays in #waiters) — it just never sits there: the window to the re-check is inside one decision section.
Root cause
src/leasing/wait-queue.ts:365-369 — the Separately: markNew … paragraph of the #armTimeout doc block was written assuming a markNew caller can park the waiter in queued; both callers on main return it to a decision immediately, so the "real gap" it declares does not exist.
Simplest fix
Comment-only, in the #armTimeout doc block (src/leasing/wait-queue.ts), landed verbatim:
Prefix the block's first line with why: (the edit makes comment-lint judge the whole block).
Replace the last paragraph — from Separately: \markNew` (below) is a public paththroughnot this module's problem to close on its own).` — with:
*
* `markNew` arms nothing, and that is safe only because its callers hand the waiter straight
* back to a decision: every branch of that decision that keeps the waiter alive passes
* `#expireIfPastDeadline` (through `markProcessing`) or `enqueue`'s own upfront check first. A
* caller that returned without re-deciding would leave a waiter `queued` with a fixed deadline
* and no timer, and would have to arm here.
Both edits verified on 7bbc22e5: node .agents/scripts/comment-lint.mjs src/leasing/wait-queue.ts exits 0 and the two suites above stay green (178 passed).
Alternatives rejected
Delete the paragraph and nothing else — a bare delete still edits the block, which then fails comment-lint; a rewrite is forced anyway.
Keep the false paragraph as a "warning" — a false why: is a claims finding (rule 13); the honest version warns future callers without inventing a present gap.
A type/structural guard (e.g. markNew arming its own timer) — the contract holds at both callers today and an extra arm would paper over a hypothetical caller that violates it; the rewritten paragraph names the invariant instead.
Activity
V3RON commentedon Oct 17, 2026
Confirmed: the defect is the comment, not the code. No caller, test, or future markNew-era branch on
maincan produce the state the paragraph names, so nothing is wrong intimeoutMsenforcement — and the paragraph asserts a defect that is not there and tells the reader it is known-and-accepted (rule 13: a false claim in a comment is a defect). The fix is comment-only: no test artifact, nobug/666-reprobranch — there is no assertion that can fail against a comment, exactly as in #657 ("nothing to reproduce means no failing test").Reproduction
Comment-only, so the reproduction is the demonstration that the named state is unreachable and both real deadline re-checks are already pinned. On
7bbc22e5:Deleting
markProcessing's deadline check (wait-queue.ts:254) goes red on a named test —wait-queue.test.ts > WaitQueue > rejects QUEUE_TIMEOUT instead of marking processing past the original deadline— andenqueue's check (:236) is pinned byrejects immediately on a re-enqueue past the original deadline…. BothmarkNewcall sites (lease-acquisition-coordinator.ts:849,:1008) re-decide the waiter inside the same synchronousdecisions.run, and every branch that keeps the waiter alive passes one of those two checks; #657 drove both sites with the armed deadline falling due mid-attempt and gotcallerError: 'QueueTimeoutError', storedfailed,queueDepth: 0. The waiter does land back inqueued(aprocessingwaiter stays in#waiters) — it just never sits there: the window to the re-check is inside one decision section.Root cause
src/leasing/wait-queue.ts:365-369— theSeparately: markNew …paragraph of the#armTimeoutdoc block was written assuming amarkNewcaller can park the waiter inqueued; both callers onmainreturn it to a decision immediately, so the "real gap" it declares does not exist.Simplest fix
Comment-only, in the
#armTimeoutdoc block (src/leasing/wait-queue.ts), landed verbatim:why:(the edit makes comment-lint judge the whole block).Separately: \markNew` (below) is a public paththroughnot this module's problem to close on its own).` — with:Both edits verified on
7bbc22e5:node .agents/scripts/comment-lint.mjs src/leasing/wait-queue.tsexits 0 and the two suites above stay green (178 passed).Alternatives rejected
why:is a claims finding (rule 13); the honest version warns future callers without inventing a present gap.markNewarming its own timer) — the contract holds at both callers today and an extra arm would paper over a hypothetical caller that violates it; the rewritten paragraph names the invariant instead.Risk
markNewcaller or makes#decidereturn beforemarkProcessing/#deferfor a waiter with aspec, re-derive the new paragraph — it is a claim about the callers.why:block is now a rule-17 claim: its first sentence restates the fixed-deadline behavior already pinned by the two tests named above.lease-acquisition-coordinator.tsand its test file (A provision planned after #markNew is performed for a waiter markProcessing has just rejected #665); this change touches neither — the diff is one hunk pair inwait-queue.ts.Written by an agent.