Conversation
…witch
The __wesight_managed.claudeCode.originalEnv snapshot was captured once
("first seen wins") and never updated. When the local Claude Code provider
was changed outside WeSight (e.g. by a config switcher that rewrites
settings.json), switching to or restarting with "local CLI config" restored
the outdated snapshot and silently reverted the user's provider/model.
Record the overlay env WeSight last wrote as managedEnv. On merge/cleanup,
if the live env no longer matches that overlay, treat it as an external
change: keep the live values and refresh the snapshot instead of restoring
the stale one. Legacy metadata without managedEnv keeps the old behavior.
|
@yanyanyanyan0918-cmyk is attempting to deploy a commit to the canghe's projects Team on Vercel. A member of the Team first needs to authorize it. |
Synced with
|
Summary
__wesight_managed.claudeCode.originalEnvsnapshot in~/.claude/settings.jsonis captured once ("first seen wins") and never updated.settings.jsonwhile preserving the__wesight_managedblock — restarting WeSight or switching the config source to "local CLI config" (本机配置) restores the outdated snapshot, silently reverting the user's provider/model to a previously used one.managedEnvin the managed metadata. On merge/cleanup, if the live env no longer matches that overlay, treat it as an external change: keep the live values and refresh the snapshot instead of restoring the stale one. Legacy metadata withoutmanagedEnvkeeps the previous behavior.Reproduction
settings.json, preserving__wesight_managedwith snapshot A).removeWesightManagedClaudeSettingsrestores provider A intoenv; the UI and launched Claude Code use A instead of B.Test plan
npx vitest run src/main/libs/externalAgentConfigSync.test.ts— 27/27 pass (4 new cases: managedEnv recording, external switch preserved on cleanup, snapshot refresh on next merge, legacy metadata backward compatibility)npx vitest run— no new failures (1 pre-existing environment-dependent failure inexternalAgentEnvironment.test.ts, also fails on cleanmain)npx tsc --noEmitclean;npx eslinton changed files clean