Repository navigation
fix(codex): preserve shim ownership across APFS reboots - #7061
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (5)
✨ Finishing Touches
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 |
|
✅ Deterministic PR hygiene checks passed. |
|
HOLD: security review required before merge. This PR changes the persisted ownership check for the private Codex PATH shim, which MAINTAINERS.md treats as a security-boundary change, so it is not being merged under the maintainer integration exception. What it does: the persisted (cross-reboot) wrapper and env ownership check compares the inode without requiring st_dev equality, because APFS renumbers st_dev on reboot (#7041). The path, owner, content and recorded-launcher checks are unchanged, and the snapshot and transaction checks still require device plus inode. CI on head 7615a40 is green. Reviewer question: is inode plus the content, owner and launcher match strong enough without the volume identity, or should the persisted record use a reboot-stable volume UUID (for example from statfs or getattrlist) instead of dropping the device check? |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7615a40a74
ℹ️ 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".
| function samePersistedInode(current: OverlayIdentity, recorded: OverlayIdentity | undefined): boolean { | ||
| return !!recorded && current.ino === recorded.ino; |
There was a problem hiding this comment.
Retain a volume-stable ownership discriminator
When $OPENCODEX_HOME/bin is replaced or mounted from another filesystem after the state was recorded, st_ino is only unique within st_dev, so an unrelated file can have the same numeric inode. This helper now treats that file as persistently owned on every Unix platform; if it contains the shim marker and recorded launcher binding (for example, a copied shim with additional content), install may overwrite it and uninstall may delete it instead of preserving the replacement. Persist and compare a reboot-stable volume/file discriminator, or otherwise scope the device-number relaxation to evidence that cannot collide across filesystems.
Useful? React with 👍 / 👎.
Summary
Closes #7041
Security review (implementation lane): traced both persisted comparison call sites and their diagnosis/install/auto-repair/uninstall consumers. The only relaxed comparison is saved device versus live device; missing identities, invalid namespaces, different inodes and invalid content still refuse. Journal bindings retain explicit device + inode checks before ownership validation. No credentials, logging, dependencies or execution destinations change. Independent security review remains required before merge under MAINTAINERS.md.
Verification
bun install— passed; the changed-test runner installed GUI dependencies on demand.bun test tests/codex-integration/codex-shim-overlay.test.ts --test-name-pattern 'persisted device drift'— before the fix: 4 pass / 1 fail with the reported ownership error; after the fix: 5 pass / 0 fail.bun test tests/codex-integration/codex-shim-overlay.test.ts tests/codex-integration/codex-shim-overlay-transaction.test.ts tests/codex-integration/codex-shim-overlay-readiness.test.ts tests/codex-integration/codex-shim-overlay-candidates.test.ts— 84 pass; the new same-inspection race test reached the correct refusal but expected a narrower error string. Corrected that assertion; all three other files passed.OCX_TEST_NO_QUEUE=1 bun test tests/codex-integration/codex-shim-overlay-transaction.test.ts --test-name-pattern 'device drift within'— 1 pass / 0 fail after the assertion correction.OCX_TEST_NO_QUEUE=1 bun test tests/codex-integration/codex-shim-overlay-transaction.test.ts— 43 pass / 0 fail on the final code.OCX_TEST_NO_QUEUE=1 bun run test:changed— completed against merge basef5f73ff3970b3b238c4e2fade29ba3f64914f637with the repository's four-worker default: 29,723 pass / 67 skip / 19 fail / 4 errors, exit 1 (327.8 seconds, 1,328 files). The failures are three audio timeouts, one sibling-process timeout, and 15 service-home authority failures; the changed shim regressions passed. The initialbun run test:changedremained queued behind another worktree and was stopped before tests ran. A subsequentOCX_TEST_NO_QUEUE=1 bun run test:changed --parallel=1was stopped with exit 143 after hitting the Bun isolation performance problem documented inscripts/test.ts; no passing result is claimed for either interrupted attempt.f5f73ff3970b3b238c4e2fade29ba3f64914f637:OCX_TEST_NO_QUEUE=1 bun run scripts/test.ts --parallel=4 tests/cli/cli-access-audio-live.test.ts tests/cli/sibling-home-client-sync.test.ts tests/service/service-sqlite-home.test.ts tests/service/service.test.ts tests/codex-integration/native-codex-toggle.test.ts tests/codex-integration/native-grok-toggle.test.ts— 319 pass / 4 fail / 4 errors, reproducing the same three audio timeouts and sibling-process timeout without this patch.OCX_TEST_NO_QUEUE=1 bun test tests/service/service-sqlite-home.test.ts— 5 pass;OCX_TEST_NO_QUEUE=1 bun test tests/service/service.test.ts— 211 pass;OCX_TEST_NO_QUEUE=1 bun test tests/codex-integration/native-codex-toggle.test.ts— 14 pass;OCX_TEST_NO_QUEUE=1 bun test tests/codex-integration/native-grok-toggle.test.ts— 24 pass. Zero failures in all four files.scripts/test.tsalready quarantines these files from the parallel full-suite pool because they share default-home service authority;canUseSerialLanes()excludes changed mode, explaining the 15 pool-only service-home failures. No test-runner changes are included here.OCX_TEST_NO_QUEUE=1 bun test tests/cli/cli-access-audio-live.test.tspassed;OCX_TEST_NO_QUEUE=1 bun test tests/cli/sibling-home-client-sync.test.ts— 32 pass / 1 fail / 1 error, with the same baseline-reproduced 30-second sibling timeout.bun run typecheck— passed on the final code.bun run structure:check— passed; the owning document remains within its 600-line budget.bun run privacy:scan— passed.cd docs-site && bun install --frozen-lockfile && bun run build— passed: 569 pages, 79,403 internal links checked. Existing unrelated sshconfig highlighting warnings remain.git diff --check— passed. No capped files or new test files were added.Full
bun run testwas omitted because multiple concurrent triage worktrees are running tests on this host and changed mode already exercised nearly 30,000 cases. Focused ownership, rollback, replacement, activation and candidate regressions cover this change. The broad changed run is not green: its unrelated failures are documented above with baseline reproduction and fresh-process evidence; required Ubuntu CI remains the broader validation gate. Tests simulate saved device drift rather than performing a physical reboot. This PR is not authorized for merge.Checklist