A provider set codex=as-sent (#1758) is meant to get Codex's turn as
Codex sent it, its model name alone swapped. But Codex offers web_search
on every turn, and route() translated any request offering it to a model
that doesn't search by itself (searchedForIt) before passthrough's
as-sent branch was ever reached: the developer messages merged into
instructions, apply_patch sent as a function, web_search left out,
max_output_tokens 500000 added. So as-sent never applied to a real
Codex turn, and maralica's relay, which checks requests are Codex's own,
turned them away.
route() now leaves a Responses request relayed when it goes to an
as-sent provider from Codex (codexAsSent, the same test passthrough's
branch uses, now one helper): its web_search goes to the relay as sent.
A provider at the default is translated and searched for as before.
Not changed: spawnAgentModels still widens spawn_agent's description on
an as-sent turn; filed as #3793 (whether as-sent should skip it too).
Test: TestCodexAsSentWebSearch posts the captured Codex 0.162.0 turn
(testdata/workdir/codex-0.162.0.json: developer messages, web_search;
its spawn_agent tool dropped, #3793) to a fake Responses relay: at the
default the relay gets the translation (no web_search, max_output_tokens);
set as-sent, the body is byte-identical to Codex's but for the model id.
Docs: gateway-routing.md's as-sent paragraph.
Broken by hand: the codexAsSent guard in route() off: the test red
("differs from Codex's at byte 2 of 29291": client_metadata first, the
translation). Restored, green.
Run at this commit (worktree, go1.26.8): go test internal/gateway
(whole package, -timeout 45m) ok (464s, rebased on origin/main 6afbe3f30). gofmt -l clean; go vet
gateway+provider darwin/linux/windows clean; builds as before.
Not run: the full ./... suite (machine load). Not tried: maralica's real
relay, or a real Codex against an as-sent relay.