feat(installer): support project-local Codex installs (#1531) (#1551)

Codex CLI has a first-class project config layer — `.codex/config.toml`
is layer 4 of the loader stack, above the user config at layer 6
(`codex-rs/config/src/loader/README.md` in openai/codex), and it landed
in openai/codex#8354 on 2025-12-22. The CodexTarget's "Codex has no
project-local config concept" note was therefore never accurate, and
`supportsLocation('local') === false` made Codex the one agent that
forces a machine-wide MCP install.

`mcp_servers` is not on the project layer's denylist (which strips base
URLs, model providers, `notify`, profiles and otel — settings repo
contents shouldn't choose), so a project-scoped `[mcp_servers.codegraph]`
is honored.

- Path helpers take a `Location`: global keeps `~/.codex/config.toml` +
  `~/.codex/AGENTS.md`; local writes `<cwd>/.codex/config.toml` and the
  project-root `<cwd>/AGENTS.md` — the same split the gemini and
  opencode targets already use for their local layout.
- Drops the five `loc !== 'global'` early returns from detect, install,
  uninstall, printConfig and describePaths.
- Local install returns a note that Codex only applies a project layer
  in a project marked trusted; untrusted projects load the layer but
  leave it disabled, so a silent success would be misleading.
- Refreshes the two doc comments that used Codex as the example of a
  global-only target (now the Copilot CLI).

Tests: two new cases covering the local write layout, the trust note,
global config staying untouched, and local uninstall leaving the global
entry intact. Both fail against the previous implementation. The generic
per-target contract suite now also exercises codex at location=local.
This commit is contained in:
Max Hsu
2026-08-22 11:55:10 -05:00
committed by GitHub
parent 474f051d3c
commit bc894802ff
5 changed files with 111 additions and 53 deletions
+3 -3
View File
@@ -137,7 +137,7 @@ export async function runInstallerWithOptions(opts: RunInstallerOptions): Promis
} else if (useDefaults) {
location = 'global';
} else {
// If every selected target is global-only (e.g. Codex), skip the
// If every selected target is global-only (e.g. the Copilot CLI), skip the
// prompt and force user-wide — project-local would just produce
// skip warnings.
const allGlobalOnly = targets.every((t) => !t.supportsLocation('local'));
@@ -328,8 +328,8 @@ export type UninstallStatus = 'removed' | 'not-configured' | 'unsupported';
* Per-target outcome of an uninstall sweep. `removed` means we deleted
* at least one thing; `not-configured` means the agent had no codegraph
* config at this location (nothing to do); `unsupported` means the
* agent has no config concept for this location (e.g. Codex is
* global-only, so a `local` uninstall skips it).
* agent has no config concept for this location (e.g. the Copilot CLI
* is global-only, so a `local` uninstall skips it).
*/
export interface UninstallReport {
id: TargetId;