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:
YeonGyu-Kim
2026-03-14 13:48:59 +09:00
parent 16b0d9eb77
commit 612b9c163d
3 changed files with 138 additions and 1 deletions
@@ -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,
);