Prioritize opencode config files over kilo config files#8756
Prioritize opencode config files over kilo config files#8756aravhawk wants to merge 1 commit intoKilo-Org:mainfrom
Conversation
… 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"]) { |
There was a problem hiding this comment.
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.
| 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"))), |
There was a problem hiding this comment.
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.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (1 files)
Fix these issues in Kilo Cloud Reviewed by gpt-5.4-20260305 · 214,700 tokens |
|
Re-implemented better in #8781 |
Context
This change reorders the configuration file loading priority to prioritize
opencode.*config files overkilo.*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.tswhere configuration files are loaded:opencode.jsonc,opencode.jsonbeforekilo.jsonc,kilo.jsonThe 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
opencode.jsonandkilo.jsonexist in the same directory, the opencode file values take precedence