Repository navigation
Protect Codex advice state from redirected writes (T5) - #125
Merged
Merged
Conversation
…e-advice # Conflicts: # scripts/providers.test.mjs
This was referenced Oct 12, 2026
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.
Closes #95
Sage task T5 (Codex logbook)
Codex advice state now lives in a private directory under CODEX_HOME by default. The hook refuses linked, foreign-owned, or unsafe directories. It opens existing state without following links and writes a private temporary file before an atomic rename. A preplaced state-file link no longer redirects the write to its target.
Reviewed head: 4b4a7e6. Base: main e8b823d (#75 merged).
Validation
All test commands used fake ps, pgrep, and kill first on PATH.
Only the tests were copied into the detached main checkout. The three baseline failures show linked-directory refusal, the private default location, and foreign-ancestor refusal missing on main. Tests also verify that the linked destination retains its original content, replacement state has mode 0600, private directories have mode 0700, and repeat advice is deduplicated.
Independent code, security, and QA reviews returned no actionable findings on this exact head. Reviewers checked the source, bundled copy, test cases, and recorded evidence; they did not rerun the full suite. QA verified the unchanged assertions and behavioral baseline failures. The final full suite passed on this exact head.
Not verified: an actual second OS user, ACL-specific permissions, simultaneous filesystem replacement, special-file corruption, or crash durability. Foreign UID tests simulate stat ownership. Atomic replacement does not serialize concurrent advice updates. No installed automatic Sage or runtime activation is claimed.
All test and review processes exited. No process signals were sent.