Skip to content

fix(install): bound and speed up dedicated workspace installs - #16986

Merged
zkochan merged 6 commits into
pnpm:mainfrom
jatmn:fix/16966-bounded-memory
Oct 17, 2026
Merged

zkochan merged 6 commits into
pnpm:mainfrom
jatmn:fix/16966-bounded-memory

Conversation

@jatmn

@jatmn jatmn commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Installing a large workspace with sharedWorkspaceLockfile: false could retain an unfinished install for every project. Each project's install also walked the whole workspace again, parsed every project manifest, and copied every manifest into its own workspace-package index. A workspace of N projects therefore did N² manifest reads and copies.

  • An install holds one of workspaceConcurrency slots from its start until it returns, including while it waits for its workspace dependencies before linking. A project starts once every workspace project it depends on has started, so every install in flight depends only on installs that are in flight or done, and the bound cannot deadlock. A project that must wait for its dependencies to finish before it starts (a preinstall script, or an injected or file: dependency) holds no slot while it waits. The dependency gates still let resolution overlap dependency scripts, and keep script ordering and failure propagation.
  • The install command discovers the workspace projects once, before any project runs, and builds the workspace-package index from them once, the first time an install needs it. Every project's install reads that list and index instead of walking the workspace itself. pnpm v11 does the same: it hands one allProjects list and one workspacePackages map to every project's install (createRecursiveContext). Commands that edit manifests (add, update, remove) keep walking per project.

Fixes #16966.

Benchmarks

All 9,028 project manifests of the pinned DefinitelyTyped reproduction, manifest-only checkout, default concurrency, warm store and metadata cache, --prefer-offline, Linux x64 with 32 cores. pnpm 11 and this PR ran alternately, three runs each:

Build Median elapsed Peak RSS
pnpm 11.28.6 54.7 s 4.9 GB
This PR (d5dde728c) 22.2 s 1.6 GB
Admission bound only (3bc531ebf), one run 11 min 49 s 12.1 GB

At 2,000 projects: pnpm 11 20 s / 1.8 GB, admission bound only 46 s / 2.9 GB, this PR 3.9 s / 0.54 GB.

Profiling the admission-bound build showed the time going to load_workspace_projects inside every project's install and to building and dropping the per-install workspace-package index. With MALLOC_ARENA_MAX=4 the same build peaked at about 0.4 GB, so most of its RSS was heap fragmentation from that churn rather than live data. Sharing the list and the index removed both.

Online runs against registry.npmjs.org showed intermittent stalls of 8-18 s in both pnpm 11 and pnpm 12, on whichever ran at the time, so the table uses --prefer-offline.

Behavior

Two CLI regressions from db35218e6 are not kept. They expected a later project's install to link to a target that an earlier project's lifecycle script or pnpmfile wrote into its manifest during the same install. pnpm 11.28.6 and pnpm 12.14.0 both link to the manifest as it was when the command started (checked with the same fixture), and with concurrent installs the outcome depended on which install started first. This PR keeps that start-of-command snapshot.

Validation

Reviewed commit: d5dde728c1d57c77f97b031ca7bb27a1ebc32353.

  • pnpm-cli and pnpm-package-manager suites: 6,443 passed, 5 skipped.
  • New CLI regression: a project waiting to start leaves its slot to a ready project. It times out against the previous buffer_unordered scheduler.
  • The node_modules symlink trees of a 500-project subset are identical between this PR and a build that still walks the workspace per project. The .modules.yaml files differ only in prunedAt.
  • New unit test: a dedicated install reuses the shared index only for the exact project list it was built from.
  • Kept from db35218e6: filtered sibling resolution with fresh discovery on the next command, and injected workspace dependencies.
  • Clippy on both crates, and the repository pre-push checks.

Squash Commit Body

Bound dedicated workspace installs by workspaceConcurrency from their
start until they return, including dependency waits. A project starts
once each workspace project it depends on has started, so the bound
cannot deadlock, and a project waiting to start holds no slot. Keep the
existing dependency gates and failure handling.

Discover the workspace projects once per install command and build the
workspace-package index from them once. Each project's install reads
both instead of walking the workspace and copying every manifest, so an
install of N projects no longer does N^2 manifest reads and copies.
Commands that edit manifests keep walking per project.

Fixes pnpm/pnpm#16966.

Checklist

  • Checked the referenced issue and related work.
  • The defect is specific to the Rust implementation. pnpm 11 already discovers the workspace once.
  • Updated the patch changeset for pacquet.
  • Added and kept CLI and unit regressions.
  • Ran the affected Rust suites and the pre-push checks on the final tree.

Written by an agent (Codex, GPT-6). Updated by an agent (Claude Code, claude-opus-5-5).

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2f8be7c-a8a4-4d5e-ac52-7517f632798a
📥 Commits

Reviewing files that changed from the base of the PR and between b0c35ec and d5dde72.

📒 Files selected for processing: 8
  • pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs
  • pnpm/crates/cli/tests/suite/workspace_install/pipelined.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/apply_materialization.rs
  • pnpm/crates/package-manager/src/install/run/dispatch.rs
  • pnpm/crates/package-manager/src/install/run/wanted.rs
  • pnpm/crates/package-manager/src/install/run/workspace.rs
  • pnpm/crates/package-manager/src/install/state_options.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

Dedicated installs now retain discovered workspace data for reuse during installation. Pipelined installs track dependency start and completion states, and include installs waiting on workspace dependencies in workspace concurrency.

Changes: Workspace installs

Layer / File(s) Summary
Reuse discovered workspace data
pnpm/crates/package-manager/src/install.rs, pnpm/crates/cli/src/cli_args/pipelines.rs, pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs, pnpm/crates/cli/src/state.rs, pnpm/crates/package-manager/src/install/run/workspace/*, pnpm/crates/package-manager/src/install/run/materialization_inputs.rs, pnpm/crates/package-manager/src/install/materialize.rs, pnpm/crates/package-manager/src/install/run.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile*, pnpm/crates/package-manager/src/install/tests/workspace.rs, pnpm/crates/cli/tests/suite/workspace_install*, .changeset/bounded-workspace-installs.md
Dedicated installs pass discovered workspace data into workspace loading. Materialization can reuse its package index. Tests cover workspace discovery, injected dependencies, and package-index reuse.
Bound pipelined install concurrency
pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs, pnpm/crates/cli/tests/suite/workspace_install/pipelined.rs
Pipelined runs track when dependencies start and settle. Installs hold a concurrency slot from install start until install return. Added tests check dependency ordering and slot use.

Priority: ⬆️ High

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant PipelinedRun
  participant ProjectFuture
  participant DependencyGate
  participant ProjectInstall
  PipelinedRun->>ProjectFuture: schedule project within workspace concurrency
  ProjectFuture->>DependencyGate: wait for dependencies to start or settle
  DependencyGate-->>ProjectFuture: report dependency state
  ProjectFuture->>ProjectInstall: run install when allowed
  ProjectInstall-->>PipelinedRun: return and release concurrency slot
Loading

Assessment against linked issues

Objective Addressed Explanation
Complete full-workspace installs with sharedWorkspaceLockfile: false without excessive memory growth [#16966] ❓ The changes reuse discovered workspace data and its package index, but the provided evidence does not establish memory use or confirm that the reported full-workspace install completes.

Suggested labels: product: pacquet

Suggested reviewers: rubnogueira

Merge Risk: ⚪ Minimal · up to d5dde

No merge-blocking issue was established; the change is ready for normal checks.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codecov-commenter

codecov-commenter commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.63946% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.60%. Comparing base (e22d34b) to head (d5dde72).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/pipelines/install.rs 0.00% 1 Missing ⚠️
...ager/src/install/run/workspace/loaded_workspace.rs 98.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16986      +/-   ##
==========================================
- Coverage   92.60%   92.60%   -0.01%     
==========================================
  Files        1766     1769       +3     
  Lines      227044   227477     +433     
==========================================
+ Hits       210259   210653     +394     
- Misses      16785    16824      +39     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2475.15 ms 2442.63 ms -1.3% 123.76 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1405.17 ms 1514.33 ms 7.8% 70.26 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 255.36 ms 252.13 ms -1.3% 12.77 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 311.98 ms 297.72 ms -4.6% 15.60 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 11.12 ms 10.04 ms -9.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.64 ms 10.77 ms 1.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 12.59 ms 13.14 ms 4.3% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 12.85 ms 13.40 ms 4.2% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2638.55 ms 2667.42 ms 1.1% 131.93 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1514.42 ms 1652.53 ms 9.1% 75.72 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pacquet 632.17 ms 532.33 ms -15.8% 31.61 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 371.38 ms 359.14 ms -3.3% 18.57 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1740.66 ms 1755.24 ms 0.8% 87.03 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 315.64 ms 313.64 ms -0.6% 15.78 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 281.40 ms 315.20 ms 12.0% 14.07 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 90.41 ms 93.49 ms 3.4% 4.52 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 324.18 ms 333.24 ms 2.8% 16.21 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 247.92 ms 254.39 ms 2.6% 12.40 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 84.88 ms 82.98 ms -2.2% 4.24 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4945.38 ms 5140.84 ms 4.0% 247.27 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3848.98 ms 3934.10 ms 2.2% 192.45 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 203.38 ms 185.10 ms -9.0% 10.17 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 236.00 ms 231.07 ms -2.1% 11.80 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1199.42 ms 1293.69 ms 7.9% 59.97 ms Inconclusive (overlapping samples)

Integrated-Benchmark Report (Linux)

Commit: d5dde728c1d5

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked and injected workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.475 ± 0.122 2.342 2.710 1.72 ± 0.17
pacquet@main 2.506 ± 0.112 2.361 2.691 1.75 ± 0.17
pnpr@HEAD 1.560 ± 0.123 1.395 1.730 1.09 ± 0.13
pnpr@main 1.436 ± 0.121 1.306 1.664 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4752946753200002,
      "stddev": 0.12175827098874947,
      "median": 2.44262698052,
      "user": 1.7310077199999998,
      "system": 1.6798959,
      "min": 2.3422294800200003,
      "max": 2.7100131530200002
    },
    {
      "command": "pacquet@main",
      "mean": 2.5062548058200003,
      "stddev": 0.11236464663531295,
      "median": 2.4751488530200003,
      "user": 1.63465922,
      "system": 1.6734441999999998,
      "min": 2.36140853402,
      "max": 2.69126733002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.56000577392,
      "stddev": 0.12288115127546481,
      "median": 1.51433216952,
      "user": 1.6996292199999998,
      "system": 1.6414784,
      "min": 1.39549862202,
      "max": 1.72965925702
    },
    {
      "command": "pnpr@main",
      "mean": 1.43598998712,
      "stddev": 0.12140675857975099,
      "median": 1.40517368702,
      "user": 1.31745502,
      "system": 1.3005974,
      "min": 1.30619192402,
      "max": 1.66370195602
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 256.1 ± 13.6 235.3 281.9 1.00 ± 0.13
pacquet@main 254.9 ± 30.9 211.7 309.1 1.00
pnpr@HEAD 300.3 ± 19.7 282.2 353.1 1.18 ± 0.16
pnpr@main 321.9 ± 32.9 280.3 385.0 1.26 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25605205988,
      "stddev": 0.01356068095072348,
      "median": 0.25213289358,
      "user": 0.29668062,
      "system": 0.61411854,
      "min": 0.23526662558,
      "max": 0.28192681658
    },
    {
      "command": "pacquet@main",
      "mean": 0.25486365298,
      "stddev": 0.03094909433621936,
      "median": 0.25535968258,
      "user": 0.30230011999999995,
      "system": 0.58837374,
      "min": 0.21171968258,
      "max": 0.30905378158
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30028998498000004,
      "stddev": 0.019703846748896817,
      "median": 0.29772180908,
      "user": 0.33144852,
      "system": 0.66861634,
      "min": 0.28223459458000005,
      "max": 0.35313955858
    },
    {
      "command": "pnpr@main",
      "mean": 0.32191059278000006,
      "stddev": 0.03292188340581279,
      "median": 0.31197753758,
      "user": 0.36927112,
      "system": 0.68245084,
      "min": 0.28028780458,
      "max": 0.38500496458000005
    }
  ]
}

Scenario: Isolated linker: repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.9 ± 1.2 7.7 13.0 1.00
pacquet@main 11.4 ± 1.8 8.1 20.7 1.14 ± 0.22
pnpr@HEAD 10.8 ± 1.3 8.5 15.6 1.09 ± 0.18
pnpr@main 10.8 ± 1.1 8.9 15.8 1.09 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009935985624435798,
      "stddev": 0.0011650406972139025,
      "median": 0.010036502640000002,
      "user": 0.005418109416342413,
      "system": 0.005410053696498057,
      "min": 0.00768257364,
      "max": 0.013032368640000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.011357520901261272,
      "stddev": 0.0017935530872998987,
      "median": 0.011116033640000002,
      "user": 0.006434001981981983,
      "system": 0.0059095018018018005,
      "min": 0.008128443640000002,
      "max": 0.02071834764
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.01079388526857143,
      "stddev": 0.0012525168087093865,
      "median": 0.010766927640000002,
      "user": 0.006130982857142857,
      "system": 0.005601150857142859,
      "min": 0.00854118864,
      "max": 0.01561167164
    },
    {
      "command": "pnpr@main",
      "mean": 0.010806909579024396,
      "stddev": 0.0011184037592460836,
      "median": 0.01064025364,
      "user": 0.006093796422764227,
      "system": 0.005658423577235773,
      "min": 0.00886290464,
      "max": 0.01578042864
    }
  ]
}

Scenario: Isolated linker: repeat install, cold cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 13.6 ± 3.0 8.8 23.8 1.04 ± 0.28
pacquet@main 13.1 ± 2.0 10.0 20.7 1.00
pnpr@HEAD 13.9 ± 3.0 9.4 24.4 1.06 ± 0.28
pnpr@main 13.5 ± 2.3 9.8 20.6 1.03 ± 0.24
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.013602361120412377,
      "stddev": 0.002984408593362441,
      "median": 0.01313601144,
      "user": 0.007276123298969073,
      "system": 0.007449120721649482,
      "min": 0.00878104694,
      "max": 0.02378279494
    },
    {
      "command": "pacquet@main",
      "mean": 0.013110639033137257,
      "stddev": 0.0020302043937907434,
      "median": 0.01259092094,
      "user": 0.007946483921568628,
      "system": 0.006237160784313731,
      "min": 0.00997958194,
      "max": 0.02069324494
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.013922195158750008,
      "stddev": 0.0029844900148008834,
      "median": 0.013395924940000001,
      "user": 0.008158562812499997,
      "system": 0.006937385156249998,
      "min": 0.00938649594,
      "max": 0.02440599594
    },
    {
      "command": "pnpr@main",
      "mean": 0.01345884894480769,
      "stddev": 0.0023305160654215644,
      "median": 0.01285203644,
      "user": 0.007740184807692308,
      "system": 0.006828009519230769,
      "min": 0.00981449094,
      "max": 0.02060638994
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.774 ± 0.238 2.560 3.279 1.77 ± 0.20
pacquet@main 2.648 ± 0.088 2.537 2.809 1.69 ± 0.14
pnpr@HEAD 1.636 ± 0.115 1.439 1.811 1.04 ± 0.11
pnpr@main 1.569 ± 0.119 1.423 1.740 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.77445751446,
      "stddev": 0.23808208398747047,
      "median": 2.66741501016,
      "user": 2.5826740999999993,
      "system": 2.0344019600000003,
      "min": 2.55980540966,
      "max": 3.27935255666
    },
    {
      "command": "pacquet@main",
      "mean": 2.64824509636,
      "stddev": 0.08805518990219967,
      "median": 2.63855037716,
      "user": 2.2838008,
      "system": 1.77989636,
      "min": 2.53705411966,
      "max": 2.80918307866
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.63597716596,
      "stddev": 0.1145913187103537,
      "median": 1.65253428866,
      "user": 1.3987966,
      "system": 1.53436386,
      "min": 1.43874578766,
      "max": 1.81098403366
    },
    {
      "command": "pnpr@main",
      "mean": 1.56940987756,
      "stddev": 0.1191292248650207,
      "median": 1.5144239271600002,
      "user": 1.3416622,
      "system": 1.36331726,
      "min": 1.42275087066,
      "max": 1.73981436066
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 529.9 ± 45.6 452.9 584.8 1.47 ± 0.18
pacquet@main 671.3 ± 101.9 584.2 923.5 1.86 ± 0.32
pnpr@HEAD 360.2 ± 30.0 317.8 400.3 1.00
pnpr@main 362.9 ± 22.2 322.6 384.0 1.01 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5298573297000001,
      "stddev": 0.04555688792693264,
      "median": 0.5323263922,
      "user": 0.76536752,
      "system": 0.8106204,
      "min": 0.4528975672000001,
      "max": 0.5848260542
    },
    {
      "command": "pacquet@main",
      "mean": 0.6712570445,
      "stddev": 0.10189286609740703,
      "median": 0.6321659182,
      "user": 0.9735379200000001,
      "system": 1.0051592999999999,
      "min": 0.5841948072,
      "max": 0.9234503902000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36022259710000004,
      "stddev": 0.029961519978966542,
      "median": 0.35914021470000007,
      "user": 0.3375406199999999,
      "system": 0.6781567999999999,
      "min": 0.3178361022,
      "max": 0.4002984412000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.3628719658000001,
      "stddev": 0.022202270757100913,
      "median": 0.37138278720000006,
      "user": 0.33196751999999996,
      "system": 0.6687857999999999,
      "min": 0.32256040320000007,
      "max": 0.38400918320000005
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.799 ± 0.131 1.656 2.018 5.68 ± 0.54
pacquet@main 1.788 ± 0.098 1.712 1.971 5.65 ± 0.46
pnpr@HEAD 0.317 ± 0.019 0.284 0.351 1.00
pnpr@main 0.318 ± 0.019 0.301 0.365 1.01 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.79872108132,
      "stddev": 0.13083350571700192,
      "median": 1.75523977642,
      "user": 1.2818737199999999,
      "system": 1.07016522,
      "min": 1.65551961742,
      "max": 2.01849538542
    },
    {
      "command": "pacquet@main",
      "mean": 1.78805530672,
      "stddev": 0.09760176020589069,
      "median": 1.74065719292,
      "user": 1.2183852199999996,
      "system": 1.0300871199999997,
      "min": 1.7118541934200002,
      "max": 1.97116912642
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31664766202,
      "stddev": 0.01944484179695854,
      "median": 0.31364479942,
      "user": 0.2832356199999999,
      "system": 0.57534312,
      "min": 0.28448700142,
      "max": 0.35146453442
    },
    {
      "command": "pnpr@main",
      "mean": 0.31839138682,
      "stddev": 0.01917511690816896,
      "median": 0.31564255342,
      "user": 0.29792781999999995,
      "system": 0.57383752,
      "min": 0.30050130842,
      "max": 0.36452557642
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 313.7 ± 16.1 286.2 339.6 3.46 ± 0.22
pacquet@main 286.2 ± 13.2 270.6 304.0 3.15 ± 0.19
pnpr@HEAD 97.3 ± 7.7 86.6 111.4 1.07 ± 0.09
pnpr@main 90.8 ± 3.3 85.8 97.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.31367535112000006,
      "stddev": 0.016135037376779616,
      "median": 0.31519787292,
      "user": 0.32535455999999996,
      "system": 0.12245809999999997,
      "min": 0.28622134742000005,
      "max": 0.33960613542
    },
    {
      "command": "pacquet@main",
      "mean": 0.28620658462000004,
      "stddev": 0.01319508089927943,
      "median": 0.28140435192,
      "user": 0.28153695999999995,
      "system": 0.11159159999999999,
      "min": 0.27060622442000004,
      "max": 0.30397890642000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09733303349407407,
      "stddev": 0.0077349982621154655,
      "median": 0.09349433042,
      "user": 0.035716152592592594,
      "system": 0.015599688888888893,
      "min": 0.08661838642,
      "max": 0.11137552642000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09076644876482759,
      "stddev": 0.003326542074650056,
      "median": 0.09041494242,
      "user": 0.030460318620689656,
      "system": 0.01386818620689655,
      "min": 0.08577657442,
      "max": 0.09746958442
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 336.7 ± 18.6 313.1 370.9 1.07 ± 0.09
pacquet@main 313.4 ± 19.7 270.8 329.2 1.00
pnpm@HEAD 4341.2 ± 627.8 3599.9 5469.0 13.85 ± 2.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3366837170444444,
      "stddev": 0.018649831710152494,
      "median": 0.3332436276,
      "user": 0.3471709266666666,
      "system": 0.07510065333333331,
      "min": 0.3131374426,
      "max": 0.3709296646
    },
    {
      "command": "pacquet@main",
      "mean": 0.31339080671111114,
      "stddev": 0.019737380866674033,
      "median": 0.3241815116,
      "user": 0.32872370444444443,
      "system": 0.06694065333333334,
      "min": 0.2708292216,
      "max": 0.3291525306
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.341185886933334,
      "stddev": 0.6278482417251363,
      "median": 4.089254411600001,
      "user": 6.542942704444443,
      "system": 0.49415254222222216,
      "min": 3.5998670426,
      "max": 5.4690094236
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 258.3 ± 17.5 237.4 299.4 1.04 ± 0.09
pacquet@main 249.5 ± 15.0 233.6 286.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2583209355,
      "stddev": 0.01752289538522191,
      "median": 0.2543873095,
      "user": 0.21566776000000001,
      "system": 0.10502039999999999,
      "min": 0.2374329615,
      "max": 0.2993740355
    },
    {
      "command": "pacquet@main",
      "mean": 0.2495329965909091,
      "stddev": 0.015041581682800934,
      "median": 0.2479249315,
      "user": 0.19516648727272726,
      "system": 0.10888169090909092,
      "min": 0.2336140985,
      "max": 0.2860298235
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 84.5 ± 6.1 76.6 101.4 1.00
pacquet@main 91.6 ± 16.0 78.8 141.1 1.09 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.08445808220787877,
      "stddev": 0.006076723895805222,
      "median": 0.08297549342,
      "user": 0.030095109090909098,
      "system": 0.06063249151515151,
      "min": 0.07656638842,
      "max": 0.10142746942
    },
    {
      "command": "pacquet@main",
      "mean": 0.09164200030888887,
      "stddev": 0.01600439387644127,
      "median": 0.08488223042,
      "user": 0.03396150555555555,
      "system": 0.06488597888888888,
      "min": 0.07880052842,
      "max": 0.14109316442
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.223 ± 0.230 5.004 5.667 1.35 ± 0.09
pacquet@main 5.018 ± 0.171 4.860 5.395 1.30 ± 0.08
pnpr@HEAD 3.947 ± 0.145 3.665 4.149 1.02 ± 0.06
pnpr@main 3.867 ± 0.188 3.539 4.135 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.2226248145400005,
      "stddev": 0.23031878349450716,
      "median": 5.140842468640001,
      "user": 2.7261601000000004,
      "system": 2.5113453800000003,
      "min": 5.00390516314,
      "max": 5.66689189614
    },
    {
      "command": "pacquet@main",
      "mean": 5.01757781734,
      "stddev": 0.17069660357387023,
      "median": 4.945375691140001,
      "user": 2.5885536999999994,
      "system": 2.3223812799999997,
      "min": 4.86044061714,
      "max": 5.39480629114
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.94676706244,
      "stddev": 0.14486576288668748,
      "median": 3.9340954206400003,
      "user": 2.2686922,
      "system": 2.1251492800000005,
      "min": 3.66526907614,
      "max": 4.14910415914
    },
    {
      "command": "pnpr@main",
      "mean": 3.86716655094,
      "stddev": 0.18785968910732184,
      "median": 3.8489847466400002,
      "user": 2.0064468,
      "system": 1.8984318800000004,
      "min": 3.5388121851400003,
      "max": 4.13547390714
    }
  ]
}

Scenario: GVS linker: fresh restore, hot cache + hot store

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 190.9 ± 21.9 167.0 242.2 1.00
pacquet@main 204.4 ± 14.4 184.1 231.9 1.07 ± 0.14
pnpr@HEAD 229.6 ± 17.8 199.2 251.2 1.20 ± 0.17
pnpr@main 242.3 ± 26.3 207.3 293.5 1.27 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19086929143428574,
      "stddev": 0.0218600925715581,
      "median": 0.18509687622,
      "user": 0.2424111114285714,
      "system": 0.1919376142857143,
      "min": 0.16700211422,
      "max": 0.24219483422000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.20436386898923078,
      "stddev": 0.014446809179912664,
      "median": 0.20338296722000002,
      "user": 0.2720792707692307,
      "system": 0.19072305384615382,
      "min": 0.18413250122000002,
      "max": 0.23194403922
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22964765580333338,
      "stddev": 0.017820434742617266,
      "median": 0.23106976072000002,
      "user": 0.2758388733333333,
      "system": 0.20761323333333334,
      "min": 0.19921383922000002,
      "max": 0.25116880222000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.24228808672000005,
      "stddev": 0.02626803338227521,
      "median": 0.23600447372,
      "user": 0.29269529,
      "system": 0.2198029,
      "min": 0.20728731422000002,
      "max": 0.29345631022
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.300 ± 0.108 1.168 1.456 1.08 ± 0.09
pacquet@main 1.208 ± 0.025 1.179 1.256 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.29961090368,
      "stddev": 0.10762309124097573,
      "median": 1.29368745408,
      "user": 0.78930072,
      "system": 0.31417367999999996,
      "min": 1.16794286558,
      "max": 1.45596296958
    },
    {
      "command": "pacquet@main",
      "mean": 1.2077951083799998,
      "stddev": 0.02500043306522384,
      "median": 1.19942207058,
      "user": 0.65204942,
      "system": 0.25715088,
      "min": 1.17931333258,
      "max": 1.25583801858
    }
  ]
}

@jakebailey

Copy link
Copy Markdown
Member

Completed in 24 minutes; sampled peak process RSS about 6.5 GiB

This is surprisingly slow; it doesn't take this long in pnpm 11 and below. Very odd

@jatmn

jatmn commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Completed in 24 minutes; sampled peak process RSS about 6.5 GiB

This is surprisingly slow; it doesn't take this long in pnpm 11 and below. Very odd

hmm.. let me get back to you on that.

@jatmn

jatmn commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Completed in 24 minutes; sampled peak process RSS about 6.5 GiB

This is surprisingly slow; it doesn't take this long in pnpm 11 and below. Very odd

Thanks for flagging this, Jake. The 24-minute figure came from my initial validation run, not a controlled benchmark; competing CPU load may have affected it. I should have made that limitation clear. In subsequent controlled comparisons that completed, the patch was slightly faster than the unpatched main. I’m still investigating the full-workspace memory issue and the performance gap versus pnpm 11.

Count dependency-waiting dedicated installs toward workspaceConcurrency
so large workspaces do not retain every project installation at once.
Preserve dependency ordering, overlap within the limit, and error handling.

Fixes pnpm#16966.
@zkochan
zkochan force-pushed the fix/16966-bounded-memory branch from 2d4bc49 to 3bc531e Compare October 16, 2026 19:10
Share discovered workspace projects and the resolver package map within
plain dedicated installs when scripts, hooks, project settings and other
ecosystem builds cannot change the inputs. Keep discovery fresh for
mutating paths and preserve the existing unfinished-install bound.

Avoid repeated full-workspace parsing and allocation that could still
exhaust memory after scheduling was bounded. Cover filtered siblings,
fresh subsequent commands, lifecycle and pnpmfile mutations, and injected
dependencies through the CLI.
@jatmn jatmn changed the title fix(install): bound pipelined workspace installs fix(install): reduce memory use of independent workspace installs Oct 16, 2026
zkochan and others added 2 commits October 16, 2026 23:40
Replace the opt-in discovery cache with the projects the install command
already discovered before any project ran. Each per-project install of a
`sharedWorkspaceLockfile: false` workspace reads that list and the
workspace-package index built from it once, so a workspace of N
projects no longer reparses and copies N^2 manifests, whether or not
scripts or pnpmfiles are enabled. The list is the one pnpm v11 hands to
every project's install as well.

Drop the semaphore the bounded admission made redundant: at most
`concurrency` installs are admitted, and each held at most one of its
`concurrency` permits, so acquiring one never waited.

The two CLI tests that expected a later project to see a manifest a
lifecycle script or pnpmfile rewrote are removed. Neither v11 nor the
released v12 links to the rewritten target, and with concurrent
installs the result depended on which install started first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imits

Group the loaded projects with the command's discovered workspace, and
the fresh resolve's index source into one field, so neither struct
grows past eight fields and `discover` stays short. The loading moves
into its own module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan zkochan changed the title fix(install): reduce memory use of independent workspace installs fix(install): bound and speed up dedicated workspace installs Oct 16, 2026
@zkochan
zkochan marked this pull request as ready for review October 16, 2026 22:13
@zkochan

zkochan commented Oct 16, 2026

Copy link
Copy Markdown
Member

On the slowness Jake raised: the per-project installs of a sharedWorkspaceLockfile: false workspace each walked the whole workspace and parsed every project manifest again. Each one also copied every manifest into its own workspace-package index. For DefinitelyTyped that is roughly 9,000 × 9,000 manifest reads and copies. pnpm 11 discovers the projects once and hands the same list and workspacePackages map to every project's install, which is why it was not affected.

1a9cefd0c makes the install command discover the workspace once and pass the list and index to every project's install. On the full manifest-only reproduction (warm cache, --prefer-offline, alternating runs on one machine), pnpm 11.28.6 takes 45.9 s and 4.9 GB peak RSS, and this PR takes 21.8 s and 1.6 GB. Most of the earlier 12 GB was heap fragmentation from that per-install churn. Details are in the description.

@jatmn, this replaces the opt-in cache from db35218e6. That cache only engaged with scripts disabled and no pnpmfiles, so most workspaces with scripts would have stayed quadratic. Your filtered-sibling and injected-dependency tests are kept. The two tests that expected a later project to link to a target an earlier project's postinstall or pnpmfile wrote are removed. With the same fixture, pnpm 11.28.6 and pnpm 12.14.0 both link app to packages/lib, not packages/lib/dist. With your build the result came from workspaceConcurrency: 1 running app after lib's script, so it would vary with concurrency. Commands that edit manifests (add, update, remove) still walk per project.


Written by an agent (Claude Code, claude-opus-5-5).

@zkochan
zkochan self-requested a review as a code owner October 16, 2026 22:13
Copilot AI balanced review requested due to automatic review settings October 16, 2026 22:13
@zkochan

zkochan commented Oct 16, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Bound dedicated workspace installs and reuse workspace discovery

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Count dependency-waiting installs toward workspace concurrency to bound retained install state.
• Share command-level workspace discovery and package indexing to avoid repeated manifest reads and
 allocations.
• Add regressions for scheduling, filtered installs, fresh commands, and injected dependencies.
Diagram

graph TD
  A["Workspace discovery"] --> B["Shared workspace"] --> C["Bounded scheduler"] --> D["Project installs"] --> E["Workspace loader"] --> F["Package resolver"]
  D --> G{"Dependencies ready?"} --> H["Link and scripts"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Dependency-aware admission queue
  • ➕ Could prioritize ready projects when an early-start install is waiting, improving slot utilization.
  • ➖ Adds scheduler complexity and risks changing resolution overlap, cycle handling, and failure propagation.

Recommendation: Keep the bounded unordered scheduler and command-scoped workspace snapshot: together they address retained install state and repeated workspace work while preserving the existing dependency gates. Consider a dependency-aware queue only if profiling shows waiting installs materially underuse the bound.

Files changed (18) +377 / -91

Enhancement (10) +148 / -9
pipelines.rsRetain discovered projects for dedicated runs +6/-1

Retain discovered projects for dedicated runs

• Adds a shared workspace snapshot to dedicated project selection and documents that non-mutating pipelined installs reuse it.

pnpm/crates/cli/src/cli_args/pipelines.rs

dedicated_runs.rsPass shared discovery to pipelined project installs +5/-1

Pass shared discovery to pipelined project installs

• Supplies the command's workspace snapshot to each pipelined install while leaving other dedicated commands on their existing discovery path.

pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs

install.rsBuild the workspace snapshot for dedicated install +1/-0

Build the workspace snapshot for dedicated install

• Wraps the projects discovered by the workspace install command in a shared snapshot before starting per-project installs.

pnpm/crates/cli/src/cli_args/pipelines/install.rs

state.rsCarry shared workspace data in dedicated state +5/-2

Carry shared workspace data in dedicated state

• Extends per-project install state with an optional command-discovered workspace.

pnpm/crates/cli/src/state.rs

install.rsIntroduce a shared discovered-workspace snapshot +29/-0

Introduce a shared discovered-workspace snapshot

• Adds an optional snapshot to dedicated installs. The snapshot owns the project list and its package index, and exposes the index only for that same list.

pnpm/crates/package-manager/src/install.rs

materialize.rsAccept shared or newly built package indexes +19/-2

Accept shared or newly built package indexes

• Lets fresh resolution consume the command's shared workspace-package index when available, otherwise building one from the supplied projects.

pnpm/crates/package-manager/src/install/materialize.rs

materialization_inputs.rsSelect the matching package-index source +8/-1

Select the matching package-index source

• Passes the shared index to materialization only when its project slice matches the command-discovered workspace; other slices retain index construction from their own projects.

pnpm/crates/package-manager/src/install/run/materialization_inputs.rs

loaded_workspace.rsReuse command discovery without changing override behavior +73/-0

Reuse command discovery without changing override behavior

• Prefers an explicit project override, otherwise uses the dedicated install's shared snapshot when applicable. Preserves selection-specific behavior and disk discovery when neither supplies projects.

pnpm/crates/package-manager/src/install/run/workspace/loaded_workspace.rs

install_with_fresh_lockfile.rsShare package indexes with fresh resolution +1/-1

Share package indexes with fresh resolution

• Changes fresh-resolution inputs to hold an Arc-wrapped workspace-package index.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

setup.rsForward the shared index to resolver setup +1/-1

Forward the shared index to resolver setup

• Passes the existing Arc-wrapped workspace-package index into resolver setup without wrapping or copying it again.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/setup.rs

Bug fix (1) +17 / -50
pipelined_runs.rsBound all unfinished pipelined installs +17/-50

Bound all unfinished pipelined installs

• Replaces permit handoffs with a bounded stream so dependency-waiting installs retain a concurrency slot. Keeps dependency gates and failure signaling in place.

pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs

Refactor (2) +13 / -32
run.rsAdapt install execution to loaded workspace ownership +1/-1

Adapt install execution to loaded workspace ownership

• Takes loaded workspace projects from the new workspace holder for the remainder of install execution.

pnpm/crates/package-manager/src/install/run.rs

workspace.rsIntegrate the loaded-workspace abstraction +12/-31

Integrate the loaded-workspace abstraction

• Routes workspace loading through the new holder and uses its projects for scope reporting and install setup. Moves the previous discovery helper into that holder's module.

pnpm/crates/package-manager/src/install/run/workspace.rs

Tests (4) +194 / -0
workspace_install.rsRegister workspace-discovery regressions +1/-0

Register workspace-discovery regressions

• Includes the new dedicated-install workspace discovery test module.

pnpm/crates/cli/tests/suite/workspace_install.rs

pipelined.rsTest dependency-waiting concurrency admission +54/-0

Test dependency-waiting concurrency admission

• Adds a three-project CLI fixture proving a waiting install counts toward concurrency without preventing its dependency from completing.

pnpm/crates/cli/tests/suite/workspace_install/pipelined.rs

workspace_discovery.rsTest shared discovery across install scenarios +108/-0

Test shared discovery across install scenarios

• Checks that filtered installs resolve unselected siblings, later commands see changed manifests, and injected workspace dependencies still install correctly.

pnpm/crates/cli/tests/suite/workspace_install/workspace_discovery.rs

workspace.rsGuard shared-index project identity +31/-0

Guard shared-index project identity

• Verifies the cached index is returned for its original project list, not for a separate but equivalent list or an absent list.

pnpm/crates/package-manager/src/install/tests/workspace.rs

Documentation (1) +5 / -0
bounded-workspace-installs.mdDocument the dedicated-install performance fix +5/-0

Document the dedicated-install performance fix

• Adds a patch changeset describing reduced memory use, fewer manifest reads, and the concurrency bound for dependency-waiting installs.

.changeset/bounded-workspace-installs.md

@jakebailey

Copy link
Copy Markdown
Member

Nice! Can't wait to update.

@qodo-code-review

qodo-code-review Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Projects that wait to start now block ready projects ✓ Resolved
Description
run_projects_pipelined now limits concurrency with buffer_unordered(concurrency), and inside
PipelinedRun::project a project that cannot start early waits on dependencies_installed before
its install begins. Before this change that wait happened before it took a semaphore permit, so it
held no slot. Now each such project fills a buffer slot while it holds no materialized state. When
injectWorkspacePackages is on (no project starts early), or many projects have preinstall
scripts or file:/injected deps, a group of projects waiting on one slow dependency can take up
every slot, and later independent projects that are ready to run sit idle until that dependency
finishes.
Code

pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[R116-118]

+        stream::iter(0..order.len())
+            .map(|index| run.project(index, &order[index], &position))
+            .buffer_unordered(concurrency)
Relevance

●●● Strong

Recent precedent accepted correcting dependency-wait scheduling and semaphore behavior in this exact
pipelined-run code.

PR-#16286

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In project, the line if !starts_early && !dependencies_installed.clone().await runs inside the
future that buffer_unordered counts against the limit. The removed code acquired the permit only
after this await (old lines 158-163), so a project still waiting to start held no slot.
early_starts returns an empty set when inject_workspace_packages is set, which makes every
project wait this way. The module doc says waiting installs are counted because they keep
materialized state, but projects that have not started keep none.

pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[143-151]
pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[47-59]
pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[1-15]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
With `buffer_unordered`, a project that does not start early holds a concurrency slot while it waits for its workspace dependencies to install, before its own install starts. That blocks independent projects that are ready to run.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[95-127]
- pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[143-168]

## Recommended Fix
Bring back a `Semaphore` (with `workspace_concurrency` permits) and keep the unbounded `FuturesUnordered`. In `project`, do the `!starts_early && dependencies_installed.await` wait first, then acquire the permit, and hold it until `install_project` returns. Early-start projects still keep their permit while they wait at the gate, so the memory bound this PR adds still holds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. Manifest-editing commands build an index they never use ✓ Resolved
Description
DedicatedProjects::new always constructs a DiscoveredWorkspace, whose constructor scans every
project and clones package paths and manifests into a workspace-package index. For non-pipelined
add, update, and remove commands, install_project never passes that index to a project
install, so large workspaces pay the build cost and retain the unused map for the command’s
lifetime.
Code

pnpm/crates/cli/src/cli_args/pipelines.rs[177]

+            workspace: pnpm_package_manager::DiscoveredWorkspace::new(selection.projects),
Relevance

●●● Strong

Clear eager allocation on non-pipelined mutation paths; removing unused index construction is a
local performance fix.

PR-#14435

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
DedicatedProjects::new constructs the discovered workspace, and DiscoveredWorkspace::new
immediately calls build_workspace_packages_map, which iterates over projects and clones package
paths and manifests. Manifest-editing runs set pipelined: false, while install_project passes
the discovered workspace only when self.pipelined is true, establishing that those runs build an
index they never use.

pnpm/crates/package-manager/src/install.rs[430-435]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
pnpm/crates/cli/src/cli_args/pipelines.rs[151-177]
pnpm/crates/package-manager/src/install/workspace_state.rs[312-327]
pnpm/crates/package-manager/src/install/workspace_state.rs[363-383]
pnpm/crates/cli/src/cli_args/pipelines/mutation.rs[58-85]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[95-102]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Non-pipelined manifest-editing commands build and retain a shared workspace-package index that their project installs never use.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[422-446]
- pnpm/crates/cli/src/cli_args/pipelines.rs[151-179]
- pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[95-102]

## Recommended Fix
Defer building the index until a pipelined install needs it. Either store an `Arc<OnceLock<WorkspacePackages>>` in `DiscoveredWorkspace` and initialize it on first use in `packages_of`, or construct `DiscoveredWorkspace` only for pipelined runs. Keep non-pipelined commands on their existing per-project discovery path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. A per-project workspace index is still rebuilt when links are excluded ✓ Resolved
Description
workspace_packages_for_install still calls build_workspace_packages_map over the whole shared
project list for every per-project install when excludeLinksFromLockfile and
linkWorkspacePackages are both enabled. It does not reuse the DiscoveredWorkspace index. With
that configuration, a workspace of N projects still builds and drops N full indexes, which is the N²
allocation churn this PR is meant to remove.
Code

pnpm/crates/package-manager/src/install/run/workspace.rs[R123-124]

        let workspace_packages =
-            workspace_packages_for_install(install, loaded_workspace_projects.as_deref(), options);
+            workspace_packages_for_install(install, loaded_workspace.projects.as_deref(), options);
Relevance

●●● Strong

This directly leaves an excluded-links path rebuilding full workspace indexes, undermining the PR’s
stated N² optimization.

PR-#16888

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
workspace_packages_for_install builds a fresh WorkspacePackages from
loaded_workspace.projects, which is now the shared list holding every project, instead of asking
loaded_workspace.packages_of for the shared Arc. The result goes into
InstallWorkspace::workspace_packages as an owned value.

pnpm/crates/package-manager/src/install/run/workspace.rs[143-157]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `excludeLinksFromLockfile` is enabled, each per-project install still builds the full workspace-package index from the shared project list.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[123-157]
- pnpm/crates/package-manager/src/install/run/workspace.rs[74-74]

## Recommended Fix
Change `InstallWorkspace::workspace_packages` to hold an `Arc<WorkspacePackages>`. When `loaded_workspace.packages_of(projects)` returns the command's shared index, use it; build a new index only when there is no shared one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. v11 installs keep the old workspace cost 📘 Rule violation ⌂ Architecture
Description
The Rust implementation shares one discovered workspace and package index, but no corresponding
TypeScript v11 implementation is changed. The PR states that v11 has the same dedicated-install
behavior and describes v11's shared-list approach, yet it documents neither a deferred v11 fix nor
equivalent v11 tests, leaving observable performance behavior divergent.
Code

pnpm/crates/package-manager/src/install.rs[R422-435]

+/// Every project of a workspace and the workspace-package index built from
+/// them, discovered once for all the per-project installs of a command.
+#[derive(Clone)]
+pub struct DiscoveredWorkspace {
+    projects: Arc<[pnpm_workspace::Project]>,
+    packages: Arc<pnpm_resolving_resolver_base::WorkspacePackages>,
+}
+
+impl DiscoveredWorkspace {
+    #[must_use]
+    pub fn new(projects: Vec<pnpm_workspace::Project>) -> Self {
+        let packages = build_workspace_packages_map(Some(&projects)).unwrap_or_default();
+        DiscoveredWorkspace { projects: Arc::from(projects), packages: Arc::new(packages) }
+    }
Relevance

● Weak

The PR documents that v11 already shares allProjects and workspacePackages; no divergent
implementation is established.

PR-#16783

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 713428 requires equivalent observable fixes and regression tests when a bug affects
both pnpm v11 and v12. The changed Rust code introduces the shared DiscoveredWorkspace, passes it
into dedicated installs, and adds Rust-only workspace-discovery tests, while the PR description
explicitly states that pnpm v11 has the same workspace-install behavior and does not document a
deferred v11 implementation.

Rule 713428: Keep pnpm v11 and v12 observable behavior aligned when fixing shared bugs
pnpm/crates/package-manager/src/install.rs[422-435]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
pnpm/crates/cli/tests/suite/workspace_install/workspace_discovery.rs[40-108]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR fixes repeated workspace discovery and package-index construction only in the Rust/pacquet implementation, although the PR description identifies the same behavior in pnpm v11. The supported versions therefore do not receive equivalent observable behavior changes or regression coverage.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[422-435]
- pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
- pnpm/crates/cli/tests/suite/workspace_install/workspace_discovery.rs[40-108]

## Recommended Fix
Implement the equivalent shared workspace-discovery and workspace-package-index flow in the pnpm v11 TypeScript path, or explicitly document that the v11 work is deferred with a follow-up issue. Add TypeScript regression tests covering filtered sibling resolution, fresh subsequent commands, and injected workspace dependencies so the v11 and v12 scenarios assert equivalent behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 66 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/setup (sha: a0881977) — View relationship
  Explored: repo: pnpm/exec (sha: d9dca8d2) — View relationship
Review mode: Auto: ⚖️ Balanced: Concurrency and install-state changes carry substantial performance and correctness risk.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit d5dde72

Results up to commit b0c35ec 🧠 Deep


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Projects that wait to start now block ready projects ✓ Resolved
Description
run_projects_pipelined now limits concurrency with buffer_unordered(concurrency), and inside
PipelinedRun::project a project that cannot start early waits on dependencies_installed before
its install begins. Before this change that wait happened before it took a semaphore permit, so it
held no slot. Now each such project fills a buffer slot while it holds no materialized state. When
injectWorkspacePackages is on (no project starts early), or many projects have preinstall
scripts or file:/injected deps, a group of projects waiting on one slow dependency can take up
every slot, and later independent projects that are ready to run sit idle until that dependency
finishes.
Code

pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[R116-118]

+        stream::iter(0..order.len())
+            .map(|index| run.project(index, &order[index], &position))
+            .buffer_unordered(concurrency)
Relevance

●●● Strong

Recent precedent accepted correcting dependency-wait scheduling and semaphore behavior in this exact
pipelined-run code.

PR-#16286

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
In project, the line if !starts_early && !dependencies_installed.clone().await runs inside the
future that buffer_unordered counts against the limit. The removed code acquired the permit only
after this await (old lines 158-163), so a project still waiting to start held no slot.
early_starts returns an empty set when inject_workspace_packages is set, which makes every
project wait this way. The module doc says waiting installs are counted because they keep
materialized state, but projects that have not started keep none.

pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[143-151]
pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[47-59]
pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[1-15]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
With `buffer_unordered`, a project that does not start early holds a concurrency slot while it waits for its workspace dependencies to install, before its own install starts. That blocks independent projects that are ready to run.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[95-127]
- pnpm/crates/cli/src/cli_args/pipelines/pipelined_runs.rs[143-168]

## Recommended Fix
Bring back a `Semaphore` (with `workspace_concurrency` permits) and keep the unbounded `FuturesUnordered`. In `project`, do the `!starts_early && dependencies_installed.await` wait first, then acquire the permit, and hold it until `install_project` returns. Early-start projects still keep their permit while they wait at the gate, so the memory bound this PR adds still holds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
2. Manifest-editing commands build an index they never use ✓ Resolved
Description
DedicatedProjects::new always constructs a DiscoveredWorkspace, whose constructor scans every
project and clones package paths and manifests into a workspace-package index. For non-pipelined
add, update, and remove commands, install_project never passes that index to a project
install, so large workspaces pay the build cost and retain the unused map for the command’s
lifetime.
Code

pnpm/crates/cli/src/cli_args/pipelines.rs[177]

+            workspace: pnpm_package_manager::DiscoveredWorkspace::new(selection.projects),
Relevance

●●● Strong

Clear eager allocation on non-pipelined mutation paths; removing unused index construction is a
local performance fix.

PR-#14435

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
DedicatedProjects::new constructs the discovered workspace, and DiscoveredWorkspace::new
immediately calls build_workspace_packages_map, which iterates over projects and clones package
paths and manifests. Manifest-editing runs set pipelined: false, while install_project passes
the discovered workspace only when self.pipelined is true, establishing that those runs build an
index they never use.

pnpm/crates/package-manager/src/install.rs[430-435]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
pnpm/crates/cli/src/cli_args/pipelines.rs[151-177]
pnpm/crates/package-manager/src/install/workspace_state.rs[312-327]
pnpm/crates/package-manager/src/install/workspace_state.rs[363-383]
pnpm/crates/cli/src/cli_args/pipelines/mutation.rs[58-85]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[95-102]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Non-pipelined manifest-editing commands build and retain a shared workspace-package index that their project installs never use.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[422-446]
- pnpm/crates/cli/src/cli_args/pipelines.rs[151-179]
- pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[95-102]

## Recommended Fix
Defer building the index until a pipelined install needs it. Either store an `Arc<OnceLock<WorkspacePackages>>` in `DiscoveredWorkspace` and initialize it on first use in `packages_of`, or construct `DiscoveredWorkspace` only for pipelined runs. Keep non-pipelined commands on their existing per-project discovery path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. A per-project workspace index is still rebuilt when links are excluded ✓ Resolved
Description
workspace_packages_for_install still calls build_workspace_packages_map over the whole shared
project list for every per-project install when excludeLinksFromLockfile and
linkWorkspacePackages are both enabled. It does not reuse the DiscoveredWorkspace index. With
that configuration, a workspace of N projects still builds and drops N full indexes, which is the N²
allocation churn this PR is meant to remove.
Code

pnpm/crates/package-manager/src/install/run/workspace.rs[R123-124]

        let workspace_packages =
-            workspace_packages_for_install(install, loaded_workspace_projects.as_deref(), options);
+            workspace_packages_for_install(install, loaded_workspace.projects.as_deref(), options);
Relevance

●●● Strong

This directly leaves an excluded-links path rebuilding full workspace indexes, undermining the PR’s
stated N² optimization.

PR-#16888

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
workspace_packages_for_install builds a fresh WorkspacePackages from
loaded_workspace.projects, which is now the shared list holding every project, instead of asking
loaded_workspace.packages_of for the shared Arc. The result goes into
InstallWorkspace::workspace_packages as an owned value.

pnpm/crates/package-manager/src/install/run/workspace.rs[143-157]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `excludeLinksFromLockfile` is enabled, each per-project install still builds the full workspace-package index from the shared project list.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[123-157]
- pnpm/crates/package-manager/src/install/run/workspace.rs[74-74]

## Recommended Fix
Change `InstallWorkspace::workspace_packages` to hold an `Arc<WorkspacePackages>`. When `loaded_workspace.packages_of(projects)` returns the command's shared index, use it; build a new index only when there is no shared one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. v11 installs keep the old workspace cost 📘 Rule violation ⌂ Architecture
Description
The Rust implementation shares one discovered workspace and package index, but no corresponding
TypeScript v11 implementation is changed. The PR states that v11 has the same dedicated-install
behavior and describes v11's shared-list approach, yet it documents neither a deferred v11 fix nor
equivalent v11 tests, leaving observable performance behavior divergent.
Code

pnpm/crates/package-manager/src/install.rs[R422-435]

+/// Every project of a workspace and the workspace-package index built from
+/// them, discovered once for all the per-project installs of a command.
+#[derive(Clone)]
+pub struct DiscoveredWorkspace {
+    projects: Arc<[pnpm_workspace::Project]>,
+    packages: Arc<pnpm_resolving_resolver_base::WorkspacePackages>,
+}
+
+impl DiscoveredWorkspace {
+    #[must_use]
+    pub fn new(projects: Vec<pnpm_workspace::Project>) -> Self {
+        let packages = build_workspace_packages_map(Some(&projects)).unwrap_or_default();
+        DiscoveredWorkspace { projects: Arc::from(projects), packages: Arc::new(packages) }
+    }
Relevance

● Weak

The PR documents that v11 already shares allProjects and workspacePackages; no divergent
implementation is established.

PR-#16783

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 713428 requires equivalent observable fixes and regression tests when a bug affects
both pnpm v11 and v12. The changed Rust code introduces the shared DiscoveredWorkspace, passes it
into dedicated installs, and adds Rust-only workspace-discovery tests, while the PR description
explicitly states that pnpm v11 has the same workspace-install behavior and does not document a
deferred v11 implementation.

Rule 713428: Keep pnpm v11 and v12 observable behavior aligned when fixing shared bugs
pnpm/crates/package-manager/src/install.rs[422-435]
pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
pnpm/crates/cli/tests/suite/workspace_install/workspace_discovery.rs[40-108]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR fixes repeated workspace discovery and package-index construction only in the Rust/pacquet implementation, although the PR description identifies the same behavior in pnpm v11. The supported versions therefore do not receive equivalent observable behavior changes or regression coverage.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[422-435]
- pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[98-102]
- pnpm/crates/cli/tests/suite/workspace_install/workspace_discovery.rs[40-108]

## Recommended Fix
Implement the equivalent shared workspace-discovery and workspace-package-index flow in the pnpm v11 TypeScript path, or explicitly document that the v11 work is deferred with a follow-up issue. Add TypeScript regression tests covering filtered sibling resolution, fresh subsequent commands, and injected workspace dependencies so the v11 and v12 scenarios assert equivalent behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

zkochan and others added 2 commits October 17, 2026 00:23
A project that cannot start before its workspace dependencies finish
held one of the bounded slots while it waited, so with
`injectWorkspacePackages` or many `preinstall` scripts a slow
dependency could idle every slot while independent projects were
ready. A project now takes a slot only when it starts, and starts once
each workspace project it depends on has started. Every install in
flight then depends only on installs in flight or done, so the bound
cannot deadlock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…zily

With `excludeLinksFromLockfile` and `linkWorkspacePackages`, each
dedicated install still built the workspace-package index of every
project for its link checks. It now takes the command's index too. The
index is built the first time an install asks for it, so `add`,
`update` and `remove`, whose installs walk the workspace themselves,
no longer build one they never read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d5dde72

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan

zkochan commented Oct 16, 2026

Copy link
Copy Markdown
Member

Qodo findings on b0c35ecd3:

  1. A project waiting to start held a slot. Fixed in 7ab83a2a3, though not the way the finding suggests. Taking a permit only after the pre-start wait, while early-start projects keep theirs through the gate, can deadlock. With concurrency 1, take P (starts early, no deps), Q (waits to start, depends on P) and R (starts early, depends on Q). R queues for the permit before Q asks for one, gets it when P finishes, then waits at its gate for Q, which never gets a permit. In 7ab83a2a3 a project takes a slot only once each workspace project it depends on has started. Every install in flight then depends only on installs in flight or done, so the earliest one can always finish. A project that waits to start holds no slot. The new a_project_waiting_to_start_leaves_its_slot_to_ready_projects test times out against the previous scheduler.
  2. The index was rebuilt per install under excludeLinksFromLockfile. Fixed in d5dde728c. workspace_packages_for_install now takes the command's index when its projects are the shared list.
  3. add, update and remove built an index they never read. Fixed in d5dde728c. The index is built the first time an install asks for it.
  4. v11 keeps the old workspace cost. Not acting on this. v11 already discovers once and hands one allProjects list and workspacePackages map to every project's install (installing/commands/src/recursive/context.ts), so it has no N² cost to fix.

Written by an agent (Claude Code, claude-opus-5-5).

@qodo-code-review

Copy link
Copy Markdown

Qodo findings on b0c35ecd3:

  1. A project waiting to start held a slot. Fixed in 7ab83a2a3, though not the way the finding suggests. Taking a permit only after the pre-start wait, while early-start projects keep theirs through the gate, can deadlock. With concurrency 1, take P (starts early, no deps), Q (waits to start, depends on P) and R (starts early, depends on Q). R queues for the permit before Q asks for one, gets it when P finishes, then waits at its gate for Q, which never gets a permit. In 7ab83a2a3 a project takes a slot only once each workspace project it depends on has started. Every install in flight then depends only on installs in flight or done, so the earliest one can always finish. A project that waits to start holds no slot. The new a_project_waiting_to_start_leaves_its_slot_to_ready_projects test times out against the previous scheduler.
  2. The index was rebuilt per install under excludeLinksFromLockfile. Fixed in d5dde728c. workspace_packages_for_install now takes the command's index when its projects are the shared list.
  3. add, update and remove built an index they never read. Fixed in d5dde728c. The index is built the first time an install asks for it.
  4. v11 keeps the old workspace cost. Not acting on this. v11 already discovers once and hands one allProjects list and workspacePackages map to every project's install (installing/commands/src/recursive/context.ts), so it has no N² cost to fix.

Written by an agent (Claude Code, claude-opus-5-5).

The updates address findings 1–3 as described:

  • finding 1: the semaphore is acquired only after dependency-start waits, while early-start projects retain permits through their gates, avoiding the described deadlock.
  • finding 2: the shared workspace-package index is now reused under excludeLinksFromLockfile.
  • finding 3: index construction is deferred until a pipelined install needs it, so manifest-editing commands do not eagerly build it.

finding 4 remains active, but your v11 evidence challenges its factual premise: if context.ts already shares allProjects and workspacePackages, the claimed v11 N² cost does not apply. The remaining concern is the compliance rule’s requirement for equivalent observable behavior and regression coverage/documentation across v11 and v12. You can update the rule’s scope or disable it here: https://app.qodo.ai/rules/713428?state=active

@zkochan
zkochan merged commit 2c01cc5 into pnpm:main Oct 17, 2026
57 checks passed
@jatmn
jatmn deleted the fix/16966-bounded-memory branch October 17, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full DefinitelyTyped install runs out of memory with sharedWorkspaceLockfile: false

5 participants