Repository navigation
Add an opt-in persistent pnpm store for self-hosted runners - #14
Merged
Merged
Conversation
Persistent self-hosted runners keep their disk between jobs, but checkout's `git clean -ffdx` deletes the in-workspace pnpm store every job, so each job restores the same dependency archive only for `pnpm install` to finish in seconds. `persistent-store-dir` keeps the pnpm store, Corepack home, and Electron caches under a root outside the workspace. A seed marker (epoch seconds, written last) makes the store warm; a missing, unreadable, future-dated, or expired marker drops it. Warm jobs skip the dependency cache restore and save and install with `--store-dir` at the persistent store. Cold jobs run exactly as in default mode, so cache entries stay shared, then move the store and caches under the root. A failed warm install removes the marker so the next job re-seeds. The root must be absolute and cannot overlap the workspace, the home directory, or a filesystem root; every delete is limited to named entries directly under it. Persistent mode is pnpm-only, requires an exact pin, and rejects lookup-only and dependency-cache: node-modules. Default behavior is unchanged. New output: persistent-store-warm.
Harold Hunt (huntharo)
added a commit
to pwrdrvr/PwrAgent
that referenced
this pull request
Oct 26, 2026
Try pwrdrvr/configure-nodejs#14 by branch reference: persistent-store-dir keeps the pnpm store, Corepack home, and Electron caches on the guest and skips the dependency cache restore when the store is warm. It replaces scripts/ci/macos-e2e-guest-store.sh and its test, which are deleted. The root stays ~/Library/Caches/pwragent-ci, beside desktop-out/. The action's marker name differs from the script's, so each guest re-seeds once. Pin the v1.7.0 release SHA before merging.
… reuse helpers - Treat a marker without its pnpm-store directory as cold, so the job re-seeds from the cache archive instead of downloading from the registry. - Start the floating setup-node timing after the persistent store check, so dropping an expired store is not reported as setup-node time. - Use a fixed temporary marker name that drops clean up. - Warn when the root is under RUNNER_TEMP, which never survives a job. - Reuse isPathWithin, findNearestExistingPath, and a shared exact pnpm pin pattern instead of local copies; move status messages into the module.
Harold Hunt (huntharo)
added a commit
to pwrdrvr/PwrAgent
that referenced
this pull request
Oct 26, 2026
Try pwrdrvr/configure-nodejs#14 by branch reference: persistent-store-dir keeps the pnpm store, Corepack home, and Electron caches on the guest and skips the dependency cache restore when the store is warm. It replaces scripts/ci/macos-e2e-guest-store.sh and its test, which are deleted. The root stays ~/Library/Caches/pwragent-ci, beside desktop-out/. The action's marker name differs from the script's, so each guest re-seeds once. Pin the v1.7.0 release SHA before merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in persistent pnpm store for self-hosted runners whose disk survives between jobs (e.g. the PwrSuiteLab macOS Tart guests). Checkout's
git clean -ffdxdeletes the in-workspace.pnpm-storeevery job, so each job restores the same ~750 MB archive only forpnpm installto finish in ~4.5 s. This absorbs the behavior of PwrAgent'sscripts/ci/macos-e2e-guest-store.sh(pwrdrvr/PwrAgent#2892), where warm lanes installed in 5–16 s instead of 38–72 s.Default behavior is unchanged for callers that do not pass the new inputs.
Design decisions
persistent-store-dir(empty = off; leading~/expanded becausewith:can't expand$HOME) andpersistent-store-max-age-days(default14). Corepack and Electron caches follow the same root; no extra inputs. A caller-setCOREPACK_HOMEis still preserved.<root>/pnpm-store,<root>/corepack,<root>/electron,<root>/npm(same as the PwrAgent script), plus the marker<root>/.configure-nodejs-seeded. Nothing else under the root is touched.$HOMEor an ancestor of it, and not the workspace, inside it, or an ancestor of it (an ancestor could name the workspace as a managed entry). Checked on both the given path and its real path. Every delete goes through one helper that only removes named, direct children of the root and refuses symlinks that escape it.EXDEV; retries transient Windows locks), writes the marker, and re-exportsPNPM_CONFIG_STORE_DIR/npm_config_store_dir/ Electron vars to the moved paths. I checked that pnpm 10 re-links cleanly in CI if a later step re-runspnpm installafter the store moved.actions/cache/restore, the Corepack actions/cache, and the dependency save. Runs setup-node, Corepack activation with the existing explicitpnpm --versionvspackageManagercheck, thenpnpm install --frozen-lockfile --store-dir <root>/pnpm-store. The Node-major mismatch guard still runs.persistent-store-warm(true/false).pnpm-store-pathandinstall-commandreport the persistent paths when used. The job summary notes warm/cold and the seed time..../${{ runner.name }}) and per repository.lookup-only: true,dependency-cache: node-modules, npm/Yarn, and pnpm without an exactpackageManagerpin.Tests
test/persistent-store.test.mjs(new, 21 tests): path guard (relative,/,~, home and ancestors, workspace / inside / ancestor, symlinked roots), warm / missing / unreadable / future / expired / boundary markers, drop removes only managed entries, seeding moves everything and writes the marker last (asserted on every rename), failed seed leaves no marker,EXDEVcopy fallback, Windows retry, invalidation,--store-dirrewrite, Corepack home selection.test/action-wiring.test.mjs: default mode leaves every pre-existing step condition unchanged; warm skips restore / Corepack cache / save; cold still saves and seeds; executes the inline check, prepare, and install scripts (warm install failure drops the marker; cold/default failures do not).Persistent pnpm storejob on ubuntu/macos/windows driving the real action: cold seed from a miss → simulated checkout clean with Corepack offline → warm run (no restore, no save) → broken lockfile fails the warm install and drops the marker → re-seed from the saved cache → expired marker re-seeds → root inside the workspace is rejected.npm test: 135 passing locally.Release plan
Minor bump: v1.7.0. After merge, tag the merge commit:
git tag -a v1.7.0 <merge-sha> -m "v1.7.0" && git push origin v1.7.0. The release workflow movesv1.Follow-up (separate PR in PwrAgent)
Switch
desktop-e2e-macostopersistent-store-dir: ~/Library/Caches/pwragent-ciand deletescripts/ci/macos-e2e-guest-store.shand its test. The directory layout matches, but the marker name differs (.configure-nodejs-seededvspnpm-store/.pwragent-seeded), so each guest re-seeds once on its first job after the switch unless the PR also renames the old marker.