Add the codex-agent provider: keyless completions through the Codex CLI - #205
Merged
Conversation
Closes #56. `--provider codex-agent` runs every completion as `codex exec --ephemeral --sandbox read-only --skip-git-repo-check --ignore-user-config --ignore-rules`, so the CLI's own login (CODEX_HOME) is the only credential and no API key is read. Each call gets a throwaway cwd and a 14-key environment allowlist; the child runs in its own process group with SIGTERM-then-SIGKILL termination that also fires on parent SIGINT, SIGTERM, and exit. The `codex` executable is resolved only from absolute PATH entries and fails closed when none matches, so a binary beside the Node runtime is never launched. Tool calls are validated against the requested tool's input_schema with Ajv; the answer is read from `--output-last-message` with a bounded O_NOFOLLOW read, stdout is drained uncounted, and only stderr counts against the 1 MiB cap. Child output never enters an error message; stderr is classified into actionable failures (not installed, not logged in, CLI too old for these flags, timed out). Selecting codex-agent on argv or in the shell environment skips loading the project .env. maxTokens is documented as not forwarded; an unset model passes no --model and reports the codex-cli-default sentinel; embeddings must name an explicit provider. The --provider flag is uniform across the seven commands that take a provider. Tests drive the real built CLI for the process boundary (env allowlist, launcher-wrapper bypass, PATH fail-closed with a copied Node binary, .env isolation at the read, interrupt custody) and a gated live smoke test exercises the installed Codex binary. The timeout tests wait on the fake's readiness marker and drive the provider's timers with fake timers, so nothing depends on process start-up speed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
SummaryCoverage spans provider selection and overrides, successful compilation and structured output, embedding setup, command isolation, secret handling, safe error messages, and process cleanup. It includes normal flows plus edge and adversarial cases such as invalid configuration, malformed data, unsafe executable locations, interruptions, timeouts, and retries, with no application regressions identified. Safe to merge — the run found no failures or PR-attributable regressions across provider behavior, compilation, security boundaries, error handling, and cleanup paths. No merge-blocking risk is indicated. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
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.

Closes #56.
What this adds
--provider codex-agent: completions run through the locally installed Codex CLI, so the CLI's own login is the only credential. No API key is read or forwarded.codex exec --ephemeral --sandbox read-only --skip-git-repo-check --ignore-user-config --ignore-rules --color never, prompt on stdin, in a per-call throwaway cwd that is removed on every exit path. The child gets a 14-key environment allowlist and runs in its own process group; termination is SIGTERM then SIGKILL, and it also fires on parent SIGINT, SIGTERM, and exit, so an interruptedllmwikinever orphans a Codex process tree.codexis resolved only from absolute PATH entries pointing at regular executable files; when none matches the call fails with an actionable error instead of launching a binary that happens to sit beside the Node runtime.--output-last-messagewith a boundedO_NOFOLLOWread; stdout is drained uncounted; only stderr counts against the 1 MiB cap. Tool calls are validated against the requested tool'sinput_schemawith Ajv (exactly one tool; malformed JSON and schema failures are rejected).codex-agenton argv or in the shell environment skips loading the project.env.maxTokensis documented as not forwarded. An unset model passes no--modeland reports thecodex-cli-defaultsentinel. Embeddings must name an explicit provider; the startup guard refuses an implicit one before Codex is spawned.--provideroption on the seven commands that take a provider, each pinned by a--helptest, with preservation tests for every existing provider.Verification
codex,.envisolation observed at thereadFileSynccall, and interrupt custody for SIGINT, repeated SIGINT, and SIGTERM.codexis absent (ENOENT). Every argv flag was checked againstcodex exec --helpof codex-cli 0.152.1.Known limits
codex --versioncheck.