diff --git a/components/AIChatSidePanel.tsx b/components/AIChatSidePanel.tsx
index 236257fda..af397e0e6 100644
--- a/components/AIChatSidePanel.tsx
+++ b/components/AIChatSidePanel.tsx
@@ -85,12 +85,14 @@ import { getAgentRuntime } from '../infrastructure/ai/harness/globalAgentRuntime
import { useAIPermissionGrantsState } from '../application/state/useAIPermissionGrantsState';
import { useConversationExport } from './ai/hooks/useConversationExport';
import { useAgentContextUsage } from '../application/state/useAgentCompactionUi';
+import { useModelCatalogWarningDismissal } from '../application/state/useModelCatalogWarningDismissal';
import type { AIChatSidePanelProps } from './AIChatSidePanel.types';
import {
buildCursorListModelsAgentEnv,
buildSdkRuntimeModelCacheKey,
sdkRuntimeModelCache,
reconcileRuntimeModelWarning,
+ isModelCatalogWarningVisible,
retainStoredModelPresetForCatalog,
toSdkRuntimeModelCatalog,
generateId,
@@ -361,6 +363,11 @@ const AIChatSidePanelActive: React.FC
= ({
const [isUndoingLastTurn, setIsUndoingLastTurn] = useState(false);
const [runtimeAgentModelPresets, setRuntimeAgentModelPresets] = useState>({});
const [runtimeModelWarnings, setRuntimeModelWarnings] = useState>({});
+ const {
+ dismissedKeys: dismissedModelCatalogKeys,
+ dismissWarning: dismissModelCatalogWarning,
+ rearmWarning: rearmModelCatalogWarning,
+ } = useModelCatalogWarningDismissal();
// Tracks SDK runtime model catalogs currently loading (per agent scope);
// the composer shows the loading row alongside the build-time presets and
// the live catalog replaces them when it arrives.
@@ -1352,6 +1359,11 @@ const AIChatSidePanelActive: React.FC = ({
t('ai.chat.modelCatalogWarning'),
);
});
+ // A clean catalog re-arms a banner the user previously dismissed, so a
+ // later failure for the same config is visible again.
+ if (catalog && !catalog.warning) {
+ rearmModelCatalogWarning(target.cacheKey);
+ }
return catalog;
}).catch((err) => {
setRuntimeModelWarnings((current) => {
@@ -1367,7 +1379,7 @@ const AIChatSidePanelActive: React.FC = ({
}
return null;
});
- }, [t, buildExternalAgentRuntimeModelTarget]);
+ }, [t, buildExternalAgentRuntimeModelTarget, rearmModelCatalogWarning]);
useEffect(() => {
if (!isVisible) return;
@@ -1390,6 +1402,9 @@ const AIChatSidePanelActive: React.FC = ({
Boolean(cached.warning),
t('ai.chat.modelCatalogWarning'),
));
+ if (!cached.warning) {
+ rearmModelCatalogWarning(target.cacheKey);
+ }
}
// Respect renderer TTL / in-flight coalescing for all SDK agents including
@@ -1470,6 +1485,7 @@ const AIChatSidePanelActive: React.FC = ({
buildExternalAgentRuntimeModelTarget,
loadSdkRuntimeModelCatalog,
applySdkRuntimeModelCatalog,
+ rearmModelCatalogWarning,
t,
]);
@@ -1625,6 +1641,14 @@ const AIChatSidePanelActive: React.FC = ({
applySdkRuntimeModelCatalog,
]);
+ // Hide the composer warning banner for this config until a clean catalog
+ // re-arms it. The underlying warning stays active so the model picker keeps
+ // its manual refresh action.
+ const handleDismissModelCatalogWarning = useCallback(() => {
+ const target = buildExternalAgentRuntimeModelTarget(currentAgentConfig);
+ dismissModelCatalogWarning(target?.cacheKey);
+ }, [currentAgentConfig, buildExternalAgentRuntimeModelTarget, dismissModelCatalogWarning]);
+
const selectedCattyThinking = agentThinkingMap.catty;
const handleCattyThinkingSelect = useCallback((level: string) => {
setAgentThinking('catty', level);
@@ -2516,6 +2540,17 @@ const AIChatSidePanelActive: React.FC = ({
&& runtimeModelWarnings[currentAgentId].cacheKey === buildExternalAgentRuntimeModelTarget(currentAgentConfig)?.cacheKey
? runtimeModelWarnings[currentAgentId].message
: undefined}
+ modelCatalogWarningDismissed={!hasCodexCustomConfig
+ && Boolean(
+ runtimeModelWarnings[currentAgentId]
+ && runtimeModelWarnings[currentAgentId].cacheKey === buildExternalAgentRuntimeModelTarget(currentAgentConfig)?.cacheKey
+ && !isModelCatalogWarningVisible(
+ runtimeModelWarnings[currentAgentId],
+ buildExternalAgentRuntimeModelTarget(currentAgentConfig)?.cacheKey,
+ dismissedModelCatalogKeys,
+ ),
+ )}
+ handleModelCatalogDismiss={handleDismissModelCatalogWarning}
modelCatalogLoading={
!hasCodexCustomConfig
&& Boolean(runtimeModelLoading[currentAgentId])
diff --git a/components/AIChatSidePanelHelpers.test.tsx b/components/AIChatSidePanelHelpers.test.tsx
index 3dda4ed15..e55b73799 100644
--- a/components/AIChatSidePanelHelpers.test.tsx
+++ b/components/AIChatSidePanelHelpers.test.tsx
@@ -17,6 +17,7 @@ import {
normalizeSdkRuntimeModelPresets,
resolveSdkRuntimeCatalogDefaultModelId,
reconcileRuntimeModelWarning,
+ isModelCatalogWarningVisible,
toSdkRuntimeModelCatalog,
shouldAdoptSdkCurrentModel,
shouldLoadSdkRuntimeModels,
@@ -685,6 +686,26 @@ test('reconcileRuntimeModelWarning clears only the banner that belongs to this c
assert.equal(reconcileRuntimeModelWarning(current, 'copilot', 'k2', false, 'warn'), current);
});
+test('isModelCatalogWarningVisible shows a matching, non-dismissed banner', () => {
+ const warning = { cacheKey: 'k1', message: 'cannot load models' };
+ assert.equal(isModelCatalogWarningVisible(warning, 'k1', new Set()), 'cannot load models');
+});
+
+test('isModelCatalogWarningVisible hides a dismissed cache key but re-arms on a new key', () => {
+ const warning = { cacheKey: 'k1', message: 'cannot load models' };
+ const dismissed = new Set(['k1']);
+ assert.equal(isModelCatalogWarningVisible(warning, 'k1', dismissed), undefined);
+ // A config/agent switch produces a different cache key, which is not dismissed.
+ assert.equal(isModelCatalogWarningVisible({ cacheKey: 'k2', message: 'again' }, 'k2', dismissed), 'again');
+});
+
+test('isModelCatalogWarningVisible never shows a warning for another cache key or without a target', () => {
+ const warning = { cacheKey: 'k1', message: 'cannot load models' };
+ assert.equal(isModelCatalogWarningVisible(warning, 'k2', new Set()), undefined);
+ assert.equal(isModelCatalogWarningVisible(warning, undefined, new Set()), undefined);
+ assert.equal(isModelCatalogWarningVisible(undefined, 'k1', new Set()), undefined);
+});
+
test('cacheOnly hydration in AIChatSidePanel reconciles cached refresh warnings before applying persisted models', () => {
const source = readFileSync(new URL('./AIChatSidePanel.tsx', import.meta.url), 'utf8');
assert.match(
diff --git a/components/AIChatSidePanelHelpers.ts b/components/AIChatSidePanelHelpers.ts
index af96c1b9e..7a78a833f 100644
--- a/components/AIChatSidePanelHelpers.ts
+++ b/components/AIChatSidePanelHelpers.ts
@@ -293,6 +293,25 @@ export const sdkRuntimeModelCache = createSdkRuntimeModelCache();
export type RuntimeModelWarnings = Record;
+/**
+ * Whether a per-agent catalog warning should surface in the composer banner.
+ *
+ * A warning the user explicitly dismissed stays hidden for its cache key until
+ * a clean catalog is observed (the caller then drops the key from
+ * `dismissedKeys`). A warning belonging to a different cache key is never
+ * shown — config/agent switches must not inherit a stale dismissal.
+ */
+export function isModelCatalogWarningVisible(
+ warning: { cacheKey: string; message: string } | undefined,
+ cacheKey: string | undefined,
+ dismissedKeys: ReadonlySet,
+): string | undefined {
+ if (!warning || !cacheKey) return undefined;
+ if (warning.cacheKey !== cacheKey) return undefined;
+ if (dismissedKeys.has(cacheKey)) return undefined;
+ return warning.message;
+}
+
/**
* Make the per-agent catalog warning banner match a catalog result. Used both
* for cache reads and after a refresh settles: a refresh that coalesced onto