Skip to content

fix(config): keep legacy settings when creating the global file - #176

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-56ae
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-56ae

Conversation

@cursor

@cursor cursor Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

lich profile use <name> and lich init --global create ~/.lich/config.json without copying ~/.config/lich/config.json. Once the global file exists, the legacy file is never read again.

A user whose only config is the legacy file (providers, tools_enabled, gateway allowlists) runs lich profile use coder. The new global file is { "profile": "coder" }. Tool restrictions disappear and the agent falls back to tools_enabled: "all". lich init --global does the same with a starter config, replacing a working model with the placeholder.

Root cause

use_profile wrote { ...read_global(), profile }, and read_global only reads ~/.lich/config.json. run_init --global wrote a starter into that path. load_layered_config treats an existing global file as the whole user config and skips the legacy path.

Fix

  • global_config_seed() copies the legacy file (plugin paths resolved, work_dir / session_dir stripped) when the global file does not exist yet. profile use writes that seed plus profile, and keeps the legacy file mode.
  • lich init --global refuses while the legacy file is still the live config, so a starter cannot hide it.

Validation

  • ./node_modules/.bin/tsc --noEmit passed.
  • node node_modules/vitest/vitest.mjs run test/first_run.test.ts test/cli_config.test.ts passed (61 tests), including the new cases for the refuse and the copy.
  • Full suite: 5 failures are environment-only (bun missing, dist/cli.js not built).
Open in Web View Automation 

lich profile use wrote {profile} into a new ~/.lich/config.json, which
stopped ~/.config/lich/config.json from being read and dropped tool
restrictions. Copy that legacy file forward. lich init --global refuses
while the legacy file is still the live config.

Co-authored-by: moikapy <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant