-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[Bug] Prometheus agent ignores fallback chain when no explicit model is configured #2986
Description
Problem Description
When using the Prometheus agent without an explicit model configuration, it incorrectly uses the UI-selected model directly instead of following the fallback chain defined in AGENT_MODEL_REQUIREMENTS. This causes Prometheus to bypass the intended fallback logic (claude-opus-4-6 → gpt-5.4 → glm-5 → gemini-3.1-pro) and use whatever model is currently selected in the UI.
Expected Behavior
When agents.prometheus.model is not explicitly configured, Prometheus should:
- Use the UI-selected model only if it matches the primary model (claude-opus-4-6)
- Otherwise, follow the fallback chain to find an available model (gpt-5.4, etc.)
This behavior should be consistent with other primary agents like Sisyphus and Atlas.
Actual Behavior
Prometheus always uses params.currentModel (UI-selected model) when no explicit configuration exists, completely bypassing the fallback chain resolution.
Root Cause Analysis
The issue is in src/plugin-handlers/prometheus-agent-config-builder.ts at line 47:
Current code (problematic):
const configuredPrometheusModel =
params.pluginPrometheusOverride?.model ?? categoryConfig?.model;
const modelResolution = resolveModelPipeline({
intent: {
uiSelectedModel: configuredPrometheusModel ? undefined : params.currentModel, // ← BUG
userModel: params.pluginPrometheusOverride?.model,
categoryDefaultModel: categoryConfig?.model,
},
// ...
});The condition configuredPrometheusModel ? undefined : params.currentModel passes uiSelectedModel to the resolution pipeline when either pluginPrometheusOverride?.model or categoryConfig?.model is undefined.
However, when neither is configured (common case), this causes:
configuredPrometheusModel=undefineduiSelectedModel=params.currentModel(UI-selected model)resolveModelPipelinereturns the UI model immediately (line 49-53 in model-resolution-pipeline.ts), skipping the fallback chain
Comparison with Other Agents
Other primary agents (Sisyphus, Atlas) use the correct pattern:
Sisyphus (src/agents/builtin-agents/sisyphus-agent.ts line 55):
uiSelectedModel: sisyphusOverride?.model !== undefined ? undefined : uiSelectedModel,Atlas (src/agents/builtin-agents/atlas-agent.ts line 42):
uiSelectedModel: orchestratorOverride?.model !== undefined ? undefined : uiSelectedModel,These only skip uiSelectedModel when the user explicitly configures a model, not when category config is missing.
Suggested Fix
Change line 47 in prometheus-agent-config-builder.ts to match the pattern used by other agents:
// Before (incorrect):
uiSelectedModel: configuredPrometheusModel ? undefined : params.currentModel,
// After (correct):
uiSelectedModel: params.pluginPrometheusOverride?.model !== undefined ? undefined : params.currentModel,This ensures:
- If user explicitly sets
agents.prometheus.model, use that model - Otherwise, use UI-selected model AND allow fallback chain resolution to work
Environment
- oh-my-opencode version: 3.14.0
- OpenCode version: v1.3.5
Additional Context
This issue makes it impossible to rely on the fallback chain for Prometheus unless the user explicitly configures a model, which defeats the purpose of having sensible defaults for primary agents.