From e960586bb5623612b031fbecf0c23fefa0511f47 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Tue, 26 May 2026 15:56:41 +0000 Subject: [PATCH] fix(handlers): log ignored descendant query errors in pause/resume workspace_restart.go Pause and Resume handlers were silently ignoring QueryContext errors when fetching descendant workspaces. Log the errors without changing behavior (rows != nil guard already prevents panic). Co-Authored-By: Claude Opus 4.7 --- .../internal/handlers/workspace_restart.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/workspace-server/internal/handlers/workspace_restart.go b/workspace-server/internal/handlers/workspace_restart.go index 0c4cc6a29..f7769006a 100644 --- a/workspace-server/internal/handlers/workspace_restart.go +++ b/workspace-server/internal/handlers/workspace_restart.go @@ -868,12 +868,15 @@ func (h *WorkspaceHandler) Pause(c *gin.Context) { // Collect this workspace + all descendants to pause toPause := []struct{ id, name string }{{id, wsName}} - rows, _ := db.DB.QueryContext(ctx, + rows, err := db.DB.QueryContext(ctx, `WITH RECURSIVE descendants AS ( SELECT id, name FROM workspaces WHERE parent_id = $1 AND status NOT IN ('removed', 'paused') UNION ALL SELECT w.id, w.name FROM workspaces w JOIN descendants d ON w.parent_id = d.id WHERE w.status NOT IN ('removed', 'paused') ) SELECT id, name FROM descendants`, id) + if err != nil { + log.Printf("Pause: descendant query failed for %s: %v", id, err) + } if rows != nil { defer rows.Close() for rows.Next() { @@ -954,12 +957,15 @@ func (h *WorkspaceHandler) Resume(c *gin.Context) { tier int } toResume := []wsInfo{{id, wsName, dbRuntime, tier}} - rows, _ := db.DB.QueryContext(ctx, + rows, err := db.DB.QueryContext(ctx, `WITH RECURSIVE descendants AS ( SELECT id, name, tier, COALESCE(runtime, 'claude-code') AS runtime FROM workspaces WHERE parent_id = $1 AND status = 'paused' UNION ALL SELECT w.id, w.name, w.tier, COALESCE(w.runtime, 'claude-code') FROM workspaces w JOIN descendants d ON w.parent_id = d.id WHERE w.status = 'paused' ) SELECT id, name, tier, runtime FROM descendants`, id) + if err != nil { + log.Printf("Resume: descendant query failed for %s: %v", id, err) + } if rows != nil { defer rows.Close() for rows.Next() { -- 2.52.0