Skip to content

Bot tool limits are not enforced on Codex #33

Open

Description

@anildukkipatty

A bot's allowedTools / disallowedTools are enforced on claude-code (a PreToolUse hook, src/start-claude-code.ts:207-225) and on opencode (presetTools() per message). On Codex they are ignored, and the adapter says so at the start of every turn:

Tool limits are not enforced on Codex. {bot} runs with every tool its sandbox allows.

Now that Codex has a real approval channel (src/codex-app-server.ts), there is an interception point: every command execution and every file change raises an approval request under approvalPolicy: "untrusted", so an off-list tool can be declined before the user ever sees a card.

What to do

Intercept before codexAutoApprove and before any card is raised. If the mapped tool name is off-list, answer decline with the bot's reason and emit something the user can see — a silent decline is indistinguishable from the model changing its mind. Match the claude-code message: "{bot} is only allowed these tools: …".

The limitation has to be documented, not papered over

This is weaker than the claude-code hook, and the issue is not done until that is written down accurately:

  • Enforcement only reaches operations that raise an approval. In yolo the policy is never and nothing is raised, so nothing can be fenced.
  • Codex's tool taxonomy is not Claude's. commandExecution maps to Bash and fileChange to Edit/Write/Delete, but a shell command can do anything — so allowedTools: ["Read"] does not mean what a user would assume. Decide whether the list matches our mapped names or codex's own, and say which in the UI.

Where fencing cannot hold, keep telling the truth: narrow the existing warning to those cases rather than deleting it.

The acceptance test that matters: a bot with allowedTools: ["Read"] whose agent runs cat via a shell command. If the fence doesn't hold there, the UI must not claim it does.

Context: docs/codex-permissions.md.

Activity

  1. added
    enhancement
    on Sep 29, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions