diff options
| author | Sandy Tao <[email protected]> | 2025-08-13 13:33:04 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-13 20:33:04 +0000 |
| commit | 61047173a8f5bc279f480c5ab150d74337c0265a (patch) | |
| tree | 9ebe7f4170c57ef39f466aee38af08d3e61ee2ff /packages/core/src/config/config.ts | |
| parent | a90aeb3d8fd05fc6303ce9ef4e957c2e19cbe9c4 (diff) | |
fix(core): Discard thought signature when switching from Gemini API Key to OAuth (#6090)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/config/config.ts')
| -rw-r--r-- | packages/core/src/config/config.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 7c61f239..5c11667b 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -379,13 +379,21 @@ export class Config { const newGeminiClient = new GeminiClient(this); await newGeminiClient.initialize(newContentGeneratorConfig); + // Vertex and Genai have incompatible encryption and sending history with + // throughtSignature from Genai to Vertex will fail, we need to strip them + const fromGenaiToVertex = + this.contentGeneratorConfig?.authType === AuthType.USE_GEMINI && + authMethod === AuthType.LOGIN_WITH_GOOGLE; + // Only assign to instance properties after successful initialization this.contentGeneratorConfig = newContentGeneratorConfig; this.geminiClient = newGeminiClient; // Restore the conversation history to the new client if (existingHistory.length > 0) { - this.geminiClient.setHistory(existingHistory); + this.geminiClient.setHistory(existingHistory, { + stripThoughts: fromGenaiToVertex, + }); } // Reset the session flag since we're explicitly changing auth and using default model |
