Skip to content

fix(openai): respect response exclusions when reusing WebSockets - #768

Merged
zyycn merged 1 commit into
mainfrom
fix/websocket-exclude-header
Nov 23, 2026
Merged

zyycn merged 1 commit into
mainfrom
fix/websocket-exclude-header

Conversation

@zyycn

@zyycn zyycn commented Nov 23, 2026

Copy link
Copy Markdown
Owner

问题与改动

Codex 默认用 x-codex-exclude: tools,usage.attribution 省略工具列表和逐项用量,开启 experimentalRawEvents 时发送 tools 以保留逐项用量。该头在 WebSocket 握手时发送。同一账号、同一会话切换设置后,CPR 原先会把请求交给按旧设置握手的连接,导致客户端可能收不到所需的逐项用量。官方变更 · Codex 请求头实现

连接池现在按最终握手的全部 x-codex-exclude 值匹配上游连接,保留缺省、显式空值和重复头。依赖原连接的 previous_response_id 也遵循同一条件,值相同时继续使用原连接,值变化时返回已有的 previous_response_not_found,由客户端重放完整历史。

自审与验证

  • 从出站中间件处理后的握手读取头值,普通复用和精确续接共用同一字段。旧客户端省略该头时沿用缺省连接池。
  • 用本地 WebSocket 上游复现了旧实现接受头值已变化的精确续接。回归测试核对了五种实际握手值,以及普通复用、精确续接和要求重放后的原连接状态。
  • OpenAI Provider 全部 1,194 项测试通过。Provider 全目标 Clippy(-D warnings)、Rust workspace 格式和 git diff --check 均通过。

AI 使用

OpenAI Codex(gpt-6.2-astra)参与实现、测试、文档和自审。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T03:42:23.121044Z b46f5be PR opened
🔒 Security Review ✅ Completed 2026-11-23T03:44:09.990150Z b46f5be PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zyycn
zyycn merged commit 7ff7741 into main Nov 23, 2026
10 checks passed
@zyycn
zyycn deleted the fix/websocket-exclude-header branch November 23, 2026 03:45
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