fix: authenticate dashboard health probe

This commit is contained in:
Hermes Agent
2026-07-25 00:53:11 +00:00
parent 6bf375ee78
commit 511baa60f3
2 changed files with 7 additions and 2 deletions
@@ -29,7 +29,12 @@ class GatewayHttpProbe(
bearerToken: String,
sessionCookie: String
): GatewayProbeResult {
val health = getJson("$baseUrl/health")
// Hermes dashboard auth gates every protected route, including /health.
// A successful password login therefore must send its session cookie to
// the health probe as well as /v1/models; otherwise the 302-to-login
// response is incorrectly presented as a generic offline failure.
val healthCookie = if (authMode == ConnectionAuthMode.PasswordLogin) sessionCookie else ""
val health = getJson("$baseUrl/health", sessionCookie = healthCookie)
if (health != HttpProbeResult.Success) return health.toGatewayResult("Health probe")
if (authMode == ConnectionAuthMode.None) {
return GatewayProbeResult.Healthy("Gateway health check passed.")
@@ -72,7 +72,7 @@ class GatewayHttpProbeTest {
assertTrue(result is GatewayProbeResult.Healthy)
assertEquals(
listOf(
Triple("/health", null, null),
Triple("/health", null, SESSION_COOKIE),
Triple("/v1/models", null, SESSION_COOKIE)
),
requests