codex debug trace-reduce fails when request history adds internal metadata to a prior tool_search_call

Open 💬 1 comment Opened Jun 30, 2026 by anton-kalshi

What version of Codex CLI is running?

Running codex app-server and codex debug trace-reduce on the trace.

Occurred on servers running both codex-cli 0.143.0-alpha.21 and codex-cli 0.143.0-alpha.31

What subscription do you have?

Pay-as-you-go API key

Which model were you using?

Observed on trace output of gpt-5.5

What terminal emulator and version are you using (if applicable)?

Not terminal-dependent. Repro is a noninteractive codex debug trace-reduce command.

What platform is your computer?

Original trace producer:

  • AWS
  • m6i.4xlarge, x86_64
  • Ubuntu 22.04 LTS / Jammy
  • AMI: ami-04680790a315cd58d
  • AMI name: ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20260218

Explanation

codex debug trace-reduce fails on a rollout trace produced by codex --strict-config app-server

The app-server produced trace contains this shape. First, an inference response records a completed tool_search_call:

{
  "response_id": "resp_example",
  "output_items": [
    {
      "type": "tool_search_call",
      "status": "completed",
      "call_id": "call_example",
      "arguments": {
        "query": "spawn subagent launch manage agents report result",
        "limit": 10
      },
      "execution": "client"
    }
  ]
}

Then the next inference request replays the same logical call in its input array, but with internal metadata attached:

{
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "start"
        }
      ]
    },
    {
      "type": "tool_search_call",
      "status": "completed",
      "call_id": "call_example",
      "arguments": {
        "query": "spawn subagent launch manage agents report result",
        "limit": 10
      },
      "execution": "client",
      "internal_chat_message_metadata_passthrough": {
        "turn_id": "turn_example"
      }
    }
  ]
}

Problematic difference:

 {
   "type": "tool_search_call",
   "status": "completed",
   "call_id": "call_example",
   "arguments": {
     "query": "spawn subagent launch manage agents report result",
     "limit": 10
   },
-  "execution": "client"
+  "execution": "client",
+  "internal_chat_message_metadata_passthrough": {
+    "turn_id": "turn_example"
+  }
 }

The original production trace had real generated IDs; this report uses call_example, resp_example, and turn_example in the sanitized repro.

Reducer output:

$ npx -y @openai/codex@0.143.0-alpha.31 debug trace-reduce \
    -o /tmp/codex-trace-reducer-repro-min/state.json \
    /tmp/codex-trace-reducer-repro-min

Error: model-visible call id call_example was reused with different content

Why it appears to fail:

  1. The same logical tool_search_call appears once in a response and later in a request.
  2. The call_id, arguments, status, and execution are the same.
  3. The later request-side copy has extra internal metadata.
  4. The reducer appears to compare the full JSON body for tool_search_call.
  5. That makes internal_chat_message_metadata_passthrough part of equality.
  6. The reducer then sees the same model-visible call_id with different content and aborts.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗