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

fork flows > the MCP tool answers the same data: load /mcp when the file load… #17268

shipped production is serving it opened this has it

Landed in pull #17269 · run

opened this

fork flows > the MCP tool answers the same data: load /mcp when the file loads, not inside the test's 5 s

Red on three unrelated pull checks in the last hour: #17168 (run 01m8ssth1b7ssvmq0wbysew7mw), #17240 (01m8stwhwasg59b4cxmyyf41yn) and #17220 (01m8styk5d5c5ced2mfecjpv4c), each under heavy runner load with about 11% disk free. Main's full suite at 01e9b02 (run 01m8snsv1bzqz0c2c3tfg6dpbc, #17245) passed it, so the tool is fine and the test is load-flaky.

Cause: /mcp is a lazy route (#12521). Its first request runs loadMcp(), which imports about two hundred modules. Nothing in test/fork-flows.test.ts reaches /mcp before this test, so the whole cold import is paid inside the test's 5 s. Moving it into beforeAll does not help, because bun's 5 s also covers hooks (checked: a 6 s beforeAll times out at 5 s, a 6 s top-level await does not). A top-level await runs as the file loads, outside every test and hook budget, and it is the same sequenced loader production uses, so no TDZ.

Patch (test only: no budget raised, nothing skipped, no retry):

--- a/test/fork-flows.test.ts
+++ b/test/fork-flows.test.ts
@@ -23,7 +23,13 @@
 import { serve, type Servers } from "../src/http/server.ts";
+import { loadMcp } from "../src/http/mcp/load.ts";
 import { forkFlowsScreen, flowRows } from "../src/tui/screens/forkflows.ts";
 import { promote } from "./helpers/members.ts";
 import { mcpTool } from "./helpers/mcp.ts";
 import type { Repo } from "../src/core/repos.ts";
 
+// /mcp imports its ~200 modules on the first request (#12521). Paid here, as the file loads, that is
+// outside every 5 s test and hook budget; paid inside "the MCP tool answers the same data" it ran past
+// 5 s under a full check's load (#17168, #17220, #17240).
+await loadMcp();
+
 describe("fork flows", () => {

To see it before and after: run bun test ./test/fork-flows.test.ts pinned to one core beside five other busy bun test processes on that core (for example with taskset -c 0). Before the patch the MCP test can overrun 5 s; after it, the test only answers two tools/call requests.

Any other file whose first /mcp request sits inside a test has the same exposure (grep test/ for mcpTool( with no earlier load); the same line fixes each. Please keep this pull to fork-flows.test.ts unless the grep finds one that has also gone red.

--- Where this was told from:

  • run: 01m8styk5d5c5ced2mfecjpv4c
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs