From 42bdba0810131da273af7416442c94c7f8bb029c Mon Sep 17 00:00:00 2001 From: jarugupj <121142710+jarugupj@users.noreply.github.com> Date: Thu, 28 May 2026 17:18:00 +0000 Subject: [PATCH 1/3] distinguish API down from unreachable in status command When /status returns a non-2xx response the API is reachable but unhealthy, so report it as down rather than reusing the generic 'could not reach' message used for transport errors. --- cmd/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/status.go b/cmd/status.go index 4d1ca70..9731363 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -50,7 +50,7 @@ func runStatus(cmd *cobra.Command, args []string) error { defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { - pterm.Error.Println("Could not reach Kernel API. Check https://status.kernel.sh for updates.") + pterm.Error.Println("Kernel API is down. Check https://status.kernel.sh for updates.") return nil } From ad449043eb524ed974b8aad5920fb36057ca3482 Mon Sep 17 00:00:00 2001 From: jarugupj <121142710+jarugupj@users.noreply.github.com> Date: Fri, 29 May 2026 14:10:07 +0000 Subject: [PATCH 2/3] fall back to /health on non-2xx to distinguish API down from /status broken Co-Authored-By: Claude Opus 4.7 --- cmd/status.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/status.go b/cmd/status.go index 9731363..329ae19 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -50,6 +50,13 @@ func runStatus(cmd *cobra.Command, args []string) error { defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { + if h, err := client.Get(util.GetBaseURL() + "/health"); err == nil { + h.Body.Close() + if h.StatusCode >= 200 && h.StatusCode < 300 { + pterm.Error.Println("Kernel API is responding but /status is unavailable. Check https://status.kernel.sh for updates.") + return nil + } + } pterm.Error.Println("Kernel API is down. Check https://status.kernel.sh for updates.") return nil } From 3d48cd0e70c9e489046e6575b9fbec15c09e48ae Mon Sep 17 00:00:00 2001 From: jarugupj <121142710+jarugupj@users.noreply.github.com> Date: Mon, 1 Jun 2026 19:24:53 +0000 Subject: [PATCH 3/3] shorten /health probe timeout to 3s Use a dedicated http.Client for the /health probe with a 3s timeout instead of sharing the 10s client used for /status. Caps worst-case wait during a genuine outage (both /status and /health hung) at ~13s instead of ~20s. Co-Authored-By: Claude Opus 4.7 --- cmd/status.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/status.go b/cmd/status.go index 329ae19..dea9b37 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -50,9 +50,10 @@ func runStatus(cmd *cobra.Command, args []string) error { defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { - if h, err := client.Get(util.GetBaseURL() + "/health"); err == nil { - h.Body.Close() - if h.StatusCode >= 200 && h.StatusCode < 300 { + healthClient := &http.Client{Timeout: 3 * time.Second} + if healthResp, err := healthClient.Get(util.GetBaseURL() + "/health"); err == nil { + healthResp.Body.Close() + if healthResp.StatusCode >= 200 && healthResp.StatusCode < 300 { pterm.Error.Println("Kernel API is responding but /status is unavailable. Check https://status.kernel.sh for updates.") return nil }