()
| 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, |
no test coverage detected