Merge a1a268c222 into da71eaebd2
This commit is contained in:
commit
43de6bd3e3
@ -148,26 +148,16 @@ export default function compactionSafeguardExtension(api: ExtensionAPI): void {
|
|||||||
|
|
||||||
const model = ctx.model;
|
const model = ctx.model;
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return {
|
// ctx.model may be undefined when extensionRunner.initialize() was not called
|
||||||
compaction: {
|
// (e.g. embedded runner mode). Fall through to built-in compaction which has
|
||||||
summary: fallbackSummary,
|
// correct model access via AgentSession.model.
|
||||||
firstKeptEntryId: preparation.firstKeptEntryId,
|
return undefined;
|
||||||
tokensBefore: preparation.tokensBefore,
|
|
||||||
details: { readFiles, modifiedFiles },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiKey = await ctx.modelRegistry.getApiKey(model);
|
const apiKey = await ctx.modelRegistry.getApiKey(model);
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
return {
|
// Fall through to built-in compaction rather than producing an empty summary.
|
||||||
compaction: {
|
return undefined;
|
||||||
summary: fallbackSummary,
|
|
||||||
firstKeptEntryId: preparation.firstKeptEntryId,
|
|
||||||
tokensBefore: preparation.tokensBefore,
|
|
||||||
details: { readFiles, modifiedFiles },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user