Skip to content

fix(prometheus): respect agent model override instead of using global opencode.json model (fixes #2693)#2753

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/prometheus-model-override
Mar 25, 2026
Merged

fix(prometheus): respect agent model override instead of using global opencode.json model (fixes #2693)#2753
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/prometheus-model-override

Conversation

@MoerAI
Copy link
Copy Markdown
Contributor

@MoerAI MoerAI commented Mar 23, 2026

Summary

  • Skip the global opencode.json model (uiSelectedModel) when the user explicitly configures a Prometheus-specific model override
  • Separate category model into its correct pipeline slot (categoryDefaultModel) instead of folding into userModel

Problem

When opencode.json sets a global model to Gemini (e.g., "model": "google/gemini-3.1-pro-preview") and the user explicitly configures agents.prometheus.model to a Claude model in oh-my-opencode.json, Prometheus still uses the Gemini model and its Gemini-specific prompt.

Root cause: buildPrometheusAgentConfig() passes params.currentModel (the global model) as uiSelectedModel unconditionally. Since uiSelectedModel is Step 1 (highest priority) in resolveModelPipeline(), it short-circuits before ever reaching Step 2 where the user's Prometheus-specific model override lives.

All other agents guard against this:

  • Sisyphus (sisyphus-agent.ts): uiSelectedModel: sisyphusOverride?.model ? undefined : uiSelectedModel
  • Atlas (atlas-agent.ts): uiSelectedModel: orchestratorOverride?.model ? undefined : uiSelectedModel
  • General agents (general-agents.ts): uiSelectedModel: (isPrimaryAgent && !override?.model) ? uiSelectedModel : undefined

Prometheus lacked this guard.

Fix

Applied the same guard pattern used by all other agents:

const configuredPrometheusModel =
  params.pluginPrometheusOverride?.model ?? categoryConfig?.model;

resolveModelPipeline({
  intent: {
    uiSelectedModel: configuredPrometheusModel ? undefined : params.currentModel,
    userModel: params.pluginPrometheusOverride?.model,
    categoryDefaultModel: categoryConfig?.model,
  },
  ...
});

When the user explicitly configures a Prometheus model (via agents.prometheus.model or category config), uiSelectedModel is set to undefined, allowing the user's override to take priority. Additionally, categoryConfig?.model is now correctly placed in categoryDefaultModel instead of being folded into userModel.

Changes

File Change
src/plugin-handlers/prometheus-agent-config-builder.ts Added uiSelectedModel guard matching other agents; separated categoryDefaultModel from userModel

Fixes #2693


Summary by cubic

Fix Prometheus to honor its agent-specific model override instead of the global opencode.json model, and put the category model in the correct pipeline slot. Fixes #2693.

  • Bug Fixes
    • Ignore uiSelectedModel when a Prometheus-specific or category model is set, so the override wins in resolveModelPipeline().
    • Use categoryDefaultModel for the category model instead of userModel.

Written for commit 11f1d71. Summary will update on new commits.

@MoerAI
Copy link
Copy Markdown
Contributor Author

MoerAI commented Mar 23, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Follows established patterns in the codebase to fix model priority issues and aligns Prometheus agent configuration with other agents.

@code-yeongyu code-yeongyu added the triage:bug-fix PR: Bug fix label Mar 24, 2026
@code-yeongyu code-yeongyu merged commit 422eaa9 into code-yeongyu:dev Mar 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:bug-fix PR: Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Prometheus agent uses Gemini-specific prompt when opencode.json global model is Gemini, ignoring agent-specific model override

2 participants