Repository navigation
Description
Company
Independent
Component
Code index
Describe what's wrong
A large pnpm monorepo whose root tsconfig.json uses include and has no references is still indexed as one program, and runs out of memory as #1678 reported. #1782 detects an umbrella root with references and no files of its own (is_umbrella_tsconfig, scripts/scip_harness/scip_ts_projects.py:95-105), the shape #1678 described. That description was our error: the root has "include": ["src/**/*", "ui/**/*", "extensions/**/*", "packages/**/*"], over 200 paths entries and no references. So discover prints nothing and run_typescript_delta.sh (:49-55) indexes the root with --pnpm-workspaces, the path that ran out of memory:
| run | heap (NODE_HEAP_MB) |
result |
|---|---|---|
--full, no project list, main |
8,192 (default) | V8 heap out of memory after 233 s, peak RSS 8.14 GiB, exit 134 |
--full, no project list, #1782's head before the merge |
24,576 | no project finished after 2,712 s, RSS 23.9 GB and rising (stopped) |
With scip_ts_projects listed by hand (15 directory patterns, 222 to 226 projects as the repository changes), #1782's per-member runs and delta selection do work on this repository: a delta in one package runs one project in under a minute at 0.95 GB. Delta narrowing therefore reaches this shape only through a hand-written list.
Detection has three smaller gaps on the same path:
- A root
tsconfig.jsonthat starts with a UTF-8 BOM is read withencoding="utf-8"(scip_ts_projects.py:84),json.loadsrejects the BOM, the stripped retry fails too, anddiscoverreturns nothing with exit 0. TypeScript accepts the BOM, so a BOM-prefixed umbrella takes the whole-root path. - Every parse error, missing file and reference outside the checkout in
discoverreturns an empty list or skips the entry, and a non-zero exit fromdiscoverreads as "not an umbrella" (run_typescript_delta.sh:49). The pass then indexes the root with no log line naming the root that was rejected and why. - Discovered members exist only inside the harness. The worker's dependency preparation still receives
cfg.scip_ts_projects(server/code/workers/scip_ts_delta.py:135,prepare_dependenciesinserver/code/app/index/typescript_dependencies.py), so an umbrella that is not a workspace and keeps a lockfile per member is installed at the root only, and_delta_shape(scip_ts_delta.py:179), the key for holding a refused pass, does not include the discovered set.
Does it reproduce on the latest release or main?
Yes
How to reproduce
Detection, from a checkout of main:
mkdir -p tree/packages/app tree/packages/lib
echo '{"include": ["packages/**/*"]}' > tree/tsconfig.json
echo '{"include": ["src"]}' > tree/packages/app/tsconfig.json
echo '{"include": ["src"]}' > tree/packages/lib/tsconfig.json
python3 scripts/scip_harness/scip_ts_projects.py discover tree # prints nothing
mkdir -p bom/packages/a
printf '\xef\xbb\xbf{"files": [], "references": [{"path": "packages/a"}]}' > bom/tsconfig.json
echo '{"include": ["src"]}' > bom/packages/a/tsconfig.json
python3 scripts/scip_harness/scip_ts_projects.py discover bom; echo "rc=$?" # prints nothing, rc=0Without the BOM, the second tree prints packages/a.
The out-of-memory run: a full pass with scip_ts_projects unset over a pnpm workspace whose root tsconfig.json uses include across a few hundred projects, here the repository from #1678:
DELTA_OUT=full.json scripts/scip_harness/run_typescript_delta.sh /path/to/checkout --full HEADExpected behavior
Either of these would close the gap:
- The docs say that an include-style root still needs
scip_ts_projects, anddiscoverlogs why it rejected a root. discoveralso treats a root whoseincludereaches directories with their owntsconfig.jsonas an umbrella over them. This has open questions: the root's own files outside every member directory (this repository has extensions with apackage.jsonand notsconfig.json), and members nested inside members (srcand nine projects below it).
In both cases, load_tsconfig reads with utf-8-sig, as TypeScript accepts a BOM.
Environment
Loom main at 3058a5816 (contains #1782); the 24 GiB row ran #1782's head e8fbb33 before the merge, whose discovery code is the same.
@sourcegraph/scip-typescript 0.4.0, node 22.23.4, pnpm 12.15.0, Python 3.12.
run_typescript_delta.sh in DELTA_OUT mode, the worker's mode; no ClickHouse involved.
The repository: a pnpm workspace, root tsconfig.json with include and no references; the 30 s delta used a project list of 222 entries.
Related issues and pull requests
How this was found
An AI tool found it, and I have not reproduced it myself
Additional context
Tests that would cover this, each failing or undefined on main:
- An include-style root with workspaces (this shape): assert what the tier does, today the whole-root pass.
- A BOM-prefixed umbrella root:
\xef\xbb\xbf{"files": [], "references": [...]}; assert the members are discovered.
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
Activity
KaloyanNaumov commentedon Dec 2, 2026
@zlareb1 product decision needed here: should
discovertreat an include-style root (one whoseincludereaches directories with their owntsconfig.json) as an umbrella over them, as in option 2? Or should such a root keep needingscip_ts_projects, with the docs saying so anddiscoverlogging why it rejected the root, as in option 1? Option 2 needs two rules first: what happens to the root's own files outside every member directory, and to members nested inside other members.zlareb1 commentedon Dec 6, 2026
@KaloyanNaumov go with option 2. On this repo the default path runs out of memory at 8 GiB after 233 s, and nothing in the log says why. The hand list that works is something every operator with a big include-style monorepo would have to work out alone. Discovery should do what the hand list does.
The rule: a root's members are its references, plus every directory with a tracked
tsconfig.jsonthat the root'sincludereaches and itsexcludedoesn't. Use TypeScript's defaults.includemeans**/*only when the root has neitherfilesnorinclude, so afiles: []root still gets only its references, andis_umbrella_tsconfigcan go. In a pnpm or yarn workspace, also add each workspace package that has atsconfig.json.--pnpm-workspacesindexes every packagepnpm ls -rlists today, so without this a package outside the root'sincludewould lose its rows.On your two questions:
_preferred_ownerdoes in the merge, and whatselect_projects_for_deltawill do after the TypeScript member passes index more members than a change needs, and one failing member fails all #1961 filter change..scip-norefs.configs, that extends the root and adds the member directories to itsexclude. Its scope is., so the merge keeps only files no member owns, and those files keep the root's options. If nothing is left, the run reads as empty.Two more things for the same PR. First,
load_tsconfigshould readutf-8-sig, andscip_ts_paths.pyshould use it instead of its own_parse_tsconfig, so there's one reader. The BOM breaks more thandiscover: it also stopsplanfrom walking a member's references, so that member runs with its whole closure. Second,discovershould log each root or entry it rejects and why, and still exit 0. Then only a crash fails the pass, and nothing drops to the root run without a word (run_typescript_delta.sh:52).This changes ordinary repos too: a root with
include: ["src"]plus ane2e/tsconfig.jsongoes from one process to two. I'm fine with that, but I want a test showing such a repo keeps the same files as the root pass, with any edge differences named in the PR.Land it after #1973, so one broken nested
tsconfig.jsonfails only itself. It also needs to come after the #1961 filter change, because onmainevery TypeScript edit selects a root-level member.Tests:
include;include;--fullrun on the The TypeScript tier cannot index a large monorepo through its root tsconfig, and every delta repeats the full cost #1678 repo withscip_ts_projectsunset, at the default 8 GiB heap.Member files should match the hand-list pass file for file. Report the leftover root run's file count and peak RSS, and if it doesn't fit, post the numbers here first.
Gap 3: the hold needs nothing, because
refusal_heldkeys on the target commit and discovery reads that tree. Dependency installs do need the discovered members: the worker should rundiscoverbeforeprepare_dependencies(scip_ts_delta.py:149). That one can be a separate PR.