Skip to content

Refuse terminal Codex child tools after Sage off (T16) - #259

Merged
erickb336 merged 2 commits into
mainfrom
codex/t16-off-terminal-authority
Oct 17, 2026
Merged

erickb336 merged 2 commits into
mainfrom
codex/t16-off-terminal-authority

Conversation

@erickb336

@erickb336 erickb336 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #258
Sage task T16

A tracked Codex child could pass tool policy after its turn ended when Sage was off. The policy now requires the exact native turn to remain active before evaluation and again before permission returns.

The fix preserves ongoing off-mode work, unmanaged off-mode children, and separate completion/interruption recording. A refused tool does not release the reservation or finish its logbook run. Source edits are in packages/sage-codex/runtime/policy.mjs; plugin output was regenerated through the build.

Verification

Final reviewed head: f6cf267c9f9c05de9b51abf2290c94bc6d3c91ec.

  • npm run build: built 317 files.
  • npm run check: all checks pass (4 documented timing bounds).
  • git diff --check: passed.
  • node --test --test-name-pattern='T16:' scripts/codex-server.test.mjs: tests 9; pass 9; fail 0.
  • npm test: tests 1613; pass 1613; fail 0; cancelled 0; skipped 0.
  • Two fresh independent code/security/QA cycles are clean on the final head. Cycle 1: 32/18/30 checks. Cycle 2: 21/25/28 checks, plus two isolated QA turn-context diagnostics.
  • Sage merge check: two clean cycles on this SHA.
  • Exact-head CI run38998065454: passed; actual log confirms tests1613, pass1613, fail0, cancelled0, skipped0.

Every test used fake ps, pgrep and kill first on PATH, with NODE_TEST_CONTEXT unset. No timing-based assertion was added.

Regression evidence and fixture repair

On detached main 443c00a, the identical new tests report tests 9; pass 5; fail 4. Each off-mode regression fails with Missing expected rejection, covering completion/interruption before/during awaited evaluation. Five positive controls already pass on main. The final repair did not change those cases.

The first full candidate suite reported 1612 passes and one failure: an older message-policy fixture omitted its child transcript. The repair supplies that existing transcript, preserving every assertion and the production checks. Both review cycles restarted after that commit. The final full suite above passes. During initial test development, interruption ingestion was also corrected to use parent reconciliation; those fixture errors are not counted as behavioral regression proof.

Not verified

No live-model or installed-session trial ran for this repair. Tests exercise packaged production policy with transcript fixtures. This cannot revoke a command that already received permission before a later terminal event. Automatic Sage, project-wide PR ownership, upstream trusted execution context and abrupt-loss recovery remain separate work under #88. Claude-owned work is unchanged.

@erickb336
erickb336 marked this pull request as ready for review October 17, 2026 03:22
@erickb336
erickb336 merged commit 66fe812 into main Oct 17, 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.

Refuse terminal Codex child tool calls after Sage off (T16)

1 participant