Skip to content

Preserve assistant phase for replayed messages#19832

Open
friel-openai wants to merge 1 commit intomainfrom
fix/inter-agent-phase-recording
Open

Preserve assistant phase for replayed messages#19832
friel-openai wants to merge 1 commit intomainfrom
fix/inter-agent-phase-recording

Conversation

@friel-openai
Copy link
Copy Markdown
Contributor

Summary

This PR preserves ResponseItem::Message.phase when a message is converted through ResponseInputItem::Message, and records InterAgentCommunication::to_response_input_item() as MessagePhase::Commentary at the inter-agent message source.

The prior fork-based PR included unrelated Bazel workflow edits. This PR intentionally contains only the response-phase change.

Context

The OpenAI API deployment checklist says follow-up requests should preserve assistant phase: https://developers.openai.com/api/docs/guides/deployment-checklist#set-up-the-assistant-phase-parameter

We found this while debugging forked-agent prompt caching. Replayed inter-agent mailbox items could cross the ResponseInputItem::Message -> ResponseItem::Message boundary without their assistant phase, which made the same assistant history replay with different phases across resumed or forked sessions.

Validation

  • cd codex-rs && just fmt
  • cd codex-rs && cargo test -p codex-protocol
  • cd codex-rs && just fix -p codex-protocol
  • cd codex-rs && just fix -p codex-core
  • cd codex-rs && just argument-comment-lint

@friel-openai friel-openai requested a review from a team as a code owner April 27, 2026 16:15
@friel-openai friel-openai force-pushed the fix/inter-agent-phase-recording branch from d490430 to c3d92b1 Compare April 27, 2026 16:51
ResponseInputItem::Message can contain assistant-authored history that is later converted into ResponseItem::Message. Preserve phase across that boundary instead of inferring phase from message content.

InterAgentCommunication::to_response_input_item records inter-agent mailbox messages as commentary because they are assistant-authored in-between updates, not completed final answers.

This follows the assistant phase guidance in https://developers.openai.com/api/docs/guides/deployment-checklist#set-up-the-assistant-phase-parameter.

Co-authored-by: Codex <noreply@openai.com>
@friel-openai friel-openai force-pushed the fix/inter-agent-phase-recording branch from c3d92b1 to b2a6f1c Compare April 27, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant