Skip to content

Revert "[core] Support interleaved response items" - #31261

Merged
alexi-openai merged 1 commit into
mainfrom
revert-30876-codex/interleaved-reasoning-items
Jul 6, 2026
Merged

Revert "[core] Support interleaved response items"#31261
alexi-openai merged 1 commit into
mainfrom
revert-30876-codex/interleaved-reasoning-items

Conversation

@alexi-openai

Copy link
Copy Markdown
Contributor

Reverts #30876

@alexi-openai
alexi-openai requested a review from a team as a code owner July 6, 2026 16:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c343e7a898

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +354 to 358
if let (Some(delta), Some(summary_index)) = (event.delta, event.summary_index) {
return Ok(Some(ResponseEvent::ReasoningSummaryDelta {
item_id,
delta,
summary_index,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve item IDs on reasoning summary events

When the Responses stream interleaves a reasoning item with a later message/tool item and then sends another response.reasoning_summary_text.delta or response.reasoning_summary_part.added for the original reasoning item, this code drops the server-provided item_id; turn.rs then emits the app-server reasoning summary notification using whichever item is currently active, so clients can receive deltas/section breaks attached to the wrong item or lose them after the active item changes. Please keep the item_id on these events and route by that ID rather than active-item state.

AGENTS.md reference: AGENTS.md:L102-L107

Useful? React with 👍 / 👎.

Comment on lines +1989 to 1993
if let Some((_, mut consumer)) = active_tool_argument_diff_consumer.take()
&& let Ok(Some(event)) = consumer.finish()
{
sess.send_event(&turn_context, event).await;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Finish streamed tool inputs only for their own call

When an apply_patch custom tool call is streaming argument deltas and any unrelated output_item.done arrives before that custom tool call completes, this unconditional take() calls finish() on the patch diff consumer and drops it; later response.custom_tool_call_input.delta events for the same call are ignored, so clients stop receiving correct item/fileChange/patchUpdated progress even though the final tool call may still apply. Please only finish the consumer when the completed item is the matching custom tool call.

AGENTS.md reference: AGENTS.md:L104-L107

Useful? React with 👍 / 👎.

Comment on lines +1994 to +2000
let previously_active_item = active_item.take();
let previously_streamed_item = if active_item_is_streaming_to_client {
previously_active_item
} else {
None
};
let previously_streamed_item = completed_item_id
.as_deref()
.and_then(|item_id| streamed_items.remove(item_id));
if completes_active_item {
active_item = None;
active_item_is_streaming_to_client = false;
}
active_item_is_streaming_to_client = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clear active streamed items only by matching ID

When the stream completes an earlier non-tool item while a later item is currently active, this unconditional active_item.take() treats the later item as the completed item's prior start and clears it. In an interleaved response such as reasoning started, message started, message done, reasoning done, the reasoning item can then be emitted as started twice (or have its buffered text lifecycle finalized against the wrong item), which corrupts the app-server/TUI item lifecycle for valid out-of-order output_item.done events. Please look up the completed item by its item ID and only clear the active slot when that ID matches.

AGENTS.md reference: AGENTS.md:L104-L107

Useful? React with 👍 / 👎.

@alexi-openai
alexi-openai merged commit 7b4e70d into main Jul 6, 2026
35 checks passed
@alexi-openai
alexi-openai deleted the revert-30876-codex/interleaved-reasoning-items branch July 6, 2026 17:09
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants