Skip to content

Commit 36805ee

Browse files
committed
docs(workbench): re-measure the cost that justifies one non-isolated worker
The comment named `await import("deepagents")`, a package 0e53709 removed from the dependencies, at a line number that had also drifted. A comment that justifies a configuration is how that configuration stays open to question — this one had stopped being checkable. The cost survived the package, because it was never that factory: `runChat` dynamically imports `./deep-agent/service`, and the graph underneath it costs ~1.25 s per worker, measured by timing the import inside a `.wb.ts`. About 0.38 s of that is `langchain` itself. Seven of the nineteen `.wb.ts` files reach that path, so isolating them would re-pay it six more times. The two module-Map line numbers are corrected as well, and the guard is credited to the harness rather than to `runScenario`.
1 parent e2e41c9 commit 36805ee

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

vitest.workbench.config.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@ export default defineConfig({
2424
// wins and the run gets a TIMEOUT verdict instead of a dead worker.
2525
testTimeout: DEFAULT_TURN_TIMEOUT_MS + 30_000,
2626
reporters: ["default"],
27-
// ponytail: the fixed cost of the suite is the dynamic
28-
// `await import("deepagents")` in chat-service.ts:346 — hundreds of
29-
// milliseconds, paid ONCE PER WORKER. One non-isolated thread makes the
30-
// marginal cost of a new file its own runtime.
27+
// ponytail: the fixed cost of the suite is `runChat`'s dynamic
28+
// `await import("./deep-agent/service")` — measured at ~1.25 s, of which
29+
// ~0.38 s is `langchain` itself and the rest is the agent graph, the tool
30+
// schemas and the document model behind them. It is paid ONCE PER WORKER,
31+
// and 7 of the 19 `.wb.ts` files reach that path, so isolating them would
32+
// re-pay it six more times. One non-isolated thread makes the marginal
33+
// cost of a new file its own runtime.
3134
//
32-
// The trade this accepts: `sessionsByProject` (chat-service.ts:36) and
33-
// `messageCheckpointsBySession` (:48) are module Maps with no exported
34-
// reset, so state now leaks between files. `runScenario` mints a unique
35-
// projectId per run, which is what makes that safe — anything calling
36-
// `runChat` directly would bypass the guard.
35+
// (This used to name `deepagents`, which 0e53709a removed from the
36+
// dependencies. The cost survived the package: it was never that factory,
37+
// it was the graph underneath. Re-measure before trusting the figure —
38+
// `await import(…)` timed inside a `.wb.ts` is enough.)
39+
//
40+
// The trade this accepts: `sessionsByProject` (chat-service.ts:38) and
41+
// `messageCheckpointsBySession` (:50) are module Maps with no exported
42+
// reset, so state leaks between files. The harness mints a unique
43+
// projectId per run (`lib/harness.ts:239`), which is what makes that
44+
// safe — anything calling `runChat` directly would bypass the guard.
3745
pool: "threads",
3846
maxWorkers: 1,
3947
isolate: false,

0 commit comments

Comments
 (0)