Codex bottles get zero egress: duplicate *_PROXY env drops the identity token #441
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Every Codex bottle is denied all egress. Claude bottles on the same host, same gateway, same manifests, work fine. Codex fails on its model calls, its
wss://chatgpt.com/backend-api/codex/responsesreconnects, and its MCP servers:The registry row is correct — right slug, right source IP, seconds old. That is what made this look like a registration bug for so long.
Root cause
container exec --envdoes not override the run-time environment on Apple Container — it appends.launch._agent_env_entriesbaked a token-less*_PROXYintocontainer run, and_identity_proxy_envapplied the token-bearing value at exec, on the assumption that exec wins.The agent's
environtherefore holds two entries, token-less first:Verified directly in
/proc/<pid>/environfor both a Claude and a Codex agent — both have the duplicate. The difference is only in how each runtime resolves it:std::env::var(Codex) reads the first -> no token ->/resolvefail-closes on the (source_ip, identity_token) pair -> every host denied.Three comments asserted the false invariant (
launch.py:269,bottle.py:71-73), which is why it survived review: it was true in practice for the only agent anyone tested.Fix
PR #442 drops the run-time proxy vars entirely, making the exec-time env the single source. A token-less proxy URL has no legitimate consumer — the init process is
sleepand everything that egresses arrives via exec. A process that egresses before the exec-time env still fails closed, since the agent network is host-only.Related