Skip to content

Prioritize opencode config files over kilo config files#8756

Closed
aravhawk wants to merge 1 commit intoKilo-Org:mainfrom
aravhawk:claude/awesome-maxwell-6gb1O
Closed

Prioritize opencode config files over kilo config files#8756
aravhawk wants to merge 1 commit intoKilo-Org:mainfrom
aravhawk:claude/awesome-maxwell-6gb1O

Conversation

@aravhawk
Copy link
Copy Markdown
Contributor

@aravhawk aravhawk commented Apr 10, 2026

Context

This change reorders the configuration file loading priority to prioritize opencode.* config files over kilo.* config files. This ensures that opencode-specific configurations take precedence, allowing for a cleaner migration path from kilo to opencode naming conventions.

Implementation

Updated four locations in packages/opencode/src/config/config.ts where configuration files are loaded:

  1. Project config loading (line 283): Reordered file array to check opencode.jsonc, opencode.json before kilo.jsonc, kilo.json
  2. Directory config loading (line 314): Applied same reordering for consistency
  3. Managed directory config loading (line 372): Applied same reordering
  4. Global config loading (lines 1545-1553): Restructured to load opencode files first, then kilo files last (with a comment noting that kilo files take priority in this specific context due to merge order)

The changes maintain backward compatibility by still loading kilo config files, but ensure opencode files are preferred when both exist. The merge order in the global config loading was adjusted so kilo files are merged last, giving them priority in that specific context.

How to Test

  • Verify that when both opencode.json and kilo.json exist in the same directory, the opencode file values take precedence
  • Confirm that existing kilo config files continue to work as fallbacks
  • Run existing config loading tests to ensure no regressions

… loading

The config file merge order was reversed — opencode files were loaded last
(highest priority), causing opencode.json settings to override kilo.json.
This fixes all 4 config loading paths (project, directory, managed, global)
so kilo files are loaded last and take priority as intended.

Fixes Kilo-Org#7621

https://claude.ai/code/session_01LQKpfKCbSdZm34LYwNcMQP
if (!Flag.KILO_DISABLE_PROJECT_CONFIG) {
// kilocode_change start
for (const file of ["kilo.jsonc", "kilo.json", "opencode.jsonc", "opencode.json"]) {
for (const file of ["opencode.jsonc", "opencode.json", "kilo.jsonc", "kilo.json"]) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: This reorder still gives kilo.* higher precedence

mergeConfigConcatArrays(result, await loadFile(file)) treats the newly loaded file as the overriding source, so the last filename in this array wins. With opencode.* first and kilo.* last, a repo that has both files will still apply the legacy kilo values over the opencode ones. The same ordering issue also affects the directory and managed-directory loops below.

Suggested change
for (const file of ["opencode.jsonc", "opencode.json", "kilo.jsonc", "kilo.json"]) {
for (const file of ["kilo.jsonc", "kilo.json", "opencode.jsonc", "opencode.json"]) {

mergeDeep(await loadFile(path.join(Global.Path.config, "opencode.jsonc"))),
mergeDeep(await loadFile(path.join(Global.Path.config, "opencode.json"))),
// kilocode_change start — kilo files loaded last so they take priority
mergeDeep(await loadFile(path.join(Global.Path.config, "kilo.jsonc"))),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Global precedence is reversed here too

In this pipe() chain, later mergeDeep(...) calls override earlier ones. Loading kilo.jsonc and kilo.json after the opencode.* files means the legacy global configs still win whenever both exist, which conflicts with the migration goal in this PR.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 10, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
None - None

WARNING

File Line Issue
packages/opencode/src/config/config.ts 283 Reordering the per-file load loop still leaves kilo.* with higher precedence because later merges override earlier ones.
packages/opencode/src/config/config.ts 1551 The global pipe() merge order also loads kilo.* last, so legacy global config still overrides opencode.*.

SUGGESTION

File Line Issue
None - None
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
None - None
Files Reviewed (1 files)
  • packages/opencode/src/config/config.ts - 2 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · 214,700 tokens

@aravhawk
Copy link
Copy Markdown
Contributor Author

Re-implemented better in #8781

@aravhawk aravhawk closed this Apr 11, 2026
@aravhawk aravhawk deleted the claude/awesome-maxwell-6gb1O branch April 11, 2026 18:41
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