multi_agent_v2: fork_turns="all" sends msg_* items without their required reasoning items

Open 💬 1 comment Opened Jul 15, 2026 by WAcry

What version of Codex CLI is running?

0.145.0-alpha.4

What subscription do you have?

Azure Responses (store=true) Enterprise / API

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Linux 6.8.0-1055-aws x86_64 x86_64

What issue are you seeing?

When using an Azure-classified Responses API provider, a subagent spawned with
fork_turns="all" can receive invalid inherited history and fail before producing
any response.

The parent history originally contains Responses items similar to:

[
  {
    "type": "reasoning",
    "id": "rs_<redacted>"
  },
  {
    "type": "message",
    "role": "assistant",
    "id": "msg_<redacted>",
    "phase": "final_answer",
    "content": [
      {
        "type": "output_text",
        "text": "<redacted>"
      }
    ]
  }
]

When Codex constructs the forked child history, it retains the assistant
final_answer message but removes the reasoning item. The resulting child request
contains the referenced msg_* item without its required rs_* item.

Azure rejects the request with:

Item 'msg_<redacted>' of type 'message' was provided without its required
'reasoning' item: 'rs_<redacted>'.

What steps can reproduce the bug?

  1. Configure a custom Responses provider that Codex recognizes as Azure:

``toml
[model_providers.azure-responses]
name = "Azure"
base_url = "<redacted Azure Responses endpoint>"
wire_api = "responses"
``

  1. Start Codex:

``bash
codex -c 'model_provider="azure-responses"'
``

  1. Submit these prompts in order (gpt-5.6-sol max reasoning)

``text
test spawn agent fork=none
``

``text
what is fork=none
``

``text
test spawn agent fork=all
``

the fork all agent won't work

Additional information

The same sequence succeeds with the built-in openai model provider. However, this appears to be because of request preprocessing rather than because the forked history is valid: - Codex sets store=true for Azure Responses endpoints. - When store=true, prepare_response_items_for_request preserves prefixed Responses item IDs. - The built-in openai provider uses store=false; with the item_ids feature disabled, Codex removes item IDs before sending the request. - The orphaned assistant message is consequently sent as ordinary message content in the OpenAI-provider case and does not reference the missing reasoning item.

View original on GitHub ↗

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