Repository navigation
fix: 修复大历史与 OAuth 桥接的 WebSocket 工具结果续接 - #966
Merged
Merged
Conversation
2 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决的问题与行为变化
WebSocket 的
store=false工具结果有时会经过 HTTP 桥接。较大的首轮包含已完成的工具调用和结果时,旧逻辑可能因整帧超过 8 MiB 而失去下一轮要核对的历史记录。现在对完整帧检查结构,对提取出的工具项应用 8 MiB 限额,继续限制 1024 个调用标识。已完成并向客户端交付的历史仍按账号、模型、调用指纹和结果核对。普通 OAuth 账号走 HTTP 桥接时,允许以刚交付的响应续接一轮纯工具结果。实际写入前核对响应归属、会话、账号配置、原始输入、出站输入和工具控制字段。共享记录缺失、等待交付超时、内容失配以及当前连接缺失交付证据会分别记录固定分类。历史请求的确切子原因仍受旧版日志粒度限制。
关联记录与来源
Refs #854、#961。基线为
production的8678e88f4,实现与用例均基于本仓库。源自 v2.23.1 的 WStool_provenance_unknown和ws_previous_removed分类。管理员新功能提示
无新增管理界面,提示 ID、登记项、展示位置、关闭与 ID 沿用、A/B/C 升级、刷新和重新登录回归均不适用。
复现与验收
合成客户端用一条 WS 连接发送含旧工具调用及结果的大首轮,回环上游交付一个新函数调用。客户端第二轮只发其工具结果及上一响应指针。API Key 路径和 OAuth 大请求桥接路径各应到达模拟上游两次,第二次的历史包含两个原始结果。未知调用、指针不匹配及把旧调用当作刚交付的调用都应在第二次发送前被拒绝。
协议、调度或传输改动补充
端点为
/v1/responsesWebSocket,经 HTTP/SSE 出站。前置条件是已开启可读历史恢复;发送时要求相同账号、授权范围、模型和会话。沿用现有上游发送、计费及关闭流程。此次聚焦发送前拒绝,不新增发送后的重试。多轮错误样本未保留业务正文,回归使用虚构输入。实际验证
git diff --checkbackend下go test -race -tags=unit,bridgewarmup ./internal/handler -run '^TestHTTPBridgeLargeHistoryToolResult$' -count=1兼容性与运行影响
沿用现有开关,无 API 和数据库迁移。大帧在默认 64 MiB 上限内检查,工具历史筛选和摘要有额外 CPU 开销,尚无性能量测。日志只增加固定分类,不含工具内容或身份数据。可回退应用二进制;可信历史缺失时仍可能返回 409。
文档与用户可见变化
符合条件的已有客户端可续接工具结果,无需更改设置或调用格式。无 UI 变更。
Agent 使用声明
Codex 负责诊断、实现、回归与 PR。模型为 GPT-6,完整运行型号及推理强度未知,会话未提供。未使用子 Agent。
提交前自查