fix: set user agent in headless lifecycle scripts#12092
Conversation
|
💖 Thanks for opening this pull request! 💖 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (3)📚 Learning: 2026-05-26T21:01:06.666ZApplied to files:
📚 Learning: 2026-05-14T09:04:00.133ZApplied to files:
📚 Learning: 2026-05-24T08:18:00.622ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThis PR fixes a regression where ChangesUser Agent Environment Variable for Lifecycle Scripts
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
Review Summary by QodoSet user agent in headless lifecycle scripts
WalkthroughsDescription• Pass configured user agent to root lifecycle scripts during headless installs • Add regression test for lockfile-only then install path • Update @pnpm/installing.deps-restorer and pnpm packages Diagramflowchart LR
A["HeadlessOptions"] -- "userAgent parameter" --> B["Root Lifecycle Scripts"]
B -- "npm_config_user_agent env var" --> C["Preinstall Hook Execution"]
D["Lockfile-only Install"] -- "followed by" --> E["Full Install"]
E -- "triggers headless path" --> C
File Changes1. installing/deps-restorer/src/index.ts
|
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Fixes #12003.
What changed
@pnpm/installing.deps-restorerandpnpm.This is in the TypeScript headless lifecycle options path. I did not make a pacquet change because pacquet is not assembling these root lifecycle script options.
Validation
pnpm installcompleted; optionalfuse-nativenative build printedspawn node-gyp ENOENT, but install exited 0.cargo build -p pnpr-fixtures --bin pnpr-prepareenv PATH=/tmp/pnpm-codex-bin:$PATH pnpm --filter pnpm test test/install/lifecycleScripts.ts -t "correct user agent"env PATH=/tmp/pnpm-codex-bin:$PATH git push -u origin codex/fix-lifecycle-user-agentran the repo pre-push checks successfully.git diff --checkSummary by CodeRabbit
npm_config_user_agentenvironment variable was not being properly passed to lifecycle scripts during headless installations, ensuring scripts have proper context about the package manager being used.