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:
7 files changed
+534
-13
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ export interface GeminiRequest {
|
||||
}
|
||||
|
||||
export interface GeminiInternalRequest {
|
||||
project: string;
|
||||
project?: string;
|
||||
requestId: string;
|
||||
request: GeminiRequest;
|
||||
model: string;
|
||||
|
||||
Reference in new issue
Block a user