Fix/6499 config overwrite on mcp install - #6527
Closed
myipanta wants to merge 1 commit into
Closed
Conversation
…fails (esengine#6499) LoadForEdit silently falls back to config.Default() when the TOML file cannot be parsed (corrupt, malformed, or a migration error). Callers that mutate-then-save — notably applyInstallMCP — then persist this empty default config via SaveTo, which does a full rewrite. All provider keys, model settings, and other user configuration are lost. Add LoadForEditSafe(path) (*Config, error) that propagates parse errors when the file exists. When the file is absent (fresh start) it falls back to defaults safely. Switch applyInstallMCP, applySkillRoot, applyRemoveSkillRoot, and applyRemoveMCP to use the safe variant. Update TestApplyMCPRollsBackOnSaveFailure to reflect the new fail-fast behaviour: LoadForEditSafe rejects a directory path before connecting any MCP server, so no disconnect rollback is needed.
myipanta
force-pushed
the
fix/6499-config-overwrite-on-mcp-install
branch
from
July 15, 2026 12:16
fc61a13 to
b8194a6
Compare
Collaborator
|
Thanks for the fix. #6784 has now landed strict, no-write-on-parse-error handling for permission approval persistence. For the install_source / #6499 path covered here, #6505 is the broader implementation: it applies strict loading across MCP and skill install, remove, and uninstall paths, and includes wider regression coverage. Closing this PR as superseded by #6505 so the remaining config-edit work can be reviewed in one place. Thank you @myipanta for identifying and implementing the fail-before-write approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
Cache impact
Cache-impact: none — config load path only, no prompt/tool/system-prefix changes
Cache-guard: go test ./internal/installsource/ -count=1 covers MCP install apply path
System-prompt-review: N/A
For cache-sensitive changes, fill these lines before requesting review:
Cache-impact:none,low,medium, orhigh, plus the reason.Cache-guard: the focused guard test/command added or run, or why an existing guard covers the change.System-prompt-review: required reviewer/approval note when provider-visible system prompt, memory prefix, output style, or skill index behavior changes.