Skip to content

fix(deps): bump biome to 2.5.6 to stop the LSP daemon memory leak - #317

Merged
norvalbv merged 2 commits into
mainfrom
fix/biome-2.5.6-daemon-leak
Aug 3, 2026
Merged

fix(deps): bump biome to 2.5.6 to stop the LSP daemon memory leak#317
norvalbv merged 2 commits into
mainfrom
fix/biome-2.5.6-daemon-leak

Conversation

@norvalbv

@norvalbv norvalbv commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Why

The Biome LSP daemon for this repo was sitting at 9.7 GB RSS-equivalent and 95% CPU after ~2.5 days of uptime. footprint showed 9,944 MB spread across 112,109 un-freed mmap regions — a leak signature, not heap growth. (ps reported only 1.8 MB RSS because macOS had compressed essentially all of it.)

This is a known upstream regression, biomejs/biome#10658, fixed in 2.5.1 by #10689:

The issue was caused by the "Go-to definition" editor feature, which was enabled by default … the feature triggers the scanner to build the module graph. This caused memory leak issues.

That matches the observed daemon exactly — its logs showed 8,082 update_module_graph_internal spans in a single hour, plus 8,901 open_file_internal with reason=Index.

2.5.1 also fixed the daemon failing to shut down when the editor closes mid-scan, which is why the leaking process was orphaned at PPID 1, outliving its editor session by over a day.

devkit was the only project on the affected machine still pinned to 2.5.0 — every other repo was on 2.5.1+ and idle at ~2 MB. The ^2.5.0 range already permitted 2.5.6; it was the lockfile holding it back.

What changed

Config (3 files)

  • package.json + bun.lock@biomejs/biome 2.5.0 → 2.5.6
  • biome.jsonc$schema bumped to match, and !!dist force-ignore added

On the force-ignore: dist/ is already unlinted (it is not in the files.includes allowlist), but a single ! still lets the LSP scanner index it for the module graph, and it is rewritten wholesale on every build. !! keeps the scanner out entirely, per Biome's own guidance for output folders. Verified zero lint-coverage change — biome check dist/... already reported "paths were provided but ignored".

Formatting (17 files)
Biome 2.5.6 changed how it.each([...])(…) calls are broken. These are pure formatter output from biome check --write, scoped to exactly the affected files.

Correctness (1 file)
cli/__tests__/reconcile-detect-merged.test.mts — 2 × lint/correctness/noUnsafeOptionalChaining, caught by a rule 2.5.0 missed. mock.calls[0]?.[2] short-circuits to undefined and then .stdio is read off it; the as { stdio?: unknown } cast hid it from TypeScript. Completed the optional chain rather than asserting non-null, so a missing mock call now fails the assertion cleanly instead of throwing a TypeError.

Verification

  • biome check — clean on all 18 touched files
  • bun run typecheck — exit 0
  • bunx vitest run cli/__tests__/reconcile-detect-merged.test.mts — 9/9 passing

Notes for review

  • cli/lib/install/package-json.mts:48 still writes '@biomejs/biome': '^2.5.0' into consumer projects. The caret means fresh installs already resolve to 2.5.6, so no consumer is getting the leak — but anyone with a pre-existing lockfile is pinned to it exactly as this repo was. Left out deliberately: it needs a dist rebuild and belongs with a release rather than as a drive-by.
  • The formatting churn is a direct consequence of the version bump, not unrelated cleanup. It was scoped to the 18 affected files; a repo-wide --write would have touched 119 files of unrelated in-flight work.

Summary by CodeRabbit

  • Chores

    • Updated code-quality tooling to the latest 2.5.x release.
    • Excluded build output and lockfiles from automated scanning.
  • Tests

    • Expanded coverage for review-mode path handling, cleanup behavior, and unsafe input validation.
    • Improved checks for runtime assets, exit-status normalization, dependency preparation, persistence, corruption handling, and concurrency scenarios.
    • Standardized parameterized test formatting without changing existing behavior or expectations.

## Why

The Biome LSP daemon for this repo was sitting at **9.7 GB RSS-equivalent and 95% CPU** after ~2.5 days of uptime. `footprint` showed 9,944 MB spread across **112,109 un-freed mmap regions** — a leak signature, not heap growth. (`ps` reported only 1.8 MB RSS because macOS had compressed essentially all of it.)

This is a known upstream regression, [biomejs/biome#10658](biomejs/biome#10658), fixed in **2.5.1** by [#10689](biomejs/biome#10689):

> The issue was caused by the "Go-to definition" editor feature, which was enabled by default … the feature **triggers the scanner to build the module graph**. This caused memory leak issues.

That matches the observed daemon exactly — its logs showed **8,082 `update_module_graph_internal`** spans in a single hour, plus 8,901 `open_file_internal` with `reason=Index`.

2.5.1 also fixed the daemon failing to shut down when the editor closes mid-scan, which is why the leaking process was orphaned at PPID 1, outliving its editor session by over a day.

devkit was the only project on the affected machine still pinned to 2.5.0 — every other repo was on 2.5.1+ and idle at ~2 MB. The `^2.5.0` range already permitted 2.5.6; it was the **lockfile** holding it back.

## What changed

**Config (3 files)**
- `package.json` + `bun.lock` — `@biomejs/biome` 2.5.0 → **2.5.6**
- `biome.jsonc` — `$schema` bumped to match, and `!!dist` force-ignore added

On the force-ignore: `dist/` is already unlinted (it is not in the `files.includes` allowlist), but a single `!` still lets the LSP scanner index it for the module graph, and it is rewritten wholesale on every build. `!!` keeps the scanner out entirely, per Biome's own guidance for output folders. Verified zero lint-coverage change — `biome check dist/...` already reported "paths were provided but ignored".

**Formatting (17 files)**
Biome 2.5.6 changed how `it.each([...])(…)` calls are broken. These are pure formatter output from `biome check --write`, scoped to exactly the affected files.

**Correctness (1 file)**
`cli/__tests__/reconcile-detect-merged.test.mts` — 2 × `lint/correctness/noUnsafeOptionalChaining`, caught by a rule 2.5.0 missed. `mock.calls[0]?.[2]` short-circuits to `undefined` and then `.stdio` is read off it; the `as { stdio?: unknown }` cast hid it from TypeScript. Completed the optional chain rather than asserting non-null, so a missing mock call now fails the assertion cleanly instead of throwing a TypeError.

## Verification

- `biome check` — clean on all 18 touched files
- `bun run typecheck` — exit 0
- `bunx vitest run cli/__tests__/reconcile-detect-merged.test.mts` — 9/9 passing

## Notes for review

- `cli/lib/install/package-json.mts:48` still writes `'@biomejs/biome': '^2.5.0'` into consumer projects. The caret means fresh installs already resolve to 2.5.6, so no consumer is getting the leak — but anyone with a pre-existing lockfile is pinned to it exactly as this repo was. Left out deliberately: it needs a `dist` rebuild and belongs with a release rather than as a drive-by.
- The formatting churn is a direct consequence of the version bump, not unrelated cleanup. It was scoped to the 18 affected files; a repo-wide `--write` would have touched 119 files of unrelated in-flight work.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@norvalbv, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 124d13b3-1cd0-4155-8e90-b9bc9909f6a5

📥 Commits

Reviewing files that changed from the base of the PR and between 6c65287 and 57e27ed.

📒 Files selected for processing (1)
  • cli/__tests__/checklist-scripts.test.mts
📝 Walkthrough

Walkthrough

Changes

Configuration and test maintenance

Layer / File(s) Summary
Biome configuration and dependency update
biome.jsonc, package.json
Biome now references version 2.5.6. The scanner excludes bun.lock and dist.
Checklist root handling coverage
cli/__tests__/checklist-scripts.test.mts
Tests cover injected review roots, review and commit cleanup behavior, and unsafe-root validation.
CLI test maintenance
cli/__tests__/*, cli/lib/install/install-hooks.test.mts
Parameterized tests were reformatted. Subprocess option assertions tolerate missing call options.
Gate-engine test maintenance
gate-engine/**/__tests__/*, gate-engine/critique/lifecycle/work-quarantine.test.mts
Parameterized tests were reformatted without changing their scenarios or assertions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the Biome dependency upgrade and its purpose of addressing the LSP daemon memory leak.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/biome-2.5.6-daemon-leak

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/__tests__/checklist-scripts.test.mts`:
- Around line 212-221: Update the checklist test around the `spawnSync`
invocation to configure the fixture’s existing `backendRoots` with a nonmatching
root, while retaining the injected `DEVKIT_*_ROOTS` value of `' . '`. After
generation, assert that the generated state includes `src/auth$(touch
INJECTED).ts`, proving the injected root normalizes to and controls the
repository-root scan rather than falling back to the fixture configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a75a26b-fd8f-46d4-916a-e76127f6c3d6

📥 Commits

Reviewing files that changed from the base of the PR and between c6d2992 and 6c65287.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (20)
  • biome.jsonc
  • cli/__tests__/checklist-scripts.test.mts
  • cli/__tests__/decision-edit-guard.test.mts
  • cli/__tests__/knip-check-hook.test.mts
  • cli/__tests__/reconcile-detect-merged.test.mts
  • cli/__tests__/review-asset-runtime.test.mts
  • cli/__tests__/review-gate-supervisor.test.mts
  • cli/__tests__/review-private-dependencies.test.mts
  • cli/lib/install/install-hooks.test.mts
  • gate-engine/coverage/__tests__/produce.test.mts
  • gate-engine/coverage/__tests__/run.test.mts
  • gate-engine/critique/__tests__/capture-normalizer.test.mts
  • gate-engine/critique/__tests__/evidence-bindings.test.mts
  • gate-engine/critique/__tests__/evidence-lineage.test.mts
  • gate-engine/critique/__tests__/immutable-file.test.mts
  • gate-engine/critique/__tests__/persistence-lock.test.mts
  • gate-engine/critique/lifecycle/work-quarantine.test.mts
  • gate-engine/deterministic/__tests__/run.test.mts
  • gate-engine/judge/__tests__/verdict-store.test.mts
  • package.json

Comment thread cli/__tests__/checklist-scripts.test.mts
…ust that it is accepted

Addresses the CodeRabbit review comment on PR #317.

`expect(dot.status).toBe(0)` proved only that `' . '` was *accepted* — it passed equally if the script ignored `DEVKIT_REVIEW_*_ROOTS` and fell back to the fixture's configured `backendRoots: ['src']`, which already covers the crafted file.

Now the fixture's configured roots are pointed at `no-such-root` (both backend and frontend), so nothing but the injected root can reach `src/auth\$(touch INJECTED).ts`. The test then asserts the generated state contains that path, using the `stateName` element already present in `REVIEW_ROOT_CASES` but previously unused by this case.

Verified load-bearing by mutation: swapping `' . '` for a valid-but-non-matching root fails all 6 cases on the new assertion. 39/39 pass as written; biome and tsc clean.
@norvalbv
norvalbv merged commit 219cc74 into main Aug 3, 2026
1 of 2 checks passed
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