fix: merge per-path Codex filesystem rules across read/edit/write categories#2291
Merged
Merged
Conversation
…egories Codex models a single access level per path (deny < read < write) while the canonical model has separate read/edit/write categories. The generator previously wrote each category's rules into the filesystem table with plain assignments, so the last-processed category silently overwrote earlier ones — read: allow + write: deny emitted "deny", blocking reads the user explicitly allowed. Rules are now merged per pattern before emission: - edit/write collapse onto Codex's write side, restrictive action wins - read allow + write-side allow -> "write" - read allow + write-side non-allow -> "read" (readable, not writable) - read non-allow -> "deny"; a contradictory write-side allow (not expressible in Codex) warns - single-category patterns keep the existing mappings The merge is one-way and documented: "read" imports back as read:allow only, since the write-side deny is implied by Codex's access level. Closes #2283 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
@dyoshikawa Thank you! |
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.
Summary
Codex CLI models a single filesystem access level per path (
deny<read<write), while rulesync's canonical model has separateread/edit/writecategories.convertRulesyncToCodexProfileiterated the categories independently and wrote each rule with a plain assignment, so when the same pattern appeared in multiple categories the last-processed category silently overwrote the earlier one —read: allow+write: denyemitted"{path}" = "deny", blocking reads the user explicitly allowed, when the intended "readable but not writable" is exactly what Codex's"read"level expresses.Changes
mergeFilesystemCategoryRulescollects the three categories and emits one access level per pattern, order-independently:edit/writecollapse onto Codex's write side; when both carry the same pattern, the more restrictive action wins (deny>ask>allow).read: allow+ write-sideallow→"write"read: allow+ write-side non-allow →"read"(the issue's headline case)readnon-allow →"deny"; a contradictory write-sideallow("writable but not readable" is not expressible in Codex) emits a warning.mapReadAction/mapWriteActionmappings — no behavior change for configs without cross-category overlaps."{path}" = "read"imports back asread: allowonly; the write-side deny is implied by Codex's access level and deliberately not re-materialized (synthesizingwrite: denyon import would pollute round-trips of plain single-category read rules). Recorded in the merge function's doc comment.Closes #2283
🤖 Generated with Claude Code