MCPcopy
hub / github.com/coder/mux / getProvidersConfigForCompaction

Method getProvidersConfigForCompaction

src/node/services/agentSession.ts:2991–3018  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2989 }
2990
2991 private getProvidersConfigForCompaction(): ProvidersConfigMap | null {
2992 try {
2993 // Prefer ProviderService's safe config view: it includes env/file API-key source
2994 // metadata plus the Codex OAuth presence bit, which context-limit resolution needs
2995 // to distinguish GPT-5.5 API-key requests from lower-cap OAuth-routed requests.
2996 const maybeAIService = this.aiService as AIService & {
2997 getProvidersConfig?: () => ProvidersConfigMap | null;
2998 };
2999 if (typeof maybeAIService.getProvidersConfig === "function") {
3000 return maybeAIService.getProvidersConfig();
3001 }
3002
3003 // Some unit tests provide minimal service mocks; fall back to raw config so custom
3004 // provider model context overrides still work in those environments.
3005 const maybeConfig = this.config as Config & {
3006 loadProvidersConfig?: () => ProvidersConfigMap | null;
3007 };
3008 if (typeof maybeConfig.loadProvidersConfig !== "function") {
3009 return null;
3010 }
3011
3012 return maybeConfig.loadProvidersConfig() as unknown as ProvidersConfigMap | null;
3013 } catch {
3014 // Best-effort read: if config cannot be loaded, keep null and rely on
3015 // built-in model limits. This matches prior behavior without crashing.
3016 return null;
3017 }
3018 }
3019
3020 private is1MContextEnabledForModel(
3021 modelString: string,

Callers 2

sendMessageMethod · 0.95
streamWithHistoryMethod · 0.95

Calls 2

getProvidersConfigMethod · 0.80
loadProvidersConfigMethod · 0.80

Tested by

no test coverage detected