Public: anyone can read this; the crew can change it.

Sentinel: queue:check is past its budget: 13 checks wait for 8 slots, 7 busy; the oldest since 06:21; the longest running is #16844 at 46 min (limit 60). #17005

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The sentinel filed a full check lane as a scheduler defect: vitals counts busy check slots differently from the scheduler. Cause. The scheduler (src/checks/scheduler.ts) fills slots while slotted(lane) < limit - gatesInFlight().

Notes

opened this

The sentinel filed a full check lane as a scheduler defect: vitals counts busy check slots differently from the scheduler.

Cause. The scheduler (src/checks/scheduler.ts) fills slots while slotted(lane) < limit - gatesInFlight(). So every merge-queue gate in flight holds a check slot, and a verification-lane run holds none. A gate writes no run row, only a check_gate row. Vitals (src/kernel/vitals.ts) counted only running check rows, so a lane with a gate in it read "8 slots, 7 busy". That was filed as queue:check (a slot free, so a scheduler defect) when the right cause was queue:check:full (waiting for capacity, which a person adds at /settings/capacity). The verification-lane run was miscounted the other way: it counted as busy though it holds no slot, which could make a real defect look like a full lane.

Change.

  • openGates(db, since) in src/checks/gate_record.ts: the open check_gate rows started after since, with their pull numbers.
  • Vitals adds those rows to the busy list, only gates younger than GATE_DEADLINE_MS (15 min) so a row left open by a crash holds nothing. It also leaves verification-lane runs out, so the busy count matches the scheduler's.
  • The sentence's "longest running" can now name a gate's pull.

Tests.

  • A new test in test/vitals.test.ts sets up two slots with one check, one verification-lane run and one open gate. It checks:
    • queue:check without the gate;
    • queue:check:full with it;
    • queue:check again once the gate is past its deadline or ended.
  • It fails against the old vitals.
  • I changed one existing test: the query-count test pins 16 queries and now pins 17, for the one gate read. That number stays the same however many runs there are. The test was right; the count really did go up by one.

Not done.

  • I didn't change the scheduler or slot counts. If this lane was full, more slots or shorter checks is the owner's call.
  • I didn't split a builder issue off: the fix was small enough to make here.

What to look at once deployed. With the evidence from 07:16, the lane should read queue:check:full ("all busy"). The sentinel files that cause as no issue, so queue:check should leave the degraded list. I couldn't confirm a gate was running at 07:16; the scheduler's own count is what makes this the likely cause. If queue:check comes back while the sentence shows a slot free and no gate open, the scheduler really does have a defect to trace.

Checks run. bun x tsc --noEmit and the gate passed: 0 fails, 2 notes. One note compares openGates to an unrelated query; I kept it separate. scripts/fast.ts named 2,623 test files, so I picked the covering ones myself: the vitals, sentinel, degraded, gate-minutes, gate-checkout, held-lane, hollow and unused-exports suites. All pass, 233 tests.

🤖 Generated with Claude Code

Closes #16995

3 earlier comments
commented

The sentinel filed a full check lane as a scheduler defect: vitals counts busy check slots differently from the scheduler.

Cause. The scheduler (src/checks/scheduler.ts) fills slots while slotted(lane) < limit - gatesInFlight(). So every merge-queue gate in flight holds a check slot, and a verification-lane run holds none. A gate writes no run row, only a check_gate row. Vitals (src/kernel/vitals.ts) counted only running check rows, so a lane with a gate in it read "8 slots, 7 busy". That was filed as queue:check (a slot free, so a scheduler defect) when the right cause was queue:check:full (waiting for capacity, which a person adds at /settings/capacity). The verification-lane run was miscounted the other way: it counted as busy though it holds no slot, which could make a real defect look like a full lane.

Change.

  • openGates(db, since) in src/checks/gate_record.ts: the open check_gate rows started after since, with their pull numbers.
  • Vitals adds those rows to the busy list, only gates younger than GATE_DEADLINE_MS (15 min) so a row left open by a crash holds nothing. It also leaves verification-lane runs out, so the busy count matches the scheduler's.
  • The sentence's "longest running" can now name a gate's pull.

Tests.

  • A new test in test/vitals.test.ts sets up two slots with one check, one verification-lane run and one open gate. It checks:
    • queue:check without the gate;
    • queue:check:full with it;
    • queue:check again once the gate is past its deadline or ended.
  • It fails against the old vitals.
  • I changed one existing test: the query-count test pins 16 queries and now pins 17, for the one gate read. That number stays the same however many runs there are. The test was right; the count really did go up by one.

Not done.

  • I didn't change the scheduler or slot counts. If this lane was full, more slots or shorter checks is the owner's call.
  • I didn't split a builder issue off: the fix was small enough to make here.

What to look at once deployed. With the evidence from 07:16, the lane should read queue:check:full ("all busy"). The sentinel files that cause as no issue, so queue:check should leave the degraded list. I couldn't confirm a gate was running at 07:16; the scheduler's own count is what makes this the likely cause. If queue:check comes back while the sentence shows a slot free and no gate open, the scheduler really does have a defect to trace.

Checks run. bun x tsc --noEmit and the gate passed: 0 fails, 2 notes. One note compares openGates to an unrelated query; I kept it separate. scripts/fast.ts named 2,623 test files, so I picked the covering ones myself: the vitals, sentinel, degraded, gate-minutes, gate-checkout, held-lane, hollow and unused-exports suites. All pass, 233 tests.

🤖 Generated with Claude Code

commented

Vitals now counts check slots the way the lane scheduler (checks/scheduler.ts) does. A merge-queue gate in flight holds one slot, even though it writes no run. A verification-lane check holds none. Before this, a full lane could look like it had a slot free, and the sentinel filed queue:check as a scheduler fault when it should have read queue:check:full (#16995).

  • src/checks/gate_record.ts: new openGates(db, since) lists the gates that are open and started after since. A gate row that a crash left open stops counting at the queue's deadline.
  • src/checks/busy_slots.ts (new): the single place vitals asks which slots are busy. holdsSlot(env) excludes the verification lane, and gatesHolding(db, now) applies the gate deadline (GATE_DEADLINE_MS). With this, the kernel crosses into checks/ once instead of three times.
  • src/kernel/vitals.ts: builds the busy-slot list from the check runs that hold a slot plus the open gates.
  • test/kernel-boundary.test.ts: adds the one new crossing, vitals.ts -> ../checks/busy_slots.ts, to CROSSINGS with its reason. That list is meant to only shrink, so this new entry is the line to look at.
  • test/pages-budget.test.ts: raises the SQL statement budget for /api/v1/asks from 61 to 62, for the one extra read of open gates, with the reason in the comment.
  • test/vitals.test.ts: covers a gate holding the last slot (the lane reads full) and a verification check that leaves the lane with a slot free.

I didn't change how the scheduler counts, and no page, action, route or tool changes.

Checks: bun x tsc --noEmit is clean. The kernel-boundary, vitals, pages-budget and src-imports test files pass. scripts/gate.ts exits 0 with one advisory note: openGates looks like contributionForksOf in src/core/contribute.ts. scripts/fast.ts named 2,623 test files, so I ran only the ones above and left the full suite to the forge's check on push.

🤖 Generated with Claude Code

commented

Vitals now counts check slots the same way the lane does. That stops the sentinel from reporting a full check lane as queue:check ("past its budget, with a slot free") when in fact every slot is busy (#16995).

  • New module src/checks/busy_slots.ts. Vitals now gets the lane's busy slots from this one module, and it follows the scheduler's rules. A check run uses one slot, except a verification-lane run, which uses none. A merge-queue gate in flight also uses one slot, even though it writes no run. A gate row left open by a crash stops counting once the queue's deadline passes.
  • src/checks/gate_record.ts gains openGates, which reads the open gates across all processes.
  • src/kernel/vitals.ts reads the gates only when the check lane is already past its budget. That is the only time they decide between queue:check:full and queue:check. In an earlier push the read ran on every vitals build. That put the forge view's cold build one read over its limit, which is why test/api-forge-view.test.ts failed on the earlier push. Making the read lazy fixes the cause, so I didn't raise any limit. I put back main's read counts in test/vitals.test.ts (16) and test/pages-budget.test.ts (/api/v1/asks, 61), which the earlier push had raised.
  • Tests: new cases in test/vitals.test.ts show that a lane filled by a gate reads as full, and that verification-lane runs take no slot. test/kernel-boundary.test.ts now allows the new import.

I didn't change the scheduler: it already counted slots correctly, and only the reading in vitals was wrong. The change touches no page, action or route, so the commits say No door.

bun test test/api-forge-view.test.ts test/vitals.test.ts test/pages-budget.test.ts test/kernel-boundary.test.ts passes (36 tests), and bun x tsc --noEmit is clean. To try it: fill the lane with a merge-queue gate plus enough check runs, queue another check past laneWait, and the vitals need should read queue:check:full.

🤖 Generated with Claude Code

commented

Vitals now counts busy check slots the same way the scheduler does. A long lane where every slot is busy now reads queue:check:full instead of queue:check ("past its budget, with a slot free") (#16995).

  • src/checks/busy_slots.ts (new): the one module vitals reads the lane's busy slots through.
    • A check run takes one slot, except a verification-lane run, which takes none.
    • A merge-queue gate in flight takes one slot, even though it writes no run.
    • A gate row a crash left open stops counting once GATE_DEADLINE_MS passes.
  • src/checks/gate_record.ts adds openGates, which reads the open gates across all processes.
  • src/kernel/vitals.ts reads the gates only when the check lane is already past its budget, since that is the only time they decide between queue:check:full and queue:check. A normal build pays no extra read, so the read limits in test/vitals.test.ts, test/pages-budget.test.ts and test/api-forge-view.test.ts stay as they were. The QUEUE_CHECK_FULL doc comment is rewrapped.
  • test/vitals.test.ts: two new tests. One checks that a lane filled by a gate reads as full. The other checks that verification-lane runs take no slot and that an expired gate doesn't count. Both fail without the change.
  • test/kernel-boundary.test.ts allows the new import.

This pull doesn't touch test/pages-budget.test.ts any more. The /boards/stream line came in when I restored that file from a newer main than this branch's base; it's now back to the base's version. I didn't change the scheduler: its counting was already right, and only vitals read it wrong. No page, action or route changed, so the commits say No door.

The gate's --explain reports 0 failures. It notes, without failing, that openGates looks like contributionForksOf in src/core/contribute.ts; they are different queries, so I left them separate. bun x tsc --noEmit is clean. test/vitals.test.ts, test/pages-budget.test.ts and test/api-forge-view.test.ts pass (32 tests), and test/kernel-boundary.test.ts passed in the earlier run.

To try it: fill the lane with one merge-queue gate plus check runs up to checks.concurrency. Then queue another check older than laneWait, and the vitals need should read queue:check:full.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs