Repository navigation
fix: classify Linux Codex service modes from verified argv - #91
Merged
Merged
Conversation
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.
Summary
On Linux, an ordinary prompt such as
codex exec 'fix the daemon', a--cd /work/app-servervalue, or a parent directory containingdaemonis currently treated as a shared service. Use verified kernel argv boundaries and known execution-mode/option positions to distinguish those values from an actual service invocation.Official hidden aliases retain their canonical flags' supported scopes:
--yolofor--dangerously-bypass-approvals-and-sandbox,--not-so-yolofor--approve-for-me, and exec's--experimental-jsonfor--json. The mappings are verified in pinned Codex shared options and exec options. Tests compare alias/canonical evidence, exercise aliases with real advisory-lock owners, and retain unknown-option and unsupported-nested-mode refusals.Closes #89
Type
Safety impact
Linux argv must agree with independent
psoutput before mode classification. Unreadable, truncated, conflicting, unsupported, or ambiguous evidence produces null arguments and incomplete identity, which blocks unlock. Actual app-server, Remote Control, daemon, exec-server, remote options, and unrecognized service-looking root modes remain refused.The parser deliberately supports a bounded grammar from Codex CLI 0.159.2 help. Unknown and variadic options, unsupported nested modes, and exact service/subcommand-looking operands after
--remain conservatively refused. macOS still uses its conservative whole-command matching because flattenedpsoutput does not prove argv boundaries; macOS prompt/path false positives are documented and retained.Checklist
npm cipassesnpm run checkpassesnpm run lintpassesnpm testpasses: 171 tests, 170 passed, 1 filesystem-dependent skipnpm run smoke:packagepassesNotes
Unit tests cover prompts, executable/option paths, config/model values, real service positions, unsupported options, evidence conflicts, truncation, and flattened arguments. Integration fixtures preserve real NUL-delimited process argv and real advisory locks; refused cases assert no SIGTERM and owner survival. The existing terminal-width/truncation regression remains covered.
Local checks passed on macOS arm64 with Node 24.16.0. The existing Linux x64/arm64 Node 22/24 PR CI matrix checks the Linux-specific real argv behavior. JSON Schema v1 and signal/revalidation contracts retain their existing shape.
Strict reconciliation can refuse non-ASCII/control-byte arguments when
psrenders them differently. The procps rendering implementation substitutes non-printable bytes in a non-UTF8 locale. This PR retains refusal for such discrepancies rather than treating a lossy rendering as verified identity.Synthetic owner lock paths are supplied through fixture-only environment data, so the fixture's actual argv contains only the requested Codex invocation. This preserves the existing multiple-lock and Unicode-home regressions without interpreting fake lock-file operands as Codex commands.