Skip to content

fix(fix): bound type-check memory and clean up after a dead worker (UPT-82) - #196

Merged
lucasbraum merged 2 commits into
mainfrom
lucasbraum/upt-82-analysis-worker-runs-out-of-memory-on-alova-and-leaves-a-run
Oct 17, 2026
Merged

lucasbraum merged 2 commits into
mainfrom
lucasbraum/upt-82-analysis-worker-runs-out-of-memory-on-alova-and-leaves-a-run

Conversation

@lucasbraum

Copy link
Copy Markdown
Collaborator

Fixes UPT-82. Repro: node bench/oss-sample/run.mjs --only alovajs__alova.

Cleanup

A worker that dies (crash, OOM) cannot remove its own clone. The main thread now removes the clones the worker reported whenever the worker exits without a reply. SIGINT was already handled by removeOnInterrupt. engine-exit.test.ts runs real workers that crash, run out of memory, or get SIGINT on the parent. The crash and OOM cases fail without the fix.

Memory

The OOM happened in fix's baseline verify · types, not in check. alova's root tsconfig includes packages/** and examples, so:

  • the root program compiled the whole repo (4.1 GB of heap on its own);
  • every workspace it discovered was then checked, with all programs retained together.

Changes:

  • A workspace's program takes as roots only the files that workspace owns. Files owned by another tsconfig go to that workspace's own check, as their diagnostics already did. .d.ts files stay roots.
  • The one-shot diagnostics() releases each program before building the next. The incremental checker (--agent sdk) keeps its programs.
  • A worker OOM now reports "Repository too large for analysis …" instead of the raw V8 message.

Peak RSS, alova fix --only react --no-llm

peak RSS result run dir left
main 3286 MB OOM in verify · types at 2m17s 1
this PR 1931 MB baseline types pass in 25 s 0

Same 19 baseline diagnostics before and after. Max RSS for the type check alone: 2772 → 1172 MB.

On alova, fix now gets as far as install and stops on the lockfile-resolution guard (UPT-77 finding #4, separate). Because of that, the post-upgrade type check wasn't exercised on alova.

Not done: no pre-build heap estimate for the type check. The OOM message covers the case where it still doesn't fit.

peer-worker.test.ts (local only) fails locally on main as well, because a global uptide is on PATH.

🤖 Generated with Claude Code

lucasbraum and others added 2 commits October 16, 2026 23:16
…PT-82)

On alovajs/alova the root tsconfig includes packages/** and examples, so
the baseline type check built the whole repository into the root program
(4.1 GB of heap) and then kept every discovered workspace's program alive
at once, until the analysis worker hit its heap limit. The dead worker
could not remove its clone, and the main thread only removed clones on a
signal, so a run-* directory stayed behind.

- A workspace's program takes as roots only the files it owns; files
  another tsconfig owns are checked by that workspace, as their
  diagnostics already were.
- The one-shot diagnostics() releases each workspace's program before the
  next one; the incremental checker for --agent sdk keeps them.
- The worker runner removes the clones the worker reported whenever it
  exits without a reply, and an out-of-memory exit becomes a clear
  "Repository too large for analysis" error.

alova fix --no-llm: peak RSS 3286 MB and OOM -> 1931 MB, baseline types
pass in 25 s, no run directory left. Diagnostics identical (19 = 19).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
…UPT-82)

The root program dropped any file under a nested tsconfig.json and skipped
its diagnostics, assuming that workspace checks it. A workspace tsconfig
that includes only src/ does not: packages/foo/scripts/x.ts had no check
at all. A file is now handed to another workspace only when that
tsconfig's parsed fileNames include it; otherwise, or when the owning
tsconfig does not parse, it stays a root here and its errors are reported.

alova fix --no-llm: peak RSS 2062 MB (1931 MB before this change, 3286 MB
and OOM on main); baseline diagnostics unchanged (19).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
@lucasbraum
lucasbraum force-pushed the lucasbraum/upt-82-analysis-worker-runs-out-of-memory-on-alova-and-leaves-a-run branch from 5c738aa to 83a688b Compare October 17, 2026 06:26
@lucasbraum
lucasbraum merged commit fa6f788 into main Oct 17, 2026
12 checks passed
@lucasbraum
lucasbraum deleted the lucasbraum/upt-82-analysis-worker-runs-out-of-memory-on-alova-and-leaves-a-run branch October 17, 2026 16:55
@uptide-release uptide-release Bot mentioned this pull request Oct 17, 2026
lucasbraum pushed a commit that referenced this pull request Oct 17, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## [email protected]

### Patch Changes

- [#191](#191)
[`db1d384`](db1d384)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The ai pack now
reports AI SDK 7 renames in tests that `vi.mock('ai')` or
`jest.mock('ai')` without importing it: the mock factory's `stepCountIs`
key, and `onFinish` and the other renamed options read by fakes of `ai`
calls such as `toUIMessageStreamResponse`.

- [#196](#196)
[`fa6f788`](fa6f788)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` no longer
runs out of memory type-checking monorepos whose root tsconfig includes
every package: each workspace's program holds only the files that
workspace owns, and the baseline check releases one workspace's program
before building the next. When the analysis thread does run out of
memory, `fix` says the repository is too large for analysis instead of
crashing, and its temporary clone is removed on every exit path, a
crashed or out-of-memory analysis thread included.

- [#190](#190)
[`cdf7f69`](cdf7f69)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `check <pkg>` no
longer returns nothing for an outdated dependency used only through
config files (typescript through tsconfig): it is always reported, with
the reason, including when its workspace's analysis fails or the time
budget runs out. Analysis no longer fails with ENAMETOOLONG on a package
that links itself (Yarn `link:.`).

- [#186](#186)
[`5e01ef3`](5e01ef3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Keep the
migration's starting branch and commit in reports and diff hints,
including after re-verification. Default hints to `npx uptide`, use
`uptide` only when the command on PATH resolves to the running binary,
keep shared reports portable, and preserve explicit flags accepted by
suggested commands, including peer retry budgets and workspace-root
retries.

- [#197](#197)
[`b51ca9b`](b51ca9b)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Suggested
commands no longer print `uptide` when the launcher found is a
project-local `node_modules/.bin` entry (as under `pnpm run`/`pnpm exec`
or npm scripts); only a real global install does, otherwise `npx
uptide`.

- [#187](#187)
[`6fe81b4`](6fe81b4)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Prevent `fix`
from failing with `spawnSync git ENOBUFS` when Git output exceeds 1 MiB
in large repositories. Raise the buffered output limit to 256 MiB for
shared Git operations and source-version status checks.

- [#185](#185)
[`98a3119`](98a3119)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Detect removed
Zod error members on local results of schemas imported through
repository modules, including awaited safeParseAsync calls, so their
`.errors` reads can migrate to `.issues`.

- [#193](#193)
[`a68fea3`](a68fea3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` no longer
refuses on lockfile changes the upgrade didn't cause. When the install
guard finds resolutions outside the upgrade's subtree, it runs the same
install at the parent commit and judges the upgrade against that
lockfile. Churn the parent install already produces is listed as
"Lockfile churn the parent commit already has" and never blocks; changes
only the upgrade makes are still refused, or listed for review in
agent-led runs.

- [#180](#180)
[`549edc3`](549edc3)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Update
conflicting root pins automatically when preparing draft PRs, including
App/Action runs, and list the changes at the top of the PR under "Root
pins changed: review". Add `updatePins: false` in `uptide.yml` to opt
out. Local runs still require explicit `--update-pins` consent.

- [#188](#188)
[`69b1c88`](69b1c88)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Continue `fix` as
an agent-led draft instead of exiting 2 when a preflight refusal has an
assisting agent: peer blockers that need a major run as the plan's
suggested command, root pins without consent are updated (an explicit
`updatePins: false` still refuses), companions that cannot move together
leave the lead alone, and the install check reports out-of-scope
resolutions for review. The reason heads the PR body and the terminal
summary, next to feedback rounds and spend. Without an agent, with
`--no-llm`, or on a downgrade, `fix` still refuses.

- [#188](#188)
[`69b1c88`](69b1c88)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` makes the
no-pack stop (no agent, or a major for a PR) before cloning or
installing. When the check returns nothing to analyze for an outdated
package, `fix` now says so instead of "has no upgrade", and an agent
continues as a draft. Lockfile resolutions an agent-led install changed
outside the upgrade are listed for review in the PR body and the
terminal summary. Downgrades, key-like settings in `uptide.config.json`,
credentials in `OPENAI_BASE_URL` and unsafe run reports throw
`SafetyRefusal`, which no fallback continues past.

- [#194](#194)
[`7dd3259`](7dd3259)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Stop `fix` in
preflight on npm when a package that moves, or a peer npm installs for
it, rejects a package that stays installed: vitest 5 peers on vite, and
vite 8 rejects the repository's esbuild 0.25. Before, npm refused the
install after the clone. The row names the chain, and `--allow-peer`
writes the override.

-
[`4c3dc23`](4c3dc23)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - `uptide pack
test` now prints the precision of every rule with a rewrite, breaking or
not, and warns when one is below 80%. It is a warning only: no pack's
status and no rule's run mode changes. The compatibility matrix lists
each rewrite's precision.

- [#179](#179)
[`9112f2b`](9112f2b)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Add `fix
--update-pins` to explicitly approve updates to conflicting root Yarn
resolutions and npm/pnpm overrides for the target and its companions.
Preserve unrelated pins, update root declarations and pnpm catalogs
together, report pin changes, and reject ambiguous selectors before
installation.

- [#192](#192)
[`3f81193`](3f81193)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The
`@sentry/browser` 10 to 11 pack is verified again: 5 public upgrades, 22
real breaking sites, breaking precision 100% and recall 50%.
`@sentry/react` stays a candidate: its ground truth grew to 14 public
upgrades and 29 breaking sites, with 3 false positives among its
breaking findings.

- [#202](#202)
[`51a6f70`](51a6f70)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The Sentry packs
now read JavaScript files that only require another Sentry package
(`@sentry/core`, a sibling SDK of the same release), which the
TypeScript compile scope skipped. `@sentry/browser` breaking recall on
public ground truth goes from 50% to 82% with no false positives.

- [#199](#199)
[`08da2a7`](08da2a7)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The Sentry 10 to
11 pack no longer reports `beforeSendTransaction` or
`ignoreTransactions` in a `Sentry.init` that sets `traceLifecycle`: the
option keeps transactions, so they still work.

- [#189](#189)
[`5d1d350`](5d1d350)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - Avoid shared
registry-cache write races during parallel checks, publish complete
package extractions atomically, and print package failure reasons on
stderr when check exits 2.

- [#195](#195)
[`15b3b3e`](15b3b3e)
Thanks [@lucasbraum](https://github.com/lucasbraum)! - The vitest pack
now reads `vite.config.*` and `vitest.config.*` files and jest-dom setup
files that never import `vitest` (a config that takes `defineConfig`
from a shared file, a setup file that only does `import
'@testing-library/jest-dom/vitest'`), so it reports their bare-directory
coverage patterns and jest-dom registrations.

Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
@uptide-release uptide-release Bot mentioned this pull request Oct 17, 2026
lucasbraum added a commit that referenced this pull request Oct 17, 2026
…14) (#203)

Part of UPT-14 (HN slice). Install caching and analysis memory are out
of scope (UPT-82, #196).

**What changes**
- **Per phase:** `report.json` gets `phases`, which records wall time
and agent spend for analyze, baseline, install, rules, agent, verify and
feedback. The terminal summary shows a `Phases` row, and the PR's run
details show a `Phases:` line.
- **Preflight estimate:** after the rules run and before any agent call,
`fix` counts the sites left to the agent, prices them at the selected
model's listed rates and prints the estimate with the limit. The
estimate is kept in `llm.estimate`.
- **Limit:** stays $1 without `--max-cost`/`maxCost`, and is never
raised for the estimate. When the estimate exceeds the limit, `fix`
stops before spending anything, with exit 2 like other preflight stops:
`estimated $3.00 for 50 sites; limit $1.00. Run again with --max-cost
3.00.`
- **Action/App runs** (hidden `--max-cost-from-config`, passed by the
action): no preflight stop, because nobody can rerun them and the
estimate is uncalibrated. They spend within `maxCost` as before. The PR
body and summary name the estimate, the sites left and `Raise maxCost in
uptide.yml to X to finish`. The SDK executor now records the sites it
leaves after a budget stop (`llm.costLimit`), so the message also
appears on the default executor. Local runs keep the stop before
spending.
- **Stop at the limit mid-run:** the message names the estimate and the
limit that continues.

**Calibration:** no UPT-76/78 run reports with spend exist, so the
estimate rests on stated assumptions: 20k input and 2k output tokens per
site, uncached. A test pins this to the pricing table entry for the
default model (`claude-sonnet-5-5`, $2/$10 per million), which comes to
$0.06 per site. The issue's "within 2×" criterion is not yet shown.

Tests: estimate and table price, stop messages for both settings
(`llm/cost-estimate.test.ts`); estimate shown before the first call,
preflight stop with no agent call, phase order and spend
(`fix/generic.test.ts`); exit 2, `$1` default, `--max-cost-from-config`
(`cli.test.ts`); action args (`action/run.test.ts`); Action runs on the
patch and SDK executors work within the limit and report what is left
(`fix/generic.test.ts`). `pnpm test`, `pnpm typecheck` and lint pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Lucas Braum <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
lucasbraum added a commit that referenced this pull request Oct 17, 2026
…s it (UPT-12)

Type coverage counted any .ts file as checked, so a file the tsconfig
excludes raised the share. A file now counts only when the workspace's
tsconfig, or a project it references, lists it in its parsed fileNames
(include/exclude applied, JavaScript only under allowJs/checkJs), and
JavaScript only under that project's checkJs or // @ts-check.

The parse is fix verification's own (#196), extracted from
checkWorkspace in verify.ts as workspaceProjects and used by both.

Fixture: a generated .ts excluded by the tsconfig now counts against
coverage (3 of 11; 10 of 11 with checkJs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
lucasbraum added a commit that referenced this pull request Oct 17, 2026
…T-12) (#204)

Closes UPT-12.

In a mostly-JavaScript repository, `13 errors → 0` covers a few
TypeScript files and says almost nothing about the rest. `check` and
`fix` now measure **type coverage**: of the files that import the
upgraded package, how many does the repository's own compiler
type-check?

**What counts**
- *Affected* files: every source file in the workspace that imports the
package, found by text scan (`filesImporting`). JavaScript outside the
program (no `allowJs`) counts too.
- *Checked* files: listed in the parsed `fileNames` of the workspace
tsconfig or a project it references (`include`/`exclude` applied), with
JavaScript only under that project's `checkJs` or `// @ts-check`, and
nothing marked `@ts-nocheck`. The parse is `workspaceProjects`,
extracted from fix verification's `checkWorkspace` (#196) and shared
with it. Uptide's own `checkJs: true` compile doesn't count, because
that is our check, not the repository's.

**Threshold: 0.5** (`LOW_TYPE_COVERAGE`), taken from the fixture. Below
half:
- **check** verdict: `N breaking · types cover 3 of 10 affected files:
the compile result is not proof, tests and build decide` replaces
`compiled against X: 0 new type errors`.
- **fix**:
- The Types cell is `⚠️ types cover 3 of 10 affected files, not proof ·
the upgrade broke 0 · Uptide left 0`.
- Verified-by reads `⚠️ type-check is not proof: …` and ends with `the
verdict rests on tests and build`.
- `verification.passed` now also requires a passing test run or a
post-change build, in both `fix` and re-verify. With neither, the result
is `verification failed: types cover 3 of 10 affected files and no test
or build passed`.

Breaking-site detection on JavaScript still runs as before. Those
findings carry `checked: false` and go through the runtime arbiter,
never the compiler's word, and the test asserts this.

**Fixture**: `fixtures/repos/js-heavy-consumer` has 7 plain `.js` files,
1 under `// @ts-check` and 2 `.ts` files, plus 1 generated `.ts` the
tsconfig excludes, with `allowJs` and no `checkJs`. 3 of 11 are checked.
A second case switches on `checkJs` and gets 10 of 11 (the excluded file
still counts against coverage), with no coverage wording.

**Not changed**: pack scoring, ground truth, verified status.

**Known limits**
- I skipped the optional confirmation on a public JS-heavy repo; this PR
rests on the fixture.
- The fix gate is a behavior change: a JS-heavy repo with no tests and
no build script can no longer pass `fix` on types alone.

UPT-14 also touches `fix/report.ts`, `fix/run.ts` and `fix/types.ts` but
isn't on main yet. This branch is on current main (51a6f70), so expect a
small conflict in whichever lands second.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Lucas Braum <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant