Skip to content

fix: stop a stalled update check from holding an up-to-date install, and trace the fast path - #16902

Merged
zkochan merged 7 commits into
mainfrom
fix-16839-2
Oct 13, 2026
Merged

zkochan merged 7 commits into
mainfrom
fix-16839-2

Conversation

@zkochan

@zkochan zkochan commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Related to #16839 (a pnpm install that prints "Already up to date" after minutes on Windows, with nothing in the TRACE output).

Two changes:

  1. The update check no longer holds the command. pnpm install and pnpm add start the daily update check alongside the command and awaited it before printing Done in .... With a registry that accepts the connection but never answers (a firewall that drops packets, a proxy that stalls), that wait is the registry client's connect and read timeouts, a minute each, on an install that had nothing else to do. The command no longer waits for it at all: a check the registry has answered has already printed its notice and recorded itself, and one still running when the command is done is aborted and records nothing, so the next command asks again. That is what pnpm v11 does (checkForUpdates(config).catch(() => {}) in main.ts), so the stall is v12-only.

    This only reaches an install that did not take the pre-runtime fast path (a pnpmfile, a frozen lockfile, workspaces in package.json, per-project lockfiles, config dependencies), because that fast path returns before the runtime exists. The reporter's install prints "Already up to date" with no repeat-install fast path skipped line, which is exactly the shape of an install that went through the engine, found nothing to do, and then waited on something silent.

  2. TRACE='pacquet::install=debug' now explains an up-to-date install. Before, the only line that target could print on this path was the reason the fast path was skipped, so an install that took the shortcut and was still slow printed nothing (which is what the reporter saw). Now it reports why the pre-runtime fast path was not taken (install_already_up_to_date returns the reason instead of None, and the CLI gate names its own reasons), when either fast path was taken, when the update check was dropped unanswered, and the duration of the phases that read the project tree or wait on something: loading the config, discovering the workspace projects, the repeat-install check, the store registration, building the HTTP client, taking the store lock. The durations come from tracing spans, which the pretty TRACE layer already prints on close.

Whether (1) is the reporter's cause cannot be confirmed from here: the repeat install on a 35-project workspace takes 93 ms on this Windows 10 machine. (2) is what will tell. I will ask the reporter to rerun with the same TRACE command once this ships.

Verified locally: cargo clippy --all-targets for both crates, the pnpm-package-manager repeat-install and lockfile-recovery tests (156 passed), the notifier unit tests, and the pre-push hook's rustfmt, workspace clippy, cargo doc, and dylint. Not run locally: the pnpm-cli suite (update_notifier::, repeat_install::), because the test build was stopped twice by the host for low system memory; CI covers them.

Squash Commit Body

An install that cannot take the pre-runtime fast path spawns the daily
update check alongside itself and awaited it before the "Done in"
footer. On a registry that accepts the connection and never answers,
the registry client's connect and read timeouts (a minute each) became
the duration of an install that had nothing else to do, and nothing in
the TRACE output said so. pnpm v11 never waits for its check.

`update_notifier::settle` no longer waits: a check the registry has
answered has already printed its notice and recorded itself, and one
still running when the command is done is aborted, logged at debug, and
not recorded, so the next command asks again.

The `pacquet::install` trace target used to print nothing for an
install that took the shortcut, so it could not say where a slow one
spent its time. `install_already_up_to_date` now returns the reason the
shortcut was not taken instead of `None`, the CLI gate names its own
reasons, both fast paths log when they are taken, and the phases that
read the project tree or wait on something (config load, workspace
project discovery, the repeat-install check, store registration, HTTP
client construction, the store lock) run inside debug spans whose close
events carry their duration.

Related to pnpm/pnpm#16839.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • pnpm install and pnpm add no longer wait for the daily update check to finish. If the check is still pending when the command completes, no notice is shown and the check is retried on a later run.
  • Improvements
    • Added debug tracing with reasons the repeat-install fast path is skipped, plus timings for key install stages. See the contributing guide for how to enable the trace.

zkochan and others added 5 commits October 13, 2026 12:29
An install that cannot take the pre-runtime fast path spawns the daily
update check alongside itself and awaited it before the "Done in"
footer. On a registry that accepts the connection and never answers,
the registry client's connect and read timeouts (a minute each) became
the duration of an install that had nothing else to do, and nothing in
the TRACE output said so. pnpm v11 never waits for its check.

`update_notifier::settle` now waits at most UPDATE_CHECK_GRACE_PERIOD
(one second) for a check that is still running, then aborts it and logs
that at debug. Nothing is recorded in that case, so the next command
checks again. A check that answered in time still reaches the terminal.

Related to #16839.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The `pacquet::install` target printed nothing for an install that took
the shortcut, so it could not say where a slow "Already up to date" run
spent its time: the only line it could emit was the reason the fast
path was skipped.

`install_already_up_to_date` now returns the reason the shortcut was
not taken instead of `None`, the CLI gate names its own reasons, both
fast paths log when they are taken, and the phases that read the
project tree or wait on something (config load, workspace project
discovery, the repeat-install check, store registration, HTTP client
construction, the store lock) run inside debug spans whose close events
carry their duration.

Related to #16839.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Extract the store lock, the traced verdict, project discovery, and the
repeat-install check into helpers so `run.rs`, `RunExecution::run`, and
`install_already_up_to_date` stay under the dylint function, file, and
binding limits.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Move the traced project discovery out of `run_with_config`, which the
span block had pushed past the dylint function limit.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 285891e1-1132-428a-9e08-b8b164d42962
📥 Commits

Reviewing files that changed from the base of the PR and between 81df72c and fd5803d.

📒 Files selected for processing: 5
  • .changeset/update-check-does-not-hold-install.md
  • pnpm/crates/cli/src/cli_args/dispatch_install.rs
  • pnpm/crates/cli/src/cli_args/update_notifier.rs
  • pnpm/crates/cli/src/cli_args/update_notifier/tests.rs
  • pnpm/crates/cli/tests/suite/update_notifier.rs
 ___________________________________________________________
< Veni, Vidi, Codici Fixi. I came, I saw, I fixed the code. >
 -----------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

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: f033f8f6-e404-4ca8-a3b7-ae1694a43f7c
📥 Commits

Reviewing files that changed from the base of the PR and between 2f784ba and 81df72c.

📒 Files selected for processing (5)
  • .changeset/update-check-does-not-hold-install.md
  • pnpm/crates/cli/src/cli_args/update_notifier.rs
  • pnpm/crates/cli/src/cli_args/update_notifier/tests.rs
  • pnpm/crates/cli/tests/suite/update_notifier.rs
  • pnpm/crates/package-manager/src/install/workspace_state.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/update-check-does-not-hold-install.md

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

📝 Walkthrough

The update notifier now limits how long a successful command waits for an update check. Install fast-path checks now report skip reasons, and tracing covers key install stages.

Changes: Update-check timeout

Layer / File(s) Summary
Bound update-check wait
pnpm/crates/cli/src/cli_args/update_notifier.rs, pnpm/crates/cli/src/cli_args/update_notifier/tests.rs, pnpm/crates/cli/tests/suite/update_notifier.rs, .changeset/update-check-does-not-hold-install.md
After a successful command, the notifier waits up to one second for the update check, then aborts it if it is still running and records the check time. On command failure, it aborts the check immediately without recording state. Tests cover these paths and a registry that does not reply.

Install fast-path diagnostics

Layer / File(s) Summary
Report fast-path eligibility and outcomes
pnpm/crates/package-manager/src/install/workspace_state.rs, pnpm/crates/cli/src/cli_args/install/fast_path.rs, pnpm/crates/cli/src/cli_args/dispatch.rs, pnpm/crates/cli/src/cli_args/install/tests.rs, pnpm/crates/package-manager/src/install/tests/*
Fast-path checks now return specific reasons when eligibility or up-to-date checks fail. Tests cover the updated results and eligibility checks.
Trace install stages
pnpm/crates/cli/src/cli_args/pipelines/install.rs, pnpm/crates/package-manager/src/install/run/..., pnpm/CONTRIBUTING.md
Tracing spans cover configuration preparation, workspace discovery, HTTP-client initialization, repeat-install checks, and store locking. The contributor guide documents how to enable install tracing.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant InstallCommand
  participant UpdateNotifier
  participant Registry
  participant StateFile
  InstallCommand->>UpdateNotifier: settle command result
  UpdateNotifier->>Registry: wait up to one second for update check
  UpdateNotifier->>Registry: abort check if still pending
  UpdateNotifier->>StateFile: record check time after timeout
Loading

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to 81df7

The change bounds how long an install waits for the daily update check and adds install tracing. No merge-blocking risk was identified.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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.

@zkochan zkochan mentioned this pull request Oct 13, 2026
2 of 5 tasks
@codecov-commenter

codecov-commenter commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.49749% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.61%. Comparing base (063bd8d) to head (81df72c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tes/package-manager/src/install/workspace_state.rs 98.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16902      +/-   ##
==========================================
+ Coverage   92.59%   92.61%   +0.01%     
==========================================
  Files        1708     1708              
  Lines      221550   221682     +132     
==========================================
+ Hits       205155   205302     +147     
+ Misses      16395    16380      -15     

☔ 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 13, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     14.8±1.13ms    25.3 MB/sec    1.59     23.6±3.50ms    15.9 MB/sec
packument/parse                                  1.00     49.9±3.71µs  1328.1 MB/sec    1.19     59.3±6.31µs  1118.0 MB/sec
tarball/download_dependency                      1.00      4.3±0.63ms  1011.2 KB/sec    1.43      6.1±0.85ms   706.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    217.9±9.13ms 73.4 KElem/sec    1.54   335.2±31.43ms 47.7 KElem/sec
version_pick/repeated_ranges_file                1.00      5.4±0.51ms  5.8 KElem/sec    1.27      6.9±1.85ms  4.5 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.8±0.15ms  6.5 KElem/sec    1.24      6.0±0.39ms  5.2 KElem/sec
workspace_resolution/hoist_heavy                 1.00   399.1±80.27ms        ? ?/sec    1.09   436.1±31.01ms        ? ?/sec
workspace_sort/chained_projects                  1.00     20.5±5.39ms        ? ?/sec    1.36     27.8±6.88ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 13, 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 2526.48 ms 2548.85 ms 0.9% 126.32 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1571.95 ms 1442.26 ms -8.3% 78.60 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 251.11 ms 250.94 ms -0.1% 12.56 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 277.14 ms 267.83 ms -3.4% 13.86 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 11.60 ms 12.40 ms 6.9% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.63 ms 12.51 ms 7.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 10.03 ms 10.57 ms 5.4% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 9.51 ms 9.25 ms -2.7% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2770.87 ms 2716.41 ms -2.0% 138.54 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1748.10 ms 1783.77 ms 2.0% 87.41 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 638.63 ms 619.82 ms -2.9% 31.93 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 421.18 ms 385.32 ms -8.5% 21.06 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1782.54 ms 1715.97 ms -3.7% 89.13 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 331.38 ms 338.48 ms 2.1% 16.57 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 263.24 ms 275.16 ms 4.5% 13.16 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 103.44 ms 101.53 ms -1.9% 5.17 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 263.15 ms 261.02 ms -0.8% 13.16 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 259.35 ms 246.37 ms -5.0% 12.97 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 91.79 ms 96.59 ms 5.2% 4.59 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4653.42 ms 4787.06 ms 2.9% 232.67 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3635.81 ms 3670.59 ms 1.0% 181.79 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 195.60 ms 208.21 ms 6.4% 9.78 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pnpr 210.29 ms 240.73 ms 14.5% 10.51 ms Inconclusive (overlapping samples)
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1258.75 ms 1155.68 ms -8.2% 62.94 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 81df72c369cc

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.558 ± 0.074 2.469 2.668 1.78 ± 0.16
pacquet@main 2.571 ± 0.115 2.466 2.817 1.79 ± 0.17
pnpr@HEAD 1.439 ± 0.120 1.299 1.663 1.00
pnpr@main 1.543 ± 0.129 1.330 1.694 1.07 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5575212945,
      "stddev": 0.07428718903576612,
      "median": 2.5488546129000005,
      "user": 1.8344044199999998,
      "system": 1.5882584599999998,
      "min": 2.4686837489,
      "max": 2.6681681009000005
    },
    {
      "command": "pacquet@main",
      "mean": 2.5705744135,
      "stddev": 0.11467277096454313,
      "median": 2.5264783354,
      "user": 1.79693772,
      "system": 1.68355356,
      "min": 2.4664488839,
      "max": 2.8166966009000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4391626102,
      "stddev": 0.12000294421629741,
      "median": 1.4422588583999998,
      "user": 1.38404402,
      "system": 1.36108046,
      "min": 1.2989483549,
      "max": 1.6625036399
    },
    {
      "command": "pnpr@main",
      "mean": 1.543436533,
      "stddev": 0.12907777252632213,
      "median": 1.5719457149,
      "user": 1.44198212,
      "system": 1.37167336,
      "min": 1.3298853729,
      "max": 1.6936292848999999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 258.4 ± 25.8 230.0 315.6 1.02 ± 0.10
pacquet@main 252.3 ± 5.5 242.3 261.3 1.00
pnpr@HEAD 269.1 ± 8.1 258.1 285.0 1.07 ± 0.04
pnpr@main 279.3 ± 12.0 259.8 301.0 1.11 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25844438750000004,
      "stddev": 0.02584507408734439,
      "median": 0.2509378576,
      "user": 0.2957797,
      "system": 0.6187460999999999,
      "min": 0.2299532101,
      "max": 0.3155866611
    },
    {
      "command": "pacquet@main",
      "mean": 0.2522652137,
      "stddev": 0.0055005859293528435,
      "median": 0.2511109131,
      "user": 0.2858414999999999,
      "system": 0.6260256,
      "min": 0.2422657731,
      "max": 0.2613170331
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2690531994,
      "stddev": 0.008147348165143226,
      "median": 0.26783437860000003,
      "user": 0.29756119999999997,
      "system": 0.624385,
      "min": 0.2581260911,
      "max": 0.2849895981
    },
    {
      "command": "pnpr@main",
      "mean": 0.2792709936,
      "stddev": 0.012033707263359422,
      "median": 0.2771365736,
      "user": 0.3150454,
      "system": 0.6155008,
      "min": 0.2597866641,
      "max": 0.3009532001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.7 ± 1.5 10.1 20.1 1.06 ± 0.20
pacquet@main 12.0 ± 1.7 9.6 21.4 1.00
pnpr@HEAD 12.6 ± 1.2 10.6 16.2 1.05 ± 0.18
pnpr@main 12.4 ± 2.2 9.2 20.6 1.03 ± 0.23
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012681261359814823,
      "stddev": 0.0015329181088943118,
      "median": 0.01239507342,
      "user": 0.00722938574074074,
      "system": 0.006726918703703704,
      "min": 0.01014394342,
      "max": 0.020125792420000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.011997593650769226,
      "stddev": 0.0016821662817139383,
      "median": 0.01159707192,
      "user": 0.006814998021978019,
      "system": 0.006274567032967033,
      "min": 0.00957279942,
      "max": 0.021369963420000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.012628662925000003,
      "stddev": 0.0011697909258966668,
      "median": 0.01250691892,
      "user": 0.007299855000000003,
      "system": 0.006567639100000002,
      "min": 0.01057819042,
      "max": 0.016234170420000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.012352246059484978,
      "stddev": 0.002169821946648227,
      "median": 0.01163219242,
      "user": 0.0068705672103004265,
      "system": 0.006593336137339056,
      "min": 0.00918010042,
      "max": 0.020587373420000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.9 ± 1.5 8.0 15.8 1.16 ± 0.21
pacquet@main 10.1 ± 1.1 8.0 13.0 1.08 ± 0.16
pnpr@HEAD 9.4 ± 1.0 7.5 12.5 1.00
pnpr@main 9.6 ± 0.8 7.9 15.8 1.03 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0108509056775862,
      "stddev": 0.0015222531786632015,
      "median": 0.0105745486,
      "user": 0.006329414310344824,
      "system": 0.005439854827586209,
      "min": 0.007981917100000001,
      "max": 0.0157939801
    },
    {
      "command": "pacquet@main",
      "mean": 0.0101229671909091,
      "stddev": 0.0010522634864127713,
      "median": 0.010034080600000002,
      "user": 0.006376804628099173,
      "system": 0.004598076198347109,
      "min": 0.007968222100000002,
      "max": 0.012956572100000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009350981173929962,
      "stddev": 0.0010116856377413582,
      "median": 0.009246485100000002,
      "user": 0.005623412295719843,
      "system": 0.00451615392996109,
      "min": 0.007523296100000001,
      "max": 0.012512758100000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.009605421659701496,
      "stddev": 0.0008256647097213424,
      "median": 0.009505348100000002,
      "user": 0.005738316716417911,
      "system": 0.00470895,
      "min": 0.007862644100000002,
      "max": 0.0157810131
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.721 ± 0.109 2.562 2.898 1.59 ± 0.14
pacquet@main 2.758 ± 0.066 2.645 2.858 1.61 ± 0.14
pnpr@HEAD 1.734 ± 0.113 1.526 1.834 1.01 ± 0.11
pnpr@main 1.713 ± 0.139 1.545 1.860 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.72108057504,
      "stddev": 0.10909814158218437,
      "median": 2.71640574214,
      "user": 2.59139214,
      "system": 2.0637727999999997,
      "min": 2.5620183001399996,
      "max": 2.8982541671399997
    },
    {
      "command": "pacquet@main",
      "mean": 2.75769831064,
      "stddev": 0.06594766035449728,
      "median": 2.7708728096399997,
      "user": 2.74933484,
      "system": 2.0993235,
      "min": 2.64470716814,
      "max": 2.8580954841399997
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.73428389774,
      "stddev": 0.1133437924003414,
      "median": 1.78377488264,
      "user": 1.71633374,
      "system": 1.7755987999999998,
      "min": 1.52596268214,
      "max": 1.83416827714
    },
    {
      "command": "pnpr@main",
      "mean": 1.71329940264,
      "stddev": 0.13947162901494325,
      "median": 1.7481032176400002,
      "user": 1.75316914,
      "system": 1.8276815999999996,
      "min": 1.54460694314,
      "max": 1.85950759414
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 613.9 ± 31.3 563.2 653.1 1.60 ± 0.13
pacquet@main 636.7 ± 48.2 546.9 689.8 1.66 ± 0.16
pnpr@HEAD 382.7 ± 23.2 342.8 417.7 1.00
pnpr@main 418.7 ± 20.0 388.7 445.5 1.09 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6138982773799999,
      "stddev": 0.031314426582672604,
      "median": 0.6198176686800001,
      "user": 0.86162336,
      "system": 1.02452422,
      "min": 0.56318213568,
      "max": 0.65311704968
    },
    {
      "command": "pacquet@main",
      "mean": 0.6366943382800001,
      "stddev": 0.04822153674794892,
      "median": 0.63862642118,
      "user": 0.9520134600000001,
      "system": 1.0158755199999998,
      "min": 0.54690348668,
      "max": 0.68982296068
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3827127956800001,
      "stddev": 0.023208725796531608,
      "median": 0.38531765718,
      "user": 0.35767545999999995,
      "system": 0.75133412,
      "min": 0.34276683868,
      "max": 0.41766088568000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.41869454838,
      "stddev": 0.020015862797782395,
      "median": 0.42118131818000004,
      "user": 0.42417856,
      "system": 0.81970882,
      "min": 0.38866476868000005,
      "max": 0.44546824468
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.725 ± 0.040 1.666 1.820 5.21 ± 0.17
pacquet@main 1.780 ± 0.032 1.728 1.831 5.38 ± 0.16
pnpr@HEAD 0.340 ± 0.013 0.321 0.362 1.03 ± 0.05
pnpr@main 0.331 ± 0.008 0.318 0.345 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.72451742978,
      "stddev": 0.04010120228734207,
      "median": 1.7159690052799998,
      "user": 1.19597944,
      "system": 1.0400564799999998,
      "min": 1.6659121457800001,
      "max": 1.81990800978
    },
    {
      "command": "pacquet@main",
      "mean": 1.7802899648800001,
      "stddev": 0.031776404693903575,
      "median": 1.78254413028,
      "user": 1.2718009399999999,
      "system": 1.1616009799999998,
      "min": 1.7280794347800001,
      "max": 1.8309247797800001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33968500328,
      "stddev": 0.012840410558269335,
      "median": 0.33847635528000003,
      "user": 0.32898694,
      "system": 0.65221818,
      "min": 0.32146844378,
      "max": 0.36242231478000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.33072179908000005,
      "stddev": 0.0075763232802083256,
      "median": 0.33138404928,
      "user": 0.30343204,
      "system": 0.66719588,
      "min": 0.31786762378,
      "max": 0.34450094478000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 274.0 ± 14.5 253.1 302.4 2.67 ± 0.20
pacquet@main 265.0 ± 14.3 245.5 294.8 2.59 ± 0.20
pnpr@HEAD 102.5 ± 5.5 94.5 117.0 1.00
pnpr@main 106.6 ± 10.3 91.5 132.1 1.04 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2739651836,
      "stddev": 0.01448648354584919,
      "median": 0.27515676180000004,
      "user": 0.26252638000000006,
      "system": 0.10512121999999999,
      "min": 0.2530868858,
      "max": 0.3023999108
    },
    {
      "command": "pacquet@main",
      "mean": 0.2650221044363636,
      "stddev": 0.014270302780951172,
      "median": 0.2632425738,
      "user": 0.26108718909090906,
      "system": 0.09363135636363636,
      "min": 0.24549979480000003,
      "max": 0.2948368048
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10249614012142859,
      "stddev": 0.0054933921617569825,
      "median": 0.10152731980000002,
      "user": 0.04227806571428571,
      "system": 0.01841743428571429,
      "min": 0.09453807380000001,
      "max": 0.11702289080000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.10659099383703706,
      "stddev": 0.010314861033774108,
      "median": 0.10344187480000001,
      "user": 0.041128279999999996,
      "system": 0.02271205333333333,
      "min": 0.0914699828,
      "max": 0.13212096480000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 262.9 ± 9.4 246.9 276.6 1.00 ± 0.12
pacquet@main 261.8 ± 29.9 225.3 308.0 1.00
pnpm@HEAD 4646.3 ± 631.2 4083.6 6108.5 17.75 ± 3.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2628527989044444,
      "stddev": 0.009377763815095162,
      "median": 0.26101735046,
      "user": 0.2842082244444445,
      "system": 0.05029883555555555,
      "min": 0.24685903946,
      "max": 0.27658627646
    },
    {
      "command": "pacquet@main",
      "mean": 0.2617914203488889,
      "stddev": 0.029929044466221827,
      "median": 0.26314571346,
      "user": 0.26601955777777775,
      "system": 0.05111294666666667,
      "min": 0.22527915246,
      "max": 0.30802007146
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.64629892346,
      "stddev": 0.6311819277146565,
      "median": 4.4435093854600005,
      "user": 7.128233002222221,
      "system": 0.4143499466666667,
      "min": 4.08362728146,
      "max": 6.10845461346
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 248.0 ± 18.7 226.9 287.5 1.00
pacquet@main 256.4 ± 15.4 236.2 294.3 1.03 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24800441849666666,
      "stddev": 0.018668128971133967,
      "median": 0.24636567358,
      "user": 0.21367059666666666,
      "system": 0.08783074333333334,
      "min": 0.22686427558,
      "max": 0.28752987158000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.25639196567090905,
      "stddev": 0.01537535839024789,
      "median": 0.25935458558,
      "user": 0.21080436181818182,
      "system": 0.09982034181818182,
      "min": 0.23622486458,
      "max": 0.29433042858
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 97.0 ± 6.7 87.9 119.7 1.04 ± 0.09
pacquet@main 93.7 ± 5.3 85.1 104.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0970075121625,
      "stddev": 0.006678531984234323,
      "median": 0.09659043310000001,
      "user": 0.036795884999999987,
      "system": 0.06747951625,
      "min": 0.08789334060000001,
      "max": 0.11973339960000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.09367552842758621,
      "stddev": 0.00533272570238023,
      "median": 0.0917877936,
      "user": 0.035188122068965516,
      "system": 0.0660749979310345,
      "min": 0.08514008760000001,
      "max": 0.1042191046
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.786 ± 0.182 4.544 5.077 1.32 ± 0.06
pacquet@main 4.682 ± 0.140 4.566 5.040 1.29 ± 0.04
pnpr@HEAD 3.677 ± 0.075 3.570 3.821 1.01 ± 0.03
pnpr@main 3.629 ± 0.063 3.543 3.748 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.78601252422,
      "stddev": 0.18197344230234339,
      "median": 4.78705727492,
      "user": 2.22298754,
      "system": 2.1234101,
      "min": 4.54436272092,
      "max": 5.07744976592
    },
    {
      "command": "pacquet@main",
      "mean": 4.6824553378200005,
      "stddev": 0.14047149289998176,
      "median": 4.65341682942,
      "user": 2.2471650399999996,
      "system": 2.1995348,
      "min": 4.56616812592,
      "max": 5.03985166392
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.67727453902,
      "stddev": 0.07519669037737726,
      "median": 3.6705945729200002,
      "user": 1.96317564,
      "system": 1.8992952999999997,
      "min": 3.56963378792,
      "max": 3.82138703892
    },
    {
      "command": "pnpr@main",
      "mean": 3.6293485013200004,
      "stddev": 0.06332264110002214,
      "median": 3.6358063634200004,
      "user": 1.7927419400000002,
      "system": 1.9294998999999997,
      "min": 3.54262317292,
      "max": 3.7477892119200003
    }
  ]
}

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 213.5 ± 19.9 190.5 254.3 1.09 ± 0.13
pacquet@main 195.3 ± 12.9 177.2 216.7 1.00
pnpr@HEAD 238.0 ± 20.0 201.3 265.7 1.22 ± 0.13
pnpr@main 211.0 ± 20.0 174.2 249.0 1.08 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21354757623666668,
      "stddev": 0.019905637306483065,
      "median": 0.20820763782,
      "user": 0.2549462533333333,
      "system": 0.21271495666666665,
      "min": 0.19047963532,
      "max": 0.25434019832000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.19530022908923078,
      "stddev": 0.012939191573229461,
      "median": 0.19559746532000002,
      "user": 0.2335873046153846,
      "system": 0.20015604,
      "min": 0.17723610532,
      "max": 0.21666684132000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.23802895613818184,
      "stddev": 0.019966052992397773,
      "median": 0.24072622132000002,
      "user": 0.25418710181818177,
      "system": 0.20729094909090906,
      "min": 0.20128946332,
      "max": 0.26566803532000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.21098102755076925,
      "stddev": 0.020012129598863355,
      "median": 0.21028923532000002,
      "user": 0.22495899692307691,
      "system": 0.20873203999999998,
      "min": 0.17417088732000002,
      "max": 0.24896732932
    }
  ]
}

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.153 ± 0.021 1.121 1.191 1.00
pacquet@main 1.255 ± 0.085 1.152 1.368 1.09 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1532012121400002,
      "stddev": 0.021401240264039126,
      "median": 1.15567890444,
      "user": 0.56991952,
      "system": 0.22707546,
      "min": 1.12100598344,
      "max": 1.1906064644399998
    },
    {
      "command": "pacquet@main",
      "mean": 1.25526741964,
      "stddev": 0.08452252414284706,
      "median": 1.25874899994,
      "user": 0.74732502,
      "system": 0.28447255999999993,
      "min": 1.15170793344,
      "max": 1.3677438364399999
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 13, 2026 13:00
Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:00

@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 stalled update checks and trace up-to-date installs

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Limit post-install waiting for the daily update check to one second, preventing stalled registries
 from delaying completion.
• Explain fast-path decisions and time-consuming install phases through pacquet::install tracing.
• Cover update-check cancellation with tests and document how to diagnose slow installs.
Diagram

graph TD
  CLI["Install command"] --> Gate{"Fast path eligible?"} -->|yes| Fast["Repeat check"] -->|up to date| Footer["Done footer"]
  Gate -->|no| Full["Install engine"] --> Settle["Bounded settle"] --> Footer
  Fast -->|fallback| Full
  Full -->|spawn| Update["Registry update check"] -->|result| Settle
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Never await the update check
  • ➕ Eliminates post-command waiting, as in pnpm v11.
  • ➖ A check still running at process exit may never deliver its notice; explicitly managing its cancellation is clearer.
2. Timeout the check from command start
  • ➕ Places a simple overall bound on registry-check duration.
  • ➖ Could discard a useful result during a long-running install, even though it arrives before the command finishes.

Recommendation: Keep the post-command grace period: it preserves timely notices without letting registry timeouts hold a finished install. The separate pre-runtime path and engine instrumentation are appropriate because either path can produce an up-to-date result.

Files changed (15) +452 / -118

Enhancement (7) +256 / -101
dispatch.rsTime fast-path config loading +5/-2

Time fast-path config loading

• Wraps pre-runtime fast-path configuration preparation in a debug span.

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

fast_path.rsReport pre-runtime fast-path outcomes and blockers +87/-51

Report pre-runtime fast-path outcomes and blockers

• Replaces the eligibility boolean with specific ineligibility reasons and logs whether the shortcut ran. Parsing and workspace checks also return fallback reasons without changing the full install's responsibility for errors.

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

install.rsTrace full-install preparation phases +26/-10

Trace full-install preparation phases

• Adds debug spans around config preparation, workspace-project selection, and HTTP client construction.

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

run.rsRoute store locking through a traced helper +3/-7

Route store locking through a traced helper

• Replaces inline store-lock acquisition with a helper that preserves frozen and ordinary locking behavior while timing the wait.

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

execution.rsTrace the engine repeat-install decision +21/-1

Trace the engine repeat-install decision

• Times the engine's repeat-install verdict and logs when that path short-circuits an unchanged install.

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

fast_path.rsTime store-lock acquisition +14/-0

Time store-lock acquisition

• Introduces a 'lock_store' helper with a 'pacquet::install' debug span around frozen or normal store-lock acquisition.

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

workspace_state.rsExplain and time synchronous fast-path checks +100/-30

Explain and time synchronous fast-path checks

• Returns specific fallback reasons instead of 'None' and adds spans around project discovery, the repeat-install check, and store registration. Existing failures still fall through to the full install path.

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

Bug fix (1) +29 / -9
update_notifier.rsBound and abort unfinished update checks +29/-9

Bound and abort unfinished update checks

• Successful commands wait at most one second for a pending check, then abort it and emit a debug message. Failed commands continue to abort immediately; completed checks can still report and record their result.

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

Tests (5) +152 / -8
tests.rsVerify the allow-build fast-path reason +4/-3

Verify the allow-build fast-path reason

• Updates the eligibility test to assert both the default absence of a blocker and the reason reported for '--allow-build'.

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

tests.rsTest update-check settlement and cancellation +94/-1

Test update-check settlement and cancellation

• Adds async tests for grace-period expiry, timely completion, and immediate cancellation after command failure.

pnpm/crates/cli/src/cli_args/update_notifier/tests.rs

update_notifier.rsReproduce a registry that accepts but never answers +50/-0

Reproduce a registry that accepts but never answers

• Adds an install integration test using a silent TCP registry. It checks that install succeeds without a long wait, emits no update notice, and does not record an unanswered check.

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

lockfile_recovery.rsAdapt lockfile tests to the new fast-path result +2/-2

Adapt lockfile tests to the new fast-path result

• Updates successful fast-path assertions to use the new 'Result' return type.

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

repeat_install.rsAdapt repeat-install tests to the new fast-path result +2/-2

Adapt repeat-install tests to the new fast-path result

• Checks successful shortcuts with 'Ok' and modified-manifest fallthrough with 'Err'.

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

Documentation (2) +15 / -0
update-check-does-not-hold-install.mdRecord the patch release and user-visible fix +5/-0

Record the patch release and user-visible fix

• Adds a patch changeset explaining that install and add no longer wait indefinitely for an unanswered update check.

.changeset/update-check-does-not-hold-install.md

CONTRIBUTING.mdDocument tracing for slow up-to-date installs +10/-0

Document tracing for slow up-to-date installs

• Shows how to enable 'pacquet::install' debug tracing and identifies the install phases it helps diagnose.

pnpm/CONTRIBUTING.md

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 13, 2026
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. The slowdown fix lacks before/after data 📜 Skill insight ➹ Performance
Description
The new changeset claims a minutes-long install slowdown is fixed but supplies no paired
before-and-after measurement. Without comparable v11 and v12 results across repeated Windows runs,
reviewers cannot verify the affected up-to-date workspace improved rather than merely receiving a
one-second timeout.
Code

.changeset/update-check-does-not-hold-install.md[5]

+`pnpm install` and `pnpm add` no longer wait for the daily update check when the registry does not answer it. The check now has one second after the command finishes to report a newer pnpm. Otherwise the command finishes without the notice and checks again next time. On a registry that accepted the connection but never answered, an install that had nothing to do used to take minutes [#16839](https://github.com/pnpm/pnpm/issues/16839).
Relevance

●●● Strong

Recent performance changesets include concrete before/after figures, supporting the repository’s
expectation for measurable claims.

PR-#16661
PR-#13491

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires a numeric before-and-after measurement for performance changes. The changeset
describes the user-visible slowdown and the one-second grace period, but provides no benchmark table
or paired timing results.

.changeset/update-check-does-not-hold-install.md[1-5]
Skill: review-code

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 performance fix claims to prevent stalled update checks from holding installs, but the PR does not provide paired quantitative evidence demonstrating the improvement against the previous behavior or pnpm v11.

## Fix Focus Areas
- .changeset/update-check-does-not-hold-install.md[1-5]

## Recommended Fix
Add benchmark results from comparable Windows 10 runs of an already up-to-date workspace, including repeated before-and-after measurements for pnpm v11 and the changed pnpm v12 path, with the workspace size and relevant cold or warm conditions documented.

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

Dismiss ↗ | View ↗


2. A slow state disk still holds the install ✓ Resolved
Description
settle calls the synchronous write_state after its one-second timeout, and that write includes a
filesystem sync. When the state directory is on slow or unhealthy storage, a successful install
still waits for that I/O before it can finish, even though the registry check has been abandoned.
Code

pnpm/crates/cli/src/cli_args/update_notifier.rs[120]

+        write_state(&state_file, state, Utc::now());
Evidence
The install awaits settle; the newly added timeout branch writes state before returning. That
write invokes the atomic writer, which syncs the temporary file to storage.

pnpm/crates/cli/src/cli_args/dispatch_install.rs[320-325]
pnpm/crates/cli/src/cli_args/update_notifier.rs[112-120]
pnpm/crates/cli/src/cli_args/update_notifier.rs[187-196]
pnpm/crates/fs/src/write_atomic.rs[65-88]
pnpm/crates/fs/src/sync_file.rs[1-16]

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

## Issue description
After abandoning a stalled registry check, `settle` synchronously writes and syncs the state file before the install returns. Slow state storage can therefore extend completion well beyond the one-second grace period.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/update_notifier.rs[107-120]
- pnpm/crates/cli/src/cli_args/update_notifier.rs[187-196]

## Recommended Fix
Keep the timeout-path persistence off the command's unbounded synchronous completion path. Preserve the daily suppression where persistence succeeds, and account explicitly for what happens if a bounded write cannot finish before process exit.

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



Informational

3. Lockfile read failures are traced as a build-marker problem ✓ Resolved
Description
ensure_gvs_builds_complete returns None both when a GVS build marker needs recovery and when
lockfile.get() fails or yields no lockfile, but the new .ok_or(...) always reports "a global
virtual store build marker needs recovery". In the new pacquet::install trace, which exists to
diagnose why the fast path was skipped, a lockfile read problem is mislabelled. Several other
.map_err(|_| ...) conversions in the same function also drop the underlying error.
Code

pnpm/crates/package-manager/src/install/workspace_state.rs[R128-129]

+    ensure_gvs_builds_complete(check, &lockfile, &lockfile_root)
+        .ok_or("a global virtual store build marker needs recovery")?;
Relevance

●●● Strong

Recent package-manager reviews accepted preserving specific failure causes instead of collapsing
distinct errors into generic diagnostics.

PR-#15702
PR-#15218

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ensure_gvs_builds_complete returns None through lockfile.get().ok().flatten()? when the
lockfile is missing or cannot be read. The caller maps every None to the build-marker reason
string.

pnpm/crates/package-manager/src/install/workspace_state.rs[212-225]

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

## Issue description
`ensure_gvs_builds_complete` collapses "lockfile unreadable" and "build marker needs recovery" into one `None`, and the caller labels both as the build-marker case.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state.rs[128-129]
- pnpm/crates/package-manager/src/install/workspace_state.rs[212-230]

## Recommended Fix
Change `ensure_gvs_builds_complete` to return `Result<(), &'static str>`, with one reason for a lockfile that cannot be read and another for a marker that needs recovery, and propagate it with `?` in `install_already_up_to_date`.

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


4. A stalled registry adds a second to every install ✓ Resolved
Description
When settle hits the UPDATE_CHECK_GRACE_PERIOD timeout, it aborts the check before write_state
records lastUpdateCheck, so checked_recently stays false and spawn starts a new check on the
next command. If the registry keeps stalling (the firewall or proxy case this PR targets), every
install/add that skips the pre-runtime fast path waits a full extra second on every run,
indefinitely, while pnpm v11 never waits at all.
Code

pnpm/crates/cli/src/cli_args/update_notifier.rs[R93-99]

+    let abort = handle.abort_handle();
+    if tokio::time::timeout(UPDATE_CHECK_GRACE_PERIOD, handle).await.is_err() {
+        abort.abort();
+        tracing::debug!(
+            target: "pacquet::install",
+            "the update check is still waiting on the registry; the command finishes without it",
+        );
Relevance

●● Moderate

The repeated one-second retry is real, but the PR explicitly documents this as an intentional
best-effort tradeoff.

PR-#14109

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
check reaches write_state only after latest_pnpm_version returns. Aborting at the timeout
skips that write, and spawn checks checked_recently against the unchanged state file, so the
next command spawns the check again and pays the grace period again.

pnpm/crates/cli/src/cli_args/update_notifier.rs[61-74]
pnpm/crates/cli/src/cli_args/update_notifier.rs[103-117]

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 the update check is abandoned after the grace period, nothing is recorded. Every later command on a stalling registry starts the check again and waits another second.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/update_notifier.rs[93-99]

## Recommended Fix
When the timeout fires, write a backoff marker to the state file before returning, using the existing synchronous `write_state` or a separate key such as `lastUpdateCheckAttempt`. `spawn` should then skip the check for a backoff window, for example an hour or the full 24h cadence, so a stalling registry costs the grace period once per window instead of on every command.

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


5. Test starts its own registry 📘 Rule violation ▣ Testability
Description
a_registry_that_never_answers_does_not_hold_the_install creates a TcpListener and manages
accepted connections in a spawned thread instead of using the shared registry test utility. This
leaves registry lifecycle and connection behavior in the test itself, so future registry setup
changes can bypass the repository-wide test harness.
Code

pnpm/crates/cli/tests/suite/update_notifier.rs[R140-150]

+    let listener = TcpListener::bind("127.0.0.1:0").expect("bind the silent registry");
+    let silent_registry =
+        format!("http://{}/", listener.local_addr().expect("silent registry address"));
+    // Every connection is accepted and held open without an answer; the
+    // thread ends with the test process.
+    std::thread::spawn(move || {
+        let mut held = Vec::new();
+        for connection in listener.incoming() {
+            held.extend(connection.ok());
+        }
+    });
Relevance

● Weak

The repository rejected nearly identical requests to replace direct registry servers with the shared
testing utility.

PR-#15373
PR-#15384

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test directly binds a TCP listener, accepts connections, and retains them in a spawned
thread. Compliance rule 2254915 requires registry-interacting tests to use the mocked registry
starter from pnpm-testing-utils rather than implementing their own registry startup.

Rule 2254915: Use pnpm-testing-utils to start the mocked registry in tests
pnpm/crates/cli/tests/suite/update_notifier.rs[140-150]

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 update-notifier E2E test manually creates a `TcpListener` and holds connections open instead of using the repository's shared registry test utility, violating the registry testing convention.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/update_notifier.rs[140-150]

## Recommended Fix
Extend or configure the `pnpm-testing-utils` registry helper to support an accepted-but-unresponsive registry, then use that helper in this test so registry startup and cleanup remain managed by the shared test infrastructure.

ⓘ 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
Review mode: Auto: ⚖️ Balanced: Behavioral async cancellation affects install paths and performance-critical command completion.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit fd5803d

Results up to commit 2f784ba 🧠 Deep


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


Remediation recommended
1. The slowdown fix lacks before/after data 📜 Skill insight ➹ Performance
Description
The new changeset claims a minutes-long install slowdown is fixed but supplies no paired
before-and-after measurement. Without comparable v11 and v12 results across repeated Windows runs,
reviewers cannot verify the affected up-to-date workspace improved rather than merely receiving a
one-second timeout.
Code

.changeset/update-check-does-not-hold-install.md[5]

+`pnpm install` and `pnpm add` no longer wait for the daily update check when the registry does not answer it. The check now has one second after the command finishes to report a newer pnpm. Otherwise the command finishes without the notice and checks again next time. On a registry that accepted the connection but never answered, an install that had nothing to do used to take minutes [#16839](https://github.com/pnpm/pnpm/issues/16839).
Relevance

●●● Strong

Recent performance changesets include concrete before/after figures, supporting the repository’s
expectation for measurable claims.

PR-#16661
PR-#13491

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires a numeric before-and-after measurement for performance changes. The changeset
describes the user-visible slowdown and the one-second grace period, but provides no benchmark table
or paired timing results.

.changeset/update-check-does-not-hold-install.md[1-5]
Skill: review-code

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 performance fix claims to prevent stalled update checks from holding installs, but the PR does not provide paired quantitative evidence demonstrating the improvement against the previous behavior or pnpm v11.

## Fix Focus Areas
- .changeset/update-check-does-not-hold-install.md[1-5]

## Recommended Fix
Add benchmark results from comparable Windows 10 runs of an already up-to-date workspace, including repeated before-and-after measurements for pnpm v11 and the changed pnpm v12 path, with the workspace size and relevant cold or warm conditions documented.

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

Dismiss ↗ | View ↗



Informational
2. Lockfile read failures are traced as a build-marker problem ✓ Resolved
Description
ensure_gvs_builds_complete returns None both when a GVS build marker needs recovery and when
lockfile.get() fails or yields no lockfile, but the new .ok_or(...) always reports "a global
virtual store build marker needs recovery". In the new pacquet::install trace, which exists to
diagnose why the fast path was skipped, a lockfile read problem is mislabelled. Several other
.map_err(|_| ...) conversions in the same function also drop the underlying error.
Code

pnpm/crates/package-manager/src/install/workspace_state.rs[R128-129]

+    ensure_gvs_builds_complete(check, &lockfile, &lockfile_root)
+        .ok_or("a global virtual store build marker needs recovery")?;
Relevance

●●● Strong

Recent package-manager reviews accepted preserving specific failure causes instead of collapsing
distinct errors into generic diagnostics.

PR-#15702
PR-#15218

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ensure_gvs_builds_complete returns None through lockfile.get().ok().flatten()? when the
lockfile is missing or cannot be read. The caller maps every None to the build-marker reason
string.

pnpm/crates/package-manager/src/install/workspace_state.rs[212-225]

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

## Issue description
`ensure_gvs_builds_complete` collapses "lockfile unreadable" and "build marker needs recovery" into one `None`, and the caller labels both as the build-marker case.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state.rs[128-129]
- pnpm/crates/package-manager/src/install/workspace_state.rs[212-230]

## Recommended Fix
Change `ensure_gvs_builds_complete` to return `Result<(), &'static str>`, with one reason for a lockfile that cannot be read and another for a marker that needs recovery, and propagate it with `?` in `install_already_up_to_date`.

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


3. A stalled registry adds a second to every install ✓ Resolved
Description
When settle hits the UPDATE_CHECK_GRACE_PERIOD timeout, it aborts the check before write_state
records lastUpdateCheck, so checked_recently stays false and spawn starts a new check on the
next command. If the registry keeps stalling (the firewall or proxy case this PR targets), every
install/add that skips the pre-runtime fast path waits a full extra second on every run,
indefinitely, while pnpm v11 never waits at all.
Code

pnpm/crates/cli/src/cli_args/update_notifier.rs[R93-99]

+    let abort = handle.abort_handle();
+    if tokio::time::timeout(UPDATE_CHECK_GRACE_PERIOD, handle).await.is_err() {
+        abort.abort();
+        tracing::debug!(
+            target: "pacquet::install",
+            "the update check is still waiting on the registry; the command finishes without it",
+        );
Relevance

●● Moderate

The repeated one-second retry is real, but the PR explicitly documents this as an intentional
best-effort tradeoff.

PR-#14109

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
check reaches write_state only after latest_pnpm_version returns. Aborting at the timeout
skips that write, and spawn checks checked_recently against the unchanged state file, so the
next command spawns the check again and pays the grace period again.

pnpm/crates/cli/src/cli_args/update_notifier.rs[61-74]
pnpm/crates/cli/src/cli_args/update_notifier.rs[103-117]

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 the update check is abandoned after the grace period, nothing is recorded. Every later command on a stalling registry starts the check again and waits another second.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/update_notifier.rs[93-99]

## Recommended Fix
When the timeout fires, write a backoff marker to the state file before returning, using the existing synchronous `write_state` or a separate key such as `lastUpdateCheckAttempt`. `spawn` should then skip the check for a backoff window, for example an hour or the full 24h cadence, so a stalling registry costs the grace period once per window instead of on every command.

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


4. Test starts its own registry 📘 Rule violation ▣ Testability
Description
a_registry_that_never_answers_does_not_hold_the_install creates a TcpListener and manages
accepted connections in a spawned thread instead of using the shared registry test utility. This
leaves registry lifecycle and connection behavior in the test itself, so future registry setup
changes can bypass the repository-wide test harness.
Code

pnpm/crates/cli/tests/suite/update_notifier.rs[R140-150]

+    let listener = TcpListener::bind("127.0.0.1:0").expect("bind the silent registry");
+    let silent_registry =
+        format!("http://{}/", listener.local_addr().expect("silent registry address"));
+    // Every connection is accepted and held open without an answer; the
+    // thread ends with the test process.
+    std::thread::spawn(move || {
+        let mut held = Vec::new();
+        for connection in listener.incoming() {
+            held.extend(connection.ok());
+        }
+    });
Relevance

● Weak

The repository rejected nearly identical requests to replace direct registry servers with the shared
testing utility.

PR-#15373
PR-#15384

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test directly binds a TCP listener, accepts connections, and retains them in a spawned
thread. Compliance rule 2254915 requires registry-interacting tests to use the mocked registry
starter from pnpm-testing-utils rather than implementing their own registry startup.

Rule 2254915: Use pnpm-testing-utils to start the mocked registry in tests
pnpm/crates/cli/tests/suite/update_notifier.rs[140-150]

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 update-notifier E2E test manually creates a `TcpListener` and holds connections open instead of using the repository's shared registry test utility, violating the registry testing convention.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/update_notifier.rs[140-150]

## Recommended Fix
Extend or configure the `pnpm-testing-utils` registry helper to support an accepted-but-unresponsive registry, then use that helper in this test so registry startup and cleanup remain managed by the shared test infrastructure.

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

Dismiss ↗ | View ↗


Results up to commit 81df72c ⚖️ Balanced


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


Remediation recommended
1. A slow state disk still holds the install ✓ Resolved
Description
settle calls the synchronous write_state after its one-second timeout, and that write includes a
filesystem sync. When the state directory is on slow or unhealthy storage, a successful install
still waits for that I/O before it can finish, even though the registry check has been abandoned.
Code

pnpm/crates/cli/src/cli_args/update_notifier.rs[120]

+        write_state(&state_file, state, Utc::now());
Evidence
The install awaits settle; the newly added timeout branch writes state before returning. That
write invokes the atomic writer, which syncs the temporary file to storage.

pnpm/crates/cli/src/cli_args/dispatch_install.rs[320-325]
pnpm/crates/cli/src/cli_args/update_notifier.rs[112-120]
pnpm/crates/cli/src/cli_args/update_notifier.rs[187-196]
pnpm/crates/fs/src/write_atomic.rs[65-88]
pnpm/crates/fs/src/sync_file.rs[1-16]

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

## Issue description
After abandoning a stalled registry check, `settle` synchronously writes and syncs the state file before the install returns. Slow state storage can therefore extend completion well beyond the one-second grace period.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/update_notifier.rs[107-120]
- pnpm/crates/cli/src/cli_args/update_notifier.rs[187-196]

## Recommended Fix
Keep the timeout-path persistence off the command's unbounded synchronous completion path. Preserve the daily suppression where persistence succeeds, and account explicitly for what happens if a bounded write cannot finish before process exit.

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


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.

… failure

An update check abandoned after the grace period now counts as the day's
check, so a registry that keeps stalling costs the grace period once a
day rather than on every command. A failed command still records
nothing. The GVS build-marker gate of the pre-runtime fast path now
reports a wanted lockfile it cannot read as such, rather than as a
marker needing recovery.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:27

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.

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

@zkochan

zkochan commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Thanks, two of these hold and are fixed in 81df72c.

  1. Before/after data in the changeset — not acting. A changeset is the release note, and this repository's changeset style keeps mechanism and figures out of it. The measurement that matters here is the bound itself: the new end-to-end test a_registry_that_never_answers_does_not_hold_the_install runs an up-to-date install against a registry that accepts the connection and never answers, and asserts it finishes in well under the client's 60-second read timeout. The reporter's environment could not be reproduced (a 35-project repeat install takes 93 ms on this Windows 10 machine), which the PR description says; the TRACE phase timings this PR adds are how the next report will carry the numbers.

  2. Lockfile read failures traced as a build-marker problem — fixed. ensure_gvs_builds_complete now returns Result<(), &'static str> with one reason for a wanted lockfile it cannot read and another for a marker that needs recovery, and the caller propagates it with ?.

  3. A stalled registry adds a second to every install — fixed, with the recommended shape. An abandoned check now writes lastUpdateCheck before settle returns, so a registry that keeps stalling costs the grace period once a day; a check the command dropped because the command itself failed still records nothing. The unit tests and the end-to-end test assert the recorded state.

  4. Test starts its own registry — not acting. The shared pnpr mock answers every request; the behavior under test is a server that never answers, which no option of that harness produces. The TcpListener is the whole fixture: accept and hold. Moving it into pnpm_testing_utils would add a one-caller helper.


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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 81df72c

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

The finished command gave a check still waiting on the registry a
one-second grace period and then recorded the abandoned check as the
day's. There is no reason to wait: pnpm v11 never does. The command now
finishes when it is done; a check the registry has answered has already
printed its notice and recorded itself, and one still waiting is aborted
and records nothing, so the next command asks again.

`settle` is synchronous and takes only the handle. The unit tests cover
the aborted and the already-finished check, and the silent-registry
end-to-end test asserts that nothing is recorded.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 18:47

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.

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

@zkochan

zkochan commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Follow-up to the review above: the grace period is gone entirely in fd5803d. The command never waits for the update check; one still unanswered when the command is done is aborted and not recorded, so the next command asks again, as pnpm v11 does. Finding 3 (a stalled registry costing a second per install) no longer applies.


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

@qodo-code-review

Copy link
Copy Markdown

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

@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 merged commit 535b44b into main Oct 13, 2026
34 of 39 checks passed
@zkochan
zkochan deleted the fix-16839-2 branch October 13, 2026 18:51
zkochan added a commit that referenced this pull request Oct 13, 2026
… check (#16913)

Since the update check no longer holds the command (#16902),
two suite tests that depended on the wait fail.

The notice test installed an empty workspace, which is done in
milliseconds, so the install finished before the registry answered the
check. It now installs a dependency, as the add tests in the same module
do, so the check's request, which is in flight before the install's
first, is answered while the install still has work.

The Rust test runner sets PNPM_CONFIG_CI=false, so a pnpm spawned
without the shared command harness ran the daily check against the
runner's un-isolated state directory. While the command awaited the
check, the first such pnpm recorded it and every later one skipped it.
Now an unanswered check is dropped unrecorded, so every bare pnpm asked
its mock registry for pnpm's latest, and a test whose public mock
forbids any request failed. The runner and the coverage workflow now set
PNPM_CONFIG_UPDATE_NOTIFIER=false as well; the notifier suite turns the
check back on itself.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants