Codex writing elaborate python scripts to perform web-searches instead of using the web search tool

Resolved 💬 2 comments Opened Sep 14, 2025 by guidedways Closed Nov 10, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.34.0

Which model were you using?

gpt5-medium

What platform is your computer?

macOS

What steps can reproduce the bug?

On a prompt to confirm an API call on the web, instead of using its built-in web-search tool, codex begins writing elaborate python scripts such as these:


• Ran
  └ python3 - << 'PY'
    import urllib.request, ssl
    ssl._create_default_https_context = ssl._create_unverified_context
    for q in [
     'site:developer.apple.com NSToolbar allowsDisplayModeCustomization',
     'NSToolbar allowsDisplayModeCustomization',
     'NSToolbar allowsDisplayModeSelection',
     'NSToolbar displayMode customization property',
    ]:
        print('Query:', q)
        try:
            url='https://duckduckgo.com/html/?q='+urllib.parse.quote(q)
            print(urllib.request.urlopen(url,timeout=15).read().decode('utf-8')[:2000])
        except Exception as e:
            print('ERR',e)
            pass
    PY

What is the expected behavior?

Use built-in search

What do you see instead?

Writing python scripts

Additional information

_No response_

View original on GitHub ↗

2 Comments

DanAIDev · 11 months ago

Happens to me too, all the time actually. Sometimes explicitly telling Codex not to do that helps for some time, but this is not a solution

etraut-openai contributor · 9 months ago

Thanks for the bug report. We've shared the feedback with the team members who are responsible for training our codex models. We're tracking this feedback and similar reports so we can make the model more robust in future iterations.

If you see other model behavior that you'd like to report, please use the recently-added /feedback command in the CLI. That will provide us with additional details including logs and conversation text.