Skip to content

Enforce read-only roles before Codex edits (T30) - #176

Merged
erickb336 merged 4 commits into
mainfrom
codex/t30-role-edits
Oct 13, 2026
Merged

erickb336 merged 4 commits into
mainfrom
codex/t30-role-edits

Conversation

@erickb336

@erickb336 erickb336 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

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 in packages/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.
  • Six new focused role tests pass. The combined role/message/provider check reports 9 tests, 9 pass, 0 fail/cancel/skip.
  • The six new tests on detached main 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.
  • The same command with --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.
  • Probe-only copy on detached main: verified false, role_edit_denial_missing; cleanup passed.
  • node --test scripts/codex-server.test.mjs after the fixture repair: 127 tests, 127 pass, 0 fail/cancel/skip.
  • Native --sage-completion and --sage-child-message controls: verified true, cleanup passed.
  • Code/security/QA each passed two clean review cycles on final head 40b0363.
  • npm test on repaired final head 40b0363: 1,116 tests, 1,116 pass, 0 fail/cancel/skip.
  • Exact-commit CI run 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.

@erickb336
erickb336 marked this pull request as ready for review October 13, 2026 14:39
@erickb336
erickb336 merged commit c241ec1 into main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce Codex Sage read-only roles before edits (T30)

1 participant