fix: address CodeRabbitAI review feedback

- Replace busy-wait loop in refreshModels with Promise-based approach
- Remove duplicate error logging in opencode-models.ts handlers
- Fix multi-slash parsing in provider-icon.tsx (only handle exactly one slash)
- Use dynamic icon resolution for selected OpenCode model in trigger
- Fix misleading comment about merge precedence (static takes precedence)
- Add enabledOpencodeModels and opencodeDefaultModel to settings sync
- Add clarifying comments about session-only dynamic model settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Stefan de Vogelaere
2026-01-11 22:03:59 +01:00
committed by DhanushSantosh
parent 20cc401238
commit edcc4e789b
4 changed files with 65 additions and 52 deletions

View File

@@ -584,10 +584,13 @@ export interface AppState {
codexEnableImages: boolean; // Enable image processing
// OpenCode CLI Settings (global)
// Static OpenCode settings are persisted via SETTINGS_FIELDS_TO_SYNC
enabledOpencodeModels: OpencodeModelId[]; // Which static OpenCode models are available
opencodeDefaultModel: OpencodeModelId; // Default OpenCode model selection
// Dynamic models are session-only (not persisted) because they're discovered at runtime
// from `opencode models` CLI and depend on current provider authentication state
dynamicOpencodeModels: ModelDefinition[]; // Dynamically discovered models from OpenCode CLI
enabledDynamicModelIds: string[]; // Which dynamic models are enabled (model IDs)
enabledDynamicModelIds: string[]; // Which dynamic models are enabled (session-only)
cachedOpencodeProviders: Array<{
id: string;
name: string;
@@ -2036,6 +2039,8 @@ export const useAppStore = create<AppState & AppActions>()((set, get) => ({
: state.enabledOpencodeModels.filter((m) => m !== model),
})),
setDynamicOpencodeModels: (models) => {
// Dynamic models are session-only (not persisted to server) because they depend on
// current CLI authentication state and are re-discovered each session
// When setting dynamic models, auto-enable all of them if enabledDynamicModelIds is empty
const currentEnabled = get().enabledDynamicModelIds;
const newModelIds = models.map((m) => m.id);