fix(claude): remove global header cache, gate anthropic-beta by model

The global claudeHeaderCache singleton overlaid the last-seen Claude Code
client's identity headers onto every subsequent request, leaking one
client's headers (anthropic-beta, user-agent, x-stainless-*, etc.) onto
another client/account sharing the same server. Removed the singleton and
the claudeOverlay hook entirely, falling back to static per-provider
headers. anthropic-beta is now computed per-request from the requested
model, gating heavy-agent flags (advanced-tool-use, effort) to
opus/sonnet only.
This commit is contained in:
decolua
2026-08-05 11:32:14 +07:00
parent 1eb37db32d
commit 13ed14568d
7 changed files with 65 additions and 265 deletions

View File

@@ -7,7 +7,6 @@ import {
extractApiKey,
isValidApiKey,
} from "../services/auth.js";
import { cacheClaudeHeaders } from "open-sse/utils/claudeHeaderCache.js";
import { getSettings } from "@/lib/localDb";
import { getModelInfo, getComboModels } from "../services/model.js";
import { handleChatCore } from "open-sse/handlers/chatCore.js";
@@ -46,8 +45,6 @@ export async function handleChat(request, clientRawRequest = null) {
headers: Object.fromEntries(request.headers.entries())
};
}
cacheClaudeHeaders(clientRawRequest.headers);
const modelStr = body.model;
// Request summary is emitted as the unified "▶" line in chatCore (has fmt/thinking/account)