ai-review-resolve/llm-timeout-20260626-164727
develop
修正 Step5 角色分析會「卡住數分鐘無回應」的問題(實測卡 ~9 分鐘)。根因是 OpenCode LLM 呼叫沒有逾時,server/模型停滯時請求會無限等待;且單一呼叫失敗時 chat() 直接 process.exit(1),反而繞過了去重/過濾既有的 try/catch fallback。
chat()
process.exit(1)
opencodeAxiosOptions
timeout
OPENCODE_TIMEOUT_MS
throw
Promise.allSettled
deduplicateWithAI
filterFalsePositivesWithAI
resolveMissingLineNumbers
process.exit
效果:把「卡 9 分鐘(甚至整個流程被砍)」變成「最多等 ~2 分鐘,逾時的角色/步驟自動降級、流程繼續」。
app/llm.js
fix(llm)
test(llm)
opencodeAxiosOptions 加 timeout(OPENCODE_TIMEOUT_MS,預設 120s),避免 server/模型停滯時請求無限等待;chat() 失敗改 throw 而非 process.exit(1),讓 Step5 的 Promise.allSettled 與去重/過濾的 try/catch fallback 能各自優雅降級,不再因單一 LLM 失敗砍掉整個流程。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔍 服務:opencode 模型:gemini-2.5-flash
No dependencies set.
The note is not visible to the blocked user.
變更摘要
修正 Step5 角色分析會「卡住數分鐘無回應」的問題(實測卡 ~9 分鐘)。根因是 OpenCode LLM 呼叫沒有逾時,server/模型停滯時請求會無限等待;且單一呼叫失敗時
chat()直接process.exit(1),反而繞過了去重/過濾既有的 try/catch fallback。opencodeAxiosOptions加上timeout(OPENCODE_TIMEOUT_MS,預設 120s),停滯的 OpenCode 請求會 fail-fast 而非無限等待。chat()失敗(含逾時)改throw而非process.exit(1):Promise.allSettled執行,逾時的單一角色會被略過,其餘角色照常產出。deduplicateWithAI)、誤報過濾(filterFalsePositivesWithAI)、補行號(resolveMissingLineNumbers)原本就有 try/catch fallback,先前因process.exit而從未被執行;改為 throw 後可實際優雅降級。效果:把「卡 9 分鐘(甚至整個流程被砍)」變成「最多等 ~2 分鐘,逾時的角色/步驟自動降級、流程繼續」。
影響範圍
app/llm.js(逾時設定 + 失敗處理)。不改變正常成功路徑的行為與輸出。OPENCODE_TIMEOUT_MS調整。測試
timeout的斷言;chat()失敗時 throw(不再process.exit)的斷言。本分支 commits
fix(llm): OpenCode 呼叫加逾時、失敗改丟例外以優雅降級test(llm): 補逾時設定與失敗丟例外的測試🤖 AI Code Review 團隊
Pull request closed