Skip to content

Commit 4ebe313

Browse files
committed
chore: stabilization fixes for v3.6.6 (#1298, #1254, #59, CI)
1 parent 72502e4 commit 4ebe313

5 files changed

Lines changed: 40 additions & 5 deletions

File tree

open-sse/services/combo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ function scoreAutoTargets(
880880
weights: ScoringWeights
881881
) {
882882
const candidateByExecutionKey = new Map(
883-
candidates.map((candidate) => [candidate.executionKey, candidate])
883+
candidates.map((candidate: any) => [candidate.executionKey, candidate])
884884
);
885885
return targets
886886
.map((target) => {

open-sse/translator/response/gemini-to-openai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export function geminiToOpenAIResponse(chunk, state) {
8383
state.pendingThoughtSignature = hasThoughtSig;
8484
}
8585

86-
// Handle thought signature (thinking mode)
87-
if (hasThoughtSig) {
86+
// Handle thought signature (thinking mode) or native gemini thought flag
87+
if (hasThoughtSig || isThought) {
8888
const hasTextContent = part.text !== undefined && part.text !== "";
8989
const hasFunctionCall = !!part.functionCall;
9090

open-sse/utils/proxyFetch.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,29 @@ function noProxyMatch(targetUrl) {
7878
if (patternPort && patternPort !== port) return false;
7979

8080
if (!patternHost) return false;
81+
82+
// Support wildcard matching (e.g. 192.168.* or *.local)
83+
if (patternHost.includes("*")) {
84+
const regexStr = "^" + patternHost.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$";
85+
if (new RegExp(regexStr).test(hostname)) return true;
86+
}
87+
8188
if (patternHost.startsWith(".")) {
8289
return hostname.endsWith(patternHost) || hostname === patternHost.slice(1);
8390
}
8491
return hostname === patternHost || hostname.endsWith(`.${patternHost}`);
8592
});
8693
}
8794

95+
function isLocalAddress(hostname: string): boolean {
96+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1") return true;
97+
if (hostname.startsWith("192.168.")) return true;
98+
if (hostname.startsWith("10.")) return true;
99+
if (hostname.match(/^172\.(1[6-9]|2\d|3[0-1])\./)) return true;
100+
if (hostname.endsWith(".local") || hostname.endsWith(".lan")) return true;
101+
return false;
102+
}
103+
88104
function resolveEnvProxyUrl(targetUrl) {
89105
if (noProxyMatch(targetUrl)) return null;
90106

@@ -111,6 +127,18 @@ function resolveEnvProxyUrl(targetUrl) {
111127
}
112128

113129
function resolveProxyForRequest(targetUrl) {
130+
let target;
131+
try {
132+
target = new URL(targetUrl);
133+
} catch {
134+
target = null;
135+
}
136+
137+
// Always bypass proxy for local/LAN addresses
138+
if (target && isLocalAddress(target.hostname.toLowerCase())) {
139+
return { source: "direct", proxyUrl: null };
140+
}
141+
114142
const contextProxy = proxyContext.getStore();
115143
if (contextProxy) {
116144
return { source: "context", proxyUrl: proxyConfigToUrl(contextProxy) };

src/lib/db/migrationRunner.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@ export function runMigrations(db: Database.Database): number {
204204
}
205205

206206
// ── Safety Check 2: Mass-migration detection (abort if existing DB + many migrations) ──
207+
// Skip in test environments where fresh DBs legitimately have many pending migrations.
208+
const isTestEnvironment =
209+
process.env.NODE_ENV === "test" ||
210+
process.env.VITEST !== undefined ||
211+
(typeof process.argv !== "undefined" && process.argv.some((arg) => arg.includes("test")));
212+
207213
if (
214+
!isTestEnvironment &&
208215
process.env.DISABLE_SQLITE_AUTO_BACKUP !== "true" &&
209216
MAX_PENDING_MIGRATIONS_ON_EXISTING_DB > 0 &&
210217
applied.size > 0 &&

src/sse/handlers/chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export async function handleChat(request: any, clientRawRequest: any = null) {
258258

259259
// Check if model is a combo (has multiple models with fallback)
260260
telemetry.startPhase("resolve");
261-
const combo = await getComboForModel(resolvedModelStr);
261+
const combo: any = await getComboForModel(resolvedModelStr);
262262
if (combo) {
263263
log.info(
264264
"CHAT",
@@ -540,7 +540,7 @@ async function handleSingleModelChat(
540540
}
541541
);
542542

543-
if (!credentials || credentials.allRateLimited) {
543+
if (!credentials || "allRateLimited" in credentials) {
544544
if ([408, 429, 500, 502, 503, 504].includes(Number(lastStatus))) {
545545
const quarantine = markModelAsProblematic(provider, model, {
546546
status: Number(lastStatus),

0 commit comments

Comments
 (0)