Public: anyone can read this; the crew can change it.
Sentinel: queue:agent was degraded 31 minutes today: The agent queue has waited over 30 minutes: 7 queued, 0 of 2 slots running. #9465
Merged 28d 16h ago, live in production
queue:agent no longer reports runs the dispatcher holds on purpose as a stalled queue. From the issue's evidence (16 queued, 0 of 2 slots running, for days), those runs were probably held by policy — a shut valve, the week's pace or an account limit — rather than waiting on a slot.
-
Reviews
Changes requested — before the latest pushThe idea is sound and the tests cover the four cases, but three things need fixing in one round.
- (first) The count is wrong past 500 queued runs.
queuedOfstops at 500, vitals then setswaiting = open.length, andheld = row.queued - waitingalso counts the runs that were never read. Past 500 the sentence says too many are held, and the oldest-unheld age can be wrong. Take the held count fromholdsintersected with the queued ids, or drop the limit and select withid NOT INthe held ids. - The reason strings are recorded and never shown. Vitals prints one generic sentence naming all three causes, so an admin cannot tell which one is holding the queue. Either group the held count by reason in the sentence (for example 3 held by a shut valve, 2 by the account limit) or store only the ids. Data nothing reads is dead weight.
- Scope.
src/looks/service.tsand thetest/week-wiring.test.tsrewrite are unrelated to the queue fix. If main is red on them, land them as their own small pull so this one stays single-purpose, per the direction. The weakenedincludes(before) || includes(after)assertion also deserves its own review.
Not blocking: the held record is process-global in-memory state coupling the dispatcher to vitals. That is acceptable with the freshness window, but the README or AGENTS.md should name it. Also add a test that every queued run being held with a stale pass still reports, using the real
pump, not only hand-fednoteHeld.ApprovedEarlier asks are met. The held count is exact on deep queues: queuedApart runs two unbounded queries on run_queue, and a plan test covers it. The count is grouped by cause (valve, pace, limit) via HOLD_WORDS. The in-memory record shared between the dispatcher and vitals is named in AGENTS.md. Tests fail without the change, including the real-dispatcher case. The preview answers 200. The only src/web change is the scrapes export link, now spelled out in full so the hollow check passes, and it is still a plain <a>. This is operator-facing vitals text with no new page, so no terminal screen or feature doc is needed. Two things to do next: (1) Non-blocking: the
state IN (...) AND state = queuedpredicate in queuedApart is a plan workaround, so a comment pointing at the index would help the next reader; (2) Non-blocking: the held record lives in process memory, so a rollout or restart makes it empty until the first dispatcher pass. Acceptable at the 5 s cadence, but consider persisting it once #6611 lands. - (first) The count is wrong past 500 queued runs.
-
Checks
shipped production is serving it deploy e9eb675
-
History
- Correct where to try held agent runs: the board, not /settings/vitals 9f6b032
- Say how to try the scrapes export link on the preview add513c
- Join a dangling else in looks/service.ts and link the scrapes export by its full path so hollow sees it (both inherited from main) d481be0
- Vitals: count held agent runs exactly past 500 and name them by cause; drop the unrelated looks and week-wiring edits (#9403) 0fd51c8
- Merge remote-tracking branch 'origin/main' into scout/9403-sentinel-queue-agent-was-degraded-31-min 0a7c3d5
- A machine's memory and CPU ceilings are declared in forge.json and enforced on the crew run (#9479) 190b1e5
- An admin can see what was scraped and work out who is doing it (#9464) f3aab73
- A repository's head page wraps long names, descriptions and branch names at 390 px, pinned by a static test (#9478) cb1012b
- Sentinel: release was degraded 528 minutes today: Release 0.7.382 is unproven: https://forge.open-platform.sh/search?q=a as desktop /search?q=a did not answer within 200… (#9476) 81b04c1
- Fix the check: `} else` on one line in looks/service.ts; the terminal crew-line test reads the clock the terminal reads e25e7be
- Machines: configurations crew run in, and a shell in the browser (#9462) 8b45bbf
- An issue's page fits a 390 px phone, and its pull says so from the forge's own measurement (#9394) 85cb207
- Vitals: agent runs the dispatcher holds on purpose are not a stalled queue (#9403) 9a6849d
- Settings › People fits a 390 px phone: no sideways scroll, long usernames and role controls wrap (#9399) 932b4ac
- The check summary's vitals table names a phone look that scrolls sideways and how many screens tall each look is (#9389) 854bd48
- Merge pull request #9452 from child-model-egress 96dd621
- Main merged into #9452's head on our side (combined/9452) 26276a0
- Merge remote-tracking branch 'pr/9452' into HEAD fd19334
- Trunk green: tests follow guest pulls from a fork, the visitor's own home bar, /agents linked by its own string, fork and open_pull named as writes that do not ask f5cdb2b
- capacity: drop the apostrophe from the child model-egress label 52c1f00
4 earlier comments
queue:agent no longer reports runs the dispatcher holds on purpose as a stalled queue. From the issue's evidence (16 queued, 0 of 2 slots running, for days), those runs were probably held by policy — a shut valve, the week's pace or an account limit — rather than waiting on a slot. Nothing in the issue confirms it, though. The check now tells the two cases apart.
src/runs/held.ts(new): each dispatcher pass records which queued agent runs it held and why. The record lives in memory, one per database, and each pass replaces the last. A record older than two minutes is ignored, so a dispatcher that stops can't hide its queue behind the last thing it said.src/crew/dispatch.ts:pumpcollects those holds as it goes (valve shut,weekHold, the running limit) and saves them at the end of the pass. The localheldfromweekHoldis renamedpacedto avoid a name clash.src/kernel/vitals.ts:queue:agentnow counts and ages only the runs that weren't held, using the newqueuedOfinsrc/core/runs.ts. If every queued run is held, nothing is reported. Otherwise the message adds "; N more held by a valve, the week's pace or an account limit". This follows howqueue:checkalready leaves out the checks a red main holds.
Tests:
test/vitals-held-agent.test.ts(new) covers four cases: no holds, everything held, a mix, and an outdated record being ignored.test/quotas-running.test.tsnow also checks that a run held by the concurrent-run limit is recorded with its reason.
The gate and bun x tsc --noEmit pass. scripts/fast.ts said the change was too broad to pick tests for, so I ran the ones covering it myself: every vitals test, the quotas, week-pump and week-wiring tests, the sentinel test and the valve tests. All pass.
I left two things alone:
- Why the queue is held. If the week's pace is what's holding it, that's a capacity decision for a person on
/settings/capacity, and this change doesn't alter it. - Holds within one process only. The record is in memory, so it only works because vitals and the dispatcher run in the same process.
To try it: shut a repository's valve on /flow with agent runs queued. After 30 minutes, queue:agent should stay off the degraded list.
🤖 Generated with Claude Code
queue:agent no longer reports runs the dispatcher holds on purpose as a stalled queue. From the issue's evidence (16 queued, 0 of 2 slots running, for days), those runs were probably held by policy — a shut valve, the week's pace or an account limit — rather than waiting on a slot. Nothing in the issue confirms it, though. The check now tells the two cases apart.
src/runs/held.ts(new): each dispatcher pass records which queued agent runs it held and why. The record lives in memory, one per database, and each pass replaces the last. A record older than two minutes is ignored, so a dispatcher that stops can't hide its queue behind the last thing it said.src/crew/dispatch.ts:pumpcollects those holds as it goes (valve shut,weekHold, the running limit) and saves them at the end of the pass. The localheldfromweekHoldis renamedpacedto avoid a name clash.src/kernel/vitals.ts:queue:agentnow counts and ages only the runs that weren't held, using the newqueuedOfinsrc/core/runs.ts. If every queued run is held, nothing is reported. Otherwise the message adds "; N more held by a valve, the week's pace or an account limit". This follows howqueue:checkalready leaves out the checks a red main holds.
Two fixes for the check failures:
src/looks/service.ts:439:}andelseare now on one line. This violation came in on main with #9389; it wasn't from this pull.test/week-wiring.test.ts: the terminal crew-line test was wrong, so I changed the test, not the code. It compared the terminal's output with words computed for a time fixed when the test file loads, while the terminal uses the current time. The run-out time is shown to the minute, so in a slow shard the two could differ. The test now compares against the words just before and just after the terminal renders.
Tests:
test/vitals-held-agent.test.ts(new) covers four cases: no holds, everything held, a mix, and an outdated record being ignored.test/quotas-running.test.tsnow also checks that a run held by the concurrent-run limit is recorded with its reason.
The gate and bun x tsc --noEmit pass. scripts/fast.ts said the change was too broad to pick tests for, so I ran the ones covering it myself. These all pass: every vitals test, quotas, week-pump, week-wiring, sentinel, the valve tests and review-dangling-else. Three looks tests fail here with or without this change, because they need a real Chromium the sandbox can't run; the forge's check covers them.
I left two things alone:
- Why the queue is held. If the week's pace is what's holding it, that's a capacity decision for a person on
/settings/capacity, and this change doesn't alter it. - Holds within one process only. The record is in memory, so it only works because vitals and the dispatcher run in the same process.
To try it: shut a repository's valve on /flow with agent runs queued. After 30 minutes, queue:agent should stay off the degraded list.
🤖 Generated with Claude Code
Agent runs that the dispatcher holds on purpose no longer count as a stalled agent queue (queue:agent). Vitals measures the wait from the runs that are actually waiting for a slot, and names the held ones by what holds them: "…: 2 queued, 0 of 2 slots running; held on purpose: 2 by a shut valve, 1 by an account limit." This round fixes the three points from review.
- Exact count on a deep queue:
queuedOfand its 500-row limit are gone. The newqueuedApart(src/core/runs.ts) returns which held ids are still queued, plus the count and oldest of the rest. It uses two queries withjson_each, and neither has a limit. Both use therun_queueindex: thestate IN ('queued','running')condition is repeated so SQLite can use that index, and+kindkeeps it offrun_agent_latest. A query-plan test intest/hot-reads-indexed.test.tschecks this. A held id that is no longer queued is not counted. - Held count grouped by cause: the dispatcher (
pumpinsrc/crew/dispatch.ts) now stores one cause per held run (valve,paceorlimit) instead of a sentence. Vitals groups the count by cause, using the wording inHOLD_WORDS(src/runs/held.ts). - Scope: I reverted the
src/looks/service.tsandtest/week-wiring.test.tsedits. Main still failstest/review-dangling-else.test.tson that file, and #9474 (the issue) and #9475 (a revert) already cover it, so I didn't file anything new. If this pull's check runs that test before one of those lands, it will be red for that reason only.week-wiringpassed here against main's version of the test. - Shared in-memory state:
AGENTS.mdnow names the record insrc/runs/held.tsthat the dispatcher and vitals share in process memory, and its freshness window.
New tests in test/vitals-held-agent.test.ts:
- the count grouped by cause, with a held id that is no longer queued;
- 620 queued with 600 held, which reports exactly "20 queued" and "600 by the week's pace";
- the real
startCrew/pumpwith the valve shut and both runs held: nothing is reported while the pass is fresh, and "2 queued" is reported once it goes stale.
test/quotas-running.test.ts now expects the limit cause instead of the sentence.
bun scripts/gate.ts and bun x tsc --noEmit are clean. The vitals, quotas-running, hot-reads-indexed, flow-valves, week-hold and pace-floor tests pass (66 tests, none failing). scripts/fast.ts reported that the diff was too broad to pick tests (exit 2), so I chose these files by hand.
🤖 Generated with Claude Code
A count of held agent runs that stays exact past 500, with each held run named by its cause in the vitals. This fixes the 31-minute "agent queue degraded" reading in #9403. src/runs/held.ts counts the held runs and names why each is held; src/core/runs.ts adds the query behind it. src/kernel/vitals.ts reports the count and causes, and src/crew/dispatch.ts is updated to match. test/vitals-held-agent.test.ts covers the behaviour, and test/hot-reads-indexed.test.ts checks that the new read uses an index.
The last check failed on three things this pull didn't change but has to carry to go green:
- Dangling
else: insrc/looks/service.ts:439theelsesat on its own line, which the review rule rejects. That text is identical to main's, so main has the same problem. It is now} else if. - Hollow screen: the scrapes page (from #9464) linked to its export as
${BASE}/export?group=….scripts/hollow.tsonly counts a path written out in full, so it reportedGET /settings/traffic/scrapes/exportas a screen no page links to. The link now spells out/settings/traffic/scrapes/export?group=…, and hollow passes with nothing new added to its allow list. - Cart test: "a pin's cart > a captured cart plays sandboxed…" in
test/build-cart.test.tsfailed once on the forge but passed in all three local runs. This pull doesn't touch that code, so it is left as is; if it fails again it looks flaky rather than broken.
The hollow tests, the dangling-else rule, the held-agent vitals test, the server-timing sweep, bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts all pass locally. The full suite is left to the forge's check.
To try it: open Settings → Traffic → Scrapes as an admin, and "Export for an abuse report" on a group still downloads the report.
🤖 Generated with Claude Code
A count of held agent runs that stays exact past 500, with each held run named by its cause in the vitals. This fixes the 31-minute "agent queue degraded" reading in #9403. src/runs/held.ts counts the held runs and names why each is held; src/core/runs.ts adds the query behind it. src/kernel/vitals.ts reports the count and causes, and src/crew/dispatch.ts is updated to match. test/vitals-held-agent.test.ts covers the behaviour, and test/hot-reads-indexed.test.ts checks that the new read uses an index.
The pull also carries three fixes for problems that came from main, not from this change:
- Dangling
else: insrc/looks/service.ts:439theelsesat on its own line, which the review rule rejects. It is now} else if. - Hollow screen: the scrapes page (from #9464) linked to its export as
${BASE}/export?group=….scripts/hollow.tsonly counts a path written out in full, so the link now spells out/settings/traffic/scrapes/export?group=…. Hollow passes with nothing added to its allow list. - Missing
Try:line: editing the scrapes page counts as changing a page people can reach, so the gate wants a commit message saying how to try it on the preview. Two empty commits add it. The first named/settings/vitals, a page that doesn't exist; the second corrects that to/board.
The cart test in test/build-cart.test.ts failed once on the forge but passed three times in a row locally, and this pull doesn't touch it. If it fails again, it is a flaky test.
bun scripts/gate.ts, bun x tsc --noEmit, bun scripts/design-lint.ts, the hollow tests, the dangling-else rule, the held-agent vitals test and the server-timing sweep all pass locally. The full suite is left to the forge's check.
Try it on the preview:
- As an admin, open
/board: held agent runs are counted and named by cause among the forge's needs. - Open
/settings/traffic/scrapesand use "Export for an abuse report" on a group.
🤖 Generated with Claude Code
queue:agentno longer reports runs the dispatcher holds on purpose as a stalled queue. From the issue's evidence (16 queued, 0 of 2 slots running, for days), those runs were probably held by policy — a shut valve, the week's pace or an account limit — rather than waiting on a slot. Nothing in the issue confirms it, though. The check now tells the two cases apart.src/runs/held.ts(new): each dispatcher pass records which queued agent runs it held and why. The record lives in memory, one per database, and each pass replaces the last. A record older than two minutes is ignored, so a dispatcher that stops can't hide its queue behind the last thing it said.src/crew/dispatch.ts:pumpcollects those holds as it goes (valve shut,weekHold, the running limit) and saves them at the end of the pass. The localheldfromweekHoldis renamedpacedto avoid a name clash.src/kernel/vitals.ts:queue:agentnow counts and ages only the runs that weren't held, using the newqueuedOfinsrc/core/runs.ts. If every queued run is held, nothing is reported. Otherwise the message adds "; N more held by a valve, the week's pace or an account limit". This follows howqueue:checkalready leaves out the checks a red main holds.Tests:
test/vitals-held-agent.test.ts(new) covers four cases: no holds, everything held, a mix, and an outdated record being ignored.test/quotas-running.test.tsnow also checks that a run held by the concurrent-run limit is recorded with its reason.The gate and
bun x tsc --noEmitpass.scripts/fast.tssaid the change was too broad to pick tests for, so I ran the ones covering it myself: every vitals test, the quotas, week-pump and week-wiring tests, the sentinel test and the valve tests. All pass.I left two things alone:
/settings/capacity, and this change doesn't alter it.To try it: shut a repository's valve on
/flowwith agent runs queued. After 30 minutes,queue:agentshould stay off the degraded list.🤖 Generated with Claude Code
Closes #9403