From fa51b7a7e8268e1df0f82654428b90017ede37f8 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Tue, 2 Jun 2026 01:10:59 +0000 Subject: [PATCH] fix: log silently ignored execAsRoot errors during plugin cleanup (re-created from staging #2047) - plugins_install.go: log error when skill directory removal fails during plugin uninstall. - plugins_install_pipeline.go: log error when awk marker-stripping fails during plugin uninstall. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/handlers/plugins_install.go | 6 ++++-- .../internal/handlers/plugins_install_pipeline.go | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/workspace-server/internal/handlers/plugins_install.go b/workspace-server/internal/handlers/plugins_install.go index 9696af8bc..5894b569d 100644 --- a/workspace-server/internal/handlers/plugins_install.go +++ b/workspace-server/internal/handlers/plugins_install.go @@ -171,9 +171,11 @@ func (h *PluginsHandler) uninstallViaDocker(ctx context.Context, c *gin.Context, log.Printf("Plugin uninstall: skipping invalid skill name %q in %s: %v", skill, pluginName, err) continue } - _, _ = h.execAsRoot(ctx, containerName, []string{ + if _, rmErr := h.execAsRoot(ctx, containerName, []string{ "rm", "-rf", "/configs/skills/" + skill, - }) + }); rmErr != nil { + log.Printf("Plugin uninstall: failed to remove skill %s from %s: %v", skill, workspaceID, rmErr) + } } // 3. Delete the plugin directory itself (as root to handle file ownership). diff --git a/workspace-server/internal/handlers/plugins_install_pipeline.go b/workspace-server/internal/handlers/plugins_install_pipeline.go index ce79f45ac..7fdb520d4 100644 --- a/workspace-server/internal/handlers/plugins_install_pipeline.go +++ b/workspace-server/internal/handlers/plugins_install_pipeline.go @@ -417,7 +417,9 @@ func (h *PluginsHandler) stripPluginMarkersFromMemory(ctx context.Context, conta `awk 'BEGIN{skip=0; blanks=0} /^%s/{skip=1; blanks=0; next} skip==1 && /^[[:space:]]*$/{blanks++; if(blanks>=2){skip=0; print; next} next} /^# Plugin: /{if(skip==1)skip=0} skip==1{next} {print}' /configs/CLAUDE.md > /tmp/claude.new && mv /tmp/claude.new /configs/CLAUDE.md`, regexpEscapeForAwk(marker), ) - _, _ = h.execAsRoot(ctx, containerName, []string{"bash", "-c", script}) + if _, awkErr := h.execAsRoot(ctx, containerName, []string{"bash", "-c", script}); awkErr != nil { + log.Printf("Plugin uninstall: failed to strip markers from CLAUDE.md for %s in %s: %v", pluginName, containerName, awkErr) + } } // regexpEscapeForAwk escapes characters that have special meaning inside an -- 2.52.0