Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 1.94 KB

File metadata and controls

61 lines (43 loc) · 1.94 KB

[sisyphus-bot]

Confirmed Bug

We have identified the root cause of this issue. The bug is in the config writing logic during installation.

Root Cause

File: src/cli/config-manager/write-omo-config.ts (line 46)

const merged = deepMergeRecord(existing, newConfig)

When a user runs oh-my-opencode install (even just to update settings), the installer:

  1. Reads the existing config (with user's custom model settings)
  2. Generates a new config based on detected provider availability
  3. Calls deepMergeRecord(existing, newConfig)
  4. Writes the result back

The problem: deepMergeRecord overwrites values in existing with values from newConfig. This means your custom "model": "openai/gpt-5.2-codex" gets overwritten by the generated default model (e.g., anthropic/claude-opus-4-6 if Claude is available).

Why This Happens

Looking at deepMergeRecord (line 24-25):

} else if (sourceValue !== undefined) {
  result[key] = sourceValue as TTarget[keyof TTarget]
}

Any defined value in the source (generated config) overwrites the target (user's config).

Fix Approach

The merge direction should be reversed to respect user overrides:

const merged = deepMergeRecord(newConfig, existing)

This ensures:

  • User's explicit settings take precedence
  • Only new/undefined keys get populated from generated defaults
  • Custom model choices are preserved

SEVERITY: HIGH

  • Impact: User configuration is overwritten without consent
  • Affected Files:
    • src/cli/config-manager/write-omo-config.ts
    • src/cli/config-manager/deep-merge-record.ts
  • Trigger: Running oh-my-opencode install (even for unrelated updates)

Workaround (Until Fix)

Backup your config before running install:

cp ~/.config/opencode/oh-my-opencode.jsonc ~/.config/opencode/oh-my-opencode.jsonc.backup

We're working on a fix that will preserve your explicit model configurations.