Skip to content

Commit adf37f1

Browse files
nicksenapclaude
andcommitted
fix: log errors in removeMCPConfig instead of dropping them
A permission failure on gw delete was silently leaving the grove entry in the workspace-root .mcp.json. Surface those via logging.Warn so users have a trail when cleanup misbehaves. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7f41190 commit adf37f1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

internal/workspace/workspace.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,20 @@ func removeMCPConfig(ws models.Workspace) {
245245
}
246246
delete(servers, "grove")
247247
if len(servers) == 0 {
248-
os.Remove(path)
248+
if err := os.Remove(path); err != nil && !os.IsNotExist(err) {
249+
logging.Warn("could not remove %s: %s", path, err)
250+
}
249251
return
250252
}
251253
existing["mcpServers"] = servers
252-
out, _ := json.MarshalIndent(existing, "", " ")
253-
os.WriteFile(path, out, 0o644)
254+
out, err := json.MarshalIndent(existing, "", " ")
255+
if err != nil {
256+
logging.Warn("could not marshal %s: %s", path, err)
257+
return
258+
}
259+
if err := os.WriteFile(path, out, 0o644); err != nil {
260+
logging.Warn("could not update %s: %s", path, err)
261+
}
254262
}
255263

256264
// Delete removes a workspace and its worktrees.

0 commit comments

Comments
 (0)