Skip to content

fix(websocket): preserve queued binary frames during reconnect - #4191

Draft
markstuart-oai wants to merge 1 commit into
mainfrom
markstuart/websocket-runtime-audit-20261027
Draft

markstuart-oai wants to merge 1 commit into
mainfrom
markstuart/websocket-runtime-audit-20261027

Conversation

@markstuart-oai

Copy link
Copy Markdown
Contributor

Summary

During reconnect, send_raw(bytes) used to decode queued bytes as UTF-8. A valid UTF-8 payload changed from a binary frame to a text frame. Other bytes raised UnicodeDecodeError before the SDK could send them.

Preserve each frame and its place in the queue. If recovery stops, unsent_frames returns the original text and bytes in order. unsent_messages keeps its existing string-list interface.

Verification

The previous transport failed 28 wire cases. The revised transport passed 357 queue, recovery and session tests and 328 URL and security tests. The new sync and async tests use a local WebSocket peer across all seven bindings. Scoped Ruff checks passed. The full local formatter stopped before formatting because the configured registry differed from the checked-in lockfile. Local mypy reported the same eight optional Google import errors on both revisions.

@github-actions

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: 3596d18f05b63081fd64c6da82b515293afb98c6.

Trusted main policy: 3596d18f05b63081fd64c6da82b515293afb98c6.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared 3596d18f05b6 → 194bc68cbb39. Generated baselines verified.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 40462487697 --repo openai/openai-python \
  --name castiron-custom-code-40462487697-1 --dir /tmp/castiron-custom-code-40462487697-1
git apply --stat /tmp/castiron-custom-code-40462487697-1/custom-code.patch
cat /tmp/castiron-custom-code-40462487697-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 3596d18f05b63081fd64c6da82b515293afb98c6 194bc68cbb390798bb1311f0368375a2fe65ac4a
python3 scripts/castiron/custom_code_report.py report \
  --base 3596d18f05b63081fd64c6da82b515293afb98c6 \
  --head 194bc68cbb390798bb1311f0368375a2fe65ac4a --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-194bc68cbb39
cat /tmp/castiron-custom-code-194bc68cbb39/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

This branch has not been deployed

No deployments
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