Skip to content

Conversation

@Momentum96
Copy link
Contributor

@Momentum96 Momentum96 commented Jan 13, 2026

Summary

  • Fix categories not being deep merged when combining user and project configs
  • Add comprehensive tests for mergeConfigs() function

Problem

When merging user (~/.config/opencode/oh-my-opencode.json) and project (.opencode/oh-my-opencode.json) configs, categories were simply spread instead of deep merged. This caused user-level category model settings to be completely overwritten by project-level configs, even when the project config only specified partial overrides like temperature.

Example of broken behavior:

// User config
{ "categories": { "general": { "model": "openai/gpt-5.2", "temperature": 0.5 } } }

// Project config  
{ "categories": { "general": { "temperature": 0.3 } } }

// Result (WRONG - model was lost!)
{ "categories": { "general": { "temperature": 0.3 } } }

Solution

Add deepMerge for categories field in mergeConfigs(), consistent with how agents and claude_code are already handled.

After fix:

// Result (CORRECT - model preserved, temperature overridden)
{ "categories": { "general": { "model": "openai/gpt-5.2", "temperature": 0.3 } } }

Testing

  • Added new test file src/plugin-config.test.ts with BDD-style tests
  • All 5 tests pass
  • bun run typecheck passes
  • bun run build succeeds

Summary by cubic

Fix category deep merge in mergeConfigs to preserve user settings. Prevent project overrides from wiping user-defined model fields.

  • Bug Fixes
    • Deep-merge categories (same as agents) to preserve existing fields and apply partial overrides.
    • Added mergeConfigs tests covering categories, agents, and disabled_hooks.

Written for commit 6d4cebd. Summary will update on new commits.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

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

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 2 files

Confidence score: 5/5

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

@Momentum96
Copy link
Contributor Author

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

When merging user and project configs, categories were simply
spread instead of deep merged. This caused user-level category
model settings to be completely overwritten by project-level
configs, even when the project config only specified partial
overrides like temperature.

Add deepMerge for categories field and comprehensive tests.
@Momentum96 Momentum96 force-pushed the fix/categories-deep-merge branch 2 times, most recently from 94167fb to 6d4cebd Compare January 13, 2026 14:09
@kdcokenny
Copy link
Collaborator

lgtm, thanks for the pr!

@kdcokenny kdcokenny merged commit 42de7c3 into code-yeongyu:dev Jan 13, 2026
2 checks passed
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.

2 participants