Skip to content

feat(admin): /admin config surface (API + control plane)#2081

Draft
nicoloboschi wants to merge 1 commit into
mainfrom
feat/admin-surface
Draft

feat(admin): /admin config surface (API + control plane)#2081
nicoloboschi wants to merge 1 commit into
mainfrom
feat/admin-surface

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Summary

Adds a server-level admin surface at /admin (API + control plane), gated by HINDSIGHT_API_ENABLE_ADMIN_API (off by default) with an optional, independent HINDSIGHT_API_ADMIN_TOKEN. First capability: a read-only, redacted view of the resolved server-level configuration.

This is the visibility leg of #2034 (server-level config was previously invisible in the Control Plane). The higher-value parts of #2034 — a connectivity test and health surfacing — are intentionally not in this PR; they land as a separate per-bank health endpoint (see #747), since LLM config is hierarchical and a probe belongs at bank altitude.

What's included

API

  • GET /admin/config → resolved HindsightConfig with credentials redacted ("***" when set, null when unset). Redaction = credential denylist ∪ name-suffix heuristic.
  • require_admin guard: 404 when disabled, 401 when a token is configured and missing/wrong (hmac.compare_digest), open when no token.
  • features.admin_api on /version.
  • New config flags in config.py (enable_admin_api, admin_api_token; the token is itself a credential field).

Control plane

  • Top-level /admin page reusing the shared (now data-driven) Sidebar with a single Configuration item + a dedicated AdminHeader (no bank chrome).
  • Server proxy /api/admin/config forwarding an independent HINDSIGHT_CP_ADMIN_TOKEN.
  • admin_api feature flag; admin i18n across all 10 locales.

Generated / docs

  • Regenerated OpenAPI spec + Python/TS/Go clients.
  • configuration.md, .env.example.

Tests

tests/test_admin_api.py — disabled→404, enabled→200, token enforcement, credential redaction (incl. provider keys that fall back to the LLM key), /version flag.

Known follow-ups (deliberately out of scope)

Draft until /code-review is run and the redaction guard decision is made.

Server-level admin surface, gated by HINDSIGHT_API_ENABLE_ADMIN_API with an
optional, independent HINDSIGHT_API_ADMIN_TOKEN:

- API: GET /admin/config returns the resolved HindsightConfig with credentials
  redacted (set -> "***", unset -> null) via the credential denylist plus a
  name-suffix heuristic; features.admin_api exposed on /version.
- Control plane: top-level /admin page reusing the shared (now data-driven)
  Sidebar with a single "Configuration" item + a dedicated AdminHeader; server
  proxy forwards an independent HINDSIGHT_CP_ADMIN_TOKEN to /admin/*.
- Regenerated OpenAPI spec + Python/TS/Go clients; docs + .env.example; admin
  i18n across all locales.

Groundwork for the visibility leg of #2034. The connectivity test + health
surfacing land separately as a per-bank health endpoint.
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.

1 participant