Add Redview MCP to fleet coding harnesses #291

Merged
nimmo merged 2 commits from feat/redview-mcp-fleet into main 2026-10-09 06:49:02 +01:00
Owner

Redview 2.6.0 embeds a Streamable HTTP MCP endpoint, but fleet coding harnesses currently have no registration or client credential for it. Add Redview to the shared registry for Codex, OpenCode, Pi and Antigravity on Electra, Lena, Vega and Lyra through the existing HTTPS ingress.

Clients authenticate with X-Api-Key using the user-provisioned, encrypted secrets/redview-mcp.yaml. The dedicated recipient rule scopes the key to the four harness hosts and recovery identities. Codex activation preserves personal settings and comments while reconciling its environment-backed HTTP header. Document provisioning, enablement and rotation; add four-host registry checks and configuration regression tests.

Refs #289 and #290. Milestone: Redview MCP Fleet Integration.

Validation:

  • nix flake check passed with the actual encrypted credential; all four host configurations evaluated.
  • Three Codex configuration regressions passed, covering transport repair, settings preservation, idempotence, private permissions, URL updates and malformed config preservation.
  • Full Electra build passed for base, igpu and dgpu.
  • Operator just test activated Electra's igpu configuration; Home Manager completed successfully.
  • Live authenticated HTTPS initialize reports Redview 2.6.0; tools/list returns 57 tools; harmless get_stats read passed. All four installed harness configurations carry the correct X-Api-Key mapping. No library mutations or credential values were logged.

Remaining acceptance:

  • Required MR checks and review.
  • Persistent deployment across the fleet and a genuine no-op follow-up before closing #289/#290.

Reviewed existing build warnings: duplicate NTFS utilities, upstream stdenv deprecations and the Gawk Info index warning did not block the canary. At the user's request, retain these as observations only; no warning-suppression workarounds or cleanup changes are included.

Redview 2.6.0 embeds a Streamable HTTP MCP endpoint, but fleet coding harnesses currently have no registration or client credential for it. Add Redview to the shared registry for Codex, OpenCode, Pi and Antigravity on Electra, Lena, Vega and Lyra through the existing HTTPS ingress. Clients authenticate with X-Api-Key using the user-provisioned, encrypted secrets/redview-mcp.yaml. The dedicated recipient rule scopes the key to the four harness hosts and recovery identities. Codex activation preserves personal settings and comments while reconciling its environment-backed HTTP header. Document provisioning, enablement and rotation; add four-host registry checks and configuration regression tests. Refs #289 and #290. Milestone: Redview MCP Fleet Integration. Validation: - nix flake check passed with the actual encrypted credential; all four host configurations evaluated. - Three Codex configuration regressions passed, covering transport repair, settings preservation, idempotence, private permissions, URL updates and malformed config preservation. - Full Electra build passed for base, igpu and dgpu. - Operator just test activated Electra's igpu configuration; Home Manager completed successfully. - Live authenticated HTTPS initialize reports Redview 2.6.0; tools/list returns 57 tools; harmless get_stats read passed. All four installed harness configurations carry the correct X-Api-Key mapping. No library mutations or credential values were logged. Remaining acceptance: - Required MR checks and review. - Persistent deployment across the fleet and a genuine no-op follow-up before closing #289/#290. Reviewed existing build warnings: duplicate NTFS utilities, upstream stdenv deprecations and the Gawk Info index warning did not block the canary. At the user's request, retain these as observations only; no warning-suppression workarounds or cleanup changes are included.
Refs #289. Gate client registration on the dedicated SOPS credential file; deployment acceptance remains in #290.
feat(mcp): provision encrypted Redview fleet credential
Some checks failed
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Failing after 15m22s
Build and Push Attic Cache / test (pull_request) Successful in 1m35s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
95375b25b1
Refs #289 and #290. Enable shared clients through the dedicated SOPS file; authenticated canary and fleet deployment remain pending.
clankbot left a comment

Automated code review

Reviewed commit: 95375b25b1c011106869d2c4a95aab70733337e1

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

The Redview MCP registration matches the existing registry contract in modules/mcp/default.nix: modules/mcp/redview.nix returns the documented keys (name/enable/type/url/secretName/tokenEnvVar, sopsSecrets, agy, opencode, codexSnippet), it is imported in the same serverModules list as the other servers, and scripts/check-redview-mcp.nix asserts exactly the shapes the registry derives for agy, opencode, standard (Pi) and the sops-secret/tokenExports paths. The new .sops.yaml creation rule (secrets/redview-mcp.yaml$) is ordered before the catch-all rules, does not collide with the earlier secrets/redview.yaml$ rule, and its seven listed recipients match the seven recipients recorded in secrets/redview-mcp.yaml; the key path redview/mcp/api-key matches both the sopsSecrets key and the check assertion. The new flake check evaluates that assertion plus the Python regressions. I found no defect that would break evaluation or the deterministic gate; the remaining findings are one new activation failure mode and two documentation/coverage gaps.

Blocking findings

None.

Important findings

None.

Suggestions

  • Redview's Codex snippet is the only unguarded Python call in the activation dag entry, so an unparseable ~/.codex/config.toml now fails activation (modules/mcp/redview.nix:41; medium confidence)
    modules/mcp/redview.nix:41-44 emits a bare ${python}/bin/python .../ensure-codex-http-mcp.py "$HOME/.codex/config.toml" redview ... invocation, which modules/mcp/default.nix:179-180 splices into home.activation.codexMcpConfig (modules/profiles/ai-agents.nix). scripts/ensure-codex-http-mcp.py:38 calls ensure_server() in main with no try/except, and scripts/test-codex-http-mcp.py:59-64 asserts that tomlkit.exceptions.ParseError propagates out of ensure_server while the file is left intact. Every other command in that same dag entry is guarded with || true (e.g. the codex mcp remove/codex mcp get lines in modules/profiles/ai-agents.nix), so this new call is the first one whose non-zero exit is not swallowed.
    Impact: A user-authored syntax error in ~/.codex/config.toml on Electra, Lena, Vega or Lyra now turns the Redview activation step into a hard error instead of a no-op, and the rest of the MCP registry entries in that dag entry are skipped. This is a new failure mode for this path: no previous activation step parsed user-authored TOML.
    Suggested fix: Keep the fail-closed behaviour but make it diagnosable and non-fatal to the rest of the registry: catch tomlkit.exceptions.ParseError in the main block of scripts/ensure-codex-http-mcp.py, print the offending path and parser message to stderr, and exit with a distinct code; then either append || true to the generated snippet in modules/mcp/redview.nix or emit a warning line so the remaining harness entries still activate.

  • The new redview/mcp/api-key credential is not added to the Known Secrets index (secrets/README.md:119; high confidence)
    The change adds an 'Adding New Secrets' paragraph for secrets/redview-mcp.yaml at secrets/README.md:119-133, but the 'Known Secrets' table at secrets/README.md:207 has a row for every other MCP client credential file - synthseek/mcp/api-key in secrets/synthseek-mcp.yaml, navidrome/mcp/token in secrets/navidrome-mcp-clients.yaml, kiwifs/mcp/token in secrets/kiwifs-mcp.yaml, karakeep/mcp/api-key, pangolin/mcp/token, trilium/etapi-token, beszel/mcp/* - and no row for redview/mcp/api-key in secrets/redview-mcp.yaml.
    Impact: The canonical secret index undercounts the new scoped credential, so audit, rotation or recipient-scope work driven from that table will miss redview-mcp.yaml; the rotation recipes themselves are unaffected because they glob secrets/*.yaml.
    Suggested fix: Add a Known Secrets row for redview/mcp/api-key in secrets/redview-mcp.yaml naming modules/mcp/redview.nix as the consumer, and stating that it is the direct Redview Settings API key scoped to Electra, Lena, Vega, Lyra plus the recovery identities, and is distinct from Lyra's secrets/redview.yaml service credentials and the remote-worker key.

  • The four-host check forces enable = true, so it never exercises the provisioning gate that actually enables Redview MCP (scripts/check-redview-mcp.nix:12; medium confidence)
    checkHost overrides the option with mcp.redview.enable = true (scripts/check-redview-mcp.nix:11-13) and injects a fake sops.secrets/placeholder entry, so the assertions only prove the registry shape once enabled. The real enablement is the default at modules/common/default-config.nix:263 (builtins.pathExists config.nixosConfig.mcp.redview.sopsFile) with the default path at line 276 (../../secrets + "/redview-mcp.yaml"); neither the check nor nix flake check would fail if that path were wrong or if secrets/redview-mcp.yaml were untracked.
    Impact: A typo in the sopsFile default, or a secrets/redview-mcp.yaml that is not git-tracked, would silently disable Redview MCP on the whole fleet while every gate in this change still passed; the failure would only surface in live tools/list output.
    Suggested fix: Add one assertion that does not override enable - e.g. evaluate the default for each of the four hosts and assert registry.sopsSecrets ? redview-mcp-api-key (or that the default evaluates to true) using the tracked credential - so the check proves the provisioning gate itself, not only the shape once enabled.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the installed Codex CLI accept env_http_headers as a header-name to environment-variable-name mapping, as produced by scripts/ensure-codex-http-mcp.py:31 from the JSON object built at modules/mcp/redview.nix:43? The upstream schema is not in this repository, and the script removes command/args/env/env_vars/cwd/bearer_token_env_var/http_headers but leaves any pre-existing type key beside the new url entry.
  • Is preserving enabled = false from a pre-existing [mcp_servers.redview] table the intended boundary? scripts/test-codex-http-mcp.py:16 and the assertion at lines 37-41 keep enabled = false while rewriting the transport, so a user who previously disabled Redview keeps it disabled after redeploy.
  • Should Redview MCP be excluded on hosts where the ingress is not reachable? potential/nova/default.nix:18 imports modules/profiles/ai-agents.nix, and enable defaults to true for any host once the credential file is tracked; nova is not in flake.nix's nixosConfigurations today, but its recipient set is not in secrets/redview-mcp.yaml's creation rule.

Review limitations

  • No Nix evaluation was performed: I did not run nix flake check, the redview-mcp flake check, or the Python regressions; I read modules/mcp/default.nix, modules/mcp/redview.nix and scripts/check-redview-mcp.nix to compare the asserted shapes.
  • Upstream client schemas are not in this repository: Codex config.toml keys (env_http_headers), OpenCode remote MCP enabled/oauth/headers handling, Pi's ~/.config/mcp/mcp.json adapter and Antigravity's ~/.gemini/config/mcp_config.json were compared only against the existing modules in this repo.
  • The public ingress https://redview.nimmog.uk/mcp is not declared anywhere else in the supplied tree (the domain appears only in the new README text and the new option default); modules/services/redview.nix:144 sets port 3210 but no reverse-proxy/ingress mapping was found, so ingress routing and live authenticated initialize/tools/list behaviour could not be verified.
  • Runtime behaviour was not observed: whether /run/secrets/redview-mcp-api-key is installed and readable on each host, whether REDVIEW_MCP_API_KEY reaches each harness, and whether key rotation reloads credentials were taken from the pull-request text only.
  • Only the listed changed files and their direct callers (modules/mcp/default.nix, modules/profiles/ai-agents.nix, modules/profiles/ai-runtime.nix, modules/profiles/pi-pangolin.nix, hosts/*/default.nix) were inspected; no defects were inferred in unchanged code outside that import chain.

Diff coverage

  • .sops.yaml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • modules/common/default-config.nix: reviewed — included in a context-limited batch
  • modules/mcp/default.nix: reviewed — included in a context-limited batch
  • modules/mcp/redview.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • scripts/ensure-codex-http-mcp.py: reviewed — included in a context-limited batch
  • scripts/test-codex-http-mcp.py: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/redview-mcp.yaml: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 2
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `95375b25b1c011106869d2c4a95aab70733337e1` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment The Redview MCP registration matches the existing registry contract in modules/mcp/default.nix: modules/mcp/redview.nix returns the documented keys (name/enable/type/url/secretName/tokenEnvVar, sopsSecrets, agy, opencode, codexSnippet), it is imported in the same serverModules list as the other servers, and scripts/check-redview-mcp.nix asserts exactly the shapes the registry derives for agy, opencode, standard (Pi) and the sops-secret/tokenExports paths. The new .sops.yaml creation rule (secrets/redview-mcp\.yaml$) is ordered before the catch-all rules, does not collide with the earlier secrets/redview\.yaml$ rule, and its seven listed recipients match the seven recipients recorded in secrets/redview-mcp.yaml; the key path redview/mcp/api-key matches both the sopsSecrets key and the check assertion. The new flake check evaluates that assertion plus the Python regressions. I found no defect that would break evaluation or the deterministic gate; the remaining findings are one new activation failure mode and two documentation/coverage gaps. ### Blocking findings None. ### Important findings None. ### Suggestions - **Redview's Codex snippet is the only unguarded Python call in the activation dag entry, so an unparseable ~/.codex/config.toml now fails activation** (modules/mcp/redview.nix:41; medium confidence) modules/mcp/redview.nix:41-44 emits a bare `${python}/bin/python .../ensure-codex-http-mcp.py "$HOME/.codex/config.toml" redview ...` invocation, which modules/mcp/default.nix:179-180 splices into home.activation.codexMcpConfig (modules/profiles/ai-agents.nix). scripts/ensure-codex-http-mcp.py:38 calls ensure_server() in __main__ with no try/except, and scripts/test-codex-http-mcp.py:59-64 asserts that tomlkit.exceptions.ParseError propagates out of ensure_server while the file is left intact. Every other command in that same dag entry is guarded with `|| true` (e.g. the `codex mcp remove`/`codex mcp get` lines in modules/profiles/ai-agents.nix), so this new call is the first one whose non-zero exit is not swallowed. Impact: A user-authored syntax error in ~/.codex/config.toml on Electra, Lena, Vega or Lyra now turns the Redview activation step into a hard error instead of a no-op, and the rest of the MCP registry entries in that dag entry are skipped. This is a new failure mode for this path: no previous activation step parsed user-authored TOML. Suggested fix: Keep the fail-closed behaviour but make it diagnosable and non-fatal to the rest of the registry: catch tomlkit.exceptions.ParseError in the __main__ block of scripts/ensure-codex-http-mcp.py, print the offending path and parser message to stderr, and exit with a distinct code; then either append `|| true` to the generated snippet in modules/mcp/redview.nix or emit a warning line so the remaining harness entries still activate. - **The new redview/mcp/api-key credential is not added to the Known Secrets index** (secrets/README.md:119; high confidence) The change adds an 'Adding New Secrets' paragraph for secrets/redview-mcp.yaml at secrets/README.md:119-133, but the 'Known Secrets' table at secrets/README.md:207 has a row for every other MCP client credential file - `synthseek/mcp/api-key` in secrets/synthseek-mcp.yaml, `navidrome/mcp/token` in secrets/navidrome-mcp-clients.yaml, `kiwifs/mcp/token` in secrets/kiwifs-mcp.yaml, `karakeep/mcp/api-key`, `pangolin/mcp/token`, `trilium/etapi-token`, `beszel/mcp/*` - and no row for redview/mcp/api-key in secrets/redview-mcp.yaml. Impact: The canonical secret index undercounts the new scoped credential, so audit, rotation or recipient-scope work driven from that table will miss redview-mcp.yaml; the rotation recipes themselves are unaffected because they glob `secrets/*.yaml`. Suggested fix: Add a Known Secrets row for `redview/mcp/api-key` in secrets/redview-mcp.yaml naming modules/mcp/redview.nix as the consumer, and stating that it is the direct Redview Settings API key scoped to Electra, Lena, Vega, Lyra plus the recovery identities, and is distinct from Lyra's secrets/redview.yaml service credentials and the remote-worker key. - **The four-host check forces enable = true, so it never exercises the provisioning gate that actually enables Redview MCP** (scripts/check-redview-mcp.nix:12; medium confidence) checkHost overrides the option with `mcp.redview.enable = true` (scripts/check-redview-mcp.nix:11-13) and injects a fake sops.secrets/placeholder entry, so the assertions only prove the registry shape once enabled. The real enablement is the default at modules/common/default-config.nix:263 (`builtins.pathExists config.nixosConfig.mcp.redview.sopsFile`) with the default path at line 276 (`../../secrets + "/redview-mcp.yaml"`); neither the check nor `nix flake check` would fail if that path were wrong or if secrets/redview-mcp.yaml were untracked. Impact: A typo in the sopsFile default, or a secrets/redview-mcp.yaml that is not git-tracked, would silently disable Redview MCP on the whole fleet while every gate in this change still passed; the failure would only surface in live tools/list output. Suggested fix: Add one assertion that does not override enable - e.g. evaluate the default for each of the four hosts and assert `registry.sopsSecrets ? redview-mcp-api-key` (or that the default evaluates to true) using the tracked credential - so the check proves the provisioning gate itself, not only the shape once enabled. ### Tests and validation - No configured deterministic checks. ### Questions - Does the installed Codex CLI accept env_http_headers as a header-name to environment-variable-name mapping, as produced by scripts/ensure-codex-http-mcp.py:31 from the JSON object built at modules/mcp/redview.nix:43? The upstream schema is not in this repository, and the script removes command/args/env/env_vars/cwd/bearer_token_env_var/http_headers but leaves any pre-existing `type` key beside the new url entry. - Is preserving `enabled = false` from a pre-existing [mcp_servers.redview] table the intended boundary? scripts/test-codex-http-mcp.py:16 and the assertion at lines 37-41 keep enabled = false while rewriting the transport, so a user who previously disabled Redview keeps it disabled after redeploy. - Should Redview MCP be excluded on hosts where the ingress is not reachable? potential/nova/default.nix:18 imports modules/profiles/ai-agents.nix, and enable defaults to true for any host once the credential file is tracked; nova is not in flake.nix's nixosConfigurations today, but its recipient set is not in secrets/redview-mcp.yaml's creation rule. ### Review limitations - No Nix evaluation was performed: I did not run `nix flake check`, the redview-mcp flake check, or the Python regressions; I read modules/mcp/default.nix, modules/mcp/redview.nix and scripts/check-redview-mcp.nix to compare the asserted shapes. - Upstream client schemas are not in this repository: Codex config.toml keys (env_http_headers), OpenCode remote MCP enabled/oauth/headers handling, Pi's ~/.config/mcp/mcp.json adapter and Antigravity's ~/.gemini/config/mcp_config.json were compared only against the existing modules in this repo. - The public ingress https://redview.nimmog.uk/mcp is not declared anywhere else in the supplied tree (the domain appears only in the new README text and the new option default); modules/services/redview.nix:144 sets port 3210 but no reverse-proxy/ingress mapping was found, so ingress routing and live authenticated initialize/tools/list behaviour could not be verified. - Runtime behaviour was not observed: whether /run/secrets/redview-mcp-api-key is installed and readable on each host, whether REDVIEW_MCP_API_KEY reaches each harness, and whether key rotation reloads credentials were taken from the pull-request text only. - Only the listed changed files and their direct callers (modules/mcp/default.nix, modules/profiles/ai-agents.nix, modules/profiles/ai-runtime.nix, modules/profiles/pi-pangolin.nix, hosts/*/default.nix) were inspected; no defects were inferred in unchanged code outside that import chain. ### Diff coverage - `.sops.yaml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `modules/common/default-config.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/default.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/redview.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `scripts/ensure-codex-http-mcp.py`: **reviewed** — included in a context-limited batch - `scripts/test-codex-http-mcp.py`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/redview-mcp.yaml`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 2 - Previous automated review: none found - Findings: 3 </details>
nimmo merged commit af0ad19e61 into main 2026-10-09 06:49:02 +01:00
nimmo deleted branch feat/redview-mcp-fleet 2026-10-09 06:49:03 +01:00
Sign in to join this conversation.
No reviewers
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!291
No description provided.