Skip to content

[codex] control automatic realtime handoff delivery#27986

Merged
jiayuhuang-openai merged 2 commits into
mainfrom
codex/realtime-handoff-api
Jun 18, 2026
Merged

[codex] control automatic realtime handoff delivery#27986
jiayuhuang-openai merged 2 commits into
mainfrom
codex/realtime-handoff-api

Conversation

@jiayuhuang-openai

@jiayuhuang-openai jiayuhuang-openai commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What

Built on the realtime speech-control plumbing merged in #27917.

  • Add optional codexResponseHandoffPrefix to thread/realtime/start.
  • Apply that prefix only to automatic V1 commentary sent through conversation.handoff.append; final answers remain unprefixed.
  • Add opt-in clientManagedHandoffs. When true, core suppresses automatic response handoffs and completion output so delivery is controlled by explicit client append APIs.
  • Preserve existing automatic behavior by default. codexResponsesAsItems: true continues to select item routing when client-managed mode is disabled.

Why

Voice clients need two delivery policies: automatic background context with silent commentary instructions and fully client-owned handoffs. Phase-aware prefixing keeps routine commentary silent without suppressing the final answer, while client-managed mode lets an app decide exactly which updates to append.

Validation

  • just fmt
  • cargo test -p codex-app-server-protocol serialize_thread_realtime_start
  • RUST_MIN_STACK=16777216 cargo test -p codex-core --test all conversation_handoff_persists_across_item_done_until_turn_complete
  • RUST_MIN_STACK=16777216 cargo test -p codex-app-server --test all webrtc_v1_client_managed_handoffs_disable_automatic_output
  • RUST_MIN_STACK=16777216 cargo test -p codex-app-server --test all webrtc_v1_final_automatic_handoff_omits_silent_prefix
  • cargo build -p codex-cli --bin codex
  • Local Codex Apps compatibility check: 43 focused webview tests passed, and a live voice session routed through the source-built app-server.

The explicit RUST_MIN_STACK avoids a macOS Tokio test-worker stack overflow seen with the default test environment.

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch from cb79a9a to 45824de Compare June 13, 2026 00:42
@jiayuhuang-openai jiayuhuang-openai changed the title [codex] expose realtime handoff append API [codex] preserve realtime handoff append semantics Jun 13, 2026
@jiayuhuang-openai jiayuhuang-openai changed the base branch from main to guinness/realtime-handoff-append-control June 13, 2026 00:42
@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch from 45824de to 30351ca Compare June 13, 2026 00:56
@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch 2 times, most recently from 97b6d25 to 8d0d92d Compare June 15, 2026 05:07
@jiayuhuang-openai jiayuhuang-openai changed the title [codex] preserve realtime handoff append semantics [codex] expose raw V1 realtime handoff append API Jun 15, 2026
@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch 5 times, most recently from 774e7bc to 8bb3cd6 Compare June 15, 2026 23:11
Base automatically changed from guinness/realtime-handoff-append-control to main June 15, 2026 23:16
@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch 3 times, most recently from b0e39c8 to 7c0b430 Compare June 17, 2026 21:39
@jiayuhuang-openai jiayuhuang-openai changed the title [codex] expose raw V1 realtime handoff append API [codex] expose configurable V1 realtime handoff append API Jun 17, 2026
@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch from 7c0b430 to 0b50ce5 Compare June 17, 2026 21:46
@jiayuhuang-openai jiayuhuang-openai changed the title [codex] expose configurable V1 realtime handoff append API [codex] allow custom prefixes for automatic realtime handoffs Jun 17, 2026
@jiayuhuang-openai jiayuhuang-openai marked this pull request as ready for review June 17, 2026 21:52
@jiayuhuang-openai jiayuhuang-openai requested a review from a team as a code owner June 17, 2026 21:52
enum RealtimeOutbound {
StandaloneHandoff { text: String },
HandoffUpdate { handoff_id: String, text: String },
HandoffAppend { handoff_id: String, text: String },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we need a new outbound type here?

@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: 0b50ce5dbf

ℹ️ 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 +512 to +514
} else if handoff.session_kind == RealtimeSessionKind::V1
&& handoff.codex_response_handoff_prefix.is_some()
{

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 Preserve default routing for empty handoff prefixes

When a client sends codexResponseHandoffPrefix: "" for a V1 active handoff, this is_some() check takes the new direct HandoffAppend path even though realtime_backend_item treats the empty prefix as absent. That bypasses the existing send_conversation_function_call_output path, so the response loses the default "Agent Final Message" wrapper that omission/null still gets; clients that bind an empty text input instead of omitting the field will silently change realtime behavior. Consider checking for a non-empty prefix before switching paths.

Useful? React with 👍 / 👎.

@jiayuhuang-openai jiayuhuang-openai force-pushed the codex/realtime-handoff-api branch from 0b50ce5 to 1cd9010 Compare June 17, 2026 22:01
@jiayuhuang-openai jiayuhuang-openai changed the title [codex] allow custom prefixes for automatic realtime handoffs [codex] control automatic realtime handoff delivery Jun 18, 2026
@jiayuhuang-openai jiayuhuang-openai enabled auto-merge (squash) June 18, 2026 02:19
@jiayuhuang-openai

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 18, 2026
@jiayuhuang-openai

Copy link
Copy Markdown
Contributor Author

/merge

@jiayuhuang-openai jiayuhuang-openai merged commit 683bd17 into main Jun 18, 2026
31 of 33 checks passed
@jiayuhuang-openai jiayuhuang-openai deleted the codex/realtime-handoff-api branch June 18, 2026 02:22
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 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.

3 participants