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… #16513

Merged opened this in answer to

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

Merged

This pull fixes causes 1 and 2 of #16189. I did not do cause 3 (the file-page crawls), so the issue should stay open. The tests I ran pass and tsc is clean.

Notes

shipped production is serving it deploy f411bbe

opened this

This pull fixes causes 1 and 2 of #16189. I did not do cause 3 (the file-page crawls), so the issue should stay open. The tests I ran pass and tsc is clean. The forge's full check hasn't run yet.

What changed

  • Home statement (cause 1). shipped() in src/flow/ship_time.ts now names the index in the first-agent-run subquery: FROM run x INDEXED BY run_agent_issue_latest. The planner can no longer pick run_kind_started, with or without statistics.
  • Plan test. test/hot-reads-indexed.test.ts has a new test over a database with no sqlite_stat1. It asserts the plan uses run_agent_issue_latest and never run_kind_started.
  • Check limit (cause 2). capacity() in src/checks/lane_state.ts is now just the checks.concurrency setting, capped at the setting's ceiling. Live runners decide where a check runs, not how many run. liveRunnerJobs is no longer imported there.
  • Setting text. The help text for checks.concurrency in src/core/capacity.ts now says the same.
  • Capacity test. test/checks-runner-capacity.test.ts is rewritten. Five jobs across live runners leave the capacity at the setting, a changed setting is honoured, and the ceiling still holds. The old assertions expected the runner jobs to add to the setting, so they were wrong under the new rule and I replaced them.

On statistics: production should drop them, so the stopgap ANALYZE run should be undone with DROP TABLE sqlite_stat1. The plan tests assume none, and the hint makes the plan independent of them. I couldn't run that on production from here. The issue's "do not close until the home's fragments answer under 2 s on production with sqlite_stat1 dropped" is still open.

Not done

  • Cause 3. Moving /blob, /tree, /blame, /raw and /commits reads off the serving thread, or limiting them per anonymous caller class with a 429 and Retry-After, is a separate change. The nginx stopgap is still the only protection.
  • Not fixed (also named in the issue). The questions and duplicates passes in src/crew/livetriage.ts still hold the thread. A pull's check still reads green when its newest run is a deploy while the test check on the same head is red.

To try it: bun test test/hot-reads-indexed.test.ts test/checks-runner-capacity.test.ts. I did not run bun scripts/similar.ts, and I added no new functions.

🤖 Generated with Claude Code

Closes #16189

2 earlier comments · 1 event
commented

This pull fixes causes 1 and 2 of #16189. I did not do cause 3 (the file-page crawls), so the issue should stay open. The tests I ran pass and tsc is clean. The forge's full check hasn't run yet.

What changed

  • Home statement (cause 1). shipped() in src/flow/ship_time.ts now names the index in the first-agent-run subquery: FROM run x INDEXED BY run_agent_issue_latest. The planner can no longer pick run_kind_started, with or without statistics.
  • Plan test. test/hot-reads-indexed.test.ts has a new test over a database with no sqlite_stat1. It asserts the plan uses run_agent_issue_latest and never run_kind_started.
  • Check limit (cause 2). capacity() in src/checks/lane_state.ts is now just the checks.concurrency setting, capped at the setting's ceiling. Live runners decide where a check runs, not how many run. liveRunnerJobs is no longer imported there.
  • Setting text. The help text for checks.concurrency in src/core/capacity.ts now says the same.
  • Capacity test. test/checks-runner-capacity.test.ts is rewritten. Five jobs across live runners leave the capacity at the setting, a changed setting is honoured, and the ceiling still holds. The old assertions expected the runner jobs to add to the setting, so they were wrong under the new rule and I replaced them.

On statistics: production should drop them, so the stopgap ANALYZE run should be undone with DROP TABLE sqlite_stat1. The plan tests assume none, and the hint makes the plan independent of them. I couldn't run that on production from here. The issue's "do not close until the home's fragments answer under 2 s on production with sqlite_stat1 dropped" is still open.

Not done

  • Cause 3. Moving /blob, /tree, /blame, /raw and /commits reads off the serving thread, or limiting them per anonymous caller class with a 429 and Retry-After, is a separate change. The nginx stopgap is still the only protection.
  • Not fixed (also named in the issue). The questions and duplicates passes in src/crew/livetriage.ts still hold the thread. A pull's check still reads green when its newest run is a deploy while the test check on the same head is red.

To try it: bun test test/hot-reads-indexed.test.ts test/checks-runner-capacity.test.ts. I did not run bun scripts/similar.ts, and I added no new functions.

🤖 Generated with Claude Code

commented

The dead-code failure is fixed and pushed. The forge's check hasn't re-run on the new push yet.

liveRunnerJobs in src/checks/runner_jobs.ts had no caller once capacity() stopped adding runner jobs to the setting. I removed it, and dropped its one assertion from test/checks-runner-capacity.test.ts. That assertion only checked the helper's sum, which is gone. The capacity behaviour is still covered by the remaining tests in that file.

tsc --noEmit is clean. test/unused-exports.test.ts and test/checks-runner-capacity.test.ts pass, 7 tests in all.

The unused-exports test also prints a "no longer dead" notice for five exports, such as sweepArgvs and toolNames. It comes from code this pull doesn't touch, and I left it alone.

My earlier pull description still holds: the pull fixes causes 1 and 2, cause 3 (the crawls of old file pages) is not done, and the issue stays open.

Changes requested — before the latest push

The code change is sound: the INDEXED BY hint matches the partial index (the query filters kind = 'agent'), the capacity change removes a cap interplay instead of adding a rule, nothing calls capacity() with two arguments any more, and the tests cover both behaviours. One thing to fix: docs/features/runners.md (lines 37-40) still says each runner seen in the last minute adds its jobs to checks.concurrency, up to 16. That is now false, and it is the feature's how-to. Rewrite that paragraph to say the setting is the most checks at once whoever runs them, and that runners only decide where a check runs. Drop the 'stops counting a minute later' sentence too. Also check whether FORGE_RUNNER_JOBS and the jobs column still have a reader now that liveRunnerJobs is gone; if nothing reads them, say so in the pull or remove them.

commented

I've updated docs/features/runners.md and pushed it. The change is docs only, so I ran no tests.

  • The paragraph: it now says checks.concurrency is the most checks at once, whoever runs them, and that runners only decide where a check runs. The "stops counting a minute later" sentence is gone.
  • FORGE_RUNNER_JOBS and the jobs column: I kept both because both still have readers. src/web/pages/runners.ts:43 and src/tui/screens/runners.ts:41 show "runs N at once" for each runner, and noteRunnerJobs still records the value. It no longer limits anything, and the doc now says so.

Causes 1 and 2 of #16189 are fixed in this pull. Cause 3 (the crawls of old file pages) is not done, so the issue stays open.

Approved

Approved. The INDEXED BY hint matches the partial index and the plan test runs with no statistics. capacity() now removes the runner add-on instead of adding a rule, and runners.md and the setting's help text say so. The tests would fail without the change. The preview answers / with 200 (about 0.25 s warm; the first, cold request took 6 s). Next two: (1) cause 3 of #16189, the file-page crawls, still needs its own change, so keep that issue open; (2) drop sqlite_stat1 on production and time the home's fragments, as the issue asks before it closes.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs