OpenAI Codex CLI
The first thing to know about OpenAI’s Codex CLI is that it has no local fetch tool at all. It reaches the web in only two ways, through a search tool that runs inside OpenAI’s cloud and through shell commands such as curl that run on the developer’s machine inside a sandbox whose network access is off by default verified in code. With default settings, the hosted search reads an OpenAI-maintained index instead of your live site, which means you usually see nothing in your logs when a Codex user looks something up. In our Dec 2026 lab run, Codex 0.172.0 failed to read a freshly published page in both the default and live search modes, and our origin received zero requests, so the only successful read came from curl after we turned on sandbox network access measured in our lab.
At a glance
Section titled “At a glance”| Codex CLI 0.172.0 | |
|---|---|
| Fetch tool | None. Page opens happen inside the hosted search tool (open_page) or through shell curl verified in code |
| Search tool | Hosted Responses API web_search (default); experimental standalone web.run behind a feature flag verified in code |
| Who issues the request | OpenAI’s servers for search; the developer’s machine for shell commands |
| User-Agent | Hosted tool: undocumented. Shell: whatever the command sends, for example curl/8.7.1 measured in our lab |
| Accept header | Shell curl: */* measured in our lab. Hosted tool: unknown |
| JS rendering | None on the shell path; unknown for the hosted tool |
| Content conversion | Server-side; the client only sees model output with url_citation annotations documented |
| Size and truncation | Standalone tool description caps verbatim quotes at 25 words and defaults to 200 words per source verified in code |
| Caching | Default mode cached reads an OpenAI index with no external access documented |
| robots.txt | No check in the CLI; hosted behaviour undocumented. No robots.txt request seen in our lab |
| Permission model | web_search mode (disabled, cached, indexed, live) plus sandbox network_access, network proxy allowlist and approvals |
How fetching works
Section titled “How fetching works”Codex has three distinct network paths, and only one of them starts on the developer’s machine. If you grep the Codex source at commit ba4148fa for web_fetch, fetch_url and WebFetch, you’ll find only search UI and event plumbing, so there’s no local tool that downloads a URL and converts it to markdown the way Claude Code or OpenCode do verified in code.
- Codex CLI → Responses API
tool spec - Responses API → Search index
read index - Responses API → Live open_page
live/indexed only - Live open_page → docs.example.com
not seen in lab - Codex CLI → Shell tool
shell command - Shell tool → docs.example.com
GET if network on
The hosted path is a tool spec that Codex sends to the Responses API as {"type":"web_search", external_web_access, indexed_web_access, filters, user_location, search_context_size, ...}, defined in tools/src/tool_spec.rs verified in code. The web_search config key maps onto that spec in core/src/tools/hosted_spec.rs: cached sends external_web_access:false, indexed sends external_web_access:true with indexed_web_access:true, live sends external_web_access:true, and disabled leaves the tool out. The enum defaults to Cached verified in code, and OpenAI’s Codex web search docs describe cached as “an OpenAI-maintained index without external web access” documented.
Two conditions upgrade the mode. If the permission profile is full access (--yolo or danger-full-access), a cached or live preference gets promoted to live, and the docs agree verified in code documented. Indexed mode, which a third-party writeup says was added in v0.142.0, permits live fetches only for URLs the search index already approves, so a page OpenAI has never indexed stays unreachable in that mode too.
The hosted model emits web_search_call items whose action is search, open_page or find_in_page, and results come back as Responses output with url_citation annotations, which means the Codex client never sees raw HTTP from your server verified in code. OpenAI’s web search tool guide notes that open_page and find_in_page only appear on reasoning models documented.
Codex CLI: our lab prompt in default mode
- Codex CLI→OpenAI model
prompt + web_search (cached) - OpenAI model→OpenAI index
search "site" "codex-default"model wrote a quoted query
- OpenAI index→OpenAI model
no matching document - OpenAI model→Codex CLI
cannot find the phrase - Codex CLI→Your site
(no request sent)origin log stays empty
The shell path depends on the sandbox. Codex’s SandboxPolicy variants are DangerFullAccess, ReadOnly, WorkspaceWrite and ExternalSandbox, and network_access defaults to false for both read-only and workspace-write (protocol/src/protocol.rs) verified in code. On macOS the Seatbelt profile adds outbound network rules only when network access is enabled, and on Linux bubblewrap runs with --unshare-net plus seccomp filters. The model is told the current state in its developer prompt, which ends with “Network access is {{ network_access }}” verified in code.
When network access is on, Codex can route shell traffic through its network-proxy crate, which enforces a domain allowlist under permissions.<profile>.network.domains with deny taking precedence, a limited mode that blocks non-GET methods, and approval prompts for hosts that aren’t on the list verified in code documented. Codex doesn’t rewrite the User-Agent of subprocesses, and in our lab the shell path arrived as curl/8.7.1 with Accept: */* from the developer’s own residential IP, which Netlify classified as tooling; custom-code measured in our lab.
How searching works
Section titled “How searching works”The default hosted web_search prompt lives on OpenAI’s servers, so you can’t see it in the repo. The experimental standalone web.run tool, however, ships its description in ext/web-search/web_run_description.md, and a comment in the extension says it matches the hosted tool definition, which makes it the best available view of how OpenAI steers query formation verified in code inferred. web.run posts to the provider’s alpha/search endpoint and is only enabled when features.standalone_web_search is on (default off, marked UnderDevelopment) or the model uses use_responses_lite.
search_query must have length at most 4 in each call. If it has length > 3,response_length must be medium or long...PAY CLOSE ATTENTION: you MUST browse the internet in these cases. If you'reunsure or on the fence, you MUST bias towards browsing the internet.The same description lists triggers that apply directly to developer documentation, including information that “could have changed recently” such as “software libraries that could be updated”, requests for “direct quotes, links, or precise source attribution”, and cases where “a specific page … is referenced and you haven’t been given its contents” verified in code. Its citation rules tell the model to “Prefer primary and authoritative sources” from different domains, and its quote limits cap verbatim text at 25 words per source with a default budget of 200 words. In practice, that means Codex rewards pages whose key facts can be quoted in one short sentence.
web.run also exposes commands beyond search: search_query, image_query, open (by reference id or URL), click, find, screenshot for PDFs, and data commands such as finance and weather (codex-api/src/search.rs) verified in code. All of them run in OpenAI’s backend.
In our lab, the query Codex wrote was "codingagentseo.netlify.app" "codex-default", which is a quoted hostname plus the unique token from the URL path measured in our lab. In other words, the model treated a direct URL as a search problem instead of a fetch, which is consistent with having no fetch tool.
Other paths to your content
Section titled “Other paths to your content”Shell commands are the main alternative. Package managers, git clone and curl reach your registry pages, repositories and docs only when the sandbox permits network access or the user approves an escalation, and they arrive from the developer’s IP with whatever User-Agent each tool sends by default inferred. Codex’s own API traffic carries originator: codex_cli_rs and a codex_cli_rs/<ver> User-Agent, but that traffic only goes to OpenAI and never to target sites verified in code.
It’s worth knowing that the hosted search sits outside the sandbox entirely. OpenAI’s docs state that web search “doesn’t use the permission profile’s network proxy or allowlist” and that permissions.<n>.network.domains “doesn’t restrict web search, apps, or MCP servers”, and the only domain control for search is tools.web_search.allowed_domains documented. MCP servers the user configures are one more path, and their traffic depends entirely on the server; see documentation MCP servers.
Codex cloud: internet access and the “Common dependencies” allowlist
Codex cloud environments (labelled “Codex Cloud (Legacy)” in OpenAI’s internet access docs) run setup scripts with internet, but the agent phase has internet off by default documented. When a user turns it on, they pick an allowlist preset of None, Common dependencies or All, can add domains, and can restrict HTTP methods (the docs recommend GET, HEAD, OPTIONS). The Common dependencies preset looks like this:
alpinelinux.org anaconda.com apache.org apt.llvm.org archlinux.org azure.com bitbucket.org bower.iocentos.org cocoapods.org continuum.io cpan.org crates.io debian.org docker.com docker.io dot.netdotnet.microsoft.com eclipse.org fedoraproject.org gcr.io ghcr.io github.com githubusercontent.comgitlab.com golang.org google.com goproxy.io gradle.org hashicorp.com haskell.org hex.pm java.comjava.net jcenter.bintray.com json-schema.org json.schemastore.org k8s.io launchpad.net maven.orgmcr.microsoft.com metacpan.org microsoft.com nodejs.org npmjs.com npmjs.org nuget.org oracle.compackagecloud.io packages.microsoft.com packagist.org pkg.go.dev ppa.launchpad.net pub.dev pypa.iopypi.org pypi.python.org pythonhosted.org quay.io ruby-lang.org rubyforge.org rubygems.orgrubyonrails.org rustup.rs rvm.io sourceforge.net spring.io swift.org ubuntu.com visualstudio.comyarnpkg.comA cloud agent with this preset can reach package registries, GitHub and google.com, but not a vendor’s own docs domain unless the user adds it, so content published to READMEs and registry pages is the reliable route in locked-down environments inferred. See registries and GitHub.
What shows up in your logs
Section titled “What shows up in your logs”OpenAI’s bots page lists OAI-SearchBot, OAI-AdsBot, GPTBot and ChatGPT-User, and Codex isn’t mentioned anywhere on it documented. The full cross-agent list lives on User-Agents and log signatures.
| Codex path | Signature at your origin | Evidence |
|---|---|---|
Hosted search, cached (default) | Nothing at query time. Earlier crawls by OAI-SearchBot (...; compatible; OAI-SearchBot/1.4; +https://openai.com/searchbot) may be what populated the index | measured in our lab for the empty log; inferred for the SearchBot link |
Hosted search, live | Nothing observed in our lab for a new page. If a live open_page does occur, the UA is undocumented; ChatGPT-User or OAI-SearchBot are the plausible candidates | measured in our lab; inferred |
Hosted search, indexed | Fetch only for URLs the index approves; nothing for unindexed pages | documented |
Shell curl with network on | curl/8.7.1, Accept: */*, developer’s IP, Netlify tooling; custom-code | measured in our lab |
| Shell with default sandbox | Nothing; the request fails inside the sandbox | verified in code |
| Codex’s own API calls | codex_cli_rs/<ver>, sent to OpenAI only | verified in code |
What this means for discoverability
Section titled “What this means for discoverability”For Codex, being crawlable by OpenAI’s search crawler matters more than anything you serve to the agent at request time, because the default mode never contacts your origin. That’s why I’d expect blocking OAI-SearchBot in robots.txt to remove your docs from what Codex users can retrieve, even though Codex itself never reads robots.txt inferred.
New pages are effectively invisible to Codex until OpenAI indexes them. Our lab page was minutes old, and neither cached nor live mode could read it, which means launch-day docs, changelogs and migration guides need time to show up, while the same content mirrored to GitHub or a package registry is likely to be indexed sooner measured in our lab inferred.
The standalone tool’s prompt rewards pages that state facts in short, quotable sentences from a primary source, because the model is limited to 25 verbatim words per source and is told to prefer authoritative domains. In practice, a version table or a one-line install command near the top of a page fits that budget better than prose spread across several screens.
Content negotiation, llms.txt and markdown variants have no observable effect on Codex today, since no Codex code path fetches your page directly with an Accept header of its choosing. They still matter for agents that do, such as Claude Code and Gemini CLI, and you can compare agents on the matrix.
Tests to run against this agent
Section titled “Tests to run against this agent”These map onto the shared test catalog, and the methodology page explains how we run them.
- Default index read. Setup: a page with a unique token, full header logging. Prompt:
codex exec "Fetch <url> and tell me the verification phrase". Expected signal: zero hits at query time, and you should record the search query the model writes (our run matched this). - Live mode. Setup: the same page, run with
-c web_search=live(or--search). Expected signal per OpenAI’s docs: a hit from OpenAI IP ranges; compare its UA withchatgpt-user.jsonandsearchbot.json. Our run saw no hit, so repeat after the page has existed for a week. - Indexed mode on an indexed versus unindexed URL. Run
-c web_search=indexedtwice. Expected signal: a refusal or empty result for the unindexed page and a fetch or index read for the indexed one. - Sandbox network toggle. Prompt “curl my URL” with
sandbox_workspace_write.network_access=false, thentrue. Expected signal: no hit, then acurl/x.yhit from the developer’s IP. Our run confirmed the second half. - robots.txt split. Disallow ChatGPT-User and OAI-SearchBot separately and repeat test 2 to see which token governs the live fetch.
- Tool JSON capture. Point
OPENAI_BASE_URLat mitmproxy or a mock Responses server and confirm theexternal_web_accessvalue sent per mode.
Open questions
Section titled “Open questions”- The User-Agent and IP range of a hosted
open_pagefetch are undocumented, and our lab could not trigger one. - Whether OpenAI’s search index is built only by OAI-SearchBot or also from licensed or third-party data is not stated.
- Whether the hosted
web_searchprompt matches the standaloneweb.rundescription in full is inferred from a code comment, not confirmed. - Whether robots.txt rules apply to any live fetch Codex triggers is unknown; OpenAI says robots.txt “may not apply” to ChatGPT-User.
Further reading
Section titled “Further reading”- OpenAI: crawler and user-agent reference
- OpenAI: web search tool guide
- Codex docs: web search modes
- Codex config reference
- Firecrawl: Codex Web Search vs Firecrawl, is Codex stale by default?
- Daniel Vaughan: Codex CLI indexed web search mode
- Cymulate: Codex CLI prompt-injection RCE and mitigations
- Source:
ext/web-searchin openai/codex
Last reviewed 2026-12-02 against Codex CLI 0.172.0. This site is re-reviewed monthly; see maintenance.