Skip to content

test(codex): stop two migration tests spawning the real codex CLI - #5

Merged
BenSheridanEdwards merged 1 commit into
mainfrom
fix/plugin-migration-network-leak
Aug 14, 2026
Merged

BenSheridanEdwards merged 1 commit into
mainfrom
fix/plugin-migration-network-leak

Conversation

@BenSheridanEdwards

Copy link
Copy Markdown
Owner

What

Two tests in tests/hermes_cli/test_codex_runtime_plugin_migration.py spawn the real codex CLI on every run, which shells out to git ls-remote https://github.com/openai/plugins.git HEAD — a live network call to a third-party repository, from a unit test.

Why it happens

migrate() already documents the switch:

discover_plugins: when True (default), query plugin/list against the live codex CLI to migrate any installed curated plugins... Set False to skip the subprocess spawn (for tests or restricted environments).

Both tests assert config.toml rendering, not plugin discovery, but neither passes the parameter, so it defaults to True.

Every other test in the file already handles this correctly: the ones that genuinely exercise discovery pass discover_plugins=True and monkeypatch _query_codex_plugins first. These two simply missed the switch.

Why it matters

The tests pass either way, which is why this went unnoticed — the same silent shape as the update-flow leak fixed in eff88d7a8. The costs are real though:

  • the suite fails offline, and depends on a third party's repository staying reachable
  • it is slower for no benefit
  • a unit test spawning a live CLI is a supply-chain surface nobody signed up for

Verification

Measured with a logging git shim that records every invocation, including from grandchild processes:

git calls network call result
before 1 ls-remote https://github.com/openai/plugins.git HEAD 20 passed
after 0 none 20 passed

Run in a throwaway clone with an isolated venv — never in an install or a runtime checkout.

`migrate()` documents `discover_plugins` as "when True (default), query
`plugin/list` against the live codex CLI ... Set False to skip the subprocess
spawn (for tests or restricted environments)".

Two tests never opt out. They assert config.toml RENDERING, not plugin
discovery, but leave the parameter at its default, so each run spawns the real
codex CLI, which shells out to
`git ls-remote https://github.com/openai/plugins.git HEAD` -- a live network
call to a third-party repository from a unit test.

Every other test in the file already gets this right: the ones that pass
`discover_plugins=True` monkeypatch `_query_codex_plugins` first. These two
just missed the switch.

Both tests PASS either way, which is why it went unnoticed -- the same silent
shape as the update-flow leak fixed in eff88d7. A suite that reaches the
network is non-hermetic (fails offline, depends on a third party's repo
staying reachable) and slower for no benefit.

Verified with a logging `git` shim that records every git invocation including
those from grandchild processes:
  before: 1 call -- `ls-remote https://github.com/openai/plugins.git HEAD`
  after:  0 calls
  20 passed in both cases.
@BenSheridanEdwards
BenSheridanEdwards merged commit 3cc99d7 into main Aug 14, 2026
32 of 35 checks passed
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.

1 participant