[WRONG BRANCH] fix(codex): bound destroyed shim diagnostics - #333
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e499c629bd
ℹ️ 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".
| * the misleading green status in #2411). | ||
| */ | ||
| function destroyedShimMessage(file: ShimFileState): string { | ||
| const wrapperProbe = stableShimPathProbe(file.wrapperPath); |
There was a problem hiding this comment.
Make the launcher probe resistant to path-swap races
When another local process can modify the launcher directory, this still permits the startup hang the change is intended to prevent: stableShimPathProbe() checks the path with lstatSync/statSync, then separately opens the pathname, so the checked regular file can be replaced with a FIFO before openSync(path, "r"), which blocks indefinitely. The new test covers only a FIFO already present before the metadata check. Open the path nonblocking first, verify the opened descriptor with fstatSync, and read from that same descriptor so the file-type check and read refer to one object.
Useful? React with 👍 / 👎.
Motivation
destroyedShimMessage()from performing an unbounded synchronous read of the tracked launcher path which could block or exhaust memory when a low-integrity local process replaces the launcher with a FIFO or other non-regular file.Description
isShim(file.wrapperPath)call insidedestroyedShimMessage()with a bounded, file-type-aware probe usingstableShimPathProbe(file.wrapperPath)so diagnostics read only the probe prefix and avoid opening non-regular files.present but unusable/present but not an opencodex shim/missing.autoRestoreCodexShim()returnsineligiblequickly without blocking.src/codex/shim.tsandtests/codex-shim.test.ts.Testing
bun test tests/codex-shim.test.ts --test-name-pattern "version-manager shim destruction"and the version-manager shim-destruction tests (including the new FIFO regression) passed.bun test tests/codex-shim.test.tswhich exercised the suite; the run showed 70 passed and 2 unrelated test failures in process-group cleanup assertions that observed a different diagnostic message (those failures are unrelated to the bounded-read change).bun x tsc --noEmit(typecheck) andbun run privacy:scanand both completed successfully.Codex Task