From b68546d0582b6f8f5cd869b4688f6ca1a72ccbce Mon Sep 17 00:00:00 2001 From: Samuel K Date: Fri, 21 Aug 2026 05:36:46 +0000 Subject: [PATCH] fix(client): stream internal subprocess logs through PipeJSONStream deleteContainer/stopContainer capture stdout/stderr from `devsy internal agent workspace delete|stop`, which cmd/internal/agent.go always forces to --log-output json. Piping that through log.Writer re-logged each raw JSON line verbatim as a message, producing doubly nested JSON log records. Switch to log.PipeJSONStream, which unwraps each line and re-emits it at its original level, matching the existing pattern used for other internal JSON-emitting subprocesses (ssh.go, gpg_tunnel.go, proxy_client.go). Signed-off-by: Samuel K --- .../clientimplementation/workspace_client.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/client/clientimplementation/workspace_client.go b/pkg/client/clientimplementation/workspace_client.go index 96b3ce48c..0859088c3 100644 --- a/pkg/client/clientimplementation/workspace_client.go +++ b/pkg/client/clientimplementation/workspace_client.go @@ -561,8 +561,11 @@ func (s *workspaceClient) deleteContainer(ctx context.Context, opt client.Delete return nil } - writer := log.Writer(log.LevelInfo) - defer func() { _ = writer.Close() }() + writer, done := log.PipeJSONStream() + defer func() { + _ = writer.Close() + <-done + }() log.Info("deleting workspace container") command, err := s.agentWorkspaceCommand("delete") @@ -599,8 +602,11 @@ func (s *workspaceClient) deleteMachine(ctx context.Context, opt client.DeleteOp } func (s *workspaceClient) stopContainer(ctx context.Context) error { - writer := log.Writer(log.LevelInfo) - defer func() { _ = writer.Close() }() + writer, done := log.PipeJSONStream() + defer func() { + _ = writer.Close() + <-done + }() log.Info("stopping container") command, err := s.agentWorkspaceCommand("stop")