Skip to content

fix: export corepack env vars + disable vp env node management#77

Merged
darcyclarke merged 1 commit intomainfrom
fix/run-prepare-resilience
Mar 17, 2026
Merged

fix: export corepack env vars + disable vp env node management#77
darcyclarke merged 1 commit intomainfrom
fix/run-prepare-resilience

Conversation

@vltbaudbot
Copy link
Contributor

@vltbaudbot vltbaudbot commented Mar 16, 2026

Problem

Since the vp PR (#76) was merged, the run/run benchmark job fails consistently on every CI run:

Benchmark 5: pnpm
Error: The preparation command terminated with a non-zero exit code.

Failing runs: 23092848951, 23108493842, 23139487059

Root Causes (two issues)

1. vp installer hijacks Node.js

The vp installer auto-enables Node.js version management when $CI is set (always true in GitHub Actions). This creates shims at ~/.vite-plus/bin/node, npm, npx that intercept all Node.js calls.

Evidence: npm stayed at 11.9.0 instead of upgrading to 11.11.1 after npm install -g npm@latest.

2. Corepack env vars not persisted across CI steps

setup.sh sets COREPACK_ENABLE_STRICT=0 and COREPACK_ENABLE_AUTO_PIN=0, but these were never exported or written to $GITHUB_ENV. They only applied within the setup step itself.

In the benchmark step, corepack 0.34+ runs with defaults:

  • COREPACK_ENABLE_STRICT=1: Refuses to run a PM that doesn't match the packageManager field. Since zpm's prepare sets packageManager=yarn@6.0.0-rc.15, and the cleanup may not fully restore it (the git checkout -- packages/ package.json in clean_workspace_protocol fails silently when packages/ doesn't exist in the run fixture), pnpm's prepare sees packageManager=yarn and corepack immediately rejects it (exit code 1 in ~0.04s).
  • COREPACK_ENABLE_AUTO_PIN=1: Corepack auto-adds a packageManager field when one doesn't exist, contaminating the fixture between iterations.

Reproduction (corepack 0.34.6):

echo '{"name":"test","packageManager":"yarn@6.0.0-rc.15"}' > package.json
COREPACK_ENABLE_STRICT=1 corepack pnpm@latest install --silent
# → "This project is configured to use yarn" (exit 1)
COREPACK_ENABLE_STRICT=0 corepack pnpm@latest install --silent
# → works fine (exit 0)

Fix

  1. vp env off after installing vp to disable its Node.js shims
  2. Export + persist COREPACK_ENABLE_STRICT=0 and COREPACK_ENABLE_AUTO_PIN=0 to $GITHUB_ENV so all CI steps inherit them

@vltbaudbot vltbaudbot force-pushed the fix/run-prepare-resilience branch from f7acd2a to ae23b0a Compare March 16, 2026 21:11
@vltbaudbot vltbaudbot changed the title fix: add || true to all prepare commands in run.sh fix: disable vp env node management to prevent corepack interference Mar 16, 2026
@vltbaudbot vltbaudbot force-pushed the fix/run-prepare-resilience branch from ae23b0a to 6a0eaa4 Compare March 16, 2026 21:35
Two issues causing the run/run benchmark to fail:

1. **vp env management**: The vp installer auto-enables Node.js version
   management in CI ($CI env var), creating shims that intercept
   node/npm/corepack. Fixed by running 'vp env off' after install.

2. **corepack strict mode**: COREPACK_ENABLE_STRICT and
   COREPACK_ENABLE_AUTO_PIN were set in setup.sh but never exported or
   persisted via GITHUB_ENV. In corepack 0.34+, strict mode (on by
   default) refuses to run a package manager that doesn't match the
   packageManager field. Since zpm's prepare sets
   packageManager=yarn@6.0.0-rc.15 and cleanup relies on
   vlt pkg rm to remove it, any cleanup hiccup leaves the field in
   place — and corepack immediately rejects pnpm.

   Additionally, auto-pin (on by default) causes corepack to ADD a
   packageManager field when one doesn't exist, contaminating the
   fixture state between benchmark iterations.

   Fixed by exporting the vars and persisting them to GITHUB_ENV so
   all subsequent CI steps (including the benchmark run) inherit them.
@vltbaudbot vltbaudbot force-pushed the fix/run-prepare-resilience branch from 6a0eaa4 to fcf140e Compare March 16, 2026 21:40
@vltbaudbot vltbaudbot changed the title fix: disable vp env node management to prevent corepack interference fix: export corepack env vars + disable vp env node management Mar 16, 2026
@darcyclarke darcyclarke merged commit 10deb28 into main Mar 17, 2026
89 of 90 checks passed
@darcyclarke darcyclarke deleted the fix/run-prepare-resilience branch March 17, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants