fix(action): keep OCR runtime stable during review - #1204
Open
jnhu76 wants to merge 1 commit into
Open
Conversation
The composite action owns OCR installation for the duration of a review. Disable the CLI background updater on action-owned OCR invocations so the runtime cannot change or disappear between install, configure, and review.
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
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.
Description
The composite GitHub Action installs an OCR runtime before configuration and review, but each
ocrinvocation can start the CLI's detached background updater.When the npm registry contains a newer release, that updater can run
npm i -gconcurrently with later action steps. Besides changing the OCR version during one action execution, npm may temporarily remove the globalocrlauncher and JavaScript package tree, causing subsequentocr configorocr reviewcommands to fail.This change disables CLI self-update only for OCR invocations owned by the composite Action (
OCR_NO_UPDATE: "1"step-level env on the Install / Configure / Run steps — the step-level scope keeps it out of the caller's job environment). Standalone CLI behavior is unchanged: the launcher's updater still runs exactly as before for directocrusers.The contract holds regardless of the
ocr_versioninput (exact pin, range, orlatest): the Action has already performed its own installation, so the runtime should not change again during that execution.Relation to #704
#704 addresses resilience of the generic npm auto-upgrade path with a staged native-binary fallback. This PR is intentionally narrower: the GitHub Action already owns OCR installation for one review execution, so it avoids entering that background upgrade path during the action.
The action-level fix also covers launcher / JavaScript-package removal cases where a native-binary fallback cannot run because the launcher itself is temporarily unavailable (exit 127
ocr: command not found, orCannot find module '/usr/local/bin/ocr'while npm replaces the global package tree).Type of Change
How Has This Been Tested?
Regression test: a new action-contract test (static YAML contract + executed shell-block contract via the existing fake-
ocrharness) fails on upstream/main before the fix and passes after it.Negative control (upstream/main worktree + test patch only):
After the fix, all gates pass locally:
node scripts/github-actions/action-contract.test.js— 41/41 PASSnpm run test:github-actions— PASSnpm run test:launcher— PASS (standalone launcher auto-update behavior unchanged)npm run test:update— PASSmake check— PASSmake test— PASSmake build— PASSExternal hosted GitHub Actions reproduction (not part of this repo):
Observed during failing runs: detached
scripts/update.js->npm i -g 1.11.7-> global launcher/package-tree replacement with a 0.66-0.89 s unavailable window -> subsequentocr configfailing with exit 127 orMODULE_NOT_FOUND.Checklist
go fmt,go vet)Related Issues
Related to #703.
Complementary to #704.