Skip to content

feat: richer diagnostics health summary - #84

Closed
maxjb-xyz wants to merge 1 commit into
mainfrom
feat/diagnostics-rich
Closed

maxjb-xyz wants to merge 1 commit into
mainfrom
feat/diagnostics-rich

Conversation

@maxjb-xyz

@maxjb-xyz maxjb-xyz commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • expand the local-only health endpoint with build info, MCP, AI configuration state, node freshness, and notification/webhook configuration summaries
  • keep diagnostics bounded and secret-free without external provider probes
  • surface the additional checks in the Diagnostics page and document the response contract

Verification

  • git diff --check passes
  • Go and npm verification could not run in the worker environment because go and tsc are not installed

Summary by CodeRabbit

  • New Features

    • Expanded the diagnostics health summary with build information, MCP, AI, node, notification, and webhook status.
    • Added clearer status indicators for ready, unconfigured, and warning conditions.
    • Health responses now remain available when auxiliary checks fail, while database failures are clearly reported.
  • Bug Fixes

    • Sensitive configuration details are protected from appearing in health and diagnostics results.
    • Health checks no longer probe external AI providers.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The health endpoint now returns a structured local summary for build metadata, database, OIDC, MCP, AI, nodes, notifications, and webhooks. The diagnostics page displays these domains with status-aware values and colors.

Changes

Health summary

Layer / File(s) Summary
Server health contract and collection
server/internal/handlers/setup.go, server/main.go, server/docs/openapi.yaml, server/internal/handlers/health_test.go
The handler returns structured health data with build metadata, service states, aggregate counts, secret redaction, no provider probing, and 503 responses for database failures. The route passes MCP and build metadata. The OpenAPI schema and tests cover the response.
Diagnostics health display
web/src/api/client.ts, web/src/pages/DiagnosticsPage.tsx
HealthStatus includes all health domains. Diagnostics renders normalized rows with status-specific colors and indicators.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant DiagnosticsPage
  participant HealthEndpoint
  participant Database
  participant MCPManager
  Operator->>DiagnosticsPage: Open diagnostics
  DiagnosticsPage->>HealthEndpoint: Request /api/setup/health
  HealthEndpoint->>Database: Read local health summaries
  HealthEndpoint->>MCPManager: Read MCP runtime state
  HealthEndpoint-->>DiagnosticsPage: Return structured health JSON
  DiagnosticsPage-->>Operator: Display health rows
Loading

Poem

Build and status, neatly aligned,
Secrets stay safely left behind.
MCP hums, nodes report,
Diagnostics brings the report.
One health check, many signs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: expanding the diagnostics health summary.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/diagnostics-rich

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/pages/DiagnosticsPage.tsx (1)

116-122: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

statusColor receives row.value instead of row.status. Most rows render red text under a green check.

healthRows returns a status field for exactly this purpose. Line 117 uses it. Lines 120 and 122 do not. They pass row.value, which is now a descriptive string.

Trace a healthy MCP row. value is 'enabled / running' and status is 'ok'. Line 117 sets ok = true, so the green CheckCircle renders. Line 122 calls statusColor('enabled / running'), which matches no branch and returns '#FF4444'. The operator sees a green check beside red text reading "ENABLED / RUNNING".

The same contradiction hits SERVER, AI PROVIDER, NODES, NOTIFICATIONS, and WEBHOOKS whenever those rows are healthy. DATABASE and OIDC escape only because their value and status happen to be identical strings.

The 'warning' branch you added at line 41 is unreachable. No row.value ever equals the literal 'warning'. The amber colour never renders. 'ready' at line 39 is unreachable for the same reason.

🎨 Proposed fix
             {healthRows(health).map(row => {
               const ok = row.status === 'ok'
               return (
                 <div key={row.label} style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: '12px', fontFamily: 'JetBrains Mono, Fira Code, Cascadia Code, ui-monospace, monospace' }}>
-                  {ok ? <CheckCircle size={12} style={{ color: 'var(--success)' }} /> : <XCircle size={12} style={{ color: statusColor(row.value) }} />}
+                  {ok ? <CheckCircle size={12} style={{ color: 'var(--success)' }} /> : <XCircle size={12} style={{ color: statusColor(row.status) }} />}
                   <span style={{ color: 'var(--muted)', width: 100 }}>{row.label}</span>
-                  <span style={{ color: statusColor(row.value) }}>{row.value.toUpperCase()}</span>
+                  <span style={{ color: statusColor(row.status) }}>{row.value.toUpperCase()}</span>
                 </div>
               )
             })}

One more thought. An XCircle is a harsh icon for a disabled or unconfigured row. Those states are normal, not failures. Consider a neutral icon when row.status is 'disabled' or 'unconfigured'.

Diagnostics that contradict themselves are worse than no diagnostics, Chief. Wire the status through.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/DiagnosticsPage.tsx` around lines 116 - 122, Update the
healthRows rendering in DiagnosticsPage so both statusColor calls use row.status
rather than row.value, ensuring text color matches the ok/warning/error state.
Keep row.value only for the displayed text, and adjust the failure icon
selection if needed so disabled or unconfigured statuses use a neutral icon
instead of XCircle.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/docs/openapi.yaml`:
- Around line 450-457: Add a "503" response entry to the responses block for the
documented endpoint, aligned with the existing "200" response and using the same
application/json schema. Document that this response represents a failed
database probe, with database set to error and the remaining sections at their
zero values.

In `@server/internal/handlers/health_test.go`:
- Around line 179-193: Update the health test seed data used by getAISettings to
include ai_mode, and assert the response AI.Mode equals the expected value.
Replace the strings.Contains-based probe URI assertion with assert.NotContains,
then remove the now-unused strings import.

In `@server/internal/handlers/setup.go`:
- Around line 177-216: Consolidate webhookHealthSummary and configHealthSummary
by extending configHealthSummary to accept an optional filter or query
condition, then move the shared row definition, SELECT, error handling, and
summary mapping there. Update webhookHealthSummary to pass its webhook
scope/type filter through the helper while preserving the existing model and
notification summary behavior.

In `@server/main.go`:
- Line 195: Restrict the detailed HealthCheckWithBuildInfo response to
authenticated admins by moving its registration from /api/setup/health into the
existing admin route group as /api/admin/health. Keep /api/setup/health as a
minimal unauthenticated liveness endpoint for the container probe, and update
the Diagnostics page to request the authenticated admin route.

In `@web/src/api/client.ts`:
- Line 19: Update the `oidc` status union in `web/src/api/client.ts` to include
the server-supported `"error"` value, preserving the existing `"ok"`,
`"unavailable"`, and `"disabled"` members.

In `@web/src/pages/DiagnosticsPage.tsx`:
- Around line 60-66: Update the status mappings in the DiagnosticsPage
component: make configured but non-testable AI providers use warning rather than
error, and make nodeStatus use warning whenever either offline or stale nodes
are present while preserving ok when both counts are zero. Ensure the existing
row.status rendering receives these updated values.

---

Outside diff comments:
In `@web/src/pages/DiagnosticsPage.tsx`:
- Around line 116-122: Update the healthRows rendering in DiagnosticsPage so
both statusColor calls use row.status rather than row.value, ensuring text color
matches the ok/warning/error state. Keep row.value only for the displayed text,
and adjust the failure icon selection if needed so disabled or unconfigured
statuses use a neutral icon instead of XCircle.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c88a594e-cf77-47ce-96cb-4cc7ee18e12a

📥 Commits

Reviewing files that changed from the base of the PR and between aa9fcdf and 74acd8c.

📒 Files selected for processing (6)
  • server/docs/openapi.yaml
  • server/internal/handlers/health_test.go
  • server/internal/handlers/setup.go
  • server/main.go
  • web/src/api/client.ts
  • web/src/pages/DiagnosticsPage.tsx

Comment thread server/docs/openapi.yaml
Comment on lines 450 to +457
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
required: [database, oidc, oidc_enabled]
required: [version, commit, database, oidc, oidc_enabled, mcp, ai, nodes, notifications, webhooks]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Document the 503 response.

The responses block lists only "200". The handler returns 503 when the database probe fails. See server/internal/handlers/setup.go line 105. Generated clients and the container health check both depend on that path.

The 503 body uses the same schema, with database set to error and the remaining sections at zero values.

📝 Proposed addition
                       enabled:
                         type: integer
+        "503":
+          description: Database unavailable. The body uses the 200 schema with `database` set to `error`; the remaining sections contain zero values.
+          content:
+            application/json:
+              schema:
+                type: object

Place it after line 532, aligned with the "200" key.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/docs/openapi.yaml` around lines 450 - 457, Add a "503" response entry
to the responses block for the documented endpoint, aligned with the existing
"200" response and using the same application/json schema. Document that this
response represents a failed database probe, with database set to error and the
remaining sections at their zero values.

Comment on lines +179 to +193
assert.Equal(t, "openai_compat", resp.AI.Provider)
assert.True(t, resp.AI.Configured)
assert.True(t, resp.AI.Testable)
assert.True(t, resp.AI.APIKeyConfigured)
assert.Equal(t, int64(3), resp.Nodes.Total)
assert.Equal(t, int64(1), resp.Nodes.Online)
assert.Equal(t, int64(2), resp.Nodes.Offline)
assert.Equal(t, int64(1), resp.Nodes.Stale)
assert.True(t, resp.Notifications.Configured)
assert.Equal(t, int64(1), resp.Notifications.Total)
assert.Equal(t, int64(1), resp.Notifications.Enabled)
assert.True(t, resp.Webhooks.Configured)
assert.Equal(t, int64(2), resp.Webhooks.Total)
assert.Equal(t, int64(1), resp.Webhooks.Enabled)
assert.False(t, strings.Contains(body, "127.0.0.1:1"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm the default value of mode returned by getAISettings.
rg -nP --type=go -C12 'func getAISettings'

# Confirm nodeOfflineAfter, which the stale-node assertion at line 186 depends on.
rg -nP --type=go -C2 '\bnodeOfflineAfter\b\s*='

Repository: maxjb-xyz/blackbox

Length of output: 156


🏁 Script executed:

#!/bin/bash
set -u

printf 'Tracked files matching health_test.go:\n'
git ls-files | rg '(^|/)health_test\.go$' || true

printf '\nSearch for getAISettings:\n'
rg -n --type=go 'getAISettings|nodeOfflineAfter|ai_mode|mode' . || true

printf '\nLocate files around likely paths:\n'
fd -a 'setup\.go|handlers|health' . | sed 's#^\./##' | head -80

Repository: maxjb-xyz/blackbox

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -u

printf 'health_test.go relevant lines:\n'
sed -n '1,220p' server/internal/handlers/health_test.go

printf '\nsetup.go relevant lines:\n'
sed -n '130,165p' server/internal/handlers/setup.go

printf '\nadmin_config.go relevant lines:\n'
sed -n '420,545p' server/internal/handlers/admin_config.go

printf '\nimports in health_test.go:\n'
sed -n '1,20p' server/internal/handlers/health_test.go

Repository: maxjb-xyz/blackbox

Length of output: 12787


Assert ai.mode and use assert.NotContains for the probe URI check.

AI.Mode comes from getAISettings, which defaults to "analysis", so include ai_mode in the seed and one assertion. Use assert.NotContains(t, body, "127.0.0.1:1") instead of assert.False(t, strings.Contains(...)); then strings is no longer needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/internal/handlers/health_test.go` around lines 179 - 193, Update the
health test seed data used by getAISettings to include ai_mode, and assert the
response AI.Mode equals the expected value. Replace the strings.Contains-based
probe URI assertion with assert.NotContains, then remove the now-unused strings
import.

Comment on lines +177 to +216
func notificationHealthSummary(database *gorm.DB) healthConfigSummary {
return configHealthSummary(database, &models.NotificationDest{})
}

func webhookHealthSummary(database *gorm.DB) healthConfigSummary {
var summary healthConfigSummary
var row struct {
Total int64 `gorm:"column:total"`
Enabled int64 `gorm:"column:enabled"`
}
if err := database.Model(&models.DataSourceInstance{}).
Where("scope = ? AND type LIKE ?", models.ScopeServer, "webhook_%").
Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
Scan(&row).Error; err != nil {
log.Printf("health: webhook summary query failed: %v", err)
return summary
}
summary.Total = row.Total
summary.Enabled = row.Enabled
summary.Configured = row.Total > 0
return summary
}

func configHealthSummary(database *gorm.DB, model interface{}) healthConfigSummary {
var summary healthConfigSummary
var row struct {
Total int64 `gorm:"column:total"`
Enabled int64 `gorm:"column:enabled"`
}
if err := database.Model(model).
Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
Scan(&row).Error; err != nil {
log.Printf("health: configuration summary query failed: %v", err)
return summary
}
summary.Total = row.Total
summary.Enabled = row.Enabled
summary.Configured = row.Total > 0
return summary
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Consolidate the duplicated summary query.

webhookHealthSummary and configHealthSummary carry the same row struct, the same SELECT, and the same mapping. Only the model and the scope filter differ. Two copies means two places to update when the shape changes.

Pass the filter into the shared helper.

♻️ Proposed consolidation
 func notificationHealthSummary(database *gorm.DB) healthConfigSummary {
-	return configHealthSummary(database, &models.NotificationDest{})
+	return configHealthSummary(database, &models.NotificationDest{}, nil)
 }
 
 func webhookHealthSummary(database *gorm.DB) healthConfigSummary {
-	var summary healthConfigSummary
-	var row struct {
-		Total   int64 `gorm:"column:total"`
-		Enabled int64 `gorm:"column:enabled"`
-	}
-	if err := database.Model(&models.DataSourceInstance{}).
-		Where("scope = ? AND type LIKE ?", models.ScopeServer, "webhook_%").
-		Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
-		Scan(&row).Error; err != nil {
-		log.Printf("health: webhook summary query failed: %v", err)
-		return summary
-	}
-	summary.Total = row.Total
-	summary.Enabled = row.Enabled
-	summary.Configured = row.Total > 0
-	return summary
+	return configHealthSummary(database, &models.DataSourceInstance{}, func(q *gorm.DB) *gorm.DB {
+		return q.Where("scope = ? AND type LIKE ?", models.ScopeServer, "webhook_%")
+	})
 }
 
-func configHealthSummary(database *gorm.DB, model interface{}) healthConfigSummary {
+func configHealthSummary(database *gorm.DB, model interface{}, scope func(*gorm.DB) *gorm.DB) healthConfigSummary {
 	var summary healthConfigSummary
 	var row struct {
 		Total   int64 `gorm:"column:total"`
 		Enabled int64 `gorm:"column:enabled"`
 	}
-	if err := database.Model(model).
+	query := database.Model(model)
+	if scope != nil {
+		query = scope(query)
+	}
+	if err := query.
 		Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
 		Scan(&row).Error; err != nil {
 		log.Printf("health: configuration summary query failed: %v", err)
 		return summary
 	}

Cleaner code, cleaner telemetry. I like tidy systems.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func notificationHealthSummary(database *gorm.DB) healthConfigSummary {
return configHealthSummary(database, &models.NotificationDest{})
}
func webhookHealthSummary(database *gorm.DB) healthConfigSummary {
var summary healthConfigSummary
var row struct {
Total int64 `gorm:"column:total"`
Enabled int64 `gorm:"column:enabled"`
}
if err := database.Model(&models.DataSourceInstance{}).
Where("scope = ? AND type LIKE ?", models.ScopeServer, "webhook_%").
Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
Scan(&row).Error; err != nil {
log.Printf("health: webhook summary query failed: %v", err)
return summary
}
summary.Total = row.Total
summary.Enabled = row.Enabled
summary.Configured = row.Total > 0
return summary
}
func configHealthSummary(database *gorm.DB, model interface{}) healthConfigSummary {
var summary healthConfigSummary
var row struct {
Total int64 `gorm:"column:total"`
Enabled int64 `gorm:"column:enabled"`
}
if err := database.Model(model).
Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
Scan(&row).Error; err != nil {
log.Printf("health: configuration summary query failed: %v", err)
return summary
}
summary.Total = row.Total
summary.Enabled = row.Enabled
summary.Configured = row.Total > 0
return summary
}
func notificationHealthSummary(database *gorm.DB) healthConfigSummary {
return configHealthSummary(database, &models.NotificationDest{}, nil)
}
func webhookHealthSummary(database *gorm.DB) healthConfigSummary {
return configHealthSummary(database, &models.DataSourceInstance{}, func(q *gorm.DB) *gorm.DB {
return q.Where("scope = ? AND type LIKE ?", models.ScopeServer, "webhook_%")
})
}
func configHealthSummary(database *gorm.DB, model interface{}, scope func(*gorm.DB) *gorm.DB) healthConfigSummary {
var summary healthConfigSummary
var row struct {
Total int64 `gorm:"column:total"`
Enabled int64 `gorm:"column:enabled"`
}
query := database.Model(model)
if scope != nil {
query = scope(query)
}
if err := query.
Select("COUNT(*) AS total, COALESCE(SUM(CASE WHEN enabled = ? THEN 1 ELSE 0 END), 0) AS enabled", true).
Scan(&row).Error; err != nil {
log.Printf("health: configuration summary query failed: %v", err)
return summary
}
summary.Total = row.Total
summary.Enabled = row.Enabled
summary.Configured = row.Total > 0
return summary
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/internal/handlers/setup.go` around lines 177 - 216, Consolidate
webhookHealthSummary and configHealthSummary by extending configHealthSummary to
accept an optional filter or query condition, then move the shared row
definition, SELECT, error handling, and summary mapping there. Update
webhookHealthSummary to pass its webhook scope/type filter through the helper
while preserving the existing model and notification summary behavior.

Comment thread server/main.go

r.Get("/api/setup/status", handlers.SetupStatus(database))
r.Get("/api/setup/health", handlers.HealthCheck(database, registry))
r.Get("/api/setup/health", handlers.HealthCheckWithBuildInfo(database, registry, mcpMgr, Version, Commit))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

The expanded health payload is served without authentication.

/api/setup/health is registered outside every auth group. Compare it with the admin routes at lines 235-276. Before this change the response held two status strings. It now returns the build version, the commit, node inventory counts, and the configuration posture for OIDC, MCP, AI, notifications, and webhooks.

No secrets leak. The test at server/internal/handlers/health_test.go lines 138-140 confirms that. The concern is reconnaissance value: an unauthenticated caller learns the exact build to match against CVEs, the fleet size, and which integrations are unconfigured.

The container health check at lines 45-53 needs only the HTTP status code. Consider one of these options:

  • Serve the detailed payload only to authenticated admins, and keep a minimal public shape for the liveness probe.
  • Gate the detail behind a separate authenticated route, and point the Diagnostics page at that route.

I have run the numbers on this one. The exposure is small, but it is free intelligence for anyone who asks.

🔒 Option: split liveness from diagnostics
-	r.Get("/api/setup/health", handlers.HealthCheckWithBuildInfo(database, registry, mcpMgr, Version, Commit))
+	r.Get("/api/setup/health", handlers.HealthCheck(database, registry))

Then register the detailed handler inside the admin group at lines 235-276:

r.Get("/api/admin/health", handlers.HealthCheckWithBuildInfo(database, registry, mcpMgr, Version, Commit))

The Diagnostics page then calls /api/admin/health.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/main.go` at line 195, Restrict the detailed HealthCheckWithBuildInfo
response to authenticated admins by moving its registration from
/api/setup/health into the existing admin route group as /api/admin/health. Keep
/api/setup/health as a minimal unauthenticated liveness endpoint for the
container probe, and update the Diagnostics page to request the authenticated
admin route.

Comment thread web/src/api/client.ts
version: string
commit: string
database: 'ok' | 'error'
oidc: 'ok' | 'unavailable' | 'disabled'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

The oidc union omits the error value the server can return.

The handler sets oidcStatus = "error" when the OIDC provider query fails. See server/internal/handlers/setup.go lines 113-115. The OpenAPI enum at server/docs/openapi.yaml line 470 lists error. This union does not.

Nothing breaks today, because DiagnosticsPage renders unknown values through a fallback. The risk is future: an exhaustive switch over health.oidc will compile while missing a reachable case.

🔧 Proposed fix
-  oidc: 'ok' | 'unavailable' | 'disabled'
+  oidc: 'ok' | 'unavailable' | 'disabled' | 'error'

Three sources describe this field. Two of them agree. Let us make it three.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
oidc: 'ok' | 'unavailable' | 'disabled'
oidc: 'ok' | 'unavailable' | 'disabled' | 'error'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/api/client.ts` at line 19, Update the `oidc` status union in
`web/src/api/client.ts` to include the server-supported `"error"` value,
preserving the existing `"ok"`, `"unavailable"`, and `"disabled"` members.

Comment on lines +60 to +66
const aiStatus = !current.ai.configured ? 'unconfigured' : current.ai.testable ? 'ok' : 'error'
const aiValue = !current.ai.configured
? 'unconfigured'
: current.ai.testable
? `${current.ai.provider} / configured (no probe)`
: `${current.ai.provider} / not testable`
const nodeStatus = current.nodes.offline > 0 ? 'warning' : 'ok'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Two status mappings send the wrong signal.

Line 60: a configured provider outside the testable allow-list gets 'error'. That is not an error. The provider works; it simply has no local test path. The row renders as a failure. Use 'warning' instead.

Line 66: nodeStatus ignores stale. A fleet with zero offline nodes and three stale nodes reports 'ok' in green, while nodeValue on line 67 prints "3 stale" in the same row. The colour and the text disagree.

🔧 Proposed fix
-    const aiStatus = !current.ai.configured ? 'unconfigured' : current.ai.testable ? 'ok' : 'error'
+    const aiStatus = !current.ai.configured ? 'unconfigured' : current.ai.testable ? 'ok' : 'warning'
-    const nodeStatus = current.nodes.offline > 0 ? 'warning' : 'ok'
+    const nodeStatus = current.nodes.offline > 0 || current.nodes.stale > 0 ? 'warning' : 'ok'

Note that the amber colour only appears once lines 120 and 122 pass row.status. See my comment on that range.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const aiStatus = !current.ai.configured ? 'unconfigured' : current.ai.testable ? 'ok' : 'error'
const aiValue = !current.ai.configured
? 'unconfigured'
: current.ai.testable
? `${current.ai.provider} / configured (no probe)`
: `${current.ai.provider} / not testable`
const nodeStatus = current.nodes.offline > 0 ? 'warning' : 'ok'
const aiStatus = !current.ai.configured ? 'unconfigured' : current.ai.testable ? 'ok' : 'warning'
const aiValue = !current.ai.configured
? 'unconfigured'
: current.ai.testable
? `${current.ai.provider} / configured (no probe)`
: `${current.ai.provider} / not testable`
const nodeStatus = current.nodes.offline > 0 || current.nodes.stale > 0 ? 'warning' : 'ok'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/DiagnosticsPage.tsx` around lines 60 - 66, Update the status
mappings in the DiagnosticsPage component: make configured but non-testable AI
providers use warning rather than error, and make nodeStatus use warning
whenever either offline or stale nodes are present while preserving ok when both
counts are zero. Ensure the existing row.status rendering receives these updated
values.

@atlas-maxjb

Copy link
Copy Markdown

Closed in favor of #88, which keeps the same changes on the atlas-maxjb fork branch with the correct commit attribution.

@atlas-maxjb

Copy link
Copy Markdown

Superseded by #88, which has the same changes from the atlas-maxjb fork branch with corrected commit attribution.

@maxjb-xyz maxjb-xyz closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants