fix branch summary when using ambient auth (#6595)

allow null apiKey. uses the same auth flow like compaction

fixes #6324
This commit is contained in:
David Brailovsky
2026-07-13 10:49:10 +02:00
committed by GitHub
parent 298665cfb9
commit 7303cbac5d
3 changed files with 66 additions and 5 deletions
@@ -399,7 +399,7 @@ export class AgentSession {
throw new Error(formatNoApiKeyFoundMessage(model.provider));
}
private async _getCompactionRequestAuth(model: Model<any>): Promise<{
private async _getSummarizationRequestAuth(model: Model<any>): Promise<{
apiKey?: string;
headers?: Record<string, string>;
env?: Record<string, string>;
@@ -1744,7 +1744,7 @@ export class AgentSession {
throw new Error(formatNoModelSelectedMessage());
}
const { apiKey, headers, env } = await this._getCompactionRequestAuth(this.model);
const { apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model);
const pathEntries = this.sessionManager.getBranch();
const settings = this.settingsManager.getCompactionSettings();
@@ -2012,7 +2012,7 @@ export class AgentSession {
headers = authResult.headers;
env = authResult.env;
} else {
({ apiKey, headers, env } = await this._getCompactionRequestAuth(this.model));
({ apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model));
}
const pathEntries = this.sessionManager.getBranch();
@@ -2881,7 +2881,7 @@ export class AgentSession {
let summaryDetails: unknown;
if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
const model = this.model!;
const { apiKey, headers, env } = await this._getRequiredRequestAuth(model);
const { apiKey, headers, env } = await this._getSummarizationRequestAuth(model);
const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
const result = await generateBranchSummary(entriesToSummarize, {
model,
@@ -66,7 +66,7 @@ export interface GenerateBranchSummaryOptions {
/** Model to use for summarization */
model: Model<any>;
/** API key for the model */
apiKey: string;
apiKey?: string;
/** Request headers for the model */
headers?: Record<string, string>;
/** Provider-scoped environment values for the model */