bug: tool_calls must be followed by tool messages error when creating prefix approval rules

Open 💬 3 comments Opened May 29, 2026 by hmx7

Bug: ool_calls must be followed by ool messages error when approving prefix rules

Environment

  • Application: Codex Desktop (Windows)
  • Version: v0.135.0

Steps to Reproduce

  1. Trigger a command requiring escalated permissions (write file, install package)
  2. Click Yes, and don't ask again for commands that start with...
  3. Error appears:
{"error":{"message":"An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'."}}

Expected

Prefix rule saved, command executes normally.

Actual

API call fails. The approval flow breaks the required assistant(tool_calls) -> tool message pairing.

Root Cause

When the approval UI modifies internal message history, it violates the OpenAI API invariant that every assistant message with tool_calls must be immediately followed by corresponding tool messages.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗