Skip to content

fix: explain SSH publickey failures when installing git dependencies - #15877

Merged
zkochan merged 9 commits into
pnpm:mainfrom
Shuuren:cursor/git-ssh-publickey-hint-c109
Sep 26, 2026
Merged

zkochan merged 9 commits into
pnpm:mainfrom
Shuuren:cursor/git-ssh-publickey-hint-c109

Conversation

@Shuuren

@Shuuren Shuuren commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #13743

Installing a git dependency that is still locked to an SSH remote, or resolving an SSH URL, failed with git's raw Permission denied (publickey) and exit 128. The resolve path that used to record SSH for shorthand github: dependencies is already fixed. This change only adds the missing hint at the clone and ls-remote boundary.

When the failure is a publickey refusal, pnpm now says to load a key with ssh-add -l. Resolving an SSH URL also shows a local git config HTTPS rewrite (url."https://host/".insteadOf) that leaves the recorded URL alone. A connection refusal stays without that auth hint. pnpm update <pkg> is still how to re-record a pre-v11.21 lockfile entry. pnpm install --force and --resolution-only do not re-resolve git dependencies, so the hint does not recommend them as a repair.

The rewrite is built from the user git and a shell-safe host. A password in the URL is dropped, and a host that could break out of the pasted command produces no hint. A remote that logs in as a user other than git gets the ssh-add advice without the rewrite, because the rewrite prefix would have to repeat that user to match and userinfo is never echoed.

Squash Commit Body

Fetching a git dependency locked to an SSH remote now says to load a key
with ssh-add when git reports a publickey refusal, and still explains how
to re-record a pre-v11.21 entry with pnpm update.

Resolving an SSH URL that fails the same way shows that advice plus a
local HTTPS insteadOf rewrite when the remote logs in as git. The
rewrite uses a shell-safe host and no userinfo, so a password or a
hostile host cannot reach the command.

Closes pnpm/pnpm#13743

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.

Written by an agent (Cursor, Grok 4.7).
Fixes and description update by an agent (Claude Code, claude-opus-5-5).

Summary by CodeRabbit

  • Bug Fixes
    • SSH public-key authentication errors now clarify that the host was reached but rejected the key, and explain how to check loaded keys with ssh-add -l.
    • For supported SSH repository addresses, errors may suggest a local HTTPS rewrite without changing the recorded URL. Unsafe addresses and unrelated connection failures do not receive this guidance.
    • Rewrite suggestions preserve non-default SSH ports and avoid exposing embedded credentials.
    • Fetch errors explain how to update a package without re-resolving Git dependencies.

@Shuuren
Shuuren requested a review from zkochan as a code owner September 26, 2026 07:15
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 7258ffb5-018d-42a5-8c6d-45d9e6f78228

📥 Commits

Reviewing files that changed from the base of the PR and between 7ca9834 and c19583d.

📒 Files selected for processing (2)
  • pnpm/crates/resolving-resolver-base/src/errors/tests.rs
  • pnpm11/resolving/git-resolver/test/index.ts

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


📝 Walkthrough

Walkthrough

The change adds SSH public-key troubleshooting guidance to Git fetch and resolution errors. For supported SSH references, resolver errors can also suggest a local HTTPS rewrite without changing the recorded URL.

Changes

SSH Git dependency guidance

Layer / File(s) Summary
Fetch error guidance
pnpm/crates/git-fetcher/src/error.rs, pnpm/crates/git-fetcher/src/error/tests.rs, pnpm/crates/git-fetcher/src/fetcher/tests/behavior.rs, pnpm11/fetching/git-fetcher/src/index.ts, pnpm11/fetching/git-fetcher/test/index.ts
Rust and TypeScript fetch diagnostics explain that a public-key refusal means the host rejected the key and advise checking keys with ssh-add -l. Tests check the guidance and package-update instructions.
Resolver SSH hints
pnpm/crates/resolving-resolver-base/src/errors.rs, pnpm/crates/resolving-resolver-base/src/errors/tests.rs, pnpm/crates/resolving-resolver-base/Cargo.toml, pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs, pnpm11/resolving/git-resolver/src/index.ts, pnpm11/resolving/git-resolver/test/index.ts, .changeset/git-ssh-publickey-hint.md, cspell.json
Rust and TypeScript resolvers detect SSH public-key refusals and add SSH-agent guidance and, for supported SSH references, a local HTTPS rewrite hint. Tests cover connection failures, unsafe hosts, credentials, and ports. The changeset records the affected packages, and the spell-checker word list adds publickey.

Priority: ➖ Normal

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

Change: Bug fix

Assessment against linked issues

Objective Addressed Explanation
[#13743] Resolve the reported Git dependency install failure so CI can install as on a local system. ❌ The reported failure is an SSH connection refusal. This change adds guidance for public-key refusals and retains the no-hint behavior for connection refusals.

Suggested labels: product: pnpm@11, product: pacquet

Suggested reviewers: m2na7

Merge Risk: ⚪ Minimal · up to c1958

The diagnostic changes appear mergeable after normal checks. They add troubleshooting guidance without changing the recorded Git URL.

Architecture Summary

Architecture risk: 🔵 Low · up to c1958

The change affects 3 systems.

Changed systems: pnpm, pnpm11, cspell.json

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — pnpm (service) was modified; 7 changed files map to changed impact.
  • observed — pnpm11 (service) was modified; 4 changed files map to changed impact.
  • observed — cspell.json (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in cspell.json: Added publickey to the spell-checker word list.
  • observed — Modified behavior in pnpm/crates/git-fetcher/src/error.rs: Added SSH-key troubleshooting guidance to the FetchOverSsh diagnostic: interpret “Permission denied (publickey)” as a host refusal and check loaded keys with ssh-add -l.
  • observed — Modified behavior in pnpm/crates/git-fetcher/src/error/tests.rs: Added the miette::Diagnostic import and moved the GitFetcherError import after the platform-specific ExitStatusExt imports.
  • observed — Modified behavior in pnpm/crates/git-fetcher/src/error/tests.rs: Added a test that checks SSH clone failure help text for a public-key refusal includes the host’s SSH-key requirement, the refusal text, ssh-add -l, the package update command, and the instruction not to re-resolve Git dependencies.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

pnpm11/resolving/git-resolver/test/index.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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 Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.20253% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.03%. Comparing base (c4eeecf) to head (c19583d).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/resolving-resolver-base/src/errors.rs 96.20% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15877   +/-   ##
=======================================
  Coverage   92.02%   92.03%           
=======================================
  Files        1479     1479           
  Lines      199084   199160   +76     
=======================================
+ Hits       183210   183288   +78     
+ Misses      15874    15872    -2     

☔ 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 added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 26, 2026
@github-actions

github-actions Bot commented Sep 26, 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 2288.94 ms 2397.55 ms 4.7% 114.45 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1467.92 ms 1448.34 ms -1.3% 73.40 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 230.91 ms 230.53 ms -0.2% 11.55 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 275.96 ms 252.60 ms -8.5% 13.80 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 14.15 ms 7.57 ms -46.5% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 7.44 ms 12.79 ms 72.0% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pacquet 8.17 ms 8.18 ms 0.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 8.11 ms 8.22 ms 1.4% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2612.39 ms 2618.55 ms 0.2% 130.62 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1638.13 ms 1517.74 ms -7.3% 81.91 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 439.69 ms 505.32 ms 14.9% 21.98 ms Inconclusive (not reproduced)
isolated-fresh-install-hot-cache-hot-store pnpr 285.57 ms 301.10 ms 5.4% 14.28 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-hot-store pacquet 1731.81 ms 1737.24 ms 0.3% 86.59 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 348.61 ms 356.95 ms 2.4% 17.43 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 201.82 ms 202.29 ms 0.2% 10.09 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 90.32 ms 91.50 ms 1.3% 4.52 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 607.08 ms 557.45 ms -8.2% 30.35 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 198.92 ms 185.04 ms -7.0% 9.95 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4472.49 ms 4435.33 ms -0.8% 223.62 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3465.63 ms 3442.70 ms -0.7% 173.28 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 116.41 ms 118.54 ms 1.8% 5.82 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 128.06 ms 130.08 ms 1.6% 6.40 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: c19583d835d5

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares 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.451 ± 0.162 2.275 2.696 1.70 ± 0.17
pacquet@main 2.317 ± 0.068 2.264 2.460 1.61 ± 0.13
pnpr@HEAD 1.443 ± 0.113 1.307 1.635 1.00
pnpr@main 1.476 ± 0.125 1.323 1.630 1.02 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4511896090999996,
      "stddev": 0.16235797425995785,
      "median": 2.3975524933,
      "user": 1.334542,
      "system": 1.4384089399999997,
      "min": 2.2748835157999996,
      "max": 2.6955006077999997
    },
    {
      "command": "pacquet@main",
      "mean": 2.3173299628999997,
      "stddev": 0.0684842705825905,
      "median": 2.2889380418,
      "user": 1.2748781999999999,
      "system": 1.37104834,
      "min": 2.2639100778,
      "max": 2.4598963888
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.443199676,
      "stddev": 0.11316131085832645,
      "median": 1.4483446618000002,
      "user": 1.1754159999999998,
      "system": 1.2047627399999998,
      "min": 1.3068304338,
      "max": 1.6346314898
    },
    {
      "command": "pnpr@main",
      "mean": 1.4758660446,
      "stddev": 0.12450183493257336,
      "median": 1.4679155263,
      "user": 1.1516969,
      "system": 1.22066234,
      "min": 1.3226273348000002,
      "max": 1.6303305678
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 233.7 ± 12.3 218.4 252.7 1.02 ± 0.06
pacquet@main 229.6 ± 7.5 212.6 237.7 1.00
pnpr@HEAD 252.2 ± 8.0 239.5 262.1 1.10 ± 0.05
pnpr@main 308.8 ± 86.3 225.6 440.6 1.35 ± 0.38
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23368639634000005,
      "stddev": 0.012273172466894123,
      "median": 0.23053068914000002,
      "user": 0.24069787999999998,
      "system": 0.59205916,
      "min": 0.21844949564000002,
      "max": 0.25266461564000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.22955866494000002,
      "stddev": 0.007465245185081551,
      "median": 0.23091461963999999,
      "user": 0.23770688,
      "system": 0.5836286599999999,
      "min": 0.21260161664000002,
      "max": 0.23773072764
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25221002504,
      "stddev": 0.007996929453266174,
      "median": 0.25259783014000003,
      "user": 0.25220728000000003,
      "system": 0.57837916,
      "min": 0.23947780264000001,
      "max": 0.26206837164
    },
    {
      "command": "pnpr@main",
      "mean": 0.30876506784,
      "stddev": 0.08633449435034507,
      "median": 0.27595622414,
      "user": 0.32645757999999997,
      "system": 0.69241806,
      "min": 0.22558072364,
      "max": 0.44057618364
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.1 ± 2.5 6.7 16.0 1.22 ± 0.35
pacquet@main 14.2 ± 1.5 9.4 19.3 1.91 ± 0.23
pnpr@HEAD 11.8 ± 3.3 6.7 19.0 1.58 ± 0.46
pnpr@main 7.4 ± 0.4 6.7 11.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009077004268115946,
      "stddev": 0.0025476427032032124,
      "median": 0.0075730751,
      "user": 0.005073998260869565,
      "system": 0.00446480295652174,
      "min": 0.0066985361,
      "max": 0.0159645011
    },
    {
      "command": "pacquet@main",
      "mean": 0.014217689494088671,
      "stddev": 0.0015378320959674163,
      "median": 0.014147306100000001,
      "user": 0.007682703251231522,
      "system": 0.007201643251231528,
      "min": 0.009410472100000001,
      "max": 0.0193230221
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011802448033014357,
      "stddev": 0.003349294041282374,
      "median": 0.012787095100000001,
      "user": 0.006558120956937795,
      "system": 0.005828967942583731,
      "min": 0.0067053881,
      "max": 0.018969520099999998
    },
    {
      "command": "pnpr@main",
      "mean": 0.007449767271686743,
      "stddev": 0.00037471806001703216,
      "median": 0.0074362291,
      "user": 0.004477263373493976,
      "system": 0.003383707951807228,
      "min": 0.006682155100000001,
      "max": 0.0113570531
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.4 ± 0.9 7.5 13.6 1.01 ± 0.16
pacquet@main 8.4 ± 0.9 7.5 13.4 1.01 ± 0.16
pnpr@HEAD 8.5 ± 0.9 7.5 13.3 1.02 ± 0.16
pnpr@main 8.4 ± 0.9 7.4 13.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00842206244189781,
      "stddev": 0.0009430197755012767,
      "median": 0.00818299342,
      "user": 0.004558280583941608,
      "system": 0.004359446715328466,
      "min": 0.007513387920000001,
      "max": 0.013585211920000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.008449452479440563,
      "stddev": 0.000920148396375983,
      "median": 0.00816877992,
      "user": 0.00474695216783217,
      "system": 0.004193528811188812,
      "min": 0.007498988920000001,
      "max": 0.013416285920000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008484458970387595,
      "stddev": 0.0009457758649528814,
      "median": 0.008223942420000002,
      "user": 0.005013701395348838,
      "system": 0.0039691487596899225,
      "min": 0.00747752592,
      "max": 0.013314392920000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.008351847698169015,
      "stddev": 0.000935436732267469,
      "median": 0.00810666592,
      "user": 0.004597697464788732,
      "system": 0.004224207676056343,
      "min": 0.0073907919200000005,
      "max": 0.013429217920000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.655 ± 0.131 2.582 3.023 1.68 ± 0.16
pacquet@main 2.616 ± 0.028 2.587 2.685 1.66 ± 0.14
pnpr@HEAD 1.580 ± 0.130 1.450 1.761 1.00
pnpr@main 1.629 ± 0.144 1.435 1.827 1.03 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6554472487600007,
      "stddev": 0.13050995839067456,
      "median": 2.61854614296,
      "user": 2.22620784,
      "system": 2.0480011399999998,
      "min": 2.58176577596,
      "max": 3.02312424396
    },
    {
      "command": "pacquet@main",
      "mean": 2.6159568395600004,
      "stddev": 0.02753470915260276,
      "median": 2.6123882179600004,
      "user": 2.15333594,
      "system": 1.97731024,
      "min": 2.58677490196,
      "max": 2.68474782496
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5798063029600002,
      "stddev": 0.13042668101872193,
      "median": 1.5177411809599999,
      "user": 1.30842634,
      "system": 1.6122522399999997,
      "min": 1.44953165096,
      "max": 1.76067561796
    },
    {
      "command": "pnpr@main",
      "mean": 1.62881473236,
      "stddev": 0.14355606717487235,
      "median": 1.6381285354600001,
      "user": 1.3937922399999998,
      "system": 1.72299114,
      "min": 1.43456219696,
      "max": 1.8270687999600002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 500.8 ± 45.3 396.6 566.6 1.75 ± 0.17
pacquet@main 433.0 ± 21.0 389.7 453.9 1.52 ± 0.08
pnpr@HEAD 309.1 ± 24.7 271.5 345.2 1.08 ± 0.09
pnpr@main 285.6 ± 7.9 274.1 297.3 1.00

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pnpr@main 283.4 ± 7.4 267.0 288.5 1.00
pnpr@HEAD 286.7 ± 6.1 277.4 297.7 1.01 ± 0.03
pacquet@main 448.9 ± 74.4 390.6 652.8 1.58 ± 0.27
pacquet@HEAD 416.4 ± 21.5 387.7 460.7 1.47 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.50076206276,
      "stddev": 0.045341355978695236,
      "median": 0.50532024706,
      "user": 0.7208056599999999,
      "system": 0.77577508,
      "min": 0.39663108706000005,
      "max": 0.56661600206
    },
    {
      "command": "pacquet@main",
      "mean": 0.43295795856,
      "stddev": 0.020997813601359917,
      "median": 0.43969273206000004,
      "user": 0.5985760600000001,
      "system": 0.73534258,
      "min": 0.38970629306000004,
      "max": 0.45385599006000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30913468086000007,
      "stddev": 0.02474461143759625,
      "median": 0.30110419406000005,
      "user": 0.26013176,
      "system": 0.5995318799999999,
      "min": 0.27152469906000004,
      "max": 0.34520420506000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.28562325595999993,
      "stddev": 0.007865132617090466,
      "median": 0.28556861156,
      "user": 0.24403936,
      "system": 0.5392860799999999,
      "min": 0.27410096506000003,
      "max": 0.29731845906000004
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pnpr@main",
        "mean": 0.2833644313,
        "stddev": 0.007360118350748373,
        "median": 0.28629437450000006,
        "user": 0.23864601999999996,
        "system": 0.5500149999999999,
        "min": 0.2669829065,
        "max": 0.28851669350000003
      },
      {
        "command": "pnpr@HEAD",
        "mean": 0.2867073291000001,
        "stddev": 0.006104224130669612,
        "median": 0.28712138100000006,
        "user": 0.22509082,
        "system": 0.5767922000000001,
        "min": 0.2774496175,
        "max": 0.2976787665
      },
      {
        "command": "pacquet@main",
        "mean": 0.4489127281,
        "stddev": 0.07440978221882937,
        "median": 0.43623736300000004,
        "user": 0.6385317199999998,
        "system": 0.7232891999999999,
        "min": 0.3905589935,
        "max": 0.6528244185000001
      },
      {
        "command": "pacquet@HEAD",
        "mean": 0.41638197759999995,
        "stddev": 0.02145572261729397,
        "median": 0.4109952365,
        "user": 0.58875312,
        "system": 0.6818899,
        "min": 0.3877178215,
        "max": 0.4607112225
      }
    ]
  }
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.809 ± 0.144 1.715 2.087 5.18 ± 0.43
pacquet@main 1.730 ± 0.013 1.702 1.749 4.96 ± 0.13
pnpr@HEAD 0.386 ± 0.051 0.335 0.469 1.11 ± 0.15
pnpr@main 0.349 ± 0.009 0.331 0.362 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8091360472199998,
      "stddev": 0.1443755352263998,
      "median": 1.73724354392,
      "user": 1.19875556,
      "system": 1.25625996,
      "min": 1.71468531642,
      "max": 2.0872426694199997
    },
    {
      "command": "pacquet@main",
      "mean": 1.7304040532200002,
      "stddev": 0.013333592290483575,
      "median": 1.7318121179200001,
      "user": 1.05749256,
      "system": 1.11364786,
      "min": 1.7017669314200001,
      "max": 1.7487919544200001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38586356692,
      "stddev": 0.051099229148508445,
      "median": 0.35694514092,
      "user": 0.36384655999999993,
      "system": 0.8426859599999998,
      "min": 0.33467818442,
      "max": 0.46873830642000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.34894227752000007,
      "stddev": 0.00889281709737047,
      "median": 0.34861323942,
      "user": 0.30106826000000003,
      "system": 0.7390738599999999,
      "min": 0.33082657842,
      "max": 0.36237992142000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 204.7 ± 15.4 184.1 232.0 2.26 ± 0.18
pacquet@main 202.4 ± 11.7 181.7 224.3 2.24 ± 0.14
pnpr@HEAD 90.8 ± 2.0 86.6 94.1 1.00 ± 0.03
pnpr@main 90.5 ± 2.1 86.7 94.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20474524315333337,
      "stddev": 0.015445144443099993,
      "median": 0.20228515462000002,
      "user": 0.20172368666666665,
      "system": 0.07713065333333334,
      "min": 0.18411576062,
      "max": 0.23199234162000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.20242575477384622,
      "stddev": 0.011670958215594633,
      "median": 0.20181702662000003,
      "user": 0.19857848153846158,
      "system": 0.07235575076923077,
      "min": 0.18171262162000001,
      "max": 0.22428741262000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09078847396375,
      "stddev": 0.002020912336076435,
      "median": 0.09150167562,
      "user": 0.03384873875,
      "system": 0.013386238750000001,
      "min": 0.08658047562,
      "max": 0.09408869562000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09052868610387098,
      "stddev": 0.0020617017259788235,
      "median": 0.09031911862,
      "user": 0.03318614903225806,
      "system": 0.013943406451612904,
      "min": 0.08669988062,
      "max": 0.09402399262
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 577.1 ± 75.7 472.7 687.3 1.00
pacquet@main 607.2 ± 56.6 533.7 713.4 1.05 ± 0.17
pnpm@HEAD 2937.7 ± 80.2 2752.7 3021.2 5.09 ± 0.68
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.577090940568889,
      "stddev": 0.07573632711440652,
      "median": 0.55745137168,
      "user": 0.6082296977777778,
      "system": 0.12611107111111108,
      "min": 0.47265712668,
      "max": 0.68731391368
    },
    {
      "command": "pacquet@main",
      "mean": 0.6072102703466666,
      "stddev": 0.056649364922696684,
      "median": 0.6070788436800001,
      "user": 0.6503694755555557,
      "system": 0.13013473777777776,
      "min": 0.5336840366800001,
      "max": 0.7133604396800001
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.9376657064577776,
      "stddev": 0.0801970680839963,
      "median": 2.96362144068,
      "user": 4.478979586666666,
      "system": 0.23526973777777777,
      "min": 2.75271842968,
      "max": 3.02116917468
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 201.0 ± 31.1 181.0 260.9 1.01 ± 0.17
pacquet@main 198.3 ± 10.7 184.2 221.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2009614954745455,
      "stddev": 0.0311307820685244,
      "median": 0.18504384302000002,
      "user": 0.15999944363636362,
      "system": 0.07429261090909091,
      "min": 0.18096118802000002,
      "max": 0.26087007602
    },
    {
      "command": "pacquet@main",
      "mean": 0.19831554625076922,
      "stddev": 0.010731071093359577,
      "median": 0.19891825102000002,
      "user": 0.15367361846153843,
      "system": 0.08305567384615385,
      "min": 0.18420236602000004,
      "max": 0.22173502802000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.456 ± 0.108 4.337 4.631 1.27 ± 0.06
pacquet@main 4.515 ± 0.149 4.323 4.728 1.29 ± 0.06
pnpr@HEAD 3.497 ± 0.125 3.378 3.774 1.00
pnpr@main 3.497 ± 0.084 3.411 3.680 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.45647059262,
      "stddev": 0.10846497240704847,
      "median": 4.43532892442,
      "user": 1.5273419000000001,
      "system": 1.54594888,
      "min": 4.33677940442,
      "max": 4.63146832942
    },
    {
      "command": "pacquet@main",
      "mean": 4.514855846719999,
      "stddev": 0.14888629495549835,
      "median": 4.47248950792,
      "user": 1.4760418000000002,
      "system": 1.4436592799999999,
      "min": 4.322506467419999,
      "max": 4.72753335742
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.49661241242,
      "stddev": 0.12524868359013744,
      "median": 3.44270054142,
      "user": 1.4599411999999998,
      "system": 1.4588935800000002,
      "min": 3.37812946942,
      "max": 3.7740341814200002
    },
    {
      "command": "pnpr@main",
      "mean": 3.4970204797200006,
      "stddev": 0.08437110235276493,
      "median": 3.46562580342,
      "user": 1.4203606,
      "system": 1.3959001799999997,
      "min": 3.41076908842,
      "max": 3.67970187742
    }
  ]
}

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 119.4 ± 4.2 114.1 132.4 1.01 ± 0.05
pacquet@main 117.8 ± 4.7 113.3 131.5 1.00
pnpr@HEAD 130.4 ± 1.8 127.7 133.5 1.11 ± 0.05
pnpr@main 128.8 ± 4.1 123.0 142.1 1.09 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11942956059090909,
      "stddev": 0.004155836928523283,
      "median": 0.1185401625,
      "user": 0.1450193890909091,
      "system": 0.13714483636363634,
      "min": 0.1141175495,
      "max": 0.1324003015
    },
    {
      "command": "pacquet@main",
      "mean": 0.11784676209090911,
      "stddev": 0.004714645777597706,
      "median": 0.116409397,
      "user": 0.1411828890909091,
      "system": 0.13594024545454547,
      "min": 0.11333699450000001,
      "max": 0.1314857745
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1303510943421053,
      "stddev": 0.0018496751133244749,
      "median": 0.13008395450000002,
      "user": 0.15472992736842106,
      "system": 0.1400919631578947,
      "min": 0.1277270765,
      "max": 0.1335243635
    },
    {
      "command": "pnpr@main",
      "mean": 0.12884097665,
      "stddev": 0.004062569192562044,
      "median": 0.1280623575,
      "user": 0.15645103,
      "system": 0.13044840000000002,
      "min": 0.12297801350000001,
      "max": 0.1420770505
    }
  ]
}

cursoragent and others added 7 commits September 26, 2026 14:54
Fetching a git dependency locked to an SSH remote now says to load a key
with ssh-add when git reports a publickey refusal, and still explains how
to re-record a pre-v11.21 entry with pnpm update.

Resolving an SSH URL that fails the same way shows that advice plus a
local HTTPS insteadOf rewrite. The rewrite uses the user git and a
shell-safe host, so a password or a hostile host cannot reach the
command.

Closes pnpm#13743
The OpenSSH refusal text uses that spelling, and the release note quotes it.
Rustdoc read the bracketed port notation as an intra-doc link.
The pull request opened before workflow runs were recorded, and marking it
ready then draft does not match the pull_request types these workflows listen for.
The rewrite prefix always named the user `git`, so for a remote that logs
in as another user (AWS CodeCommit key IDs, or an ssh:// URL with no
user) the suggested git config line matched nothing. The hint now keeps
the ssh-add advice and omits the rewrite for those remotes, since the
user name is never copied into a hint.

Also use raw strings for the shell-injection test fixtures that dylint
flagged, and make the changeset say ssh-add -l lists keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan force-pushed the cursor/git-ssh-publickey-hint-c109 branch from 7998ec8 to a75d01e Compare September 26, 2026 13:08
@qodo-code-review

qodo-code-review Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (3) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Refusal checker docs omit edge cases 📘 Rule violation ⚙ Maintainability ⭐ New
Description
isPublicKeyRefusal's JSDoc describes the intended OpenSSH pattern but does not state its
case-insensitive matching contract or its results for empty, malformed, and non-delimited method
lists. A later parser change can alter these boundary cases without readers knowing which inputs
must continue to return false.
Code

pnpm11/resolving/git-resolver/src/index.ts[R276-279]

+/**
+ * Whether git's stderr carries OpenSSH's `Permission denied (...)` list of
+ * refused methods with `publickey` among them. The detail also echoes the
+ * host, so the word alone could be part of a host name.
Relevance

●● Moderate

Recent JSDoc contract findings were both accepted and rejected, including directly conflicting
edge-case documentation precedents.

PR-#15793
PR-#15612
PR-#15720

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713430 requires modified JSDoc to document function preconditions, postconditions,
and edge cases. The modified comment explains the intended OpenSSH pattern but omits boundary
behavior that is implemented by the parsing operations immediately below it.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/resolving/git-resolver/src/index.ts[276-285]

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 JSDoc for `isPublicKeyRefusal` omits relevant input and edge-case behavior, including case-insensitive matching and malformed or empty method lists.

## Fix Focus Areas
- pnpm11/resolving/git-resolver/src/index.ts[276-285]

## Recommended Fix
Expand the JSDoc to document the expected stderr input, the boolean guarantee, case-insensitive matching, and behavior for empty, malformed, or unrelated error text.

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


2. Some connection failures blame SSH keys ✓ Resolved 🐞 Bug ≡ Correctness
Description
ssh_publickey_hint and sshPublicKeyHint classify any error text containing publickey as an
authentication refusal rather than recognizing Git's actual permission-denied message. A connection
failure to a valid host such as publickey.example therefore receives incorrect key and
HTTPS-rewrite guidance in both supported implementations.
Code

pnpm/crates/resolving-resolver-base/src/errors.rs[R327-328]

+    if !detail.to_ascii_lowercase().contains("publickey") {
+        return None;
Relevance

●●● Strong

Unrestricted stderr matching creates a concrete false-positive authentication hint; this aligns with
accepted security/error-boundary fixes.

PR-#13759

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both new classifiers use an unrestricted substring check, while their error boundaries pass through
Git's stderr, which may include the remote hostname. Existing negative tests only use github.com,
so they do not exercise a non-authentication message whose attacker-controlled hostname itself
contains publickey.

pnpm/crates/resolving-resolver-base/src/errors.rs[326-330]
pnpm11/resolving/git-resolver/src/index.ts[258-261]
pnpm/crates/resolving-git-resolver/src/runners.rs[154-168]
pnpm11/resolving/git-resolver/src/lsRemote.ts[35-45]
pnpm/crates/resolving-resolver-base/src/errors/tests.rs[311-320]
pnpm11/resolving/git-resolver/test/index.ts[705-713]

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 SSH failure classifier treats every occurrence of `publickey` as a public-key authentication refusal. Unrelated errors can contain that token in a hostname or other echoed input and consequently receive misleading authentication and rewrite guidance.

## Fix Focus Areas
- pnpm/crates/resolving-resolver-base/src/errors.rs[326-329]
- pnpm/crates/resolving-resolver-base/src/errors/tests.rs[311-320]
- pnpm11/resolving/git-resolver/src/index.ts[258-261]
- pnpm11/resolving/git-resolver/test/index.ts[705-713]

## Recommended Fix
In both implementations, recognize an OpenSSH permission-denied authentication-method list containing `publickey`, rather than searching the entire detail for that word. Add regression tests showing that a connection refusal or DNS failure for a host whose name contains `publickey` produces no authentication hint.

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


3. New fetch test omits a trailing comma 📘 Rule violation ⚙ Maintainability
Description
The final options object passed to fetch ends at line 566 without a comma in a multi-line argument
list. Adding or reordering arguments will unnecessarily modify that line and leaves the new test
inconsistent with the required TypeScript style.
Code

pnpm11/fetching/git-fetcher/test/index.ts[R563-566]

+    {
+      filesIndexFile: path.join(storeDir, 'index.json'),
+      pkg: { name: '@scope/pkg', version: '1.0.0' },
+    }
Relevance

●●● Strong

Directly matches the repository’s enforced TypeScript trailing-comma rule and is a trivial
deterministic style fix.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713434 requires a trailing comma after the final item in multi-line TypeScript argument lists.
The newly added fetch invocation has multiple arguments on separate lines, but its final argument
closes without one.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/fetching/git-fetcher/test/index.ts[556-567]

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

## Issue description
A newly added multi-line TypeScript argument list does not place a trailing comma after its final options object.

## Fix Focus Areas
- pnpm11/fetching/git-fetcher/test/index.ts[556-567]

## Recommended Fix
Add a comma after the closing brace of the final options object passed to `fetch`, then run the TypeScript formatter or lint task.

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


View medium (2)
4. Git hints duplicate remote parsing ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
parse_ssh_remote manually splits SSH authorities, user information, bracketed hosts, and ports
instead of using the workspace's established url parser. The new resolver therefore maintains a
second URL grammar whose behavior must remain synchronized with the TypeScript implementation and
other Rust URL consumers.
Code

pnpm/crates/resolving-resolver-base/src/errors.rs[R362-365]

+fn parse_ssh_remote(repo: &str) -> Option<SshRemote> {
+    let ssh_url = repo.strip_prefix("git+").unwrap_or(repo);
+    if let Some(rest) = ssh_url.strip_prefix("ssh://") {
+        let authority = rest.split('/').next().unwrap_or(rest);
Relevance

●● Moderate

Manual parsing is maintainability-risky, but repository history lacks a close precedent rejecting
this deliberate cross-version implementation.

PR-#13110

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713437 rejects hand-written parsers when a maintained equivalent is already available without a
documented reason. The changed code implements authority and port parsing manually, while the
workspace declares url 2.5.8 and other Rust code uses url::Url for repository addresses.

Rule 713437: Avoid reimplementing functionality provided by well-maintained open source packages
pnpm/crates/resolving-resolver-base/src/errors.rs[362-446]
Cargo.toml[237-237]
pnpm/crates/cli/src/cli_args/repo.rs[354-375]

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 Rust resolver introduces a hand-written SSH URL parser even though the workspace already provides and uses the maintained `url` crate.

## Fix Focus Areas
- pnpm/crates/resolving-resolver-base/src/errors.rs[362-446]
- pnpm/crates/resolving-resolver-base/Cargo.toml[12-25]

## Recommended Fix
Add the workspace `url` dependency to the resolver-base crate and use `url::Url` for `ssh://` references. Keep only the minimal adapter needed for SCP-style references and retain explicit shell-safety validation before constructing the suggested command.

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


5. Remote parser docs omit its contract 📘 Rule violation ⚙ Maintainability
Description
The JSDoc for parseSshRemote documents only two conditions that produce undefined, without
describing the successful SshRemote result, accepted SSH forms, credential handling, or
malformed-authority behavior. Changes involving ports, user information, or SCP-style references
therefore require readers to reconstruct the parser's contract from its control flow.
Code

pnpm11/resolving/git-resolver/src/index.ts[R286-289]

+/**
+ * `undefined` when `repo` is not an SSH reference or its host is not
+ * {@link isShellSafeHost | shell safe}.
+ */
Relevance

●● Moderate

Contract documentation is reasonable, but the requested breadth is subjective and lacks a close
acceptance precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713430 requires new function JSDoc to cover purpose, preconditions, postconditions, and edge
cases rather than leaving readers to derive behavior from the implementation. The added
documentation states only a subset of the failure contract despite the function handling several
distinct input forms and security-sensitive edge cases.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/resolving/git-resolver/src/index.ts[286-319]

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 new `parseSshRemote` JSDoc does not fully document its inputs, successful output, or important edge cases.

## Fix Focus Areas
- pnpm11/resolving/git-resolver/src/index.ts[286-319]

## Recommended Fix
Rewrite the JSDoc as a contract that states the supported SSH URL and SCP-style forms, the returned hostname and optional rewrite prefix, exclusion of user credentials, and behavior for malformed or shell-unsafe inputs.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 64 rules
✅ Skills: review-code
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/pnpm.io (sha: 719c351f) — View relationship
  Explored: repo: pnpm/hosted-git-info (sha: d3229cc6) — View relationship
Review mode: ⚖️ Balanced: The push changes security-sensitive SSH error detection and shell-safe URL hint generation across Rust and TypeScript paths, warranting a careful single-pass review.

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit c19583d

Results up to commit a75d01e ⚖️ Balanced


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


Remediation recommended
1. Some connection failures blame SSH keys ✓ Resolved 🐞 Bug ≡ Correctness
Description
ssh_publickey_hint and sshPublicKeyHint classify any error text containing publickey as an
authentication refusal rather than recognizing Git's actual permission-denied message. A connection
failure to a valid host such as publickey.example therefore receives incorrect key and
HTTPS-rewrite guidance in both supported implementations.
Code

pnpm/crates/resolving-resolver-base/src/errors.rs[R327-328]

+    if !detail.to_ascii_lowercase().contains("publickey") {
+        return None;
Relevance

●●● Strong

Unrestricted stderr matching creates a concrete false-positive authentication hint; this aligns with
accepted security/error-boundary fixes.

PR-#13759

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both new classifiers use an unrestricted substring check, while their error boundaries pass through
Git's stderr, which may include the remote hostname. Existing negative tests only use github.com,
so they do not exercise a non-authentication message whose attacker-controlled hostname itself
contains publickey.

pnpm/crates/resolving-resolver-base/src/errors.rs[326-330]
pnpm11/resolving/git-resolver/src/index.ts[258-261]
pnpm/crates/resolving-git-resolver/src/runners.rs[154-168]
pnpm11/resolving/git-resolver/src/lsRemote.ts[35-45]
pnpm/crates/resolving-resolver-base/src/errors/tests.rs[311-320]
pnpm11/resolving/git-resolver/test/index.ts[705-713]

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 SSH failure classifier treats every occurrence of `publickey` as a public-key authentication refusal. Unrelated errors can contain that token in a hostname or other echoed input and consequently receive misleading authentication and rewrite guidance.

## Fix Focus Areas
- pnpm/crates/resolving-resolver-base/src/errors.rs[326-329]
- pnpm/crates/resolving-resolver-base/src/errors/tests.rs[311-320]
- pnpm11/resolving/git-resolver/src/index.ts[258-261]
- pnpm11/resolving/git-resolver/test/index.ts[705-713]

## Recommended Fix
In both implementations, recognize an OpenSSH permission-denied authentication-method list containing `publickey`, rather than searching the entire detail for that word. Add regression tests showing that a connection refusal or DNS failure for a host whose name contains `publickey` produces no authentication hint.

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


2. New fetch test omits a trailing comma 📘 Rule violation ⚙ Maintainability
Description
The final options object passed to fetch ends at line 566 without a comma in a multi-line argument
list. Adding or reordering arguments will unnecessarily modify that line and leaves the new test
inconsistent with the required TypeScript style.
Code

pnpm11/fetching/git-fetcher/test/index.ts[R563-566]

+    {
+      filesIndexFile: path.join(storeDir, 'index.json'),
+      pkg: { name: '@scope/pkg', version: '1.0.0' },
+    }
Relevance

●●● Strong

Directly matches the repository’s enforced TypeScript trailing-comma rule and is a trivial
deterministic style fix.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713434 requires a trailing comma after the final item in multi-line TypeScript argument lists.
The newly added fetch invocation has multiple arguments on separate lines, but its final argument
closes without one.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/fetching/git-fetcher/test/index.ts[556-567]

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

## Issue description
A newly added multi-line TypeScript argument list does not place a trailing comma after its final options object.

## Fix Focus Areas
- pnpm11/fetching/git-fetcher/test/index.ts[556-567]

## Recommended Fix
Add a comma after the closing brace of the final options object passed to `fetch`, then run the TypeScript formatter or lint task.

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


3. Git hints duplicate remote parsing ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
parse_ssh_remote manually splits SSH authorities, user information, bracketed hosts, and ports
instead of using the workspace's established url parser. The new resolver therefore maintains a
second URL grammar whose behavior must remain synchronized with the TypeScript implementation and
other Rust URL consumers.
Code

pnpm/crates/resolving-resolver-base/src/errors.rs[R362-365]

+fn parse_ssh_remote(repo: &str) -> Option<SshRemote> {
+    let ssh_url = repo.strip_prefix("git+").unwrap_or(repo);
+    if let Some(rest) = ssh_url.strip_prefix("ssh://") {
+        let authority = rest.split('/').next().unwrap_or(rest);
Relevance

●● Moderate

Manual parsing is maintainability-risky, but repository history lacks a close precedent rejecting
this deliberate cross-version implementation.

PR-#13110

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713437 rejects hand-written parsers when a maintained equivalent is already available without a
documented reason. The changed code implements authority and port parsing manually, while the
workspace declares url 2.5.8 and other Rust code uses url::Url for repository addresses.

Rule 713437: Avoid reimplementing functionality provided by well-maintained open source packages
pnpm/crates/resolving-resolver-base/src/errors.rs[362-446]
Cargo.toml[237-237]
pnpm/crates/cli/src/cli_args/repo.rs[354-375]

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 Rust resolver introduces a hand-written SSH URL parser even though the workspace already provides and uses the maintained `url` crate.

## Fix Focus Areas
- pnpm/crates/resolving-resolver-base/src/errors.rs[362-446]
- pnpm/crates/resolving-resolver-base/Cargo.toml[12-25]

## Recommended Fix
Add the workspace `url` dependency to the resolver-base crate and use `url::Url` for `ssh://` references. Keep only the minimal adapter needed for SCP-style references and retain explicit shell-safety validation before constructing the suggested command.

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


View medium (1)
4. Remote parser docs omit its contract 📘 Rule violation ⚙ Maintainability
Description
The JSDoc for parseSshRemote documents only two conditions that produce undefined, without
describing the successful SshRemote result, accepted SSH forms, credential handling, or
malformed-authority behavior. Changes involving ports, user information, or SCP-style references
therefore require readers to reconstruct the parser's contract from its control flow.
Code

pnpm11/resolving/git-resolver/src/index.ts[R286-289]

+/**
+ * `undefined` when `repo` is not an SSH reference or its host is not
+ * {@link isShellSafeHost | shell safe}.
+ */
Relevance

●● Moderate

Contract documentation is reasonable, but the requested breadth is subjective and lacks a close
acceptance precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713430 requires new function JSDoc to cover purpose, preconditions, postconditions, and edge
cases rather than leaving readers to derive behavior from the implementation. The added
documentation states only a subset of the failure contract despite the function handling several
distinct input forms and security-sensitive edge cases.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/resolving/git-resolver/src/index.ts[286-319]

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 new `parseSshRemote` JSDoc does not fully document its inputs, successful output, or important edge cases.

## Fix Focus Areas
- pnpm11/resolving/git-resolver/src/index.ts[286-319]

## Recommended Fix
Rewrite the JSDoc as a contract that states the supported SSH URL and SCP-style forms, the returned hostname and optional rewrite prefix, exclusion of user credentials, and behavior for malformed or shell-unsafe inputs.

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

The hint fired on any detail containing "publickey", and git echoes the
host in its stderr, so a connection failure to a host such as
publickey.example.com got SSH key advice. Both CLIs now require the word
inside OpenSSH's "Permission denied (...)" method list.

The Rust ssh:// branch now parses with url::Url, matching the TypeScript
CLI's URL, instead of splitting the authority by hand.

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

zkochan commented Sep 26, 2026

Copy link
Copy Markdown
Member

Replies to the Qodo review of a75d01e:

  1. Trailing comma in the new fetch test — not changing. The neighbouring tests in pnpm11/fetching/git-fetcher/test/index.ts close the same fetch(...) call the same way, and the repository's ESLint config passes on it.
  2. Any publickey in the detail triggers the hint — fixed in 7ca9834. Both CLIs now require publickey inside OpenSSH's Permission denied (...) method list, with a regression test for a connection refusal to publickey.example.com in each stack.
  3. Hand-written SSH URL parsing in Rust — fixed in 7ca9834. The ssh:// branch uses url::Url (already in the tree through reqwest), matching the TypeScript side's URL. The SCP-style user@host:path form keeps its small adapter, since it is not a URL.
  4. parseSshRemote JSDoc breadth — not changing. The doc states when it returns undefined, and the userinfo policy is documented on SshRemote.insteadOf. The repository's comment rules ask docs not to re-narrate the body.

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7ca9834

@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 parser keeps the brackets around an IPv6 literal, and the hint's
insteadOf prefix has to match that form.
@zkochan

zkochan commented Sep 26, 2026

Copy link
Copy Markdown
Member

Review-and-fix pass complete. The PR stays ready for review, as it was.

Changes pushed on top of the rebase onto main:

  • The insteadOf rewrite is only offered when the SSH user is git. The prefix has to repeat the user to match, and userinfo is never echoed. Other users, such as CodeCommit key IDs or ssh://host/... with no user, still get the ssh-add -l advice. Both CLIs, with tests.
  • A publickey refusal is recognized by OpenSSH's Permission denied (...) method list, not by any occurrence of the word. This fixes the Qodo finding. Both CLIs, with tests.
  • The Rust ssh:// branch parses with url::Url. Clippy and dylint lint fixes in the tests. The changeset now says ssh-add -l lists the loaded keys.

Status on c19583d (the author's IPv6 test commit on top of my push): all 62 checks pass. CodeRabbit reviewed this commit and has no actionable comments. There are no open review threads. Qodo's latest review covers 7ca9834, which has all of the code changes. Its two bug-class findings are marked resolved. I declined the remaining style and JSDoc items, with reasons in the comment above. Qodo has not re-reviewed the test-only head commit. Nothing else remains within scope.


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

@zkochan
zkochan merged commit 37227c0 into pnpm:main Sep 26, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm 11.21 haven't fix Permission denied (publickey) on git dependencies

4 participants