[codex] Fix action Corepack bootstrap#819
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the command execution logic in action.mjs by introducing helper functions for formatting commands, summarizing results, and asserting success. It removes the steps for globally installing and enabling corepack, opting instead to use the bundled version. Additionally, it improves logging by outputting environment details and command results. The test suite was updated to verify the removal of corepack installation steps. I have no feedback to provide.
llun
left a comment
There was a problem hiding this comment.
Review: Fix action Corepack bootstrap
The core fix — switching from getRuntimeCommand('npm') to plain PATH-resolved npm — is the right direction based on the diagnostic findings. The assertCommandSucceeded refactor also improves error reporting significantly. However, there are four issues to address before merging:
Must fix
-
corepackCommandpath may not be valid after PATHnpm -ginstall —getRuntimeCommand('corepack')points to the runtime bin dir, but that dir reportedly lacks bothnpmandcorepack. Ifnpm install -g corepackputs corepack in a different prefix, theenableandyarn installsteps will still fail. Needs verification or a fix. (inline comment onaction.mjsline 75) -
Debug
console.logstatements left in — four path-logging lines are diagnostic artifacts that should be removed (or gated behindRUNNER_DEBUG). (inline comment onaction.mjslines 76–79)
Should fix
-
Label string duplicated at every call site — passing the same string to both
runCommandandassertCommandSucceededis error-prone. Suggested refactor in inline comment. (inline comment onaction.mjslines 81–84) -
Test lost the ordering invariant — the new test checks string existence but no longer verifies that install happens before enable. Also, string-existence tests are fragile against future refactors. Suggested fix in inline comment. (inline comment on
action.test.js)
Generated by Claude Code
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97f050e04d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
llun
left a comment
There was a problem hiding this comment.
Follow-up review
All four points from the previous review are addressed cleanly. CI is green.
Resolved
- ✅
corepackCommandfragility —getRuntimeCommandis gone.enable corepackandyarn installnow invoke'corepack'via PATH, consistent with hownpm install -g corepackdeposits the binary on the runner's global npm prefix (which is on PATH). - ✅ Debug
console.loglines removed — the four diagnostic path-prints are gone. The remaining per-command log lines fromrunCommand/assertCommandSucceededare operationally useful (matches the PR description's "keeps command/status debug logs for future runner changes") and are well-scoped. - ✅ Label duplication eliminated —
runCommandnow returns{ label, result }andassertCommandSucceededconsumes the combined object, so each call site names the step exactly once. Matches the suggested refactor. - ✅ Test ordering invariant restored —
installIndex < enableIndex < yarnIndexis now asserted, plus the newt.false(source.includes("getRuntimeCommand(...)"))assertions guard against regressions of the original bug.
Minor nit (non-blocking)
- The PR description still says "keeps using the runtime-local
corepackpath after npm creates it", but the implementation no longer does that — it uses PATH-resolvedcorepack. Worth tweaking the description before merging so future readers don't get a wrong mental model from the commit/PR history.
LGTM aside from that documentation nit.
Generated by Claude Code
|
Follow-up review documentation nit addressed. The PR description now says the action uses PATH-resolved npm/corepack shims (including .cmd on Windows) instead of the old runtime-local corepack wording. |
Summary
Fixes the GitHub Action bootstrap for Node 24 hosted runner actions without downloading Yarn manually.
The original failure came from resolving npm with
getRuntimeCommand('npm'), which builds an absolute path next toprocess.execPath. On the hosted action runtime that directory containsnode, but notnpmorcorepack, so the absolute npm path failed withENOENTeven thoughnpm install -g corepackworks when npm is resolved fromPATH.This PR now:
PATHfor spawned setup commandsPATHinstead of the runtime-local bin directoryspawnSyncwithoutshell: true(npm/npm.cmd,corepack/corepack.cmd)npm install -g corepackcorepack enablebeforecorepack yarn install.cmdsuffix support, and install -> enable -> yarn orderingThe temporary workflow changes used to run
Samplefrom branch refs are not in the final diff; themainguard is restored.Validation
node --check action.mjsyarn test action.test.jsyarn test(50 tests)gh pr checks 819:test: https://github.com/llun/feeds/actions/runs/25513815228/job/74879396181Analyze (actions): https://github.com/llun/feeds/actions/runs/25513813614/job/74879402928Analyze (javascript): https://github.com/llun/feeds/actions/runs/25513813614/job/74879402836CodeQL: https://github.com/llun/feeds/runs/74879531395