Skip to content

codex through incode's tools: verify with a real login, then make it the default #19

Closed

Description

@blockmandev

Why

PR #17 added codex_tools: "incode" (or INCODE_CODEX_TOOLS=incode). Codex runs as the model only; its own tools are switched off and every tool call comes back to incode's toolbox over the MCP tool bridge. So permission rules, guards, allowed-tools, hooks and the sandbox apply to codex.

It is off by default because no turn with a real OpenAI model has run. It was only tested with codex 0.163.0 against a local stand-in model endpoint.

Where the code is

  • src/agent/codex.rs:
    • CodexTools, MODEL_ONLY_OVERRIDES (14 -c overrides), bridge_registration;
    • bridged_command (fresh and exec resume), run_bridged, Reading (parses --json output).
  • src/tool_bridge.rs: the bridged turn loop, shared with claude_code.rs.
  • src/admin.rs: codex_tools and resolve_codex_tools.
  • src/cli/mod.rs: codex_backend.
  • Evidence table for every override: docs/ARCHITECTURE.md §5a. Codex silently ignores unknown -c keys, so each one was checked by watching the tool list codex sends to the model.

Steps (local, with codex logged in)

cd /tmp && mkdir codex-try && cd codex-try && git init
INCODE_CODEX_TOOLS=incode incode -t "create hello.txt containing hi" -w . --output-format json
cat hello.txt
# a deny rule must stop it:
mkdir -p .incode && echo '{"permissions":{"deny":["Write(secret.txt)"]}}' > .incode/settings.json
INCODE_CODEX_TOOLS=incode incode -t "write secret.txt with x" -w .
ls secret.txt   # must not exist

Then try the same in the REPL (incode, pick codex) and with a code-mode model (e.g. -m gpt-5.6-terra), where incode's tools are reached through codex's own exec JavaScript tool.

Open points

  • A real turn works: tools appear as mcp__incode__*, edits land, deny rules refuse.
  • codex 0.145 and 0.153: these lack view_image switching and omit_tools_from, so incode's tools sit behind tool_search. Check a turn still finds them.
  • Not covered by --ignore-user-config: a trusted project's .codex/config.toml, which could add MCP servers or tools. Decide whether to refuse or warn when one exists in the workspace.
  • apply_patch stays on offer; sandbox_mode="read-only" rejects it before it runs (seen live). Confirm with a real model that it then uses incode's Edit/Write.
  • Once verified, flip the default to incode: resolve_codex_tools fallback, README, --admin text, and the tests that pin the default.
  • agy can't be bridged (no flag to switch its tools off; MCP only through a persistent agy mcp add). This is documented in src/agent/agy.rs. Revisit if agy adds such flags.

Generated by Claude Code

Activity

  1. blockmandev commented on Nov 13, 2026

    @blockmandev
    MemberAuthor

    Ran the steps with a real login (Windows, codex-cli 0.167.0, ChatGPT login). Not verified yet: the account hit its codex usage limit.

    • Codex was chosen and started: INCODE_AGENT=codex INCODE_CODEX_TOOLS=incode incode -t … put codex first (stream: "agent":"codex","model":"gpt-5.6-terra"). Codex then stopped with "You've hit your usage limit … try again at Nov 17th, 2026 7:19 AM", and incode fell back to Claude Code, as designed. The stream marks this with "fallback_from":"codex", so the run that wrote hello.txt was Claude's, not codex's. The real-turn check has to wait for the limit to reset, or for more credits.
    • The deny step was wrong, and incode hid that. The step wrote {"deny":[...]}, but incode reads rules only under "permissions". The top-level deny was dropped without a word, and the Write ran: secret.txt was written. The step above is corrected to {"permissions":{"deny":["Write(secret.txt)"]}}. The silent drop is a security bug in its own right. It's fixed in the next PR: a project settings file incode can't use now refuses every tool call and says why. That was measured live: the same file now gets NOT RUN — Write is refused by the deny rule …: .incode/settings.json has \deny` at the top level …, and no secret.txt`.
    • Left for after Nov 17: a real codex turn (tools as mcp__incode__*, edits land, the corrected deny rule refuses), the 0.145/0.153 tool_search check, the .codex/config.toml decision, the apply_patch check, then flipping the default.
  2. blockmandev commented on Nov 13, 2026

    @blockmandev
    MemberAuthor

    Verified with a real login, on codex 0.145.0, 0.153.4 and 0.167.0. Real turns run on incode's tools: edits land, and a deny rule refuses. One problem was found and fixed: codex told the model its sandbox was read-only, and the model sometimes refused to write at all. Details and the per-version table are in the PR that closes this issue. The default was already incode. A repository's .codex/config.toml is not applied on this route (measured).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions