Repository navigation
feat(agents): let codex and opencode agents select built-in tools - #465
Merged
Merged
Conversation
OpenCodeConfig takes builtin_tools, as claude-code's does (#437), and turns it into the config's permission: a denied tool is left out of the model's tool list. disable "*" and only keep the tools of agent-env's MCP servers, which a "*" deny would also remove. The names are opencode-ai 1.17.18's permission names. Without a selection the config and argv are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodexConfig takes builtin_tools and turns it into -c overrides on the turn's CLI. disable "*" also turns off the multi_agent_v2 collaboration tools. The MCP tools agent-env gives the agent stay. Tools that one setting switches together must be named together. apply_patch is left out: codex 0.147.0 has no setting that turns it off. Without a selection the overrides are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ool selection
With {"disable": "*"} or {"only": [...]}, the permission's "*": "deny" also
denied external_directory, so a kept read or edit could no longer reach a
path outside the workspace, and doom_loop. Both stay allowed, as they are
without a selection. A new agent-level test checks that the agent passes
the stored selection to each turn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… selection drops it No codex 0.147.0 setting removes apply_patch: the model catalog offers it to every bundled GPT model through apply_patch_tool_type. When a builtin_tools selection drops it (disable "*", a disable list naming it, or an only list without it), the agent now writes a copy of the catalog the CLI would use, from `codex debug models --bundled` or the file config.toml's model_catalog_json names, with apply_patch_tool_type null for every model, under CODEX_HOME, and points the turn's CLI at it with -c model_catalog_json. apply_patch joins CodexTool. With no selection, or one that keeps apply_patch, the overrides and config.toml are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aidan-sims
marked this pull request as ready for review
November 3, 2026 16:08
…t on cancel The catalog read now counts against timeout_seconds, run_codex gets what is left, and a timed-out or cancelled read kills its `codex debug models` child. Names the stderr tail limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner: Aidan Sims
The codex and opencode agents had no way to turn off their CLI's own tools, so a task that needs strict no-tools (FDE-2584) still offered shell, edit and similar tools to the model. Both agents now accept a
builtin_toolsselection ({"disable": "*" | [...]}or{"only": [...]}) in their agent config, as claude_code already does. With no selection, the config and argv stay exactly as before.permissionconfig.disable: "*"andonlydeny"*"but still allow agent-env's MCP tools (<server>_*) and the CLI's two non-tool checks (external_directory,doom_loop). Without them, MCP tools disappear and kept file tools refuse paths outside the workspace.-coverrides added after the role overrides (for examplefeatures.shell_tool=false). Codex turns some tools on and off together, so a list must name a whole group (for exampleexec_commandwithwrite_stdin), otherwise it is rejected.apply_patch: no setting turns it off; each GPT model's catalog entry offers it. When a selection drops it, the agent writes a copy of the CLI's own catalog (codex debug models --bundled, or themodel_catalog_jsonconfig.toml names) withapply_patch_tool_type: nulland passes it with-c model_catalog_json=.... The copy is made from the installed CLI, so it follows the pinned version. If the catalog can't be read, the turn fails instead of keeping the tool.deploy_agentaccepts a selection.Validation:
pytest tst/unit/agents/opencode tst/unit/agents/codex tst/unit/task_step/test_verify_a2a_builtin_tools.py tst/unit/agents/claude_codegives 592 passed and 39 skipped, and the new tests fail on main.ruff checkis clean on the touched files.ruff format --checkfails on them, and the files weren't reformatted. With the pinned CLIs (opencode-ai 1.17.18, codex 0.147.0) and a local fake model, opencode underdisable: "*"offers only the MCP tool, and codex on gpt-5.4 offers no tools (only its MCP tools when an MCP server is configured).Not in this PR:
{"*": "deny"}. This PR adds the allows above so agent-env's MCP tools stay available.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge, with no new actionable findings.Summary
Adds
builtin_toolsselections to the Codex and OpenCode agents while preserving their default behavior and MCP tools.There are no changes since the previous reviewed revision. No new actionable issues were found.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Agent config: builtin_tools"] --> B{"Agent"} B -->|OpenCode| C["Build permission rules"] C --> D["Run OpenCode with MCP tools preserved"] B -->|Codex| E["Build tool settings"] E --> F{"Remove apply_patch?"} F -->|Yes| G["Copy catalog with apply_patch disabled"] F -->|No| H["Run Codex"] G --> HReviews (3) · Last reviewed commit: "ci: retrigger Integration Tests" · Reviewed by Greptile