Repository navigation
Enforce read-only roles before Codex edits (T30) - #176
Merged
Merged
Conversation
This was referenced Oct 13, 2026
erickb336
marked this pull request as ready for review
October 13, 2026 14:39
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 #175
Sage task T30
Sage's read-only roles now receive a refusal before an evaluator can permit a patch or a known shell write. The native policy derives each child's role from its verified binding. Implementers, designers, and arena judges retain evaluator checks. Sage off restores ordinary evaluation.
The shared helper lives in
packages/sage-core/role-policy.mjs; Codex applies it inpackages/sage-codex/runtime/policy.mjs. The build regenerates both provider bundles. Claude hooks and shared state-tool behavior are unchanged. This is part of the Codex program tracked in #88 and #138, not installed activation.A code review found three older lifecycle fixtures that used lead patches as generic tool calls. They now use a read-only operation. Every existing assertion remains intact.
Verification, with fake ps, pgrep and kill first on PATH:
npm run build: built 278 files.npm run check: all checks pass.148553a: 6 tests, 0 pass, 6 fail. One provider test lacks the new helper API; the other five expose missing edit refusal or verified role context. No production code was copied to main.node scripts/probe-codex-lifecycle.mjs --sage-role-edit: CLI 0.160.0, simulated responses, verified true. The lead receives the role refusal before evaluator entry; no file or PostToolUse edit event appears.--writer: verified true. An implementer reaches the evaluator and creates the fixed file with exact contents. Both probes use workspace-write permissions, complete normally, and remove their temporary profiles.role_edit_denial_missing; cleanup passed.node --test scripts/codex-server.test.mjsafter the fixture repair: 127 tests, 127 pass, 0 fail/cancel/skip.--sage-completionand--sage-child-messagecontrols: verified true, cleanup passed.40b0363.npm teston repaired final head40b0363: 1,116 tests, 1,116 pass, 0 fail/cancel/skip.38413912131: success; 1,116 tests, 1,116 pass, 0 fail/cancel/skip.Not verified: arbitrary shell safety, effective execution context for every command, installed automatic Sage, or a real-project pilot. The existing shared parser classifies known write forms; complete command and path policy remains the supplied evaluator's responsibility.