Skip to content

Recover native Codex command inputs before policy checks (T27) - #170

Merged
erickb336 merged 3 commits into
mainfrom
codex/t27-command-evidence
Oct 13, 2026
Merged

erickb336 merged 3 commits into
mainfrom
codex/t27-command-evidence

Conversation

@erickb336

@erickb336 erickb336 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #169
Sage task T27

Codex command policy now receives the original native command arguments, including requested shell, working directory, and permission fields. The normalized Bash hook contains only command text. The policy joins that hook to the protected pending native call, validates the complete envelope, and passes a separate copy to its evaluator.

This works with Sage on and off. Off-mode children prove native identity without creating admission records. After an awaited decision, the policy rechecks that the same command is still pending with unchanged arguments. These checks do not infer effective environment defaults or grant permission by themselves.

Source changes are in packages/sage-codex/runtime/; generated plugin files come from the build. Claude's active state-tool and hook files are unchanged.

Validation at eb3352038f38da3db2293677745604d38799a457:

  • npm run build: built 278 files.
  • npm run check: all checks pass. git diff --check: clean.
  • Focused command-policy checks: 11 tests, 11 pass, 0 fail.
  • node --test scripts/codex-server.test.mjs: 115 tests, 115 pass, 0 fail.
  • The initial ten new tests fail in a detached worktree at main 428cc47: the original envelope is absent and awaited decisions do not recheck it.
  • node scripts/probe-codex-command.mjs: actual CLI 0.160.0 with simulated responses; exact requested fields reach the evaluator, and the fixed harmless command produces the expected output in the requested directory.
  • The same probe with --deny-command, --default-command, and --extended-command --sage-off passes. Denial produces no execution or post-tool callback. Defaults remain omitted in the evaluator input. Each probe removes its temporary profile.
  • The probe scripts alone on detached main fail because the evaluator receipt lacks the original command envelope.
  • Review repair: an unassigned off-mode child can have no observation directory. Missing directory components are allowed only for the off-mode read; malformed records, symlinks, and other errors still refuse. The added regression fails before the repair and on detached main.
  • Two clean code/security/QA cycles passed on the unchanged final commit. Final npm test: 1,104 tests; 1,104 pass; 0 fail, cancelled, skipped, or todo. Exact-head CI run 38405927407 reports the same counts.

Every test/probe uses fake ps, pgrep, and kill first on PATH. Attack strings reach parsers only. The native probe executes only its fixed harmless command in its temporary workspace.

Not verified: effective remote environment resolution, complete Sage policy composition, installed automatic enforcement, or real-model operation. Automatic Sage remains incomplete; see #88.

@erickb336
erickb336 marked this pull request as ready for review October 13, 2026 13:43
@erickb336
erickb336 merged commit 83b07ea 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.

Recover original Codex command inputs before policy checks (T27)

1 participant