Summary
tsc typecheck of the monorepo has grown from ~11s (mid-Feb 2026) to ~40s today (~3.6×). A bisection isolated two regressions; one is fixed, one is still in main and is tracked here.
Full investigation + method + timeline: docs/technical/typecheck-performance-investigation.md (added in #555). A CI guard to prevent recurrences also lands in #555 (scripts/typecheck-budget.ts).
Bisected culprits
16a94b54 — MCP task schemas spread …properties + allOf, exploding packages/tasks instantiations 289k → 6.77M (23×). Already fixed (tasks back to ~207k).
888da0e1 ("image generation pipeline with ImageValue boundary") — a task-runner refactor that doubled packages/ai isolated check time (0.9s → 3.4s), persisting to today. This is the open item.
The cost is diffuse in the core task / Workflow generics, not in any single construct. Each Workflow.prototype.<name> = CreateWorkflow(<Task>) assignment relates two distinct Workflow<I,O> instantiations (inferred I ≠ written I in the declare module augmentation), forcing a full structural relation over the heavily augmented Workflow interface (~124 builder methods). Cost scales super-linearly with augmentation count; 888da0e1 added imageGenerate/imageEdit, tipping ai over.
Fixes prototyped and measured — all ineffective/net-negative
Measured on the real metric (deps pre-built, isolated tsc -p ai, 0 errors), baseline ai = 3.4s:
| Attempt |
Result |
FromSchema<…> input type → hand-written interface in ToolCallingTask |
no effect (3.4s) |
WithImageValuePorts<…> image-task types → explicit interfaces |
no effect (image tasks ~13ms each) |
Restore tsBuildInfoFile line deleted from root tsconfig.json |
no real effect; only changes tsc -b orchestration and breaks solution builds (TS6377) |
Declare correct variance Workflow<in out Input, out Output> |
no effect (3.4s → 3.58s); removes getVariancesWorker but the structural relation still runs |
There is no surgical fix.
Remaining options
- Architectural: rethink how
Workflow is augmented (124 CreateWorkflow<…> members in one mega-interface) and/or how AI task input types are derived. Multi-day effort; validate under both tsc and tsgo before investing.
- Operational: confirm whether user-felt slowness is
tsserver (still tsc) vs build-types (already tsgo, which sidesteps most of this). Note the biggest absolute cost, packages/test (~12s), is mostly legitimate file-count growth exercising the same machinery ×N.
Mitigation already in flight (#555)
- CI
typecheck-budget guard gating per-package instantiation counts. Both culprits above would have failed it.
Suggested next steps
Summary
tsctypecheck of the monorepo has grown from ~11s (mid-Feb 2026) to ~40s today (~3.6×). A bisection isolated two regressions; one is fixed, one is still inmainand is tracked here.Full investigation + method + timeline:
docs/technical/typecheck-performance-investigation.md(added in #555). A CI guard to prevent recurrences also lands in #555 (scripts/typecheck-budget.ts).Bisected culprits
16a94b54— MCP task schemas spread…properties+allOf, explodingpackages/tasksinstantiations 289k → 6.77M (23×). Already fixed (tasks back to ~207k).888da0e1("image generation pipeline with ImageValue boundary") — a task-runner refactor that doubledpackages/aiisolated check time (0.9s → 3.4s), persisting to today. This is the open item.Root cause (888da0e)
The cost is diffuse in the core task /
Workflowgenerics, not in any single construct. EachWorkflow.prototype.<name> = CreateWorkflow(<Task>)assignment relates two distinctWorkflow<I,O>instantiations (inferredI≠ writtenIin thedeclare moduleaugmentation), forcing a full structural relation over the heavily augmentedWorkflowinterface (~124 builder methods). Cost scales super-linearly with augmentation count;888da0e1addedimageGenerate/imageEdit, tippingaiover.Fixes prototyped and measured — all ineffective/net-negative
Measured on the real metric (deps pre-built, isolated
tsc -p ai, 0 errors), baselineai= 3.4s:FromSchema<…>input type → hand-written interface inToolCallingTaskWithImageValuePorts<…>image-task types → explicit interfacestsBuildInfoFileline deleted from roottsconfig.jsontsc -borchestration and breaks solution builds (TS6377)Workflow<in out Input, out Output>getVariancesWorkerbut the structural relation still runsThere is no surgical fix.
Remaining options
Workflowis augmented (124CreateWorkflow<…>members in one mega-interface) and/or how AI task input types are derived. Multi-day effort; validate under bothtscandtsgobefore investing.tsserver(stilltsc) vsbuild-types(alreadytsgo, which sidesteps most of this). Note the biggest absolute cost,packages/test(~12s), is mostly legitimate file-count growth exercising the same machinery ×N.Mitigation already in flight (#555)
typecheck-budgetguard gating per-package instantiation counts. Both culprits above would have failed it.Suggested next steps
tscvstsgoas the metric that matters for DX (editor responsiveness vs build).Workflow/CreateWorkflowaugmentation refactor and measure under both compilers before committing.