Repository navigation
fix(codex): upgrade CPA and support response interrupts - #838
Conversation
📝 WalkthroughWalkthrough升级 CPA 依赖版本,并新增 Codex WebSocket 的 Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to An upstream write stall could leave an interrupted connection unresponsive. Add a write deadline before merging, or accept this bounded connection-level risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 13 files. (2 skipped: 2 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (1)
internal/gateway/websocket.go (1)
379-386: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win为中断写入设置实际的写超时。
读取循环会同步等待
handleInterrupt。CodexWebsocketsExecutor.InterruptExecutionSession只在写入前检查一次ctx.Err(),随后直接调用conn.WriteMessage或NextWriter。这条写入路径没有设置SetWriteDeadline,因此上游写入阻塞时,读取循环可能无法继续读取后续帧。仅在调用处包装context.WithTimeout不能中断已经开始的 WebSocket 写入。请在 CPA 的中断写入路径设置有限的 WebSocket 写期限,并在写入结束后清除或恢复期限。若该逻辑属于外部 CPA 依赖,请升级到包含此修复的版本,或应用等效的本地补丁。
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: QUIET
- Plan: Advanced
- Run ID:
ad574c8b-b7d5-40d8-a628-ad480955e662
⛔ Files ignored due to path filters (2)
go.sumis excluded by!**/*.sumthird_party/cpaembedded/go.sumis excluded by!**/*.sum
📒 Files selected for processing (16)
go.modinternal/catalog/codex_client_models.gointernal/execution/cpa/websocket.gointernal/execution/cpa/websocket_test.gointernal/execution/websocket.gointernal/gateway/execution_forward.gointernal/gateway/websocket.gointernal/gateway/websocket_interrupt.gointernal/gateway/websocket_interrupt_test.gointernal/gateway/websocket_turn.gointernal/subscription/providers/codex/websocket.gothird_party/cpaembedded/embedded/antigravity_executor.gothird_party/cpaembedded/embedded/antigravity_test.gothird_party/cpaembedded/embedded/codex_websocket.gothird_party/cpaembedded/embedded/codex_websocket_interrupt_test.gothird_party/cpaembedded/go.mod
💤 Files with no reviewable changes (1)
- third_party/cpaembedded/embedded/antigravity_executor.go
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
|
Addressed the interrupt-write finding in 13079f0. Interrupt writes now have an independent deadline capped at 30 seconds and the earlier caller/turn deadline. Cancellation or timeout closes the underlying connection to release the blocked SDK write, even after generation finishes. Regression tests cover cancellation, both deadline sources, and same-connection continuation. The model-catalog CI failure was also fixed by matching CPA 8.0.22's updated warning text; the unchanged-catalog assertions remain in place. Regarding the docstring coverage warning: The repository does not require 80% docstring coverage; no bulk comment changes are needed for this fix. Validation passed: |
关联 Issue / Related Issue
Related upstream fix: router-for-me/CLIProxyAPI#6456
变更内容 / Change Content
Answering an asynchronous Codex question during generation can send
response.interrupt. GPT-Load previously queued and rejected that control frame, then closed sessions that ended with an incomplete response.InterruptExecutionSessionAPI to forward interrupts immediately on the bound upstream connection.response.donecontinuation, exact output-token preservation, and rejecting incomplete responses without a requested interrupt.Compatibility: existing configuration and database schemas are unchanged. The pinned Codex 0.159.2 identity and model template are retained; the template matches the official tag byte for byte.
Known limitation: CPA v8.0.22 closes the upstream WebSocket when a requested interruption returns
response.incompletewith no output andoutput_tokens: 0. This remains an upstream issue. The PR uses the official CPA release; the corresponding continuation-success regression is deferred until an official CPA fix is available.Validation using the official CPA v8.0.22 dependency:
make checkgo test -count=20 -run '^TestWebsocketInterrupt' ./internal/gatewaycovers success/failure classification, terminal-before-write completion, continuation, usage, pricing, and RPM.third_party/cpaembedded:go mod tidy -diff,go vet ./..., andgo test -count=1 ./...response.incompletefailure remains reproducible and is not reclassified as success. A live Codex client/backend smoke test of this final revision has not been rerun.自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。 / I ranmake check, or documented why it could not run and what remains unverified.