[WRONG BRANCH] fix(codex): reject profile FIFOs without blocking - #41
[WRONG BRANCH] fix(codex): reject profile FIFOs without blocking#41luvs01 wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
✅ Deterministic PR hygiene checks passed. |
📝 WalkthroughWalkthroughNon-Windows bounded profile vault reads now open files with ChangesProfile vault read behavior
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/native-profile-store.test.ts`:
- Around line 386-392: Update the skipped FIFO test around
readNativeProfileVault to execute the vault read in a child process with an
OS-level timeout, preventing openSync from hanging the test runner when no
writer exists. Assert that the child exits before the deadline and reports
NativeProfileError, rather than wrapping the synchronous call in toThrow or
relying on a JavaScript timer.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 95c48458-dfca-440e-b5a6-a7b3e53cede2
📒 Files selected for processing (2)
src/codex/native-profile-store.tstests/native-profile-store.test.ts
| test.skipIf(process.platform === "win32")("rejects a vault FIFO without waiting for a writer", () => { | ||
| const store = context(); | ||
| execFileSync("mkfifo", [store.vaultPath]); | ||
|
|
||
| expect(() => readNativeProfileVault(store)).toThrow(NativeProfileError); | ||
| }); | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Run the FIFO read in a bounded subprocess.
If O_NONBLOCK regresses, readNativeProfileVault(store) can block inside openSync while waiting for a writer. The synchronous call prevents toThrow from completing, so the test process can hang instead of reporting a failure.
Execute the vault read in a child process with an OS-level timeout. Assert that the child reports the expected NativeProfileError before the deadline. Do not rely on a JavaScript timer around the current synchronous call.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/native-profile-store.test.ts` around lines 386 - 392, Update the
skipped FIFO test around readNativeProfileVault to execute the vault read in a
child process with an OS-level timeout, preventing openSync from hanging the
test runner when no writer exists. Assert that the child exits before the
deadline and reports NativeProfileError, rather than wrapping the synchronous
call in toThrow or relying on a JavaScript timer.
Motivation
readBoundedopens untrusted paths in blocking mode and can hang the process when a FIFO is placed at profile/config paths.open.Description
O_NONBLOCKto the open flags used byreadBoundedsoopenSync(path, flags)does not block waiting for a FIFO partner; the change is insrc/codex/native-profile-store.ts.readNativeProfileVaultrejects it without waiting for a writer, intests/native-profile-store.test.ts.execFileSyncin the test to create the FIFO; the change is minimal and focused to avoid changing existing bounded-read semantics for regular files.Testing
bun test tests/native-profile-store.test.tswhich passed (16 tests, 0 failures).bun run typecheckwhich completed successfully.bun run privacy:scanwhich completed successfully.bun run testwas executed but encountered unrelated failures in other test suites (tests/api-key-attribution.test.ts), so the focused native-profile tests and static checks were used to validate this fix.Codex Task
Summary by CodeRabbit