Skip to content

fix(codex): upgrade SDK and ignore late interrupts - #840

Merged
tbphp merged 1 commit into
mainfrom
tbphp/fix-codex-late-interrupt
Oct 10, 2026
Merged

tbphp merged 1 commit into
mainfrom
tbphp/fix-codex-late-interrupt

Conversation

@tbphp

@tbphp tbphp commented Oct 9, 2026

Copy link
Copy Markdown
Owner

关联 Issue / Related Issue

Related to router-for-me/CLIProxyAPI#6483.

变更内容 / Change Content

  • Bug 修复 / Bug fix
  • 新功能 / New feature
  • 其他改动 / Other changes

Late or repeated interrupts for a completed response could leave a 400 error frame that Codex reads as the next turn's failure. Upgrade the root and embedded CPA dependencies to v8.0.23 and ignore these interrupts for known completed responses on the same connection, while retaining authentication, response ownership, and lane checks.

Keep the current turn's response ID through terminal delivery so CPA can handle an interrupt arriving before bridge cleanup. Existing regressions now verify that late interrupts preserve continuation without adding inference attempts, RPM usage, or request logs.

Validation: make check passed. The embedded module also passed go test -count=1 ./..., go vet ./..., and go mod tidy -diff. Focused version-alignment, gateway interrupt, and embedded continuation tests were rerun before pushing.

No data migration is required. The Codex client identity and model snapshot remain unchanged. CPA's separate zero-output response.incomplete interruption limitation on the non-steering path remains unresolved; this PR uses the official dependency without an upstream source patch. Validation used mock upstreams, not a live Codex backend.

自查清单 / Checklist

  • 我已运行 make check,或在说明中写明无法运行的原因和未验证范围。 / I ran make check, or documented why it could not run and what remains unverified.
  • 本 PR 范围聚焦,未包含无关改动。 / This PR is focused and contains no unrelated changes.
  • 我已更新必要的公开文档或发布说明。 / I updated any required public documentation or release notes. — Not applicable: no public documentation changes are required.
  • 我已确认提交、日志和测试数据不包含敏感信息。 / I confirmed that commits, logs, and fixtures contain no sensitive data.
  • 如适用,我已说明兼容性或数据迁移影响。 / Where applicable, I documented compatibility or data-migration impact.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

Walkthrough

将 CLIProxyAPI 依赖版本和 Codex 模型目录中的 CPA SDK 版本从 v8.0.22 更新为 v8.0.23。调整 WebSocket 中断处理:响应已结束时忽略中断,不再发送错误帧;响应不存在或通道不匹配时,仍发送错误帧。更新 CPA 中活动响应 ID 的终态处理,并修改相关中断测试。


Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to da525

The late-interrupt test could miss extra same-connection work or accounting activity. Adding explicit assertions is a bounded follow-up; no production regression is established, so the change remains mergeable with this coverage gap noted.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning 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 2 functions across 5 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed 标题准确概括了主要变更:升级 Codex SDK,并忽略已完成响应的迟到中断。
Description check Passed 描述完整说明了关联 Issue、变更内容、验证结果、兼容性影响、未解决限制和自查清单。内容与变更范围一致。

Full details: Docstring Coverage

Explanation

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 2 functions across 5 files. (2 skipped: 2 unsupported.)



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
third_party/cpaembedded/embedded/codex_websocket_interrupt_test.go (1)

228-232: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

为终止事件增加无额外工作的断言。

终止事件回调调用 sender.Interrupt 后,测试只检查一次 continuation 请求和 connections == 1。connections 只能发现新建 WebSocket,不能发现同一连接上的额外推理、RPM 使用或请求日志。测试在收到 resp_2 后还会忽略下一条消息,因此额外工作可能不会使测试失败。

请为上游请求、推理和 RPM 记录增加明确计数,并在终止事件回调返回后断言这些计数没有增加。


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: c72fe709-0787-4bdc-99d8-44e72892ad92
📥 Commits

Reviewing files that changed from the base of the PR and between 25ec9aa and da5253a.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • third_party/cpaembedded/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • go.mod
  • internal/catalog/codex_client_models.go
  • internal/gateway/websocket_interrupt.go
  • internal/gateway/websocket_interrupt_test.go
  • third_party/cpaembedded/embedded/codex_websocket.go
  • third_party/cpaembedded/embedded/codex_websocket_interrupt_test.go
  • third_party/cpaembedded/go.mod

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@tbphp tbphp changed the title fix(codex): upgrade CPA and ignore late interrupts fix(codex): upgrade SDK and ignore late interrupts Oct 9, 2026
@tbphp tbphp self-assigned this Oct 10, 2026
@tbphp tbphp added the bug Something isn't working label Oct 10, 2026
@tbphp tbphp added this to the v2.0.0 milestone Oct 10, 2026
@tbphp
tbphp merged commit 5a00879 into main Oct 10, 2026
12 checks passed
@tbphp
tbphp deleted the tbphp/fix-codex-late-interrupt branch October 10, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants