ai-review-resolve/20260620131600
develop
OPENCODE_SKIP_TLS_VERIFY
/global/health
/config/providers
/session
/message
rejectUnauthorized: false
opencode
OPENCODE_SKIP_TLS_VERIFY=true
GITEA_SKIP_TLS_VERIFY
npm test
🔍 服務:gemini 模型:gemini-2.5-flash
app/llm.js
app/preflight.js
opencodeAxiosOptions
timeout
httpsAgent
config.js
例如,可以將 httpsAgent 的邏輯移至 config.js:
// app/config.js export function getOpenCodeHttpsAgent() { return shouldSkipOpenCodeTLSVerify() ? new https.Agent({ rejectUnauthorized: false }) : undefined; } // app/llm.js import { getOpenCodeHttpsAgent } from './config.js'; function opencodeAxiosOptions(headers) { return { headers, httpsAgent: getOpenCodeHttpsAgent(), }; } // app/preflight.js import { getOpenCodeHttpsAgent } from './config.js'; const opencodeAxiosOptions = (headers) => ({ headers, timeout: 30000, httpsAgent: getOpenCodeHttpsAgent(), }); ``` |
No dependencies set.
The note is not visible to the blocked user.
變更摘要
OPENCODE_SKIP_TLS_VERIFYaction input/env,讓 OpenCode server 使用自簽憑證時可明確選擇略過 TLS 驗證。/global/health、/config/providers與實際/session、/message呼叫統一套用 OpenCode 專用 HTTPS agent。rejectUnauthorized: false。影響範圍
opencode的 HTTPS 呼叫。OPENCODE_SKIP_TLS_VERIFY=true時仍維持 TLS 憑證驗證。GITEA_SKIP_TLS_VERIFY語意維持不變,未與 OpenCode 設定混用。測試
npm test:144 個測試通過。注意事項
OPENCODE_SKIP_TLS_VERIFY=true僅建議用於內部或自簽憑證環境。正式公開服務仍應使用可信任 CA 簽發的憑證。🤖 AI Code Review 團隊
🔍 新發現問題(1 筆)
app/llm.js與app/preflight.js中,opencodeAxiosOptions函數的邏輯存在重複。雖然timeout參數在兩處有所不同,但處理httpsAgent的核心邏輯是相同的。建議將httpsAgent的建立邏輯抽象為一個共用函數或在config.js中定義,以避免未來修改時造成不一致,並提高程式碼的可維護性。例如,可以將
httpsAgent的邏輯移至config.js: