Skip to content

Avoid cloning Responses WebSocket payloads - #34381

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/b63d746b7f5164b5204ab95b057c914a4aeb71e1
Jul 20, 2026
Merged

Avoid cloning Responses WebSocket payloads#34381
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/b63d746b7f5164b5204ab95b057c914a4aeb71e1

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 20, 2026

Copy link
Copy Markdown

Avoid cloning Responses WebSocket payloads

Why

Building a Responses WebSocket request copied the model, instructions, input
history, tools, and other request settings into a second payload before
serialization.

What changed

  • Make ResponseCreateWsRequest borrow shared fields from
    ResponsesApiRequest.
  • Keep only WebSocket-specific fields owned, and allocate a separate input
    vector only for incremental continuations.
  • Restore response item IDs after preparing a full request so the request
    retained for continuation matching keeps its original state.

Testing

Update the serialization test to verify that the borrowed WebSocket request
produces the same wire payload as the Responses API request plus its
WebSocket-specific fields.

## Why

Building a Responses WebSocket request copied the model, instructions, input
history, tools, and other request settings into a second payload before
serialization.

## What changed

- Make `ResponseCreateWsRequest` borrow shared fields from
  `ResponsesApiRequest`.
- Keep only WebSocket-specific fields owned, and allocate a separate input
  vector only for incremental continuations.
- Restore response item IDs after preparing a full request so the request
  retained for continuation matching keeps its original state.

## Testing

Update the serialization test to verify that the borrowed WebSocket request
produces the same wire payload as the Responses API request plus its
WebSocket-specific fields.

GitOrigin-RevId: b63d746b7f5164b5204ab95b057c914a4aeb71e1
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/b63d746b7f5164b5204ab95b057c914a4aeb71e1 branch from 832bd94 to 6b9a559 Compare July 20, 2026 17:19
@copyberry
copyberry Bot merged commit 6b9a559 into main Jul 20, 2026
32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/b63d746b7f5164b5204ab95b057c914a4aeb71e1 branch July 20, 2026 17:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 20, 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.

1 participant