Repository navigation
Description
Description
On environment.type: none, the Codex engine installs MCP servers with codex mcp add (codex.go#L149), which writes to the user's global ~/.codex/config.toml. Before adding, it runs codex mcp remove for the same name (codex.go#L146), so a user's own server with that name, say a real github server, is replaced by the mock. Nothing removes the entry after the run, so every later Codex session on that machine, outside skill-up too, starts the mocked server. Claude Code installs with --scope project, so this only affects Codex.
Steps to reproduce
- Copy
~/.codex/config.tomlaside. - Run any Codex case with a mocked server on
environment.type: none. Mine:
# SKILL.md body: call get_order on the shop MCP server and report the status it returns.
# evals/fixtures/mcp/shop.yaml
tool_responses:
get_order:
default:
order_id: "{{params.order_id}}"
status: SHIPPED-7F3Q
# evals/cases/lookup.yaml
id: lookup
input:
prompt: What is the status of order 42? Use the shop tools.
judge:
type: rule_based
success:
- tool_called:
name: mcp__shop__get_order
- output_contains:
all: ["SHIPPED-7F3Q"]
# evals/eval.yaml
schema_version: v1alpha1
environment:
type: none
skills:
- source: local_path
path: .
mcp:
servers:
- name: shop
mode: mocked
config_ref: evals/fixtures/mcp/shop.yaml
engine:
name: codex
model: {}
cases:
files: [evals/cases/lookup.yaml]- Diff the config against the copy.
Expected behavior
The user's Codex config is unchanged after the run, or skill-up uses a Codex home of its own.
Actual behavior
- A new
[mcp_servers.shop]table holds the whole generated Node script (136 added lines) and stays after the run. - Codex rewrites the file while adding it. Empty
http_headers = {}tables and an emptyargs = []disappear from unrelated servers, and a trust entry for the temporary workspace is added under[projects]. - The eval session also loads every MCP server and the global instructions from the user's own Codex setup, so results depend on the machine.
Environment
- skill-up
0.14.0-14-g99894b3(main, built from source) - Codex CLI
0.166.0, preinstalled and logged in, account default model (gpt-6-astrain every run) (skill-up's default pin is0.80.0, codex.go#L35) - Go 1.26.0, macOS arm64,
environment.type: none
Additional context
Setting environment.env.CODEX_HOME to a separate folder keeps the global file untouched, but the session lookup hard-codes $HOME/.codex/sessions (codex.go#L1130), so it then misses the session file. A CODEX_HOME per case runtime, used by both install and lookup, with the user's auth.json copied in, would isolate local runs. Per case rather than per run, since two cases can mock the same server name with different fixtures.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
karanb192 commentedon Nov 1, 2026
A proposal for the fix, before I write it. Your view on the open questions would help.
Idea: stop running
codex mcp add. Define each MCP server skill-up installs on thecodex execcommand itself, with-c mcp_servers.<name>.command=...,-c mcp_servers.<name>.args=[...], and the same flags oncodex exec resume.What I checked with Codex CLI 0.166.0:
-coverrides starts, and its tool calls work. Nothing is written toconfig.toml.-c mcp_servers.<name>.default_tools_approval_mode="approve"lets the call through under--sandbox workspace-write(bug(codex): local runs reject MCP tool calls with "approval policy is never" #358, PR fix(codex): approve installed MCP servers under the local sandbox #362).RawMcpServerConfigalready readscommand,argsandenv_vars(from the source; I did not run 0.80.0).What it would fix:
--env KEY="$KEY"writes the value intoconfig.toml. Withenv_vars = ["KEY"]Codex passes the variable from its own environment to the server, so the value never lands on disk. The variables would need to be set on thecodex execenvironment. One limit: two servers that need different values under the same variable name cannot both get them from one process environment, while today each server is installed with its own values.Open questions:
-cserver merges with a same-named server already in the user's config. Over a stdio server, the command and args are replaced but fields such asenvcarry over. Over a URL server, Codex fails to load its config. Today skill-up removes the user's server instead. I'd fail fast with a clear message when the name exists (codex mcp get <name>). Falling back to remove and add would bring back the global writes and the cross-case overwrites.-c mcp_servers.<name>.env={...}, which puts them on the command line where other local processes can read them. Which do you prefer?environment.env.CODEX_HOMEavoids that today; PR fix(codex): look up session files under CODEX_HOME #364 makes the session lookup follow it. A built-in per-caseCODEX_HOMEwould need a local login copied in (API-key credentials already come through the environment), so I'd leave that out.If this direction works for you, I'll send it as one PR for the Codex engine.
fix(codex): look up session files under CODEX_HOME
fix(codex): look up session files under CODEX_HOME (alibaba#364)
fix(codex): define mocked MCP servers on the codex exec command (alib…
zpzjzj commentedon Nov 27, 2026
Fixed in #398. Both
codex execandcodex exec resumenow receive mocked MCP server definitions as command-line overrides. This keeps the definitions scoped to the case and leaves the user's globalconfig.tomluntouched by mock registration. Thanks for the report and the proposed fix. Closing as completed.