fix: project id forwarding regression (#93)

* fix(proxy): avoid empty project context and hydrate project_id from account token

* test(proxy): add regressions for empty project and token project_id hydration

* test(scripts): add live request validator for project_id forwarding
This commit is contained in:
vin authored and GitHub committed 2026-02-11 12:36:01 +08:00
1 parent 32abbb6793
commit ab78d93252
7 files changed
+534 -13

No files matched your search

+7 -2
View File
@@ -43,7 +43,7 @@ interface RequestConfig {
*/
export function transformClaudeRequestIn(
claudeReq: ClaudeRequest,
projectId: string,
projectId?: string,
): GeminiInternalRequest {
// Check for networking tools (server tool or built-in tool)
const hasWebSearchTool = detectsNetworkingTool(claudeReq.tools);
@@ -163,8 +163,9 @@ export function transformClaudeRequestIn(
const requestId = `agent-${uuidv4()}`;
const normalizedProjectId = projectId?.trim();
const body: GeminiInternalRequest = {
project: projectId,
requestId: requestId,
request: innerRequest as GeminiInternalRequest['request'],
model: config.finalModel,
@@ -172,6 +173,10 @@ export function transformClaudeRequestIn(
requestType: config.requestType,
};
if (normalizedProjectId) {
body.project = normalizedProjectId;
}
if (claudeReq.metadata?.user_id) {
body.sessionId = claudeReq.metadata.user_id;
}
+1 -1
View File
@@ -269,7 +269,7 @@ export interface GeminiRequest {
}
export interface GeminiInternalRequest {
project: string;
project?: string;
requestId: string;
request: GeminiRequest;
model: string;