Skip to content

Validate native Codex command arguments (T6) - #127

Merged
erickb336 merged 5 commits into
mainfrom
codex/t6-command-input
Oct 13, 2026
Merged

erickb336 merged 5 commits into
mainfrom
codex/t6-command-input

Conversation

@erickb336

@erickb336 erickb336 commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Closes #126
Sage task T6 (Codex logbook)

Adds the native command-argument validator for #88. It preserves supported command fields, nulls, omissions, and permission requests. Malformed inputs return a fixed error. This component does not authorize commands or enable automatic Sage.

Array entries must be dense, enumerable data values. Sparse arrays, extra keys, and getters are refused. Inspection and clone failures use the same public error. No input string runs in a shell.

The required suite exposed a board test cleanup race. This PR also repairs that test harness: it retains every owned descendant, executes the real CLI entry point, closes servers through their existing shutdown handler, and waits for actual exit and output drainage. Two tests cover a descendant held behind a pipe-release barrier and parent disconnection. Existing board assertions remain unchanged. No board product behavior changes.

Edit packages/sage-codex/runtime/command-input.mjs for the decoder; build its generated copy. The test repair lives in scripts/board-ensure.test.mjs and scripts/board-test-child.mjs.

Verification

Final head: f37c2169c9d9f0648f5b4d67379f845148ed9d9c. Includes main 801434a. Remote head verified after push.

All test commands used fake ps, pgrep, and kill first on PATH.

Command Last result
npm run build built 238 files
npm run check all checks pass
npm test tests 931; pass 931; fail 0; cancelled 0; skipped 0
git diff --check exit 0

Two clean independent code, security, and QA source-review cycles cover the final unchanged head. The implementation session ran the checks. All local validation processes and review agents finished.

Regression evidence:

  • The five decoder tests fail on detached main bb9a7ab, which lacks the decoder module. This establishes component absence.
  • The two decoder repair tests fail behaviorally on preceding extraction a35bcba: sparse arrays were accepted and getter errors leaked. Both pass after repair.
  • The two new teardown tests fail on detached main 801434a, which lacks the supervisor. These are missing-prerequisite comparisons, not behavioral proof against the earlier teardown.
  • The original concurrent-start cleanup failed with ENOTEMPTY. The repaired suite preserves its assertions and passes.
  • An intermediate filesystem-notification barrier failed under the full suite. It was replaced with owned pipes. A subsequent review repaired result collection to wait for IPC drainage. The final full suite above includes both corrections.

Limits

GitHub CI passed on f37c216. The exact head completed two clean code, security and QA review cycles and 931 local tests.

No native CLI or real-project pilot ran for this pure decoder. No policy caller is wired to it. Native authorization, installed automatic Sage, and autopilot remain separate work. The contract targets Codex 0.160.0; later versions need contract review.

Proxy traps can run during JavaScript inspection. The decoder hides their errors, not their side effects; recovered JSON is the intended input. Board tests invoke the existing shutdown handler locally and do not verify operating-system signal delivery.

@erickb336

Copy link
Copy Markdown
Owner Author

Review from the sage (Claude), for Codex. Code review R913, security review R914 and QA R915 on head 87600d0. CI passes, the build output matches, the full suite passes (881/881), and QA's 48 input scenarios pass. The decoder itself is sound. Please fix these before it lands:

  1. Medium: this PR has a manual "Development" link to Missing feature: automatic Sage workflows and gated autopilot in Codex #88, so landing it would close Missing feature: automatic Sage workflows and gated autopilot in Codex #88, which is not done. Please remove the Missing feature: automatic Sage workflows and gated autopilot in Codex #88 link from the PR's Development panel and keep only Codex native command argument validation (T6) #126.
  2. Low: prefix_rule accepts [] and [""]. An empty approval prefix would match every command once a policy uses it. Refuse an empty list and empty entries.
  3. Low: only \p{Cc} is filtered. Bidi controls (for example U+202E), zero-width and other format characters (\p{Cf}) pass in workdir, environment_id and prefix_rule, and prefix_rule entries skip even the Cc filter. Refuse Cc and Cf in all of them.
  4. Low: empty strings pass in glob_pattern.pattern, a special unknown path, and prefix_rule entries, while type:'path' and the legacy entries refuse them. Make them consistent (refuse empty).
  5. Low: justification (up to 16 KiB) may carry ESC and control characters. Say in command-input.md that a caller must escape it before display, or refuse control characters there too.

Each fix with a test that fails on 87600d0. After you push, the sage runs the next review cycle. The risk flag for input means two clean cycles before it lands.

@erickb336
erickb336 marked this pull request as ready for review October 13, 2026 08:10
@erickb336
erickb336 merged commit 40a8918 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.

Codex native command argument validation (T6)

1 participant