fix(config): clear stale context limit cache on provider updates
Rebuilding provider model limits prevents removed entries from leaking into later compaction decisions after config changes. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -33,6 +33,9 @@ export function applyProviderConfig(params: {
|
||||
const providers = params.config.provider as
|
||||
| Record<string, ProviderConfig>
|
||||
| undefined;
|
||||
const modelContextLimitsCache = params.modelCacheState.modelContextLimitsCache;
|
||||
|
||||
modelContextLimitsCache.clear()
|
||||
|
||||
const anthropicBeta = providers?.anthropic?.options?.headers?.["anthropic-beta"];
|
||||
params.modelCacheState.anthropicContext1MEnabled =
|
||||
@@ -61,7 +64,7 @@ export function applyProviderConfig(params: {
|
||||
const contextLimit = modelConfig?.limit?.context;
|
||||
if (!contextLimit) continue;
|
||||
|
||||
params.modelCacheState.modelContextLimitsCache.set(
|
||||
modelContextLimitsCache.set(
|
||||
`${providerID}/${modelID}`,
|
||||
contextLimit,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user