Skip to content

Conversation

@acamq
Copy link

@acamq acamq commented Jan 26, 2026

Summary

  • Fixed provider detection in oh-my-opencode installer to eliminate false positives
  • Fixed provider detection for categories-only configurations
  • Fixed Claude detection to exclude OpenCode Zen models
  • Fixed isMax20 to only check Anthropic Opus (not Copilot/OpenCode Zen)
  • Replaced fragile string-based detection with robust JSON parsing
  • Added support for Copilot detection (was completely missing)
  • Added comprehensive roundtrip tests for all providers

Problem

The installer was incorrectly detecting AI providers in four scenarios:

1. Aggressive Defaults

The installer was initializing with hasClaude: true, hasOpenAI: true by default, causing false positives when no providers were actually configured.

2. Categories-Only Configs (CRITICAL FIX)

When users configured models in categories section without an agents block (which is allowed by schema), provider detection returned all false. This broke provider detection for users who only override categories.

3. Claude Detection False Positives (CRITICAL FIX)

The hasAnyOtherClaude check matched any model containing "claude" substring, which incorrectly matched OpenCode Zen models like opencode/claude-opus-4-5. This caused OpenCode Zen-only configs to be misclassified as having Anthropic subscriptions and isMax20 enabled, leading to incorrect TUI defaults and auth prompts.

4. isMax20 Over-Detection (CRITICAL FIX)

Initial fix used findModelContaining("claude-opus") which matched ANY provider's Opus models (Copilot, OpenCode Zen). This caused false positives - isMax20 should ONLY be true for Anthropic's claude-opus-4-5 model, not for Copilot's github-copilot/claude-opus-4.5 or OpenCode Zen's opencode/claude-opus-4-5.

5. Fragile String-Based Detection

Used configStr.includes('"openai/') which could match in comments or unrelated strings.

6. Missing Copilot Detection

hasCopilot always returned false - no detection logic existed.

Solution

  1. Conservative defaults: Changed all defaults to false - only reports providers that actually exist in config
  2. JSON-based detection: Created findProviderInObjects() helper that traverses config objects and checks model strings with startsWith()
  3. Categories support: detectProvidersFromOmoConfig() now scans BOTH agents and categories sections
  4. Claude detection fix: Restricted to anthropic/ prefix only, excluding opencode/ models
  5. isMax20 fix: ONLY checks for anthropic/claude-opus-4-5 - does NOT match Copilot or OpenCode Zen Opus models
  6. Complete provider support: Added detection for Copilot via github-copilot/ prefix in model strings
  7. Fixed isMax20 detection: Now scans ALL models in config (not just sisyphus), but only for Anthropic Opus

Changes

  • src/cli/config-manager.ts:
    • Rewrote detectProvidersFromOmoConfig() to check both agents and categories
    • Added detectProvidersFromConfig() helper for direct config object testing
    • Conservative defaults, JSON parsing, complete provider support
    • Fixed isMax20 to detect from any model, but ONLY for anthropic/claude-opus-4-5
    • Fixed Claude detection to use anthropic/ prefix, excluding opencode/ models
    • Removed findModelContaining() helper that caused over-detection
  • src/cli/config-manager.test.ts:
    • Added 3 new tests: categories-only config, mixed agents+categories, OpenCode Zen-only config
    • Added tests verifying Copilot Opus and OpenCode Zen Opus do NOT set isMax20
    • Tests verify provider detection works correctly for all scenarios
    • Tests verify OpenCode Zen models don't trigger false Claude detection
    • Tests verify isMax20 only triggers for Anthropic Opus
    • Total: 34 tests (was 29)

Testing

  • ✅ Type check passes
  • ✅ 34/34 config tests pass (127 assertions)
  • ✅ 202/202 CLI tests pass (470 assertions)
  • ✅ Zero regressions

Checklist

  • bun run typecheck passes
  • bun run build succeeds
  • All tests pass locally
  • No version changes (managed by CI)

- Replace aggressive defaults with conservative detection
- Replace fragile string matching with JSON-based provider detection
- Add Copilot detection support (github-copilot/ prefix)
- Add comprehensive roundtrip tests for all providers
- Fix false positives when no providers configured

Fixes: OpenAI, Copilot, and other providers now properly detected
when already configured. Installer shows accurate provider state
instead of assuming providers exist.

Tests: 29 config tests, 197 CLI tests, all passing
@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@acamq
Copy link
Author

acamq commented Jan 26, 2026

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

@acamq
Copy link
Author

acamq commented Jan 26, 2026

recheck

github-actions bot added a commit that referenced this pull request Jan 26, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64a069ed18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link

@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 4 files

Confidence score: 5/5

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

When users configure models in the categories section without an
agents block (which is allowed by the schema), provider detection
was returning all false. This broke provider detection for users
who only override categories.

Changes:
- Modified detectProvidersFromOmoConfig to scan both agents and categories
- Added detectProvidersFromConfig helper for direct config object testing
- Fixed isMax20 detection to scan all models, not just sisyphus
- Added tests for categories-only and mixed agents+categories scenarios
- Exported getOmoConfig and detectProvidersFromConfig for testing

Tests: 31 config tests, 199 CLI tests, all passing
Copy link

@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 4 files

Confidence score: 5/5

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

@acamq
Copy link
Author

acamq commented Jan 26, 2026

@codex review

The hasAnyOtherClaude check was matching any model containing "claude"
substring, which incorrectly matched OpenCode Zen models like
opencode/claude-opus-4-5. This caused OpenCode Zen-only
configs to be misclassified as having Anthropic subscriptions.

Changes:
- Restricted Claude detection to anthropic/ prefix only
- This excludes opencode/claude-* models from Claude detection
- Added test for OpenCode Zen-only config to verify correct behavior

Tests: 32 config tests, 200 CLI tests, all passing
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45ef7c36de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link

@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 4 files

Confidence score: 5/5

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

The isMax20 flag should ONLY be true when using Anthropic's
claude-opus-4-5 model. Copilot and OpenCode Zen Opus
models (github-copilot/claude-opus-4.5, opencode/claude-opus-4-5)
should NOT trigger isMax20=true.

Reverted change that used findModelContaining() for any provider's
Opus models. Restored original logic that checks specifically
for anthropic/claude-opus-4-5.

Updated test expectations:
- Copilot Opus: isMax20=false (not Anthropic)
- OpenCode Zen Opus: isMax20=false (not Anthropic)

Tests: 34 config tests, 202 CLI tests, all passing
Copy link

@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 4 files

Confidence score: 5/5

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

nludd25 pushed a commit to nludd25/oh-my-opencode that referenced this pull request Jan 26, 2026
@acamq
Copy link
Author

acamq commented Jan 27, 2026

I'm going to be honest, I'm not sure this is necessary. Does the installer need to detect existing configurations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant