Skip to content

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

Open

Description

@t6106118-cell

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.

Activity

  1. added
    CLIIssues related to the Codex CLI
    configIssues involving config.toml, config keys, config merging, or config updates
    tool-callsIssues related to tool calling
    on Jul 16, 2026
  2. github-actions commented on Jul 16, 2026

    @github-actions
    Contributor
  3. bbingz commented on Jul 25, 2026

    @bbingz

    Analysis (community)

    Residual analysis for #33669 (model_info.tool_mode silently overrides enabled Code Mode flags) under docs/contributing.md — invitation-only. No unsolicited PR.

    Root-cause hypothesis

    When model catalog/API metadata sets tool_mode to a concrete value (including direct), that field wins over features.code_mode / features.code_mode_only, and the path that would warn about a Code Mode / model mismatch is short-circuited whenever tool_mode is Some(...) — so the tool surface changes without a user-visible degradation notice.

    Verified at HEAD 4c43465133 (/tmp/codex):

    1. Absolute precedence — effective_tool_mode.
    codex-rs/core/src/tools/mod.rs (effective_tool_mode):

    turn_context.model_info.tool_mode.unwrap_or_else(|| {
      if CodeModeOnly feature → CodeModeOnly
      else if CodeMode feature → CodeMode
      else → Direct
    })

    If model_info.tool_mode is Some, feature flags are never consulted. Spec registration that gates Code Mode tools on effective_tool_mode matching CodeMode|CodeModeOnly (e.g. tools/spec_plan.rs call sites) therefore omits the Code Mode tool surface under Direct even when the user enabled the features.

    2. Warning gap — silent when override is present.
    codex-rs/core/src/session/code_mode_warning.rs unsupported_code_mode_warning:

    • Returns None when model_info.tool_mode.is_some() (alongside the “features off” and “fallback metadata” cases).
    • The warning text only fires when features enable Code Mode and tool_mode is None (model “does not advertise” Code Mode).

    So an explicit catalog/API tool_mode: "direct" both overrides features and suppresses the warning path that was meant for degraded Code Mode setups. That matches the “silent override” framing of this issue more tightly than a pure missing-feature claim.

    3. Catalog reality at HEAD (not a total wipe of Code Mode).
    In models-manager catalog data, several gpt-5.6-* rows set "tool_mode": "code_mode_only"; many others leave the field null so features apply. The residual is still real for: (a) any model/API payload with tool_mode: direct, (b) future catalog rows, (c) custom model metadata — i.e. the precedence + warning design, not “every default model is broken.”

    4. Distinct from related posts.

    Ranked fix outline (all OSS):

    1. Warn when features enable Code Mode but effective_tool_mode is Direct (or non-CodeMode), even if tool_mode is Some — invert the current “is_some → silent” rule for the degradation case.
    2. Document precedence in config / Code Mode docs: model_info.tool_mode beats features.code_mode*.
    3. Optional config escape hatch (e.g. features.code_mode_overrides_model_tool_mode) for power users who intentionally want features to win.
    4. One-shot session log at info: effective_tool_mode=… source=model_catalog|features.

    Fail-first tests I’d want: (1) features CodeMode + tool_mode=Some(Direct) → warning Some / tools not silently “look like Code Mode”; (2) features off + catalog code_mode_only still selects CodeModeOnly; (3) tool_mode=None + features on still hits the existing “does not advertise” warning.

    Happy to refine the warning wording or tests if maintainers want them. No unsolicited PR from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingconfigIssues involving config.toml, config keys, config merging, or config updatestool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions