Exclude sequence numbers from Responses stream deltas by default (#63479)

## Why

Codex does not use sequence numbers on text or custom tool input deltas.

## What changed

Add `delta.sequence_number` to the default `x-codex-exclude-stream-fields`
header for Responses requests over HTTP and WebSocket. Explicit provider
header values still take precedence.

## Testing

Update the WebSocket handshake and HTTP output-token replay tests to
expect the new default.

GitOrigin-RevId: d16ecb10f9188ba9cca4504e1b68e32832fb931a
This commit is contained in:
Charlie Marsh
2026-11-24 00:26:55 +00:00
committed by copyberry
parent 8bb8ed6bab
commit 98f8a3311b
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -2984,13 +2984,14 @@ fn build_responses_headers(
/// Apply Responses stream defaults after resolving provider headers so explicit exclusions win.
fn with_default_stream_exclusions(mut provider: ApiProvider) -> ApiProvider {
// Text and custom tool input deltas don't need sequence numbers.
// Reasoning replay only needs the ciphertext on the finished item.
// Negotiate separately so older servers still recognize x-codex-exclude.
provider
.headers
.entry("x-codex-exclude-stream-fields")
.or_insert(HeaderValue::from_static(
"reasoning.added.encrypted_content",
"delta.sequence_number,reasoning.added.encrypted_content",
));
provider
}
+1 -1
View File
@@ -308,7 +308,7 @@ async fn responses_websocket_streams_request() {
);
assert_eq!(
handshake.header("x-codex-exclude-stream-fields").as_deref(),
Some("reasoning.added.encrypted_content")
Some("delta.sequence_number,reasoning.added.encrypted_content")
);
assert_eq!(
handshake.header("session-id"),
@@ -122,7 +122,7 @@ async fn output_token_replay_respects_provider_and_preserves_history(
requests[0]
.header("x-codex-exclude-stream-fields")
.as_deref(),
Some("reasoning.added.encrypted_content")
Some("delta.sequence_number,reasoning.added.encrypted_content")
);
let expected_include = if enabled && openai_provider {
json!(["reasoning.encrypted_content", "output.encrypted_content"])