發布 AI review Review 統計與 Step9 合併阻擋調整 #30

Merged
admin merged 20 commits from develop into master 2026-06-22 10:41:37 +00:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit a60fb8d168 - Show all commits
+7
View File
@@ -114,6 +114,13 @@ describe('getLLMConfig', () => {
assert.equal(shouldSkipOpenCodeTLSVerify(), false);
});
it('skips OpenCode TLS verification for empty string and non-false values', () => {
for (const value of ['', '0', 'true', 'yes']) {
process.env.OPENCODE_SKIP_TLS_VERIFY = value;
assert.equal(shouldSkipOpenCodeTLSVerify(), true);
}
});
it('openai takes priority over gemini when both set', () => {
process.env.OPENAI_API_KEY = 'sk-test';
process.env.GEMINI_API_KEY = 'gemini-key';
+17
View File
@@ -199,6 +199,23 @@ describe('verifyLLM', () => {
assert.equal(agents[1].options.rejectUnauthorized, false);
});
it('passes an insecure https agent for opencode when TLS skip is explicitly true', async () => {
clearLLMEnv();
process.env.OPENCODE_BASE_URL = 'https://opencode.local:4096';
process.env.OPENCODE_SKIP_TLS_VERIFY = 'true';
const agents = [];
mock.method(axios, 'get', async (url, opts) => {
agents.push(opts.httpsAgent);
if (url.endsWith('/global/health')) return { data: { healthy: true } };
return { data: { providers: [{ id: 'google', models: { 'gemini-2.5-flash': { id: 'gemini-2.5-flash' } } }] } };
});
const result = await verifyLLM();
assert.equal(result.ok, true);
assert.equal(agents.length, 2);
assert.equal(agents[0].options.rejectUnauthorized, false);
assert.equal(agents[1].options.rejectUnauthorized, false);
});
it('does not pass an insecure https agent for opencode when TLS verification is enabled', async () => {
clearLLMEnv();
process.env.OPENCODE_BASE_URL = 'https://opencode.local:4096';