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

The home's lanes and figures never wait on a 44 s statement, and three things… #16189

shipped production is serving it opened this has it

Landed in pull #16513 · run

opened this

The home's lanes and figures never wait on a 44 s statement, and three things that locked the forge on 2026-11-23 are fixed in code After release 0.7.630 (21:00 to 21:45Z) the home showed "reading" with no cards and every page was slow. The steward found three causes on the host and put a stopgap on each; each needs its real fix in code.

  1. A 44 s statement in the home's slow part. shipped() in src/flow/ship_time.ts reads each closed issue's first agent run with a correlated subquery, (SELECT MIN(x.started_at) FROM run x WHERE x.issue_id = i.id AND x.kind = 'agent' AND x.started_at IS NOT NULL). With no statistics the planner walked run_kind_started (kind=? AND started_at>?): every agent run, once per issue, 11,721 issues over 165,669 runs. Measured on production read-only: readSlow 44,977 ms, of which that statement 44,052 ms. The lanes worker's limit is 20 s (JOB_LIMIT_MS in src/flow/lanes.ts), so /live/strip, /live/figures and every /live/lane answered in 16 to 27 s or never. Told to use run_agent_issue_latest (or run_issue) the same statement takes 37 ms. Stopgap in place: ANALYZE run was run on production at 21:44Z (the database had no sqlite_stat1); the plan now walks run_agent_issue_latest (issue_id=?) and readSlow takes 1,044 ms. Fix: name the index in the statement (INDEXED BY), with a plan test in the style of test/hot-reads-indexed.test.ts over a database with NO statistics, and say on this issue whether production should keep statistics at all (the plan tests assume none; if not, the stopgap is undone with DROP TABLE sqlite_stat1).
  2. The check limit stopped limiting. #15268 made capacity() in src/checks/lane_state.ts setting + liveRunnerJobs, so with 17 runners production ran 16 checks at once where checks.concurrency 6 had meant 6. CPU pressure sat near 45% and the worker starved. Stopgap: FORGE_RUNNERS=4 in the host's env and checks.concurrency 2 (so 6 at once again; restart at 21:38Z, about 12 s dark). Fix: the setting is the most checks at once, whoever runs them; runners only decide where. A test with more runners than the setting.
  3. Anonymous crawls of old file pages hold the serving thread. 440 of 669 requests in five minutes were /blob/ and /tree/ at old tags and branches from scattered addresses with browser user agents; each held the thread 0.5 to 10 s (median 455 ms, 90 blocks in 4 min) and 244 were abandoned before an answer. Stopgap at the edge (nginx): anonymous /blob|tree|blame|raw|commits/ pages two at a time across everyone, 429 past that; a signed-in browser or a token is never counted. Fix in the forge: these reads leave the serving thread (a worker, as the lanes do) or are bounded per anonymous caller class, and the page answers 429 with Retry-After itself.

Also seen and not fixed: questions and duplicates in src/crew/livetriage.ts hold their thread 0.5 to 4 s each pass (about 13 s of every 2 minutes); a pull's check reads green when its newest run is a deploy while its test check on the same head is red (#16102 showed this for an hour).

Do not close until the home's fragments answer under 2 s on production with sqlite_stat1 dropped.

Files: src/flow/ship_time.ts, src/checks/lane_state.ts, src/flow/lanes.ts, src/crew/livetriage.ts, test/hot-reads-indexed.test.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs