[#774] fix-codex-reconnect#775
Merged
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 Walkthrough🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Summary
背景
Codex プロバイダで長尺レスポンス(例: スライド60枚を1コールでレビュー)を実行すると、サーバ側がレスポンス完了前に websocket を切断することがある(
websocket closed by server before response.completed)。この切断時、codex バイナリ自身は最大5回の再接続(
Reconnecting... N/5)を持っているが、TAKT 側がそれを活かせていない。実ログ(debug)で次が確認できた。type:"error"("Reconnecting..." 通知)で、SDK 本来の終端シグナルturn.failedは1度も発生していない(error 9回 / turn.failed 0回)2/5止まりで 3/5 以降に進まないerrorを終端扱いしてストリームを打ち切り、独自にスレッドを丸ごと再実行する retry(PR [#758] fix-codex-reconnect-retry #767)を最大8回・上限なしの指数バックオフ(合計約255秒)で繰り返した末に失敗する調査の結果(Codex CLI にもセカンドオピニオンを取得)、TAKT が
type:"error"(再接続中の通知)を「回復不能エラー」と誤認してストリームを break し、その結果 SDK の generator が閉じて codex の子プロセスが kill され、バイナリ自身の再接続が毎回途中で潰されていることが「再接続できない」真因と判断した。SDK 公式コンシューマ(Thread.run())はerrorを無視して読み続け、終端はturn.failedのみで扱っている点も裏付けになる。(留保: SDK 型定義のコメントは
ThreadErrorEventを "unrecoverable" と記載しており、設計意図としては終端の可能性も残る。状態に基づく判定で安全に吸収する想定。)やりたいこと
errorイベントだけでストリームを打ち切らず、codex バイナリ/SDK 自身の再接続を完遂させるturn.failed/ 例外 / 外部 abort / idle-timeout に限定し、ストリームが正常終了したのに完了も有効な出力も無い場合のみ、記録しておいた最後のエラーで失敗とするerror起点でスレッド丸ごと再実行する retry」は見直す(turn.failed・例外・idle-timeout 起点の retry は限定的に残す)補足
Execution Report
Workflow
takt-defaultcompleted successfully.Closes #774
Summary by CodeRabbit
Bug Fixes
Tests
Chores