Skip to content

fix: classify Linux Codex service modes from verified argv - #91

Merged
abruption merged 3 commits into
mainfrom
fix/89-process-mode-evidence
Oct 4, 2026
Merged

abruption merged 3 commits into
mainfrom
fix/89-process-mode-evidence

Conversation

@abruption

@abruption abruption commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

On Linux, an ordinary prompt such as codex exec 'fix the daemon', a --cd /work/app-server value, or a parent directory containing daemon is 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: --yolo for --dangerously-bypass-approvals-and-sandbox, --not-so-yolo for --approve-for-me, and exec's --experimental-json for --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

  • fix

Safety impact

Linux argv must agree with independent ps output 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 flattened ps output does not prove argv boundaries; macOS prompt/path false positives are documented and retained.

Checklist

  • npm ci passes
  • npm run check passes
  • npm run lint passes
  • npm test passes: 171 tests, 170 passed, 1 filesystem-dependent skip
  • npm run smoke:package passes
  • Commits follow Conventional Commits
  • Platform behavior and limitations are documented
  • No tokens, private paths, or unredacted process data are in the diff

Notes

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 ps renders 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.

@abruption
abruption merged commit f1915dd into main Oct 4, 2026
23 checks passed
@abruption
abruption deleted the fix/89-process-mode-evidence branch October 4, 2026 23:02
@abruption abruption added this to the v0.4.3 milestone Oct 4, 2026
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.

fix: distinguish Codex service modes from prompt and path arguments

1 participant