Repository navigation
[upstream #89] Responses 流 finish 修复 (0c2af9780) - #92
Merged
Merged
Conversation
…ct errors (QuantumNous#7956) Stop Responses SSE after its completed event has been written, preserving upstream token and tool usage. Reconcile a concurrent client cancellation only after all scanner workers have joined and a completed response was successfully delivered. Bare EOF, failed writes and protocol errors do not qualify. Propagate SSE write/flush errors and suppress cleanup read errors. Integrates the completion handling from QuantumNous#6904 and QuantumNous#6951 and narrows the cancellation reconciliation proposed in QuantumNous#6808. Refs QuantumNous#6649. Co-authored-by: leecz <[email protected]> Co-authored-by: zkasuran <[email protected]> Co-authored-by: yinshaohua <[email protected]>
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.
🔗 关联任务 / Related Issue
Closes #89。关联 #83、#65、#51;合同 R3-0199。
🚀 变更类型 / Type of change
📝 变更描述 / Description
原样 cherry-pick QuantumNous/new-api@0c2af97,无冲突。成功投递 Responses completed/done 事件后结束扫描;所有工作协程退出后,仅对已完成且无错误的投递纠正并发取消造成的误报。写入与 flush 失败继续报告错误,保留 token/tool usage。
仅改动指定 7 个文件。未纳入 #81 原生 SSE、#82 流收费或 OAuth;不包含 7e65967 / 1424ffd。基线 67db8dc。
本 PR 由 Codex 协助移植和验证,保留上游作者。独立审查与合入由主管流程完成。
📸 运行证明 / Proof of Work
GOMAXPROCS=2 go test ./relay/... ./common -count=1 -p=2 -run 'Responses|Stream|Billing|Disconnect':退出码 0;openai 0.050s、relay/helper 2.633s;common 无匹配测试。git diff --check HEAD^ HEAD:退出码 0。上下游git patch-id --stable均为f8d0b59ff488196c8833c5e58f325d7203f58911。/workspace/g4-t638u-r3-0199/writers/R0199W89/。无 UI、数据库或模块 API 变更;未验证真实供应商网络。CI 与独审待完成。✅ 提交前检查项 / Checklist