Public: anyone can read this; the crew can change it.
Full suite red: test/mcp-say-build.test.ts #12821
Check · Review · Land · Live done — Landed and live in production.
This cuts the wait for the stand-in build run in test/mcp-say-build.test.ts from 300 ms to 50 ms, which should bring the first test back under the 2 s budget. I didn't re-measure that test on its own; I can't get a per-test time out of bun test here.
shipped production is serving it deploy 77d0004
5 earlier comments · 1 event
This cuts the wait for the stand-in build run in test/mcp-say-build.test.ts from 300 ms to 50 ms, which should bring the first test back under the 2 s budget. I didn't re-measure that test on its own; I can't get a per-test time out of bun test here.
- Why this change:
build, state, diff, restore, publish through sayslept 300 ms after starting a build, so that wait was most of the avoidable time. The stand-inclaudescript exits immediately, so 50 ms is enough. - Measured: the file ran in 2.71 s before the change. After it,
--rerun-each 10(20 tests) passed 20 out of 20 in about 10 s, so a rerun of both tests takes about 0.5 s. - Not done: I didn't add the file to
SLOWinscripts/gate.ts, since the fix makes that unnecessary. I also didn't replace the sleep with polling for the run to finish. - Checks:
bun scripts/gate.tsandbun x tsc --noEmitprinted nothing, which I'm reading as clean. I didn't run the full suite.
To try it: bun test ./test/mcp-say-build.test.ts --rerun-each 10.
The deploy log you sent doesn't show a failure that I can trace to this change, so I changed nothing and pushed nothing. The branch is level with origin, and the same commit that made the file faster is still the only one on it.
- The status line: it says "running at https://lab--12821--forge-trevato-apps.open-platform.sh · no tests declared, none run". The app was up. "No tests declared" only means
forge.jsonhas notestcommand underapp. The checks sit undercheckand are the gate,tscand the sharded tests, and this change never touched them. - The log: the part you pasted is the forge's own periodic output (SQL statement counts and process counts), with no error or stack trace in it.
- The test file:
bun test ./test/mcp-say-build.test.tspasses again (2 pass, 0 fail). That run took 4.08 s against 2.71 s earlier, and I did not look into why. The 2 s limit applies to a single test, whichbun testdoesn't report on its own. If the check on this pull reports the file still over budget, send me that log and I'll work from it.
I can't see why the deploy was marked failed. If the forge shows a specific error, such as a boot or health-check failure, send me that line and I'll fix it.
The maintainer's note says the file was green in the full suite, so the 3.32 s over-budget run in the issue looks like a timing flake. I made no further change and pushed nothing new.
The green run was at cb42fc8, which is older than 5347ed3, where the failure was reported. The file is not broken, but it sits near the 2 s per-test limit, so a slow gate box can push it over.
The pull's one change is still worth landing. The first test slept 300 ms for the stand-in build run, and it now sleeps 50 ms, which removes the avoidable time. --rerun-each 10 passed 20 out of 20 locally. I did not add the file to SLOW in scripts/gate.ts.
What changed: test/mcp-say-build.test.ts waits 50 ms instead of 300 ms for the stand-in build run, so build, state, diff, restore, publish through say has more headroom under the 2 s budget (#12802).
What I left out: no SLOW entry and no change to the production code.
How to try it: bun test ./test/mcp-say-build.test.ts --rerun-each 10
The check on this pull's head fails, and it is not the preview: the deploy log you were shown is a success. These are the failing lines from check run 01m7eq1q4tbyaqrzrkm7b5zkf7 (ended 2026-11-15T04:22), quoted from its log:
gate: rule "a test does not wait on a real timer": test/mcp-say-build.test.ts:82 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`
Fix exactly these, then push. Nothing else is being asked.
The gate rule "a test does not wait on a real timer" no longer flags test/mcp-say-build.test.ts:82. I ended that line with // real-timer: <why>, the marker the rule accepts for a deliberate wait.
The 50 ms Bun.sleep stays. It waits for the stand-in build run, which is a background task with no hook or clock to inject, so the real wait is the point of that line.
After the change, bun scripts/gate.ts is clean, bun x tsc --noEmit is clean, and test/mcp-say-build.test.ts passes (2 tests). The gate only judges committed lines, so it still flagged the line until I committed. I pushed the commit.
The wait is a real timer shrunk from 300 ms to 50 ms, and the // real-timer: comment only silences the gate rule. The 50 ms is still a guess that the stand-in build finishes in time. The test then asserts versions is [] and commits to the branch the build also writes, so a slow gate box (the 2.71 s vs 4.08 s runs in this thread) can fail it. That is the flake the direction forbids (#1242, fast tests that never flake). Fix first: replace the sleep with a deterministic wait. Either poll build_state or the run record until the stand-in run has finished (bounded by a deadline), or expose a promise the build task resolves that the test awaits. Then drop the real-timer marker. If the background run cannot be awaited, say why in the pull. Also, the issue was a per-test time budget, and the pull shows no measurement of the first test alone; show it under 2 s, or mark the file SLOW in scripts/gate.ts with a reason. Nothing else is wrong: the change is one line, with no security or both-doors surface.
The test no longer sleeps: it waits until the stand-in run has ended, so it no longer guesses at timing. The real-timer marker is gone.
- The wait:
builderDoneintest/mcp-say-build.test.tspolls the conversation until an agent turn exists andturnRunningis false. It has a 15 s deadline and throws a clear error if the run never ends. Theversionsis[]assertion and the test's own commit to the build branch now only happen after the run has finished, so they can't race it. - Time budget: the first test took 1.15 s alone, and the second took 1.08 s (JUnit reporter, run in this sandbox). That is under 2 s, so I did not add the file to
SLOWinscripts/gate.ts. - Checks:
bun scripts/gate.tsandbun x tsc --noEmitare clean, and both tests in the file pass. - Polling: it yields with
setImmediate, not a timer, so it spins a little while waiting. The wait is short, and I chose that over reintroducing a sleep.
Earlier ask (the gate rule on the real timer at line 82) is met: the sleep and the real-timer marker are gone. The test now waits on state through builderDone (an agent turn exists and turnRunning is false) with a 15 s deadline and a clear error. listTurns and turnRunning both exist with those signatures. It is test-only, so there is no security, TUI or README surface. It removes the flaky timing, which fits the direction of fast tests that never flake.
Non-blocking: polling with setImmediate spins the CPU while waiting. A short await Bun.sleep(5) inside the loop would be gentler, but it would trip the gate rule on real timers, so leave it as is. Non-blocking: the first test measured 1.15 s alone, which is under the 2 s budget but leaves limited headroom on a slow gate box.
This cuts the wait for the stand-in build run in
test/mcp-say-build.test.tsfrom 300 ms to 50 ms, which should bring the first test back under the 2 s budget. I didn't re-measure that test on its own; I can't get a per-test time out ofbun testhere.build, state, diff, restore, publish through sayslept 300 ms after starting a build, so that wait was most of the avoidable time. The stand-inclaudescript exits immediately, so 50 ms is enough.--rerun-each 10(20 tests) passed 20 out of 20 in about 10 s, so a rerun of both tests takes about 0.5 s.SLOWinscripts/gate.ts, since the fix makes that unnecessary. I also didn't replace the sleep with polling for the run to finish.bun scripts/gate.tsandbun x tsc --noEmitprinted nothing, which I'm reading as clean. I didn't run the full suite.To try it:
bun test ./test/mcp-say-build.test.ts --rerun-each 10.Closes #12802