From de156a4fbe7a70c3ff681bd357362f683e5182b3 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 14 Jul 2026 09:47:10 +0100 Subject: [PATCH] fix(output): suppress the pulumi-command AcceptEnv warning noise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The remote provider tries to pass PULUMI_COMMAND_STDOUT/STDERR as SSH env vars on every command; OpenSSH's default AcceptEnv rejects them and the provider warns — four lines of non-actionable noise per resource, burying the real output. The vars only control the provider's own log forwarding (stdout/stderr capture as outputs is unaffected), and the alternative — loosening every host's sshd AcceptEnv — is a fleet config change for a cosmetic win. Suppressed in the Printer via an exact-prefix known-noise filter, kept deliberately short so it never becomes the place real warnings go to die. Real warnings still print (tested). Claude-Session: https://claude.ai/code/session_012HJAUraibyPthDne5QG2FW --- internal/output/stream.go | 15 ++++++++++++++- internal/output/translate_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/internal/output/stream.go b/internal/output/stream.go index debb159..473969b 100644 --- a/internal/output/stream.go +++ b/internal/output/stream.go @@ -140,7 +140,7 @@ func (p *Printer) Handle(ev events.EngineEvent) { switch d.Severity { case "error", "warning", "info#err": msg := strings.TrimSpace(d.Message) - if msg == "" { + if msg == "" || isKnownNoise(msg) { return } if d.Severity == "error" && d.URN != "" { @@ -276,6 +276,19 @@ func (p *Printer) Finish() { _, _ = fmt.Fprintln(p.w, abortBanner) } +// isKnownNoise drops diagnostics that carry no operator-actionable signal and +// repeat on EVERY remote command of EVERY deploy. Currently exactly one: the +// pulumi-command remote provider tries to pass PULUMI_COMMAND_STDOUT/STDERR as +// SSH env vars, OpenSSH's default AcceptEnv rejects them, and the provider +// warns — harmless (the vars only control the provider's own log forwarding; +// command stdout/stderr capture is unaffected) and unfixable from here short +// of loosening every host's sshd AcceptEnv for a cosmetic win. Keep this list +// SHORT and exact-prefix-matched: a suppression that grows becomes a place +// real warnings go to die. +func isKnownNoise(msg string) bool { + return strings.HasPrefix(msg, "Unable to set 'PULUMI_COMMAND_") +} + func firstLine(s string) string { if i := strings.IndexByte(s, '\n'); i >= 0 { return strings.TrimSpace(s[:i]) diff --git a/internal/output/translate_test.go b/internal/output/translate_test.go index 8381aa3..c81b101 100644 --- a/internal/output/translate_test.go +++ b/internal/output/translate_test.go @@ -148,3 +148,27 @@ func TestPrinterDestructiveAccessor(t *testing.T) { t.Errorf("entry = %q", p.Destructive()[0]) } } + +// The pulumi-command remote provider warns about PULUMI_COMMAND_* SSH env vars +// on EVERY command of EVERY deploy — non-actionable noise that buried the real +// lines. It is suppressed; a real warning still prints. +func TestKnownNoiseWarningsAreSuppressed(t *testing.T) { + var buf bytes.Buffer + p := NewPrinter(&buf) + diag := func(sev, msg string) events.EngineEvent { + return events.EngineEvent{EngineEvent: apitype.EngineEvent{ + DiagnosticEvent: &apitype.DiagnosticEvent{Severity: sev, Message: msg}, + }} + } + p.Handle(diag("warning", "Unable to set 'PULUMI_COMMAND_STDERR'. This only works if your SSH server is configured to accept these variables via AcceptEnv.")) + p.Handle(diag("warning", "Unable to set 'PULUMI_COMMAND_STDOUT'. This only works if your SSH server is configured to accept these variables via AcceptEnv.")) + p.Handle(diag("warning", "a REAL warning about something else")) + p.Finish() + out := buf.String() + if strings.Contains(out, "PULUMI_COMMAND_") { + t.Errorf("the AcceptEnv provider noise must be suppressed:\n%s", out) + } + if !strings.Contains(out, "a REAL warning about something else") { + t.Errorf("real warnings must still print:\n%s", out) + } +}