Skip to content

[upstream #89] Responses 流 finish 修复 (0c2af9780) - #92

Merged
woncc merged 1 commit into
mainfrom
cursor/upstream-issue-89-0c2af9780-20261101
Nov 1, 2026
Merged

woncc merged 1 commit into
mainfrom
cursor/upstream-issue-89-0c2af9780-20261101

Conversation

@woncc

@woncc woncc commented Nov 1, 2026

Copy link
Copy Markdown

🔗 关联任务 / Related Issue

Closes #89。关联 #83、#65、#51;合同 R3-0199。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)

📝 变更描述 / 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 无匹配测试。
  • 上游新增的生命周期表测试覆盖终止事件、并发取消、中途断开、event/data/delimiter 写入失败、flush 失败、协议及扫描错误,并断言 usage 保留。
  • git diff --check HEAD^ HEAD:退出码 0。上下游 git patch-id --stable 均为 f8d0b59ff488196c8833c5e58f325d7203f58911。
  • 证据:/workspace/g4-t638u-r3-0199/writers/R0199W89/。无 UI、数据库或模块 API 变更;未验证真实供应商网络。CI 与独审待完成。

✅ 提交前检查项 / Checklist

…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]>
@woncc
woncc merged commit 8b66a57 into main Nov 1, 2026
@woncc
woncc deleted the cursor/upstream-issue-89-0c2af9780-20261101 branch November 1, 2026 06:50
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.

[上游/现在能解] 0c2af9780 已投递 Responses 流 finish 修复

2 participants