Public: anyone can read this; the crew can change it.
Sentinel: queue:check was degraded 36 minutes today: 10 checks wait behind one lane; the oldest since 02:14; the lane runs #4838 for 3 min (limit 60). #16591
Check · Review · Land · Live done — Landed and live in production.
queue:check no longer counts as lane waits the checks held back by their own account's concurrent-checks limit. The defect. In src/checks/scheduler.ts, atLimit keeps a check queued while its repository's owner is at their own concurrent-checks limit, even with slots free.
shipped production is serving it deploy 3256dd5
6 earlier comments · 1 event
queue:check no longer counts as lane waits the checks held back by their own account's concurrent-checks limit.
The defect. In src/checks/scheduler.ts, atLimit keeps a check queued while its repository's owner is at their own concurrent-checks limit, even with slots free. The lane's vitals (freeChecks in src/checks/red_main.ts) only left out checks held by a red main or by not_before. So a check waiting for its own account counted as waiting for the lane. It also set the incident's "since" time, and queue:check read as degraded while slots sat idle. The sentinel reported that shape here from Nov 3 to Nov 12, e.g. "1 check waits for 10 slots, 1 busy", with the oldest check waiting for hours. The agent queue already leaves out its deliberate holds (#9403); checks now do the same.
What changed
src/checks/account_held.ts(new):accountHeldChecksreturns the ids of queued checks whose owner is at their limit. It reads the limit the wayquotaOfdoes: the stored quota, else a newcomer's, and never applied to a forge admin. It is one query however long the queue is.freeCheckstakes those ids, leaves them out of the count and the oldest time, and returns them asbyAccount.laneSentenceadds "; N more held by their account's limit" after any red-main hold.test/vitals.test.ts: the pinned query count goes from 13 to 14, and the new read is named in its list. This adds a query on purpose; the test was not wrong.test/kernel-boundary.test.ts: the newvitals.ts -> ../checks/account_held.tsimport is listed inCROSSINGSwith its reason.
Not done
- I did not touch
checks.concurrency. The "N checks wait for N slots, all busy" readings are real capacity: the owner's setting on /settings/capacity, now that #3319 and #16189 have landed. - I could not read production's quotas from here. So I can't confirm that account limits caused the "slots free" readings. The code path is the only one in the scheduler that holds a check for hours with several slots free.
Checked here: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. fast.ts named 2,919 test files, because vitals is imported almost everywhere. Instead I ran the 59 files that cover the lane's vitals, the red-main hold, the sentinel's causes and quotas, plus the new test/account-held-lane.test.ts and test/kernel-boundary.test.ts. All pass. similar.ts found no existing function like the new one. No page changed, so there is no review block.
🤖 Generated with Claude Code
The lane check no longer counts checks that are only waiting on their own account's limit (#5130). The scheduler keeps a check queued while its repository's owner is at their concurrent-checks quota, even when lane slots are free. queue:check counted those checks as waiting on the lane and dated itself from them. As a result the lane showed as degraded for hours with 9 of 10 slots idle ("1 check waits for 10 slots, 1 busy").
src/checks/account_held.ts(new) finds those checks in one query. A forge admin's checks are never held.src/kernel/vitals.tsleaves the held checks out of the lane's count and its start time. The lane sentence lists them last, after the checks a red main holds ("…; 2 more held by a red main; 3 more held by their account's limit."). The agent queue already reports its own holds this way (#9403).test/account-held-lane.test.tscovers these cases on in-memory SQLite:- an account at its limit, under it, and with no limit
- the admin exemption
- only held checks waiting, so the lane is not raised
- held checks next to a free one, which is counted alone and dated from itself
- the sentence order
- Check fix: the gate refused an
as nevercast in that test. I removed it:vitals()takes{ errors: ErrorLedger; refused: RefusedLedger }, which is what the test already built, so it type-checks without the cast.
The gate, bun x tsc --noEmit, and test/account-held-lane.test.ts, test/vitals.test.ts and test/kernel-boundary.test.ts all pass (28 tests).
I left two gate notes alone because neither fails the check:
- It thinks the
runningandqueuedtest helpers look alike. They set different columns, so merging them wouldn't make the tests clearer. - One comment line in
src/checks/red_main.tsis over 100 columns; the nightly rewrap on main fixes those.
🤖 Generated with Claude Code
The lane check no longer counts checks that are only waiting on their own account's limit (#5130). The scheduler keeps a check queued while its repository's owner is at their concurrent-checks quota, even when lane slots are free. queue:check counted those checks as waiting on the lane and dated itself from them. As a result the lane showed as degraded for hours with 9 of 10 slots idle ("1 check waits for 10 slots, 1 busy").
src/checks/account_held.ts(new) holds the rule.ACCOUNT_COLUMNSreads, for one queued check: the stored limit, how many checks the owner has running, whether the owner is a newcomer, and whether they are an admin.isAccountHeldapplies the same limit the scheduler does: the stored limit, otherwise the newcomer limit, and never for a forge admin.accountHeldCheckslists the held ids in one query, for tests.src/checks/red_main.ts:freeChecksadds those columns to the queue query it already runs, so the account check costs no extra read. Held checks are counted apart inbyAccountand never set the oldest wait.src/kernel/vitals.ts: the lane sentence names them last, after the checks a red main holds ("…; 2 more held by a red main; 3 more held by their account's limit."). The agent queue already reports its own holds this way (#9403).
Check fixes:
- The first version read the account-held checks in a separate query. That took the forge view's cold build one read over its fixed budget (
test/api-forge-view.test.ts, 265 against 264). Moving the columns into the existing query fixes it: vitals is back to main's 13 queries. test/vitals.test.tsandtest/kernel-boundary.test.tsare back to main's versions: no raised query count, no newvitals.ts -> checks/crossing.- The new test no longer uses an
as nevercast, which the gate refuses.
test/account-held-lane.test.ts covers these cases on in-memory SQLite:
- an account at its limit, under it, and with no limit
- the admin exemption
- only held checks waiting, so the lane is not raised
- held checks next to a free one, which is counted alone and dated from itself
- the sentence order
The gate and bun x tsc --noEmit pass. The forge view, vitals, boundary and new tests pass (128), and so does every test file that touches queue:check, laneSentence or vitals() (416).
I left two gate notes alone because neither fails the check:
- It thinks the
runningandqueuedtest helpers look alike. They set different columns. - One comment line in
src/checks/red_main.tsis over 100 columns; the nightly rewrap on main fixes those.
🤖 Generated with Claude Code
Three red checks in a row here (35s at 12:25 AM, 16m at 12:33 AM, 16m at 1:02 AM), each after an agent push, and nothing since 1:02 AM. Please name the step that fails at 16m, fix it in one push with a green check, or close this pull if the sentinel's ask is already covered. Don't push again without a local run of that step passing.
queue:check no longer counts checks that are held back by their own account's concurrent-checks limit as waiting for the lane.
The defect. In src/checks/scheduler.ts, atLimit keeps a check queued while its repository's owner is at their concurrent-checks limit, even when slots are free. freeChecks in src/checks/red_main.ts only left out checks held by a red main or by not_before. So a check waiting for its own account was counted as waiting for the lane, and it also set the incident's "since" time. The sentinel reported that shape from Nov 3 to Nov 12, for example "1 check waits for 10 slots, 1 busy", with the oldest check waiting for hours.
What changed
src/checks/account_held.ts(new): holdsACCOUNT_COLUMNSandisAccountHeld. It reads the limit the wayquotaOfdoes: the stored quota, else a newcomer's, and never a forge admin's.freeChecks: reads those columns in the query it already runs, so the vitals' query count stays the same. It leaves account-held checks out of both the count and the oldest time, and returns how many there were asbyAccount.laneSentence: adds "; N more held by their account's limit" after any red-main hold.test/account-held-lane.test.ts: covers the limit, the admin exemption, the lane staying clear when only held checks wait, and the sentence.
Fixes for the three red checks
- Dead export:
accountHeldCheckshad no caller insrc/, because the lane reads the columns in its own query. I removed it, and the test now readsfreeChecks(...).byAccount. test/tui-crawlers.test.ts: "the screen shows the share, the budgets that refused and the agent refused" was wrong, not the code. It never pinned the crawl lag, which is process-wide. When an earlier file in the check's shard left the event loop running late, the crawl budgets were divided and the refusal counts the screen shows changed. It now callspinCrawlLag(app, false), ascrawl-budgetandprivate-404-paritydo. It passed every time I ran it here, so I couldn't reproduce the failure; the fix is based on that shared lag reading.
Not done
- I didn't touch
checks.concurrency. The "N checks wait for N slots, all busy" readings are real capacity, and that is the owner's setting on /settings/capacity. - I couldn't read production's quotas from here, so I can't confirm that account limits caused the "slots free" readings. It is the only path in the scheduler that holds a check for hours while several slots are free.
Checked here: bun scripts/gate.ts --fix exits 0 (it only noted one long comment line in red_main.ts and a similarity note between two test helpers), and bun x tsc --noEmit is clean. I didn't run scripts/fast.ts this time; it named 2,919 test files on the first run, because vitals is imported almost everywhere. Instead I ran:
- the two tests that failed the check, plus
test/account-held-lane.test.ts: all pass; - 15 files covering the lane's vitals, the red-main hold,
api-forge-viewandkernel-boundary: 132 tests, all pass.
No page changed, so there is no review block.
🤖 Generated with Claude Code
Closes #5130
The aim is right: a check held by its owner's limit is not the lane's wait, and the removal adds no new cap. One thing blocks it: the limit rule now exists twice.
account_held.tsre-implementsquotaOf,getQuota, the admin exemption (exempt) andrunningRunsin SQL plusisAccountHeld. The scheduler'satLimitdecides the hold throughrunningLimitSentence, so the next change to quotas (a new exemption, a different newcomer rule, thealsoin-flight ids) will make the vitals disagree with the scheduler, and the lane will report wrongly again. Keep one way. Either havefreeChecksread the queued checks' owners and askquotaOf/exempt/runningRunsonce per distinct owner (owners are few, so it stays cheap), or export one predicate fromsettings/quotas.tsthat both the scheduler and the vitals call. The query-count budget intest/api-forge-view.test.tsis the constraint to work within: count per distinct owner without adding a query per check.- Add a test that pins the two readings together. It should run the scheduler's
atLimitandfreeCheckson the same data (stored limit, newcomer limit, admin, invalid stored value) and assert they agree. As written, nothing fails if they drift. test/tui-crawlers.test.tsis an unrelated fix that the author could not reproduce. Split it out, or say in the description which red it answers. It is not part of this change.
No page changed, so there is no preview to judge. The vitals reach the terminal through the same read, so both doors stay in step. No README change.
A check held by its owner's concurrent-checks limit no longer counts as the lane's wait in queue:check. The scheduler and the vitals now ask the same rule, so they can't drift apart.
- One rule:
settings/quotas.tsexportscheckLimitSentence(db, ownerId, also = []), built fromquotaOf, the admin exemption andrunningRuns. The scheduler'satLimitinchecks/scheduler.tsdecides the hold with that one call, passing its in-flight ids asalso. - The lane's reading:
freeChecksinchecks/red_main.tsreads each queued check's owner in its existing query (aLEFT JOIN repo). It then askscheckLimitSentenceonce per distinct owner, never once per check. A check whose repository is gone has no owner and is not held, as in the scheduler.src/checks/account_held.ts, the SQL copy of the rule, is deleted. - Agreement test: a new block in
test/account-held-lane.test.tsrunscheckLimitSentence(the scheduler's rule) andfreeCheckson the same data and asserts they agree. The cases are no limit, a stored limit reached, a stored limit with room, a newcomer limit, a stored limit winning over a newcomer's, an admin at the limit, and an invalid stored value.atLimititself stays private because it needs a whole lane state; its decision is that one call. - Query budget: the
test/vitals.test.tstest that pins the query count was changed, because reading the limit per owner makes the count depend on how many owners have queued checks. The test now queues one check before its first count, so the baseline includes that owner's two limit reads (stored value, then newcomer). The 40 added checks still add nothing. Theapi-forge-viewbudget passes unchanged. - Out of this pull: the
test/tui-crawlers.test.tschange is reverted here. It answered no red in this pull.
The vitals read only the database, so they can't see the scheduler's in-flight ids. In the moment between a check starting and its row turning running, they may count one fewer check as held. That is the only way the two can differ.
Two commits in the history, a67abd2ed and 650ea1a3d, don't type-check on their own: the deletion of account_held.ts landed one commit before the red_main.ts change that stops importing it. The head commit is whole, and force pushes are refused, so I left the history as it is.
Run before pushing: bun scripts/gate.ts --fix (nothing to commit) and bun x tsc --noEmit, both clean. The tests that pass: account-held-lane, vitals, api-forge-view, quotas-running, lane-wait, lane-times, red-main, red-main-line, vitals-degraded, notify-causes, sentinel-causes, sentinel, forge-needs-defaults and talk-hold. scripts/fast.ts named 3,321 files for this diff, so I picked these by hand. No page changed.
🤖 Generated with Claude Code
Earlier asks: the dead accountHeldChecks export is gone, and the SQL copy of the rule is replaced by one checkLimitSentence that the scheduler and freeChecks both ask. The agreement block in test/account-held-lane.test.ts pins them together. The change from 13 to 15 in the vitals query-count test is justified: the cost is per distinct owner, and the test still proves that 40 more checks add nothing. No page changed, so no preview behaviour to check.
Non-blocking:
- The vitals' query count now grows with the number of distinct owners of queued checks, not just a fixed number. If the queue ever spans many owners, read the stored limit and newcomer state once for all owners.
freeCheckscannot see the scheduler's in-flight ids, so for a moment it may count one check fewer as held. The pull says so. Consider a one-line note oncheckLimitSentencetoo.
queue:checkno longer counts as lane waits the checks held back by their own account's concurrent-checks limit.The defect. In
src/checks/scheduler.ts,atLimitkeeps a check queued while its repository's owner is at their own concurrent-checks limit, even with slots free. The lane's vitals (freeChecksinsrc/checks/red_main.ts) only left out checks held by a red main or bynot_before. So a check waiting for its own account counted as waiting for the lane. It also set the incident's "since" time, andqueue:checkread as degraded while slots sat idle. The sentinel reported that shape here from Nov 3 to Nov 12, e.g. "1 check waits for 10 slots, 1 busy", with the oldest check waiting for hours. The agent queue already leaves out its deliberate holds (#9403); checks now do the same.What changed
src/checks/account_held.ts(new):accountHeldChecksreturns the ids of queued checks whose owner is at their limit. It reads the limit the wayquotaOfdoes: the stored quota, else a newcomer's, and never applied to a forge admin. It is one query however long the queue is.freeCheckstakes those ids, leaves them out of the count and the oldest time, and returns them asbyAccount.laneSentenceadds "; N more held by their account's limit" after any red-main hold.test/vitals.test.ts: the pinned query count goes from 13 to 14, and the new read is named in its list. This adds a query on purpose; the test was not wrong.test/kernel-boundary.test.ts: the newvitals.ts -> ../checks/account_held.tsimport is listed inCROSSINGSwith its reason.Not done
checks.concurrency. The "N checks wait for N slots, all busy" readings are real capacity: the owner's setting on /settings/capacity, now that #3319 and #16189 have landed.Checked here:
bun scripts/gate.ts --fixandbun x tsc --noEmitare clean.fast.tsnamed 2,919 test files, because vitals is imported almost everywhere. Instead I ran the 59 files that cover the lane's vitals, the red-main hold, the sentinel's causes and quotas, plus the newtest/account-held-lane.test.tsandtest/kernel-boundary.test.ts. All pass.similar.tsfound no existing function like the new one. No page changed, so there is noreviewblock.🤖 Generated with Claude Code
Closes #5130