`model_info.tool_mode=direct` silently overrides enabled Code Mode flags and changes the model-visible tool surface

Open
#33,669 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
cli, tooling

Research direction

Start by reproducing the behavior in Codex CLI 0.144.5 with code_mode enabled and model_info.tool_mode=direct, then inspect how these settings determine the model-visible tool surface. Done means the interaction between direct mode and enabled Code Mode flags is explicit and matches the intended tool availability, with coverage for the reported configuration.

Written by the indexing model from the issue text.

Description

bug CLI config tool-calls
What version of Codex CLI is running?

codex-cli 0.144.5

What subscription do you have?

plus

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Linux 7.1.3-101.fc43.x86_64 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

No response

Codex doctor report
{
  "schemaVersion": 1,
  "generatedAt": "1784228031s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.144.5",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/root/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/root/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/root/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/root/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/root/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 1
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/root/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/root/.codex",
        "config.toml": "/root/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/root/v3",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, code_mode, code_mode_host, terminal_resize_reflow, standalone_web_search, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, skill_mcp_dependency_install, mentions_v2, steer, default_mode_request_user_input, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, tui_app_server, remote_compaction_v2, workspace_dependencies",
        "feature flag overrides": "code_mode=true, standalone_web_search=true, default_mode_request_user_input=true, fast_mode=false",
        "feature flags enabled": "37",
        "log dir": "/root/.codex/log",
        "mcp servers": "1",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/root/.codex"
      },
      "remediation": null,
      "durationMs": 1
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.55.0",
      "details": {
        "PATH git #1": "/usr/bin/git",
        "PATH git entries": "1",
        "git build options": "git version 2.55.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: disabled; feature: fsmonitor--daemon; gettext: enabled; libcurl: 8.15.0; OpenSSL: OpenSSL 3.5.7 9 Jun 2026; zlib-ng: 2.3.3; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
        "git exec path": "/usr/libexec/git-core",
        "git version": "git version 2.55.0",
        "repo detected": "false",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 156
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/root/.local/bin/codex",
        "current executable": "/root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/bin/codex",
        "install context": "standalone (unix, package /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl, bin /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/bin, resources /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/codex-resources, path /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/codex-path)",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 5
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "1",
        "disabled servers": "0",
        "streamable_http servers": "1"
      },
      "remediation": null,
      "durationMs": 3181
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 175
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv6",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 775
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/bin/codex",
        "install method": "standalone (unix, package /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl, bin /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/bin, resources /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/codex-resources, path /root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/codex-path)",
        "platform": "linux-x86_64",
        "version": "0.144.5"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/root/.codex/packages/standalone/releases/0.144.5-x86_64-unknown-linux-musl/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "Granular(GranularApprovalConfig { sandbox_approval: true, rules: true, skill_approval: true, request_permissions: true, mcp_elicitations: true })",
        "codex-linux-sandbox helper": "/root/.codex/tmp/arg0/codex-arg0au2Fhl/codex-linux-sandbox",
        "execve wrapper helper": "/root/.codex/tmp/arg0/codex-arg0au2Fhl/codex-execve-wrapper",
        "filesystem sandbox": "unrestricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 9
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/root/.codex (dir)",
        "active rollout files": "75 files, 49724377 total bytes, 662991 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/root/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/root/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/root/.codex/log (missing)",
        "memories DB": "/root/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "sqlite home": "/root/.codex (dir)",
        "standalone release cache": "5 entries in /root/.codex/packages/standalone/releases",
        "state DB": "/root/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 6600
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "75",
        "rollout DB active rows": "75",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=75",
        "rollout DB rows": "75",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "cli=47, subagent:thread_spawn=28",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 2902
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "set",
        "LANG": "en_US.UTF-8",
        "VISUAL": "not set",
        "os": "Fedora 43.0.0 [64-bit]",
        "os language": "en-US",
        "os type": "Fedora",
        "os version": "43.0.0"
      },
      "remediation": null,
      "durationMs": 2
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "SSH_CLIENT": "present",
        "SSH_CONNECTION": "present",
        "SSH_TTY": "present",
        "TERM": "xterm-256color",
        "color output": "enabled",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "unknown",
        "terminal size": "187x35"
      },
      "remediation": null,
      "durationMs": 1
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title configured",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "v3",
        "terminal title source": "configured"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.144.5",
        "check for update on startup": "true",
        "last checked at": "2026-07-16T07:24:54.962114936Z",
        "latest version": "0.144.5",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "/root/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 134
    }
  }
}
What issue are you seeing?

Codex exposes only the Direct Mode tool surface even though Code Mode is explicitly enabled in my local configuration.

My relevant ~/.codex/config.toml configuration is:

[features]
code_mode = true
code_mode_host = true
code_mode_only = false

codex features list confirms that code_mode and code_mode_host are enabled.

However, the current sanitized gpt-5.6-sol entry in ~/.codex/models_cache.json contains:

{
  "slug": "gpt-5.6-sol",
  "tool_mode": "direct",
  "multi_agent_version": "v2",
  "use_responses_lite": true,
  "supports_search_tool": true
}

Because model metadata is resolved before the local feature flags, "tool_mode": "direct" wins. The session therefore exposes Direct Mode tools while the Code Mode functions.exec and
functions.wait entrypoints are absent.

There is no warning explaining that model metadata overrode my local configuration, and no diagnostic showing the effective Tool Mode or where it came from.

A separate freshly started Codex process can expose Code Mode, demonstrating that the Code Mode capability is installed and usable while the current session receives a different model-
visible tool surface.



### What steps can reproduce the bug?

```markdown
1. Use Codex CLI `0.144.5` with model `gpt-5.6-sol`.
2. Add the following configuration to `~/.codex/config.toml`:

```toml
[features]
code_mode = true
code_mode_host = true
code_mode_only = false

3. Restart Codex and start a new session.
4. Run codex features list and confirm that Code Mode is enabled.
5. Inspect the sanitized gpt-5.6-sol entry in ~/.codex/models_cache.json and confirm that it contains "tool_mode": "direct".
6. Inspect the tools exposed to the session.

Actual result: only the Direct Mode surface is exposed. The Code Mode functions.exec and functions.wait entrypoints are absent, without any configuration-conflict warning.

The behavior occurs because recognized model metadata overrides the enabled local feature flags.



### What is the expected behavior?

```markdown
An explicit local Tool Mode choice should not be silently overridden by mutable model-catalog or cache metadata.

Codex should either:

1. honor the explicit local selection when the model supports it; or
2. stop before inference and display a clear incompatibility or managed-policy error.

Codex should also display the configured Tool Mode, effective Tool Mode, winning source and catalog provenance. The effective mode should remain stable for the session unless the user
explicitly changes the model or policy.


### Additional information

PR [#25031](https://github.com/openai/codex/pull/25031) deliberately introduced the current behavior where recognized model-catalog `tool_mode` metadata takes precedence over the local Code Mode feature flags.

This explains why `"tool_mode": "direct"` selects Direct Mode even though my local configuration explicitly enables Code Mode. However, PR #25031 does not explain every related failure. Other issues appear to amplify the impact:

- [Issue #33575](https://github.com/openai/codex/issues/33575) reports MCP tools becoming unavailable after the model metadata changed to `tool_mode = "direct"`. Under Direct Mode with Responses Lite, deferred MCP tools may lack a model-reachable `tool_search` path.
- [Issue #33593](https://github.com/openai/codex/issues/33593) reports originator-specific model catalogs sharing and overwriting the same `models_cache.json`. This can make Tool Mode differ between clients or processes using the same installation and account.
- [Issue #29122](https://github.com/openai/codex/issues/29122) reports the inverse behavior: Code Mode was locally disabled but remotely selected model metadata caused it to be exposed in an IDE session.

The current behavior mixes three separate concepts:

1. Whether the local client and user permit Code Mode.
2. Which Tool Mode the user explicitly selected.
3. Which Tool Mode the model metadata supports or prefers.

Please add an explicit local Tool Mode policy such as `auto`, `direct`, `code_mode`, or `code_mode_only`, with documented precedence. Model metadata should not silently replace an explicit user selection. If the requested mode is unsupported or prohibited by managed policy, Codex should stop before inference and display an actionable compatibility error.

Codex should also expose the configured policy, effective Tool Mode, winning source, and catalog provenance through startup/session diagnostics and `codex doctor`. The resolved mode should remain stable for the session unless the user explicitly changes the model or policy.

Separately, model-cache entries should be isolated by the relevant request identity or originator, and deferred tools should never be hidden unless the active transport retains a model-reachable `tool_search` or direct-tool path.
Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.