Repository navigation
refactor(config): move Kilo config discovery behind a generic seam - #15282
Conversation
Every marked line in the discovery, config and CLI write files now calls out to Kilo-owned code (core/src/kilocode/config/discovery.ts, util/src/kilocode/config/files.ts) and carries kilocode_change(config). The files are registered as rung 4 with the reason. The CLI reads the names from util because it may not import Core. Kilo behavior tests move to the Kilo-owned test paths, the upstream test fixtures keep their Kilo edits until a generic seam lands. markedLines limit 316 to 245.
Upstream discovery reads a ConfigDiscovery layout node with upstream defaults. The Kilo host replaces it with KiloConfigDiscovery.layout, so the default graph behaves as upstream and the upstream config tests run unchanged. Kilo v2 reads only kilo.json, kilo.jsonc and .kilo (product decision, 2026-10-20).
Move the kilo_port proofs to the host override, keep an upstream fallback for the write target instead of a non-null assertion, harden the host test, cover the kilo.jsonc write preference, and scope the config-name decision in the plans.
|
➖ v2 migration progress: 0.9% → 0.9% (+2 done, 0 total, 0 dropped; 89/9829 cells) Placement: 40 new marked lines in shared files (31 seam, 9 patch), 2 new Ratchets: 9 core-internal imports (base 9); shared patches by rung 20 seam, 7 patch (base 29 seam, 3 patch).
2 cells closed
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of
Files Reviewed (24 files)
Previous Review Summaries (4 snapshots, latest commit b6935ef)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b6935ef)Status: 1 Issue Found | Recommendation: Address before merge Incremental review of
Overview
Issue Details (click to expand)SUGGESTION
Fix these issues in Kilo Cloud Files Reviewed (9 files)
Previous review (commit 0b0e79f)Incremental review of
Files Reviewed (1 file)
Previous review (commit 6e5d97b)Status: No Issues Found | Recommendation: Merge Incremental review of
No memory-leak or resource-lifetime changes in this increment; it contains no runtime code. Files Reviewed (46 files)
Previous review (commit bd8845b)Status: No Issues Found | Recommendation: Merge The Kilo config-discovery behavior is now a Notes (not findings): managed config under the system directory now reads Files Reviewed (24 files)
Reviewed by deepseek-v4.1-flash-1017 · Input: 119.3K · Output: 46.1K · Cached: 4M Review guidance: REVIEW.md from base branch |
Kilo keeps its project config in .kilo. The sync skips upstream changes under .opencode (skipFiles), and the shared-patch counter does not count the removal.
CI checks the map on the PR merge commit, whose first-parent history has no intermediate progress.json from this branch. Use that output.
Port the parts of upstream's opencode-dev skill that apply to the Kilo host, with Kilo profile paths: service, API requests, logs, heap and CPU profiles, inspector. Each command was checked with bun dev in a temporary profile. Fix the log path of a test profile.
# Conflicts: # migration-tracking/plans/migration-context.md # script/upstream/shared-patches.json
…iscovery-seam # Conflicts: # script/upstream/shared-patches.json
The CLI updater read config.json/opencode.json(c) in the Kilo global directory, so autoupdate in kilo.json was ignored. Read KiloConfigFiles.names instead, the same source the CLI write commands use.
…iscovery-seam # Conflicts: # migration-tracking/progress/README.md # migration-tracking/progress/progress.json # script/upstream/shared-patches.json
What Problem This Solves
#15018, commit
4c51aabf0d8, put Kilo config discovery into upstream files. Core imported a Kilo module, and six upstream tests were changed to Kilo fixtures. These were registered as rung 3 but were feature patches by the host strategy.The internal-release decision also requires isolation from v1: a
kilo2binary must read and writekilo2config, not a shared project.kiloorkilo.json.Why This Change Was Made
Upstream discovery gets a generic layout node with upstream defaults. The Kilo host supplies the internal-release values through its existing overrides.
LayoutServicewith upstream defaults; no Kilo value, import or conditionKiloHost.overridesreplacesConfigDiscovery.nodewithKiloConfigDiscovery.layoutpackages/util/src/kilocode/config/files.tsconfig.jsonandopencode.json(c)kilo2.json(c), last defined policy wins9d90d892dcb)The layout has
names,directories,directoryFilesandwalk. It retains upstream behavior without the host. A whole discovery-service replacement would copy the upstream walk, system/MDM handling and global-root filter; the layout avoids that mirror.User Impact
Decision 12, updated 2026-10-21, is reflected in U-E1-07, U-E3-03, U-E3-12 and U-E8-02:
kilo2~/.config/kilo2/kilo2.json,kilo2.jsonc(platform/XDG equivalents apply)kilo2.json,kilo2.jsonc,.kilo2/kilo2, separate from v1kilo2.jsonkilo2.json(c), elsekilo2.jsoncThere is no automatic filename fallback. Explicit config-path overrides still accept any filename. Root/global files read JSON then JSONC;
.kilo2reads JSONC then JSON, preserving v1 file ordering. The worktree boundary and global root-only rule are retained.Deliberate differences from v1:
kilo.json(c)and.kilokilo2namesopencode.json(c)and legacy.kilocode~/.kilocodeand~/.kilohome directoriesunattributed:config:db17aa6942cestays openkilo2tokilorename/migration at releaseThe repository's
.kilo/contributor tooling is not renamed. The repo's unused upstream.opencode/directory is deleted and registered inskipFiles, using the same process as #15151. New upstream additions under it stay removed.This PR merges the latest shipping base,
0311551d521, including #15288. The alpha installer already installs askilo2; the build, workflow smoke path and baseline runner now agree with it. The useful server-debugging instructions from the removedopencode-devskill are retained in.kilo/skills/v2-migration.Remaining work is not claimed complete: TUI
.opencodethemes/plugins, upstream-named system/MDM paths, Plan storage, Gateway project-ID files and updater distribution endpoints/install targets. These remain in the migration plan. Current config loading does not need a backend schema change; the existing schema endpoint proxies upstream's v2 schema plus Kilo extras.Placement
core/src/config/discovery.ts, consumed inconfig.tsKiloConfigDiscovery.layout,KiloHost.overridesutil/src/kilocode/config/files.ts; reasons in shared-patches registrykilo-cli/script/build.ts,src/app.ts; upstream CLI defaults unchangedShared-patch delta from current
origin/v2: 32 to 27 files, 288 to 204 marked lines, 39 unmarked lines unchanged, 0 deleted shared files. Core Kilo imports drop to zero in both discovery and config. Core-internal imports across Kilo adapters stay at 9.Progress map
87 to 89 done cells; this internal-release follow-up does not change the count.
unattributed:config:546539fc1643(global read order) andunattributed:config:8cdbdec70393(global write preference), with the internal-release filenames selected by decision 12.db17aa6942cestays open for home directories. Project trust confinement (4d540bb826f4,eb34f040b986) and managed paths (73db79553730) are not claimed reproduced.Evidence
Latest focused verification uses Bun 1.4.2:
run(), not manualcheck()(which bypasses policy). A stable-build child avoids the local-build guard. Real scoped files test disabled JSON, JSONC notification override and all five ignored legacy filenames. No network/install occurs. Mutation checks fail for old filenames and reversed precedence; ten repeated runs pass.kilo2build andscript/kilocode/smoke-host.ts: pass, including compiled version identity and isolated background-service startup/shutdown.bun run checkare blocked by the existing Node-type errors (zstdCompressSyncin AI;registerHooksin Plugin), not errors in changed files. Repository lint: 0 errors.Real self-tests, all with temporary profiles and no changes to user configuration:
bun dev debug config: globalkilo2.json(c), rootkilo2.jsonand.kilo2/kilo2.json(c)load in the expected order. V1/OpenCode files, the config above the worktree root and nested.kilo2inside the global directory are ignored..kilo2/kilo2.jsonand rootkilo2.jsonis reflected by the same service PID without restart.bun dev mcp add: existing project.kilo2/kilo2.jsonc, globalkilo2.jsoncand freshkilo2.jsonare the write targets. Seeded v1 project/global config and database bytes remain unchanged./kilo2-onlyfrom.kilo2/commandappears;/v1-onlyfrom.kilo/commandreports No matching commands. No model request was needed.bin/kilo2.