fix(cli): remember bash permission migration - #12642
Conversation
| @@ -344,13 +345,20 @@ export namespace KilocodeConfig { | |||
| * behavior now that the new default is `bash: "ask"`. | |||
There was a problem hiding this comment.
SUGGESTION: Docstring doesn't mention the new idempotency marker
The function's core fix in this PR is recording completion via .bash-permission-migrated so a later deletion of permission.bash (or an unrelated config edit on a fresh install) isn't re-migrated. Worth a line in the docstring explaining this, since the existing comment only describes the one-time write and not the marker-based skip-on-subsequent-runs behavior that this PR adds.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit abbeb3a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit abbeb3a)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit c6acd28)Status: 1 Issue Found | Recommendation: Merge Overview
Issue Details (click to expand)SUGGESTION
The migration logic is sound: the marker is checked first and short-circuits on every path (new user, explicit permission already set, schema-only file, legacy TOML, and after the write), all writes are entirely within Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 130.1K · Output: 9.9K · Cached: 554.8K Review guidance: REVIEW.md from base branch |
…sion-remigration # Conflicts: # packages/opencode/src/kilocode/config/config.ts
| // A schema-only file is generated for editor completion. It does not mean | ||
| // the user predates the bash permission default. | ||
| if (!hasLegacy && configs.every((item) => Object.keys(item.data).every((key) => key === "$schema"))) return | ||
| if (!hasLegacy && configs.every((item) => Object.keys(item.data).every((key) => key === "$schema"))) return done() |
There was a problem hiding this comment.
After these changes the migration will be marked as done even in cases of unreadable or malformed config. Fixing the config won't retry the migration. Can you address this issue? Potentially distinguish read/parse failures from empty valid configs and add regression tests to cover these scenarios.
…ed config Distinguish read/parse failures from empty valid configs so a transient file error or JSONC syntax error does not permanently mark the migration as done. Fixing the file now correctly retries.
| continue | ||
| } | ||
| const errors: ParseError[] = [] | ||
| const data = (parseJsonc(text, errors) as Record<string, unknown> | undefined) ?? {} |
There was a problem hiding this comment.
Thanks for addressing the comment, the change looks good, but please pass { allowTrailingComma: true } here to match ConfigParse.jsonc. Otherwise valid configs with trailing commas are treated as malformed and never receive the compatibility migration. Please add a regression test for that case.
Pass { allowTrailingComma: true } to match ConfigParse.jsonc so
valid JSONC with trailing commas is not treated as malformed and
correctly receives the compatibility migration. Add regression
test for trailing-comma config.
|
Thanks @noobezlol, I was able to reproduce the fix. Merged. |
Issue
Fixes #12625
Context
The compatibility migration that preserved
bash: "allow"for existing users ran on every startup without recording completion. Deleting the generated permission therefore made the next startup treat the config as unmigrated and insert it again.The same missing state could also misclassify a fresh installation later: once its schema-only config gained an unrelated setting, a future startup could treat it as an older config and add
bash: "allow".Implementation
Record completion of the bash permission migration in the global Kilo config directory. Completion is recorded whether the installation was migrated, already had an explicit permission, or was identified as fresh. Once recorded, later user edits are left untouched.
Marker writes are best-effort so a read-only config directory with an already valid permission cannot prevent startup.
Screenshots / Video
N/A — this changes config migration behavior without changing the UI.
How to Test
bun test test/kilocode/config/config.test.ts— 34 passedbun run typecheckinpackages/opencodegit diff --checkReviewer test steps
permission.bash.bash: "allow".bashpermission and restart Kilo.Checklist