feat(hermes): deploy Hermes agent on Vega with Matrix gateway and live profile sync #311

Merged
nimmo merged 17 commits from feat/hermes-agent-vega into main 2026-10-11 19:53:33 +01:00
Owner

Ref #309
Milestone: Hermes Agent Deployment (34)

Summary

Deploys Hermes Agent (hermes-agent.service) as a background daemon on Vega with a Matrix gateway, native SearXNG meta-search integration, and live bidirectional Git sync to the standalone profile repository (nimmo/hermes).

Changes

  • Hermes Service Module (modules/services/hermes.nix):
    • Restored and streamlined native systemd service integration.
    • Configured OpenAI-compatible endpoints (https://ollama-nova.nimmog.uk/v1 for qwen3.6:35b-a3b-q8_0 and OpenCode Go fallback).
    • Configured Matrix gateway adapter with timezone and timestamps.
    • Wired live bidirectional Git synchronization in preStart using deploy key (secrets/hermes.yaml), dynamically cloning nimmo/hermes to /srv/services/hermes/profile and symlinking SOUL.md, distribution.yaml, and skills/.
    • Configured Git author credentials (hermes@nimmog.uk, Hermes Agent) matching the Hermes Forgejo bot account.
    • Registered fleet MCP servers (beszel-mcp, karakeep-mcp, mcp-nixos, mcp-pangolin).
  • SearXNG Service Module (modules/services/searxng.nix):
    • Declarative native SearXNG meta search engine on port 8888, with automated secret key generation and service failure monitoring.
  • Host Configuration (hosts/vega/default.nix):
    • Enabled nixosConfig.hermes and nixosConfig.searxng.
  • Auto-Update Policy (lib/auto-update-policy.nix):
    • Registered hermes-agent input under the vega auto-update tier.
  • Documentation:
    • Documented Hermes architecture and service details in README.md and KiwiFS (pages/projects/nixos-config/hermes.md).

Validation & Live Evidence

  • nix flake check passes cleanly across all fleet targets (electra, lena, vega, lyra).
  • Live canary test deployment executed on Vega:
    • hermes-agent.service active and running (PID 2020233).
    • /srv/services/hermes/profile successfully cloned from Forgejo via SSH deploy key at commit c535b28.
    • SOUL.md, distribution.yaml, and skills/ symlinks verified.
    • Model context warmed (qwen3.6:35b-a3b-q8_0 with 128k context), all MCP servers active, Matrix connected.
    • searx.service active and returning JSON search results on port 8888.
Ref #309 Milestone: Hermes Agent Deployment (34) ## Summary Deploys Hermes Agent (`hermes-agent.service`) as a background daemon on Vega with a Matrix gateway, native SearXNG meta-search integration, and live bidirectional Git sync to the standalone profile repository (`nimmo/hermes`). ## Changes - **Hermes Service Module (`modules/services/hermes.nix`)**: - Restored and streamlined native systemd service integration. - Configured OpenAI-compatible endpoints (`https://ollama-nova.nimmog.uk/v1` for `qwen3.6:35b-a3b-q8_0` and OpenCode Go fallback). - Configured Matrix gateway adapter with `timezone` and timestamps. - Wired live bidirectional Git synchronization in `preStart` using deploy key (`secrets/hermes.yaml`), dynamically cloning `nimmo/hermes` to `/srv/services/hermes/profile` and symlinking `SOUL.md`, `distribution.yaml`, and `skills/`. - Configured Git author credentials (`hermes@nimmog.uk`, `Hermes Agent`) matching the Hermes Forgejo bot account. - Registered fleet MCP servers (`beszel-mcp`, `karakeep-mcp`, `mcp-nixos`, `mcp-pangolin`). - **SearXNG Service Module (`modules/services/searxng.nix`)**: - Declarative native SearXNG meta search engine on port 8888, with automated secret key generation and service failure monitoring. - **Host Configuration (`hosts/vega/default.nix`)**: - Enabled `nixosConfig.hermes` and `nixosConfig.searxng`. - **Auto-Update Policy (`lib/auto-update-policy.nix`)**: - Registered `hermes-agent` input under the `vega` auto-update tier. - **Documentation**: - Documented Hermes architecture and service details in `README.md` and KiwiFS (`pages/projects/nixos-config/hermes.md`). ## Validation & Live Evidence - `nix flake check` passes cleanly across all fleet targets (`electra`, `lena`, `vega`, `lyra`). - Live canary test deployment executed on Vega: - `hermes-agent.service` active and running (`PID 2020233`). - `/srv/services/hermes/profile` successfully cloned from Forgejo via SSH deploy key at commit `c535b28`. - `SOUL.md`, `distribution.yaml`, and `skills/` symlinks verified. - Model context warmed (`qwen3.6:35b-a3b-q8_0` with 128k context), all MCP servers active, Matrix connected. - `searx.service` active and returning JSON search results on port 8888.
- Add hermes-agent flake input (github:NousResearch/hermes-agent)
- Add modules/services/hermes.nix configuring Matrix gateway (E2EE off)
- Configure primary model to qwen3.6:35b-a3b-q8_0 via https://ollama-nova.nimmog.uk/v1
- Configure fallback provider to OpenCode Go using opencode-go-api-key
- Enable hermes on Vega in hosts/vega/default.nix
- Update auto-update-policy.nix and secrets/README.md

Refs #309
feat(hermes): add configurable gitAuthorName and gitAuthorEmail options
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 2m26s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 9m52s
56133b73e0
clankbot left a comment

Automated code review

Reviewed commit: 56133b73e09c2f32d33f67152a429b400164ee31

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

Validated the Hermes/SearXNG change set against the checked-out tree and the upstream module/type definitions. Two defects from the initial review hold: the auto-update classification for hermes-agent contradicts the shared-module rule stated in the policy file and README, and the web key inside services.hermes-agent.settings is built with lib.mkIf as a value, which the upstream deepConfigType (merge only at the option level, configJson = builtins.toJSON cfg.settings) does not resolve. I dropped the initial review's unguarded-git clone item (the unit carries Restart=always/RestartSec=5, so the stated 'requires a manual restart' impact is not supported) and its resolved questions about searx envsubst, HERMES_HOME, and ${VAR} expansion in MCP headers. Added one new finding: the preStop script can exit non-zero when gateway.pid is absent, which defeats its own stated purpose of avoiding a false failure alert, and one documentation gap for the new hermes/git/deploy-key secret.

Blocking findings

None.

Important findings

  • Nested lib.mkIf inside services.hermes-agent.settings renders an unresolved if-record in config.yaml (modules/services/hermes.nix:193; high confidence)
    modules/services/hermes.nix:193 sets web = lib.mkIf (cfg.searxngUrl != null) { search_backend = "searxng"; }; inside the settings attrset (line 185). The upstream module (nix/nixosModules.nix:38-47 in the pinned hermes-agent source) types settings with deepConfigType, whose merge only folds whole option definitions (lib.foldl' lib.recursiveUpdate { } (map (d: d.value) defs)), and then emits configJson = builtins.toJSON cfg.settings. lib.mkIf used as a value is therefore serialized verbatim, and the generated config in the store contains "web":{"_type":"if","condition":true,"content":{"search_backend":"searxng"}}. Hermes reads this key as web_cfg.get("search_backend") (hermes_cli/config.py:994 default schema; nous_subscription.py:336 web_search_backend = str(web_cfg.get("search_backend") or "")), and nothing in hermes_cli handles a _type/content record.
    Impact: On Vega the SearXNG web-search backend is never enabled for Hermes: web.search_backend is absent from the effective config, so web_search routing falls back to the default backend even though SEARXNG_URL is exported in the environment. The same pattern is applied correctly 13 lines above for the env var (// lib.optionalAttrs (cfg.searxngUrl != null) { SEARXNG_URL = cfg.searxngUrl; }, line 176).
    Suggested fix: Build the key conditionally at the attrset level instead of as a value: drop web from the literal and append // lib.optionalAttrs (cfg.searxngUrl != null) { web = { search_backend = "searxng"; }; }; to the settings attrset, matching the optionalAttrs style already used for SEARXNG_URL.

  • hermes-agent input classified for Vega only although its nixosModule is shared by all four hosts (lib/auto-update-policy.nix:217; high confidence)
    The new policy entry (lib/auto-update-policy.nix:215-219) declares name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ];. flake.nix:141 adds inputs.hermes-agent.nixosModules.default to the shared module list passed to makeNixosSystem, which is used by electra, lena, vega and lyra; the policy file's own header rule states that an input pulled in through a shared module rebuilds every host, and README.md:149 states 'New root flake inputs must also be classified by real consumers in lib/auto-update-policy.nix'. Other shared-module inputs in the same file list all four hosts.
    Impact: A lock update to hermes-agent is only rebuilt/validated for Vega, so the evaluation of electra, lena and lyra against the new revision is never build-proved by the auto-update job; an evaluation-time breakage in the new revision surfaces only on the next manual deploy of the other hosts.
    Suggested fix: List the full consumer set for this input (hosts = [ "electra" "lena" "vega" "lyra" ];) and update the rationale to say the module is shared, or move inputs.hermes-agent.nixosModules.default out of the shared list in flake.nix:141 into the Vega-only module list so the classification matches the actual consumer set.

  • preStop aborts with a non-zero status when gateway.pid is missing, producing a false failure alert (modules/services/hermes.nix:241; medium confidence)
    modules/services/hermes.nix:240-251 sets systemd.services.hermes-agent.preStop whose first command is hermes_pid="$(sed -nE '...' "$HERMES_HOME/gateway.pid")" with no existence guard and no || true. NixOS renders this as ExecStop=/nix/store/...-unit-script-hermes-agent-pre-stop/bin/hermes-agent-pre-stop (generated unit line 17), and the generated script starts with set -e; the unit also carries OnFailure=ntfy-service-failure@%n.service (generated unit line 4). GNU sed exits non-zero when its input file cannot be opened. The gateway removes that file during shutdown (gateway/run.py:19747-19751 remove_pid_file() / (get_hermes_home() / "gateway.pid").unlink(missing_ok=True)), i.e. before ExecStop runs. The comment at modules/services/hermes.nix:238-239 states the intent is 'to avoid a false failure alert'.
    Impact: On a normal stop (including NixOS activation SIGTERM stops) the pid file is typically already gone, so set -e aborts ExecStop with status 1, the unit enters the failed state and ntfy-service-failure@hermes-agent.service posts a spurious alert on every redeploy/stop, masking the deliberate stop the comment tries to handle.
    Suggested fix: Guard the read, e.g. if [ -f "$HERMES_HOME/gateway.pid" ]; then hermes_pid="$(sed -nE ... )"; else hermes_pid=""; fi (or append || true to the command substitution), so the script always exits 0 when there is no live gateway to mark.

Suggestions

  • New hermes/git/deploy-key secret is not documented in the secrets table (secrets/README.md:233; high confidence)
    The diff updates the row to | hermes/matrix/access-token, hermes/pangolin/api-keyinsecrets/hermes.yaml| modules/services/hermes.nix onvega | ..., but secrets/hermes.yaml also gains a git: deploy-key: entry, which modules/services/hermes.nix:119-121 consumes as sops.secrets.hermes-git-deploy-key (key = "hermes/git/deploy-key") and uses in GIT_SSH_COMMAND (line 170). Every other secret introduced by this change is listed in the same table.
    Impact: The repository's secret-ownership table under-documents a new Vega secret, so a future rotation or re-encryption of hermes/git/deploy-key has no documented owner or purpose.
    Suggested fix: Add hermes/git/deploy-key to the row's key list and mention in the description that it is the SSH deploy key used by Hermes' profile/skills git operations.

Tests and validation

  • No configured deterministic checks.

Questions

  • For the hermes-agent policy entry: does the auto-update job treat hosts as 'hosts whose system closure contains the input' or 'hosts whose evaluation imports the input'? The shared module list at flake.nix:141 makes the second reading apply to all four hosts, but the intended impact statement in the rationale suggests the first; the answer determines whether the fix belongs in lib/auto-update-policy.nix or in flake.nix.
  • Should web.backend also be set alongside web.search_backend in the Hermes settings, or is the per-capability override alone sufficient for the SearXNG path (upstream nous_subscription.py:447-450 accepts either)?

Review limitations

  • Verification relied on Nix store artifacts (generated hermes-config.yaml, unit-hermes-agent.service, the pre-start/pre-stop scripts, searx-*.service units, and the pinned hermes-agent and nixpkgs sources) read with the navigation tools; these are build outputs, not files in the checked-out tree, and I did not run nix build, nix flake check, or the scripts/check-*.nix assertions.
  • The preStop finding depends on runtime ordering (whether gateway.pid still exists when systemd runs ExecStop); the upstream shutdown code removes it, but I could not observe an actual stop on the host.
  • I did not evaluate the SearXNG secret-key path end to end (the generated searx-env file contents, base64 alphabet safety for envsubst, and file ownership under DynamicUser in the pinned searx module) beyond confirming the units, ordering (Before=searx-init.service, EnvironmentFile=/var/lib/searx/searx-env) and the static searx user/group defined by the pinned nixpkgs module.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 11
  • Previous automated review: none found
  • Findings: 4
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `56133b73e09c2f32d33f67152a429b400164ee31` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment Validated the Hermes/SearXNG change set against the checked-out tree and the upstream module/type definitions. Two defects from the initial review hold: the auto-update classification for `hermes-agent` contradicts the shared-module rule stated in the policy file and README, and the `web` key inside `services.hermes-agent.settings` is built with `lib.mkIf` as a *value*, which the upstream `deepConfigType` (merge only at the option level, `configJson = builtins.toJSON cfg.settings`) does not resolve. I dropped the initial review's unguarded-`git clone` item (the unit carries `Restart=always`/`RestartSec=5`, so the stated 'requires a manual restart' impact is not supported) and its resolved questions about searx `envsubst`, `HERMES_HOME`, and `${VAR}` expansion in MCP headers. Added one new finding: the `preStop` script can exit non-zero when `gateway.pid` is absent, which defeats its own stated purpose of avoiding a false failure alert, and one documentation gap for the new `hermes/git/deploy-key` secret. ### Blocking findings None. ### Important findings - **Nested lib.mkIf inside services.hermes-agent.settings renders an unresolved if-record in config.yaml** (modules/services/hermes.nix:193; high confidence) modules/services/hermes.nix:193 sets `web = lib.mkIf (cfg.searxngUrl != null) { search_backend = "searxng"; };` inside the `settings` attrset (line 185). The upstream module (nix/nixosModules.nix:38-47 in the pinned hermes-agent source) types `settings` with `deepConfigType`, whose `merge` only folds whole option definitions (`lib.foldl' lib.recursiveUpdate { } (map (d: d.value) defs)`), and then emits `configJson = builtins.toJSON cfg.settings`. `lib.mkIf` used as a value is therefore serialized verbatim, and the generated config in the store contains `"web":{"_type":"if","condition":true,"content":{"search_backend":"searxng"}}`. Hermes reads this key as `web_cfg.get("search_backend")` (hermes_cli/config.py:994 default schema; nous_subscription.py:336 `web_search_backend = str(web_cfg.get("search_backend") or "")`), and nothing in hermes_cli handles a `_type`/`content` record. Impact: On Vega the SearXNG web-search backend is never enabled for Hermes: `web.search_backend` is absent from the effective config, so `web_search` routing falls back to the default backend even though `SEARXNG_URL` is exported in the environment. The same pattern is applied correctly 13 lines above for the env var (`// lib.optionalAttrs (cfg.searxngUrl != null) { SEARXNG_URL = cfg.searxngUrl; }`, line 176). Suggested fix: Build the key conditionally at the attrset level instead of as a value: drop `web` from the literal and append `// lib.optionalAttrs (cfg.searxngUrl != null) { web = { search_backend = "searxng"; }; };` to the `settings` attrset, matching the `optionalAttrs` style already used for `SEARXNG_URL`. - **hermes-agent input classified for Vega only although its nixosModule is shared by all four hosts** (lib/auto-update-policy.nix:217; high confidence) The new policy entry (lib/auto-update-policy.nix:215-219) declares `name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ];`. flake.nix:141 adds `inputs.hermes-agent.nixosModules.default` to the shared module list passed to `makeNixosSystem`, which is used by electra, lena, vega and lyra; the policy file's own header rule states that an input pulled in through a shared module rebuilds every host, and README.md:149 states 'New root flake inputs must also be classified by real consumers in `lib/auto-update-policy.nix`'. Other shared-module inputs in the same file list all four hosts. Impact: A lock update to `hermes-agent` is only rebuilt/validated for Vega, so the evaluation of electra, lena and lyra against the new revision is never build-proved by the auto-update job; an evaluation-time breakage in the new revision surfaces only on the next manual deploy of the other hosts. Suggested fix: List the full consumer set for this input (`hosts = [ "electra" "lena" "vega" "lyra" ];`) and update the rationale to say the module is shared, or move `inputs.hermes-agent.nixosModules.default` out of the shared list in flake.nix:141 into the Vega-only module list so the classification matches the actual consumer set. - **preStop aborts with a non-zero status when gateway.pid is missing, producing a false failure alert** (modules/services/hermes.nix:241; medium confidence) modules/services/hermes.nix:240-251 sets `systemd.services.hermes-agent.preStop` whose first command is `hermes_pid="$(sed -nE '...' "$HERMES_HOME/gateway.pid")"` with no existence guard and no `|| true`. NixOS renders this as `ExecStop=/nix/store/...-unit-script-hermes-agent-pre-stop/bin/hermes-agent-pre-stop` (generated unit line 17), and the generated script starts with `set -e`; the unit also carries `OnFailure=ntfy-service-failure@%n.service` (generated unit line 4). GNU sed exits non-zero when its input file cannot be opened. The gateway removes that file during shutdown (gateway/run.py:19747-19751 `remove_pid_file()` / `(get_hermes_home() / "gateway.pid").unlink(missing_ok=True)`), i.e. before ExecStop runs. The comment at modules/services/hermes.nix:238-239 states the intent is 'to avoid a false failure alert'. Impact: On a normal stop (including NixOS activation SIGTERM stops) the pid file is typically already gone, so `set -e` aborts ExecStop with status 1, the unit enters the failed state and `ntfy-service-failure@hermes-agent.service` posts a spurious alert on every redeploy/stop, masking the deliberate stop the comment tries to handle. Suggested fix: Guard the read, e.g. `if [ -f "$HERMES_HOME/gateway.pid" ]; then hermes_pid="$(sed -nE ... )"; else hermes_pid=""; fi` (or append `|| true` to the command substitution), so the script always exits 0 when there is no live gateway to mark. ### Suggestions - **New hermes/git/deploy-key secret is not documented in the secrets table** (secrets/README.md:233; high confidence) The diff updates the row to `| `hermes/matrix/access-token`, `hermes/pangolin/api-key` in `secrets/hermes.yaml` | modules/services/hermes.nix on `vega` | ...`, but `secrets/hermes.yaml` also gains a `git: deploy-key:` entry, which modules/services/hermes.nix:119-121 consumes as `sops.secrets.hermes-git-deploy-key` (`key = "hermes/git/deploy-key"`) and uses in `GIT_SSH_COMMAND` (line 170). Every other secret introduced by this change is listed in the same table. Impact: The repository's secret-ownership table under-documents a new Vega secret, so a future rotation or re-encryption of `hermes/git/deploy-key` has no documented owner or purpose. Suggested fix: Add `hermes/git/deploy-key` to the row's key list and mention in the description that it is the SSH deploy key used by Hermes' profile/skills git operations. ### Tests and validation - No configured deterministic checks. ### Questions - For the `hermes-agent` policy entry: does the auto-update job treat `hosts` as 'hosts whose system closure contains the input' or 'hosts whose evaluation imports the input'? The shared module list at flake.nix:141 makes the second reading apply to all four hosts, but the intended impact statement in the rationale suggests the first; the answer determines whether the fix belongs in lib/auto-update-policy.nix or in flake.nix. - Should `web.backend` also be set alongside `web.search_backend` in the Hermes settings, or is the per-capability override alone sufficient for the SearXNG path (upstream nous_subscription.py:447-450 accepts either)? ### Review limitations - Verification relied on Nix store artifacts (generated `hermes-config.yaml`, `unit-hermes-agent.service`, the pre-start/pre-stop scripts, `searx-*.service` units, and the pinned hermes-agent and nixpkgs sources) read with the navigation tools; these are build outputs, not files in the checked-out tree, and I did not run `nix build`, `nix flake check`, or the `scripts/check-*.nix` assertions. - The preStop finding depends on runtime ordering (whether `gateway.pid` still exists when systemd runs ExecStop); the upstream shutdown code removes it, but I could not observe an actual stop on the host. - I did not evaluate the SearXNG secret-key path end to end (the generated `searx-env` file contents, base64 alphabet safety for `envsubst`, and file ownership under `DynamicUser` in the pinned searx module) beyond confirming the units, ordering (`Before=searx-init.service`, `EnvironmentFile=/var/lib/searx/searx-env`) and the static `searx` user/group defined by the pinned nixpkgs module. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 11 - Previous automated review: none found - Findings: 4 </details>
Author
Owner

Thank you for the review! Addressed the feedback in commit 592ca54:

  1. Unresolved _type: if record in settings (modules/services/hermes.nix):

    • Replaced nested lib.mkIf inside settings with an attrset-level merge using // lib.optionalAttrs (cfg.searxngUrl != null) { web = { search_backend = "searxng"; }; }, matching SEARXNG_URL.
  2. hermes-agent Module Scope (flake.nix & lib/auto-update-policy.nix):

    • Moved inputs.hermes-agent.nixosModules.default out of the shared module list in flake.nix into modules/services/hermes.nix's imports (following the pattern established by redview).
    • Vega is the sole consumer of this module, so the hosts = [ "vega" ]; classification in lib/auto-update-policy.nix is strictly accurate.
  3. preStop Script Failure on Missing gateway.pid (modules/services/hermes.nix):

    • Added an existence check if [ -f "$HERMES_HOME/gateway.pid" ]; then ... fi around gateway.pid inspection so the pre-stop hook always exits cleanly with status 0 even when the daemon has already cleaned up its PID file.
  4. Secrets Documentation (secrets/README.md):

    • Added hermes/git/deploy-key to the secret ownership table in secrets/README.md, describing its purpose for Git synchronization with the profile and skills repository.

All checks and formatters pass via nix flake check.

Thank you for the review! Addressed the feedback in commit `592ca54`: 1. **Unresolved `_type: if` record in `settings` (modules/services/hermes.nix)**: - Replaced nested `lib.mkIf` inside `settings` with an attrset-level merge using `// lib.optionalAttrs (cfg.searxngUrl != null) { web = { search_backend = "searxng"; }; }`, matching `SEARXNG_URL`. 2. **`hermes-agent` Module Scope (flake.nix & lib/auto-update-policy.nix)**: - Moved `inputs.hermes-agent.nixosModules.default` out of the shared module list in `flake.nix` into `modules/services/hermes.nix`'s `imports` (following the pattern established by `redview`). - Vega is the sole consumer of this module, so the `hosts = [ "vega" ];` classification in `lib/auto-update-policy.nix` is strictly accurate. 3. **`preStop` Script Failure on Missing `gateway.pid` (modules/services/hermes.nix)**: - Added an existence check `if [ -f "$HERMES_HOME/gateway.pid" ]; then ... fi` around `gateway.pid` inspection so the pre-stop hook always exits cleanly with status 0 even when the daemon has already cleaned up its PID file. 4. **Secrets Documentation (secrets/README.md)**: - Added `hermes/git/deploy-key` to the secret ownership table in `secrets/README.md`, describing its purpose for Git synchronization with the profile and skills repository. All checks and formatters pass via `nix flake check`.
fix(hermes): address automated code review feedback
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 2m14s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 16m41s
592ca549b6
- Replace nested lib.mkIf inside settings with optionalAttrs merge for web backend
- Scope hermes-agent nixosModule import to modules/services/hermes.nix
- Guard gateway.pid existence in preStop to avoid non-zero status
- Document hermes/git/deploy-key in secrets/README.md
clankbot left a comment

Automated code review

Reviewed commit: 592ca549b623e280b266e4a82a584d947f2e37a3

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The new flake input, auto-update policy entry, sops secrets, MCP registry wiring (hermesMcpServers/hermesEnv), firewall port and failure-monitor registration all line up with the checked-out upstream hermes-agent nixosModule and the nixpkgs services.searx module (the searx-secret-key -> searx-init -> searx chain does substitute $SEARX_SECRET_KEY via envsubst, and search.formats = [html json] matches the SearXNG plugin's /search?format=json call). Two areas do not do what the module and README claim: (1) the profile-repo bridge in preStart symlinks SOUL.md, distribution.yaml and skills into ${cfg.stateDir} instead of $HERMES_HOME (${cfg.stateDir}/.hermes), so the synced persona and skills are never loaded and the agent's own skills never reach the repo; (2) the Matrix E2EE knob emits names Hermes never reads (MATRIX_E2EE_MODE, settings.matrix.e2ee_mode). One robustness asymmetry in preStart (unguarded git clone vs. guarded git pull) is also reported. Everything else in the diff evaluated consistently against the supplied module sources.

Blocking findings

  • Profile-repo symlinks are created outside HERMES_HOME, so the synced persona and skills are never loaded (modules/services/hermes.nix:230; high confidence)
    preStart links into the bare state directory: ln -sf "$repo_dir/SOUL.md" "${cfg.stateDir}/SOUL.md" (line 230), distribution.yaml (line 233), ln -sfn "$repo_dir/skills" "${cfg.stateDir}/skills" (line 240), and migrates with cp -rn "${cfg.stateDir}/skills/." (line 237). The upstream module sets environment.HERMES_HOME = "${cfg.stateDir}/.hermes" (nix/nixosModules.nix:651 and the native unit's environment block at line 870-875) and creates ${cfg.stateDir}/.hermes/... via tmpfiles (lines 707-713). Hermes resolves these files under HERMES_HOME: hermes_constants.py:407 get_skills_dir() -> get_hermes_home() / "skills", and the upstream docs state the persona file is ${services.hermes-agent.stateDir}/.hermes/SOUL.md (website/.../getting-started/nix-setup.md:320, 404).
    Impact: The advertised bidirectional sync (README: "persona (SOUL.md), model preferences, and custom skills are maintained in the ... repository, synchronized bidirectionally") is inert: the clone at /srv/services/hermes/profile is fetched but nothing under $HERMES_HOME points at it, so the agent runs with its default persona and its own $HERMES_HOME/skills, and skills it authors are never visible to Hermes. The cp -rn migration reads ${cfg.stateDir}/skills, a path Hermes never writes, so it silently copies nothing.
    Suggested fix: Target $HERMES_HOME for all three links (${cfg.stateDir}/.hermes/SOUL.md, .hermes/distribution.yaml, .hermes/skills) and migrate from ${cfg.stateDir}/.hermes/skills. Note the upstream activation script already chmods SOUL.md under ${cfg.stateDir}/.hermes, so keep the symlink creation ordered after that (or move it into the module's activation hook) to avoid clobbering it.

Important findings

  • matrixE2eeMode emits names Hermes never reads; the option is inert (modules/services/hermes.nix:172; medium confidence)
    environment sets MATRIX_E2EE_MODE = cfg.matrixE2eeMode (line 172) and settings sets matrix.e2ee_mode = cfg.matrixE2eeMode (line 195). Neither name occurs in the hermes-agent source tree; the real switch is the boolean MATRIX_ENCRYPTION (gateway/platforms/matrix.py:12 MATRIX_ENCRYPTION Set "true" to enable E2EE, gateway/platforms/matrix.py:376, gateway/config.py:1443, documented in website/docs/reference/environment-variables.md:401). The config.yaml bridge for the matrix: block (gateway/config.py:1160-1178) handles only require_mention, free_response_rooms, allowed_rooms, auto_thread and dm_mention_threads - never e2ee_mode.
    Impact: matrixE2eeMode is dead configuration: setting optional or required changes nothing, and the three-state enum has no counterpart in Hermes (boolean plus a separate MATRIX_DEVICE_ID for key stability). Anyone later enabling E2EE through this option would silently run in plaintext while the README still says "E2EE disabled".
    Suggested fix: Model it as upstream does: a boolean emitting MATRIX_ENCRYPTION = "true"/"false" (optionally with a matrixDeviceId -> MATRIX_DEVICE_ID), and drop settings.matrix.e2ee_mode. If a tri-state is genuinely wanted, document that Hermes cannot express it.

  • The profile clone is the only unguarded git step in preStart; a transient failure leaves the profile repo missing (modules/services/hermes.nix:222; medium confidence)
    The first-start branch runs GIT_SSH_COMMAND="$git_ssh" ${pkgs.git}/bin/git clone "${cfg.gitRepo}" "$repo_dir" with no error guard (line 222), whereas the second branch runs git -C "$repo_dir" pull --ff-only || true (line 224). The three git config --global calls (lines 218-220) and the symlink/migration block (lines 229-241) follow the same conditional chain, so an aborted clone skips the whole bridge.
    Impact: The two branches behave differently: if git.nimmog.uk is unreachable on a first start (boot before network-online is really usable, or a Forgejo outage), the clone fails and the profile repo is absent, so no persona/skills bridge is created and the failure monitor reports a degraded agent; on subsequent boots the same outage is tolerated. The asymmetry also makes the intended error policy unclear to reviewers.
    Suggested fix: Make the two branches symmetric: git clone ... || true (or gate the whole git block on a reachability check) and log the failure, so a transient clone failure degrades to "agent runs without its profile repo" rather than aborting preStart.

Suggestions

  • settings.matrix.dm_auto_thread is not a bridged config key and is silently ignored (modules/services/hermes.nix:193; medium confidence)
    gateway/config.py:1160-1178 bridges only require_mention, free_response_rooms, allowed_rooms, auto_thread and dm_mention_threads from the matrix: section of config.yaml; dm_auto_thread is read only from the environment (gateway/platforms/matrix.py:515-516 os.getenv("MATRIX_DM_AUTO_THREAD", "false"), documented at matrix.py:23).
    Impact: The key is written into config.yaml but never consumed; it coincides with Hermes' default (false) so behaviour is unchanged today, but the setting cannot be turned on from Nix as written.
    Suggested fix: Emit MATRIX_DM_AUTO_THREAD in services.hermes-agent.environment (the supported path), or replace the key with dm_mention_threads, which is bridged.

Tests and validation

  • No configured deterministic checks.

Questions

  • The README says model preferences live in the nimmo/hermes profile repository, but services.hermes-agent.settings sets no model, and the clone is never installed into $HERMES_HOME/config.yaml (the upstream activation script writes/merges only the Nix-generated config at ${cfg.stateDir}/.hermes/config.yaml). How are the README's qwen3.6:35b-a3b-q8_0 primary and opencode-go fallback actually selected at runtime?
  • distribution.yaml is symlinked into the state directory, but in the supplied source Hermes reads it only as a profile-distribution manifest at a profile root (hermes_cli/profile_distribution.py:80 MANIFEST_FILENAME = "distribution.yaml", hermes_cli/profiles.py:507 profile_dir / "distribution.yaml"). Is a Hermes profile intended here, and if so should the clone be placed at $HERMES_HOME/profiles/<name>/ rather than linked at the state-dir root?
  • addToSystemPackages = true is set, which per the upstream module exports HERMES_HOME into environment.variables for the whole host (nix/nixosModules.nix:651). Is that intended on Vega, where other agent runtimes (Paseo, pi-pangolin, MCP launchers) inherit the host environment?
  • Should nixosConfig.backup.dataPaths = lib.mkAfter [ cfg.stateDir ] be kept, given hosts/vega/default.nix:181 already declares /srv/services and modules/services/backrest.nix:22 filters out any path with a declared parent? It is harmless today; the question is whether it is meant as a per-host safety net for hosts that do not declare the /srv/services root.

Review limitations

  • The only hermes-agent source available in the store is an older revision (/nix/store/yjqpq487...), not the locked b30f95ac4a80d2f6dbe3aa01001b0524314f6d74; the three "name is not recognised by Hermes" findings (MATRIX_E2EE_MODE, e2ee_mode, dm_auto_thread) are based on that earlier tree and would not apply if the newer revision added such bridging.
  • I read the upstream nixosModules.nix in the store rather than evaluating this PR's head, so the unit shape (User=hermes, HERMES_HOME, ProtectSystem=strict, ReadWritePaths, UMask=0007) is confirmed but the merged preStart/preStart text for this revision is not.
  • I did not run nix flake check, nixos-eval, or the scripts/check-*.nix assertions; I only checked by inspection that the added registry.hermesMcpServers.redview assertion matches the value modules/mcp/redview.nix produces for the hermes override branch.
  • No runtime behaviour was observed: ownership/permissions under /srv/services/hermes/profile, whether the agent can actually git commit/git push with the deploy key, whether the generated searx-env survives reboot, and whether the Matrix bridge connects are unverified.
  • Port 8888 was checked only against literal occurrences in this repository (it appears on Lyra for signal-cli, not on Vega); I did not enumerate effective listen ports of every Vega service or Docker container.
  • The contents of the nimmo/hermes profile repository were not supplied, so all claims about what the agent loads from it (SOUL.md, skills, model preferences) are inferred from the module and the upstream source.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 12
  • Previous automated review: none found
  • Findings: 4
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `592ca549b623e280b266e4a82a584d947f2e37a3` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The new flake input, auto-update policy entry, sops secrets, MCP registry wiring (hermesMcpServers/hermesEnv), firewall port and failure-monitor registration all line up with the checked-out upstream hermes-agent nixosModule and the nixpkgs services.searx module (the searx-secret-key -> searx-init -> searx chain does substitute $SEARX_SECRET_KEY via envsubst, and search.formats = [html json] matches the SearXNG plugin's /search?format=json call). Two areas do not do what the module and README claim: (1) the profile-repo bridge in preStart symlinks SOUL.md, distribution.yaml and skills into ${cfg.stateDir} instead of $HERMES_HOME (${cfg.stateDir}/.hermes), so the synced persona and skills are never loaded and the agent's own skills never reach the repo; (2) the Matrix E2EE knob emits names Hermes never reads (MATRIX_E2EE_MODE, settings.matrix.e2ee_mode). One robustness asymmetry in preStart (unguarded git clone vs. guarded git pull) is also reported. Everything else in the diff evaluated consistently against the supplied module sources. ### Blocking findings - **Profile-repo symlinks are created outside HERMES_HOME, so the synced persona and skills are never loaded** (modules/services/hermes.nix:230; high confidence) preStart links into the bare state directory: `ln -sf "$repo_dir/SOUL.md" "${cfg.stateDir}/SOUL.md"` (line 230), `distribution.yaml` (line 233), `ln -sfn "$repo_dir/skills" "${cfg.stateDir}/skills"` (line 240), and migrates with `cp -rn "${cfg.stateDir}/skills/."` (line 237). The upstream module sets `environment.HERMES_HOME = "${cfg.stateDir}/.hermes"` (nix/nixosModules.nix:651 and the native unit's `environment` block at line 870-875) and creates `${cfg.stateDir}/.hermes/...` via tmpfiles (lines 707-713). Hermes resolves these files under HERMES_HOME: `hermes_constants.py:407 get_skills_dir() -> get_hermes_home() / "skills"`, and the upstream docs state the persona file is `${services.hermes-agent.stateDir}/.hermes/SOUL.md` (website/.../getting-started/nix-setup.md:320, 404). Impact: The advertised bidirectional sync (README: "persona (SOUL.md), model preferences, and custom skills are maintained in the ... repository, synchronized bidirectionally") is inert: the clone at /srv/services/hermes/profile is fetched but nothing under $HERMES_HOME points at it, so the agent runs with its default persona and its own $HERMES_HOME/skills, and skills it authors are never visible to Hermes. The `cp -rn` migration reads `${cfg.stateDir}/skills`, a path Hermes never writes, so it silently copies nothing. Suggested fix: Target $HERMES_HOME for all three links (${cfg.stateDir}/.hermes/SOUL.md, .hermes/distribution.yaml, .hermes/skills) and migrate from ${cfg.stateDir}/.hermes/skills. Note the upstream activation script already chmods SOUL.md under ${cfg.stateDir}/.hermes, so keep the symlink creation ordered after that (or move it into the module's activation hook) to avoid clobbering it. ### Important findings - **matrixE2eeMode emits names Hermes never reads; the option is inert** (modules/services/hermes.nix:172; medium confidence) `environment` sets `MATRIX_E2EE_MODE = cfg.matrixE2eeMode` (line 172) and `settings` sets `matrix.e2ee_mode = cfg.matrixE2eeMode` (line 195). Neither name occurs in the hermes-agent source tree; the real switch is the boolean `MATRIX_ENCRYPTION` (`gateway/platforms/matrix.py:12 MATRIX_ENCRYPTION Set "true" to enable E2EE`, `gateway/platforms/matrix.py:376`, `gateway/config.py:1443`, documented in website/docs/reference/environment-variables.md:401). The config.yaml bridge for the `matrix:` block (gateway/config.py:1160-1178) handles only require_mention, free_response_rooms, allowed_rooms, auto_thread and dm_mention_threads - never e2ee_mode. Impact: `matrixE2eeMode` is dead configuration: setting `optional` or `required` changes nothing, and the three-state enum has no counterpart in Hermes (boolean plus a separate MATRIX_DEVICE_ID for key stability). Anyone later enabling E2EE through this option would silently run in plaintext while the README still says "E2EE disabled". Suggested fix: Model it as upstream does: a boolean emitting `MATRIX_ENCRYPTION = "true"/"false"` (optionally with a matrixDeviceId -> MATRIX_DEVICE_ID), and drop `settings.matrix.e2ee_mode`. If a tri-state is genuinely wanted, document that Hermes cannot express it. - **The profile clone is the only unguarded git step in preStart; a transient failure leaves the profile repo missing** (modules/services/hermes.nix:222; medium confidence) The first-start branch runs `GIT_SSH_COMMAND="$git_ssh" ${pkgs.git}/bin/git clone "${cfg.gitRepo}" "$repo_dir"` with no error guard (line 222), whereas the second branch runs `git -C "$repo_dir" pull --ff-only || true` (line 224). The three `git config --global` calls (lines 218-220) and the symlink/migration block (lines 229-241) follow the same conditional chain, so an aborted clone skips the whole bridge. Impact: The two branches behave differently: if git.nimmog.uk is unreachable on a first start (boot before network-online is really usable, or a Forgejo outage), the clone fails and the profile repo is absent, so no persona/skills bridge is created and the failure monitor reports a degraded agent; on subsequent boots the same outage is tolerated. The asymmetry also makes the intended error policy unclear to reviewers. Suggested fix: Make the two branches symmetric: `git clone ... || true` (or gate the whole git block on a reachability check) and log the failure, so a transient clone failure degrades to "agent runs without its profile repo" rather than aborting preStart. ### Suggestions - **settings.matrix.dm_auto_thread is not a bridged config key and is silently ignored** (modules/services/hermes.nix:193; medium confidence) gateway/config.py:1160-1178 bridges only `require_mention`, `free_response_rooms`, `allowed_rooms`, `auto_thread` and `dm_mention_threads` from the `matrix:` section of config.yaml; `dm_auto_thread` is read only from the environment (`gateway/platforms/matrix.py:515-516 os.getenv("MATRIX_DM_AUTO_THREAD", "false")`, documented at matrix.py:23). Impact: The key is written into config.yaml but never consumed; it coincides with Hermes' default (false) so behaviour is unchanged today, but the setting cannot be turned on from Nix as written. Suggested fix: Emit `MATRIX_DM_AUTO_THREAD` in `services.hermes-agent.environment` (the supported path), or replace the key with `dm_mention_threads`, which is bridged. ### Tests and validation - No configured deterministic checks. ### Questions - The README says model preferences live in the `nimmo/hermes` profile repository, but `services.hermes-agent.settings` sets no `model`, and the clone is never installed into `$HERMES_HOME/config.yaml` (the upstream activation script writes/merges only the Nix-generated config at `${cfg.stateDir}/.hermes/config.yaml`). How are the README's `qwen3.6:35b-a3b-q8_0` primary and `opencode-go` fallback actually selected at runtime? - `distribution.yaml` is symlinked into the state directory, but in the supplied source Hermes reads it only as a profile-distribution manifest at a profile root (`hermes_cli/profile_distribution.py:80 MANIFEST_FILENAME = "distribution.yaml"`, `hermes_cli/profiles.py:507 profile_dir / "distribution.yaml"`). Is a Hermes profile intended here, and if so should the clone be placed at `$HERMES_HOME/profiles/<name>/` rather than linked at the state-dir root? - `addToSystemPackages = true` is set, which per the upstream module exports `HERMES_HOME` into `environment.variables` for the whole host (nix/nixosModules.nix:651). Is that intended on Vega, where other agent runtimes (Paseo, pi-pangolin, MCP launchers) inherit the host environment? - Should `nixosConfig.backup.dataPaths = lib.mkAfter [ cfg.stateDir ]` be kept, given `hosts/vega/default.nix:181` already declares `/srv/services` and `modules/services/backrest.nix:22` filters out any path with a declared parent? It is harmless today; the question is whether it is meant as a per-host safety net for hosts that do not declare the `/srv/services` root. ### Review limitations - The only hermes-agent source available in the store is an older revision (`/nix/store/yjqpq487...`), not the locked `b30f95ac4a80d2f6dbe3aa01001b0524314f6d74`; the three "name is not recognised by Hermes" findings (MATRIX_E2EE_MODE, e2ee_mode, dm_auto_thread) are based on that earlier tree and would not apply if the newer revision added such bridging. - I read the upstream nixosModules.nix in the store rather than evaluating this PR's head, so the unit shape (User=hermes, HERMES_HOME, ProtectSystem=strict, ReadWritePaths, UMask=0007) is confirmed but the merged preStart/preStart text for this revision is not. - I did not run `nix flake check`, `nixos-eval`, or the `scripts/check-*.nix` assertions; I only checked by inspection that the added `registry.hermesMcpServers.redview` assertion matches the value `modules/mcp/redview.nix` produces for the `hermes` override branch. - No runtime behaviour was observed: ownership/permissions under `/srv/services/hermes/profile`, whether the agent can actually `git commit`/`git push` with the deploy key, whether the generated `searx-env` survives reboot, and whether the Matrix bridge connects are unverified. - Port 8888 was checked only against literal occurrences in this repository (it appears on Lyra for signal-cli, not on Vega); I did not enumerate effective listen ports of every Vega service or Docker container. - The contents of the `nimmo/hermes` profile repository were not supplied, so all claims about what the agent loads from it (SOUL.md, skills, model preferences) are inferred from the module and the upstream source. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 12 - Previous automated review: none found - Findings: 4 </details>
Author
Owner

Thank you for the detailed feedback! All points have been addressed in commit 0b604e2:

  1. Target $HERMES_HOME for Profile Symlinks (modules/services/hermes.nix):

    • Updated preStart to symlink SOUL.md, distribution.yaml, and skills directly into $HERMES_HOME (${cfg.stateDir}/.hermes) where Hermes actually loads them.
    • Updated the initial skills migration to copy from $HERMES_HOME/skills before replacing with the symlink.
    • Added cleanup of legacy symlinks at ${cfg.stateDir} root.
  2. Matrix E2EE & DM Auto-Thread Options (modules/services/hermes.nix):

    • Replaced matrixE2eeMode enum with matrixEncryption boolean, setting MATRIX_ENCRYPTION = "false" in the environment (matching upstream's supported variable).
    • Removed unbridged dm_auto_thread and e2ee_mode keys from settings.matrix.
    • Explicitly exported MATRIX_DM_AUTO_THREAD = "false" in the environment.
  3. Guarded Initial Clone (modules/services/hermes.nix):

    • Added an error guard || { echo "warning: initial clone of ... failed"; } around the initial git clone so a transient network failure does not abort unit preStart, making it symmetric with git pull.
  4. Declarative Model & Aliases Settings (modules/services/hermes.nix):

    • Declaratively defined model, providers, and model_aliases in services.hermes-agent.settings so the primary model (qwen3.6:35b-a3b-q8_0) and fallback (opencode-go) are explicitly managed and reproducible in NixOS.

All checks verified with nix flake check.

Thank you for the detailed feedback! All points have been addressed in commit `0b604e2`: 1. **Target `$HERMES_HOME` for Profile Symlinks (modules/services/hermes.nix)**: - Updated `preStart` to symlink `SOUL.md`, `distribution.yaml`, and `skills` directly into `$HERMES_HOME` (`${cfg.stateDir}/.hermes`) where Hermes actually loads them. - Updated the initial skills migration to copy from `$HERMES_HOME/skills` before replacing with the symlink. - Added cleanup of legacy symlinks at `${cfg.stateDir}` root. 2. **Matrix E2EE & DM Auto-Thread Options (modules/services/hermes.nix)**: - Replaced `matrixE2eeMode` enum with `matrixEncryption` boolean, setting `MATRIX_ENCRYPTION = "false"` in the environment (matching upstream's supported variable). - Removed unbridged `dm_auto_thread` and `e2ee_mode` keys from `settings.matrix`. - Explicitly exported `MATRIX_DM_AUTO_THREAD = "false"` in the environment. 3. **Guarded Initial Clone (modules/services/hermes.nix)**: - Added an error guard `|| { echo "warning: initial clone of ... failed"; }` around the initial `git clone` so a transient network failure does not abort unit preStart, making it symmetric with `git pull`. 4. **Declarative Model & Aliases Settings (modules/services/hermes.nix)**: - Declaratively defined `model`, `providers`, and `model_aliases` in `services.hermes-agent.settings` so the primary model (`qwen3.6:35b-a3b-q8_0`) and fallback (`opencode-go`) are explicitly managed and reproducible in NixOS. All checks verified with `nix flake check`.
fix(hermes): target HERMES_HOME for profile symlinks and align matrix options
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m41s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 16m17s
0b604e25de
- Target $HERMES_HOME (.hermes) for SOUL.md, distribution.yaml, and skills symlinks
- Migrate skills from .hermes/skills and clean up legacy root symlinks
- Replace matrixE2eeMode with matrixEncryption boolean emitting MATRIX_ENCRYPTION
- Add MATRIX_DM_AUTO_THREAD=false in service environment
- Make initial git clone resilient against transient network failures
- Declaratively configure model, providers, and model_aliases in settings
clankbot left a comment

Automated code review

Reviewed commit: 0b604e25de2148529a0b60b6eb99713d4bf51bcd

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The supplied changes add a Vega-only Hermes service module, a SearXNG service module, host enablement, a new hermes-agent flake input plus its auto-update tier, MCP-registry additions (hermesMcpServers, hermesEnv, the redview.hermes entry) and a matching new flake-check assertion. I verified the new assertion in scripts/check-redview-mcp.nix against the values produced by modules/mcp/redview.nix (headers."X-Api-Key" = "\${" + tokenEnvVar + "}") and the s ? hermes branch in modules/mcp/default.nix: both sides evaluate to {url; enabled = true; headers."X-Api-Key" = "${REDVIEW_MCP_API_KEY}"}, so that check is consistent. hermesEnv only emits VAR=placeholder lines for servers that carry both tokenEnvVar and secretName, and every such server module (trilium, kiwifs, synthseek, navidrome, redview) defines that key in its own sopsSecrets, which modules/services/hermes.nix re-adds with group = "hermes", so no undefined config.sops.placeholder.* lookup is introduced. secrets/hermes.yaml's new keys match the key = paths in the new module and the secrets/README.md row, and .sops.yaml scopes that file to vega plus admin keys. The new tier in lib/auto-update-policy.nix is covered by the rootInputs derivation in flake.nix (line 284), so the input is classified. Remaining reportable items are an evidence gap mandated by AGENTS.md and two cross-module coupling/duplication concerns inside the changed files; behaviours of the pinned hermes-agent nixosModule and of the nixpkgs services.searx module are not in the supplied material and are raised only as questions.

Blocking findings

None.

Important findings

  • New auto-update tier has no no-op follow-up evidence, which AGENTS.md requires before closing (lib/auto-update-policy.nix:215; high confidence)
    The change registers a new group (name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ]) and flake.nix adds hermes-agent to the flake's input argument set (flake.nix diff, alongside rootInputs = builtins.attrNames (builtins.removeAttrs inputs [ "self" ]) at line 284), so the updater treats it as a live producer input rather than a pinned one. AGENTS.md line 43 states: "For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue." The supplied material contains no record of a no-op follow-up for this new tier.
    Impact: The producer-side behaviour of the new tier is untested for the case that matters most to a newly classified input: a scheduled cycle with no upstream change. If the tier is mis-scoped, the first symptom is a repeated rebuild of Vega, a held-back input, or a partial-update notification for the other three hosts - none of which nix flake check can detect.
    Suggested fix: Before closing the issue, record the second half of the documented rollout evidence: one genuine deployment plus a subsequent no-op auto-update observation (e.g. just auto-update-last-run after a scheduled cycle with no input change), and confirm the hermes-agent tier is a no-op on electra, lena and lyra.

Suggestions

  • Hermes' SearXNG URL default duplicates the SearXNG port option instead of deriving from it (modules/services/hermes.nix:98; medium confidence)
    searxngUrl defaults to the literal "http://127.0.0.1:8888" and is fed to both SEARXNG_URL (line 178) and web.search_backend = "searxng" (line 223). The new modules/services/searxng.nix exposes the same value only through its own independent options port (line 17, default 8888) and bindAddress (line 22, default 0.0.0.0), and hosts/vega/default.nix enables both with nixosConfig.hermes = { enable = true; } and nixosConfig.searxng.enable = true without relating them. Nothing in the changed files asserts the two agree.
    Impact: Overriding nixosConfig.searxng.port or bindAddress leaves Hermes pointed at a dead listener; the configuration still evaluates and both services still start, so the break is silent at runtime rather than caught by nix flake check. The same coupling also holds when nixosConfig.searxng.enable = false while Hermes stays enabled.
    Suggested fix: Single-source the value: default searxngUrl from the SearXNG module (e.g. "http://127.0.0.1:${toString config.nixosConfig.searxng.port}"), or add an evaluation-time assertion in modules/services/hermes.nix that cfg.searxngUrl matches the enabled nixosConfig.searxng port/bindAddress so a mismatch fails at evaluation.

  • preStop derives the gateway paths from $HERMES_HOME while preStart derives them from cfg.stateDir (modules/services/hermes.nix:282; medium confidence)
    preStart deliberately avoids the environment and hardcodes the path (hermes_home="${cfg.stateDir}/.hermes", line 236, used for mkdir -p and every symlink). preStop (lines 282-290) instead reads and writes $HERMES_HOME/gateway.pid and $HERMES_HOME/.gateway-planned-stop.json. The services.hermes-agent.environment block this module contributes (lines 166-179) sets only HERMES_TIMEZONE, MATRIX_, GIT_ and SEARXNG_URL; no HERMES_HOME appears in the changed files. The unit is also registered for failure monitoring at line 302 (services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ]), and the module already relies on upstream-supplied Environment entries elsewhere (Environment = [ "MESSAGING_CWD=" ] clearing a deprecated upstream assignment).
    Impact: The planned-stop marker is only correct if the pinned upstream module exports HERMES_HOME with exactly the value preStart uses. If it does not, $HERMES_HOME expands empty, the guard tests /gateway.pid, no marker is written, and the stated purpose of the block - suppressing a false alert when NixOS activation stops the service with SIGTERM - is not met; every nixos-rebuild/just test on Vega would then raise an ntfy failure alert for hermes-agent.service. This cannot be confirmed from the supplied material.
    Suggested fix: Make the path single-sourced by construction: interpolate cfg.stateDir into preStop exactly as preStart does at line 236 (e.g. hermes_home="${cfg.stateDir}/.hermes" at the top of the preStop script), rather than depending on an inherited shell variable. Confirm the resolved value on Vega with systemctl show hermes-agent -p Environment.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the pinned hermes-agent nixosModule export HERMES_HOME into hermes-agent.service's environment, and does it equal ${cfg.stateDir}/.hermes that preStart creates at line 236? The upstream module (inputs.hermes-agent.nixosModules.default) is not in the supplied material.
  • Does the pinned Hermes config.yaml mcp_servers schema expand ${VAR} inside header values at request time? modules/mcp/default.nix emits Authorization = "Bearer \${VAR}" and modules/mcp/redview.nix emits X-Api-Key = "\${REDVIEW_MCP_API_KEY}" for Hermes, whereas the OpenCode entries use the {env:VAR} form; only the redview shape is asserted by scripts/check-redview-mcp.nix, which checks the generated value, not its runtime expansion.
  • Does the pinned module create workingDirectory (default ${cfg.stateDir}/workspace, passed at line 181) and stateDir? The supplied preStart creates only $hermes_home and $repo_dir via clone.
  • Is secret_key = "$SEARX_SECRET_KEY" (searxng.nix line 79) expanded by the nixpkgs services.searx service from its environmentFile, or is the literal string written into the settings file? The nixpkgs module is not supplied, and the generated value is written separately at line 60.
  • Is services.searx the intended (SearXNG-backed) nixpkgs module, and does it define the searx-init.service unit that searxng.nix lines 49-50 and 67-68 order against, plus a searx user for User = "searx" / StateDirectory = "searx"? The option name, README wording and unit names disagree on whether this is SearxNG or legacy Searx.

Review limitations

  • The pinned hermes-agent flake input (inputs.hermes-agent.nixosModules.default) is not present in the supplied material, so its option names (mcpServers, extraDependencyGroups, stateDir, settings, addToSystemPackages), the user/group it creates, its unit name, and any HERMES_HOME/preStop/Environment defaults it contributes could not be inspected.
  • The nixpkgs services.searx module is not supplied, so environmentFile, settings, the searx-init unit, the searx user, and whether $SEARX_SECRET_KEY is expanded could not be verified.
  • No commands were executed and no code was run: nix flake check, just test, and any live Vega canary are not independently confirmed here. The pull-request description was not supplied in this pass, so the evidence-gap finding is stated only against the material provided.
  • Only the files listed as changed were examined in full; unchanged consumers of the MCP registry (for example modules/profiles/ai-agents.nix line 37 sops.secrets = mcp.sopsSecrets;) were read only as needed to assess the group = "hermes" / mode = lib.mkForce "0440" interaction at hermes.nix lines 132-140.
  • flake.lock was reviewed only for scope: the root home-manager input still resolves to a node whose nixpkgs follows the root nixpkgs, and the new hermes-agent node's sub-inputs (flake-parts, home-manager, npm-lockfile-fix, pyproject-build-systems, pyproject-nix, uv2nix) all follow hermes-agent's nixpkgs, which follows the root; no lock-entry regression was demonstrated.
  • The KiwiFS page referenced by the AGENTS.md durable-memory rules (pages/projects/nixos-config/hermes.md) is not part of this checkout, so documentation claims about Hermes could not be cross-checked there.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 13
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `0b604e25de2148529a0b60b6eb99713d4bf51bcd` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The supplied changes add a Vega-only Hermes service module, a SearXNG service module, host enablement, a new `hermes-agent` flake input plus its auto-update tier, MCP-registry additions (`hermesMcpServers`, `hermesEnv`, the `redview.hermes` entry) and a matching new flake-check assertion. I verified the new assertion in `scripts/check-redview-mcp.nix` against the values produced by `modules/mcp/redview.nix` (`headers."X-Api-Key" = "\${" + tokenEnvVar + "}"`) and the `s ? hermes` branch in `modules/mcp/default.nix`: both sides evaluate to `{url; enabled = true; headers."X-Api-Key" = "${REDVIEW_MCP_API_KEY}"}`, so that check is consistent. `hermesEnv` only emits `VAR=placeholder` lines for servers that carry both `tokenEnvVar` and `secretName`, and every such server module (trilium, kiwifs, synthseek, navidrome, redview) defines that key in its own `sopsSecrets`, which `modules/services/hermes.nix` re-adds with `group = "hermes"`, so no undefined `config.sops.placeholder.*` lookup is introduced. `secrets/hermes.yaml`'s new keys match the `key =` paths in the new module and the `secrets/README.md` row, and `.sops.yaml` scopes that file to `vega` plus admin keys. The new tier in `lib/auto-update-policy.nix` is covered by the `rootInputs` derivation in `flake.nix` (line 284), so the input is classified. Remaining reportable items are an evidence gap mandated by AGENTS.md and two cross-module coupling/duplication concerns inside the changed files; behaviours of the pinned `hermes-agent` nixosModule and of the nixpkgs `services.searx` module are not in the supplied material and are raised only as questions. ### Blocking findings None. ### Important findings - **New auto-update tier has no no-op follow-up evidence, which AGENTS.md requires before closing** (lib/auto-update-policy.nix:215; high confidence) The change registers a new group (`name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ]`) and `flake.nix` adds `hermes-agent` to the flake's input argument set (flake.nix diff, alongside `rootInputs = builtins.attrNames (builtins.removeAttrs inputs [ "self" ])` at line 284), so the updater treats it as a live producer input rather than a pinned one. AGENTS.md line 43 states: "For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue." The supplied material contains no record of a no-op follow-up for this new tier. Impact: The producer-side behaviour of the new tier is untested for the case that matters most to a newly classified input: a scheduled cycle with no upstream change. If the tier is mis-scoped, the first symptom is a repeated rebuild of Vega, a held-back input, or a partial-update notification for the other three hosts - none of which `nix flake check` can detect. Suggested fix: Before closing the issue, record the second half of the documented rollout evidence: one genuine deployment plus a subsequent no-op auto-update observation (e.g. `just auto-update-last-run` after a scheduled cycle with no input change), and confirm the `hermes-agent` tier is a no-op on electra, lena and lyra. ### Suggestions - **Hermes' SearXNG URL default duplicates the SearXNG port option instead of deriving from it** (modules/services/hermes.nix:98; medium confidence) `searxngUrl` defaults to the literal `"http://127.0.0.1:8888"` and is fed to both `SEARXNG_URL` (line 178) and `web.search_backend = "searxng"` (line 223). The new `modules/services/searxng.nix` exposes the same value only through its own independent options `port` (line 17, default 8888) and `bindAddress` (line 22, default `0.0.0.0`), and `hosts/vega/default.nix` enables both with `nixosConfig.hermes = { enable = true; }` and `nixosConfig.searxng.enable = true` without relating them. Nothing in the changed files asserts the two agree. Impact: Overriding `nixosConfig.searxng.port` or `bindAddress` leaves Hermes pointed at a dead listener; the configuration still evaluates and both services still start, so the break is silent at runtime rather than caught by `nix flake check`. The same coupling also holds when `nixosConfig.searxng.enable = false` while Hermes stays enabled. Suggested fix: Single-source the value: default `searxngUrl` from the SearXNG module (e.g. `"http://127.0.0.1:${toString config.nixosConfig.searxng.port}"`), or add an evaluation-time assertion in `modules/services/hermes.nix` that `cfg.searxngUrl` matches the enabled `nixosConfig.searxng` port/bindAddress so a mismatch fails at evaluation. - **preStop derives the gateway paths from $HERMES_HOME while preStart derives them from cfg.stateDir** (modules/services/hermes.nix:282; medium confidence) `preStart` deliberately avoids the environment and hardcodes the path (`hermes_home="${cfg.stateDir}/.hermes"`, line 236, used for `mkdir -p` and every symlink). `preStop` (lines 282-290) instead reads and writes `$HERMES_HOME/gateway.pid` and `$HERMES_HOME/.gateway-planned-stop.json`. The `services.hermes-agent.environment` block this module contributes (lines 166-179) sets only HERMES_TIMEZONE, MATRIX_*, GIT_* and SEARXNG_URL; no `HERMES_HOME` appears in the changed files. The unit is also registered for failure monitoring at line 302 (`services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ]`), and the module already relies on upstream-supplied `Environment` entries elsewhere (`Environment = [ "MESSAGING_CWD=" ]` clearing a deprecated upstream assignment). Impact: The planned-stop marker is only correct if the pinned upstream module exports `HERMES_HOME` with exactly the value `preStart` uses. If it does not, `$HERMES_HOME` expands empty, the guard tests `/gateway.pid`, no marker is written, and the stated purpose of the block - suppressing a false alert when NixOS activation stops the service with SIGTERM - is not met; every `nixos-rebuild`/`just test` on Vega would then raise an ntfy failure alert for `hermes-agent.service`. This cannot be confirmed from the supplied material. Suggested fix: Make the path single-sourced by construction: interpolate `cfg.stateDir` into `preStop` exactly as `preStart` does at line 236 (e.g. `hermes_home="${cfg.stateDir}/.hermes"` at the top of the preStop script), rather than depending on an inherited shell variable. Confirm the resolved value on Vega with `systemctl show hermes-agent -p Environment`. ### Tests and validation - No configured deterministic checks. ### Questions - Does the pinned `hermes-agent` nixosModule export `HERMES_HOME` into `hermes-agent.service`'s environment, and does it equal `${cfg.stateDir}/.hermes` that `preStart` creates at line 236? The upstream module (`inputs.hermes-agent.nixosModules.default`) is not in the supplied material. - Does the pinned Hermes `config.yaml` `mcp_servers` schema expand `${VAR}` inside header values at request time? `modules/mcp/default.nix` emits `Authorization = "Bearer \${VAR}"` and `modules/mcp/redview.nix` emits `X-Api-Key = "\${REDVIEW_MCP_API_KEY}"` for Hermes, whereas the OpenCode entries use the `{env:VAR}` form; only the redview shape is asserted by `scripts/check-redview-mcp.nix`, which checks the generated value, not its runtime expansion. - Does the pinned module create `workingDirectory` (default `${cfg.stateDir}/workspace`, passed at line 181) and `stateDir`? The supplied `preStart` creates only `$hermes_home` and `$repo_dir` via clone. - Is `secret_key = "$SEARX_SECRET_KEY"` (searxng.nix line 79) expanded by the nixpkgs `services.searx` service from its `environmentFile`, or is the literal string written into the settings file? The nixpkgs module is not supplied, and the generated value is written separately at line 60. - Is `services.searx` the intended (SearXNG-backed) nixpkgs module, and does it define the `searx-init.service` unit that `searxng.nix` lines 49-50 and 67-68 order against, plus a `searx` user for `User = "searx"` / `StateDirectory = "searx"`? The option name, README wording and unit names disagree on whether this is SearxNG or legacy Searx. ### Review limitations - The pinned `hermes-agent` flake input (`inputs.hermes-agent.nixosModules.default`) is not present in the supplied material, so its option names (`mcpServers`, `extraDependencyGroups`, `stateDir`, `settings`, `addToSystemPackages`), the user/group it creates, its unit name, and any `HERMES_HOME`/`preStop`/`Environment` defaults it contributes could not be inspected. - The nixpkgs `services.searx` module is not supplied, so `environmentFile`, `settings`, the `searx-init` unit, the `searx` user, and whether `$SEARX_SECRET_KEY` is expanded could not be verified. - No commands were executed and no code was run: `nix flake check`, `just test`, and any live Vega canary are not independently confirmed here. The pull-request description was not supplied in this pass, so the evidence-gap finding is stated only against the material provided. - Only the files listed as changed were examined in full; unchanged consumers of the MCP registry (for example `modules/profiles/ai-agents.nix` line 37 `sops.secrets = mcp.sopsSecrets;`) were read only as needed to assess the `group = "hermes"` / `mode = lib.mkForce "0440"` interaction at hermes.nix lines 132-140. - flake.lock was reviewed only for scope: the root `home-manager` input still resolves to a node whose `nixpkgs` follows the root nixpkgs, and the new `hermes-agent` node's sub-inputs (`flake-parts`, `home-manager`, `npm-lockfile-fix`, `pyproject-build-systems`, `pyproject-nix`, `uv2nix`) all follow `hermes-agent`'s nixpkgs, which follows the root; no lock-entry regression was demonstrated. - The KiwiFS page referenced by the AGENTS.md durable-memory rules (`pages/projects/nixos-config/hermes.md`) is not part of this checkout, so documentation claims about Hermes could not be cross-checked there. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 13 - Previous automated review: none found - Findings: 3 </details>
Author
Owner

Implemented the review suggestions in commit 387d203:

  1. SearXNG Port Derivation: options.nixosConfig.hermes.searxngUrl now dynamically defaults to "http://127.0.0.1:${toString config.nixosConfig.searxng.port}" when config.nixosConfig ? searxng, falling back to http://127.0.0.1:8888.
  2. Hermes State Directory in preStop: Single-sourced hermes_home="${cfg.stateDir}/.hermes" at the top of preStop, mirroring preStart and eliminating dependencies on $HERMES_HOME.
  3. Issue #309 Lifecycle: Confirmed that PR #311 intentionally avoids closing keywords so Issue #309 remains open until post-merge canary deployment and a subsequent no-op auto-update check are documented per AGENTS.md.

Flake evaluation and formatting checks passed cleanly (treefmt-check and full flake check passed). Pushing the commit now to trigger the next review run.

Implemented the review suggestions in commit `387d203`: 1. **SearXNG Port Derivation**: `options.nixosConfig.hermes.searxngUrl` now dynamically defaults to `"http://127.0.0.1:${toString config.nixosConfig.searxng.port}"` when `config.nixosConfig ? searxng`, falling back to `http://127.0.0.1:8888`. 2. **Hermes State Directory in preStop**: Single-sourced `hermes_home="${cfg.stateDir}/.hermes"` at the top of `preStop`, mirroring `preStart` and eliminating dependencies on `$HERMES_HOME`. 3. **Issue #309 Lifecycle**: Confirmed that PR #311 intentionally avoids closing keywords so Issue #309 remains open until post-merge canary deployment and a subsequent no-op auto-update check are documented per `AGENTS.md`. Flake evaluation and formatting checks passed cleanly (`treefmt-check` and full flake check passed). Pushing the commit now to trigger the next review run.
refactor(hermes): derive searxngUrl port and single-source hermes_home in preStop
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m33s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 8m32s
387d203adc
clankbot left a comment

Automated code review

Reviewed commit: 387d203adca1f92c226063b27b7f0348b0afed55

Verdict: Ready to merge

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

Overall assessment

The Hermes/SearXNG wiring is internally consistent across the changed files: the new hermes-agent root input is declared in flake.nix and added to the flake's output argument set, and it is classified in lib/auto-update-policy.nix as required by the README rule at README.md:149 ("New root flake inputs must also be classified by real consumers"); the re-keyed flake.lock entries (flake-parts/flake-parts_2/flake-parts_3, home-manager/home-manager_2, root mapping "home-manager": "home-manager_2") keep every existing consumer pointing at a lock entry whose nixpkgs path still resolves to the root nixpkgs; secrets/hermes.yaml is covered by the vega-scoped rule in .sops.yaml and the three keys it adds match the three sops.secrets entries in modules/services/hermes.nix; the new registry.hermesMcpServers.redview assertion in scripts/check-redview-mcp.nix:50 matches the literal ${REDVIEW_MCP_API_KEY} produced by modules/mcp/redview.nix:44, and hermesEnv supplies that variable through the hermes-env template, which systemd reads as root, so no template ownership change is needed. The two findings are latent defects in the new modules: an lib.mkIf applied to the value of a systemd.services.<name> assignment, and a searxngUrl default that keys on module presence rather than on the searxng module's own enable/bindAddress options. Everything else I could not decide from supplied material is listed as a question.

Blocking findings

None.

Important findings

None.

Suggestions

  • lib.mkIf guards the value of systemd.services.searx-secret-key, so the disabled branch still emits an empty unit (modules/services/searxng.nix:47; medium confidence)
    modules/services/searxng.nix:47 writes systemd.services.searx-secret-key = lib.mkIf (cfg.environmentFile == null) { ... }. systemd.services is an attrsOf-submodule option, so lib.mkIf false {...} still assigns searx-secret-key = {} and therefore still creates the attribute; searx-secret-key is defined nowhere else in the repository (grep over the checkout returns only this module and the wantedBy/after/requires references at lines 49-50 and 67-68), so the generated unit would carry no script/ExecStart. Vega currently leaves nixosConfig.searxng.environmentFile at its null default (hosts/vega/default.nix:272 only sets enable = true), so the enabled branch is taken today and this is latent.
    Impact: If any host ever sets nixosConfig.searxng.environmentFile, the configuration would emit an ExecStart-less searx-secret-key.service instead of omitting the generator, i.e. a spurious unit rather than no unit. (The same pattern at line 66 is harmless for searx-init, since that unit is expected to come from the upstream service module and would merge with the empty assignment.)
    Suggested fix: Guard the declaration rather than its value, e.g. config = lib.mkIf cfg.enable [ (lib.mkIf (cfg.environmentFile == null) { systemd.services.searx-secret-key = { ... }; systemd.services.searx-init = { ... }; }) ] via lib.mkMerge, so no assignment to systemd.services.searx-secret-key exists when the generator is not wanted.

  • Hermes searxngUrl default keys on module presence, not on searxng.enable or bindAddress (modules/services/hermes.nix:99; medium confidence)
    modules/services/hermes.nix:99-102 defaults searxngUrl to "http://127.0.0.1:${toString config.nixosConfig.searxng.port}" guarded only by config.nixosConfig ? searxng, falling back to a hardcoded "http://127.0.0.1:8888". The searxng module introduced in the same change declares options.nixosConfig.searxng.enable (modules/services/searxng.nix:13) and bindAddress (modules/services/searxng.nix:21, default "0.0.0.0"), and wraps its whole config block in lib.mkIf cfg.enable (line 46); neither is consulted by the default. hosts/vega/default.nix:272 sets enable = true, so Vega itself is consistent today.
    Impact: A host that imports modules/services/searxng.nix with enable = false, or that overrides bindAddress, would still receive SEARXNG_URL and the web.search_backend = "searxng" settings block (modules/services/hermes.nix:181 and :225 are gated only on cfg.searxngUrl != null) pointing at an address with nothing listening, silently mis-configuring Hermes web search.
    Suggested fix: Gate the default on config.nixosConfig.searxng.enable (returning null when disabled, which already suppresses both SEARXNG_URL and the web block through the existing optionalAttrs), and build the host part from config.nixosConfig.searxng.bindAddress instead of hardcoding 127.0.0.1.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the pinned nixpkgs still declare services.searx? modules/services/searxng.nix:71 sets services.searx.enable, settings.server.* and environmentFile, and orders against searx-init.service (lines 49-50, 67-68), which is not defined anywhere in this repository. If that option or unit no longer exists in nixpkgs-unstable, evaluation of Vega fails and scripts/check-service-failure-monitor.nix (which reads config.systemd.services.searx for the watched name added at modules/services/searxng.nix:96) would also fail.
  • Does SearXNG's settings loader expand $SEARX_SECRET_KEY from the process environment? modules/services/searxng.nix:79 puts the literal string "$SEARX_SECRET_KEY" into services.searx.settings.server.secret_key, while the generated value is written only into /var/lib/searx/searx-env (line 60), which is supplied as environmentFile (line 74). If the loader does not expand $VAR, the effective secret key is a fixed public literal identical on every deployment and the generated key file is unused; the PR's 'automated secret key generation' claim would not hold. Which substitution form does the pinned module support (e.g. !ENV)?
  • Is searx.service ordered after searx-init.service by the upstream module? The new generator is ordered only before = [ "searx-init.service" ] and searx-init gets after/requires of it, so nothing in the supplied material orders the searx service itself after the key generator; a first start could race key creation.
  • Does Hermes' ~/.hermes/config.yaml interpolate ${VAR} inside mcp_servers headers from the process environment? modules/mcp/redview.nix:44 and the generic http branch at modules/mcp/default.nix:192 emit literal ${REDVIEW_MCP_API_KEY} / Bearer ${VAR} strings, and scripts/check-redview-mcp.nix:50 asserts only that literal string, so interpolation is untested here.
  • Does inputs.hermes-agent.nixosModules.default create the hermes user and group and run the daemon as that user? modules/services/hermes.nix assumes it: users.users.hermes.extraGroups = [ "users" ], users.users.${user}.extraGroups = [ "hermes" ], and the MCP secret override group = "hermes"; mode = lib.mkForce "0440" (lines 141-142), which is what lets the stdio launchers (modules/mcp/beszel.nix, modules/mcp/pangolin.nix) cat their config.sops.secrets.*.path files as the hermes user.

Review limitations

  • No Nix evaluation was performed and no repository code was executed; nix flake check, the check-redview-mcp and check-service-failure-monitor assertions, and any live-service evidence were not independently verified.
  • The pinned github:NousResearch/hermes-agent flake and nixpkgs' services.searx module are not present in the checkout, so the option names and defaults consumed by the new modules (services.hermes-agent.{mcpServers,extraDependencyGroups,settings,environment,environmentFiles,stateDir,workingDirectory,addToSystemPackages}, services.searx.settings, and the searx-init.service unit) could not be inspected.
  • Only the listed changed files were diffed; unchanged consumers of modules/mcp/default.nix (the ai-desktop/ai-runtime/pi-pangolin profiles) were read for consistency against the new hermesMcpServers/hermesEnv branches but not compared against a base revision.
  • Secret material in secrets/hermes.yaml and secrets/README.md was treated as encrypted SOPS evidence only; no secret value was inspected or disclosed, and no claim is made about whether the re-encrypted hermes/matrix/access-token is a rotation or a re-encryption.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 14
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `387d203adca1f92c226063b27b7f0348b0afed55` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment The Hermes/SearXNG wiring is internally consistent across the changed files: the new `hermes-agent` root input is declared in `flake.nix` and added to the flake's output argument set, and it is classified in `lib/auto-update-policy.nix` as required by the README rule at README.md:149 ("New root flake inputs must also be classified by real consumers"); the re-keyed `flake.lock` entries (`flake-parts`/`flake-parts_2`/`flake-parts_3`, `home-manager`/`home-manager_2`, root mapping `"home-manager": "home-manager_2"`) keep every existing consumer pointing at a lock entry whose `nixpkgs` path still resolves to the root nixpkgs; `secrets/hermes.yaml` is covered by the vega-scoped rule in `.sops.yaml` and the three keys it adds match the three `sops.secrets` entries in `modules/services/hermes.nix`; the new `registry.hermesMcpServers.redview` assertion in `scripts/check-redview-mcp.nix:50` matches the literal `${REDVIEW_MCP_API_KEY}` produced by `modules/mcp/redview.nix:44`, and `hermesEnv` supplies that variable through the `hermes-env` template, which systemd reads as root, so no template ownership change is needed. The two findings are latent defects in the new modules: an `lib.mkIf` applied to the *value* of a `systemd.services.<name>` assignment, and a `searxngUrl` default that keys on module presence rather than on the searxng module's own `enable`/`bindAddress` options. Everything else I could not decide from supplied material is listed as a question. ### Blocking findings None. ### Important findings None. ### Suggestions - **lib.mkIf guards the value of systemd.services.searx-secret-key, so the disabled branch still emits an empty unit** (modules/services/searxng.nix:47; medium confidence) `modules/services/searxng.nix:47` writes `systemd.services.searx-secret-key = lib.mkIf (cfg.environmentFile == null) { ... }`. `systemd.services` is an attrsOf-submodule option, so `lib.mkIf false {...}` still assigns `searx-secret-key = {}` and therefore still creates the attribute; `searx-secret-key` is defined nowhere else in the repository (grep over the checkout returns only this module and the `wantedBy`/`after`/`requires` references at lines 49-50 and 67-68), so the generated unit would carry no `script`/`ExecStart`. Vega currently leaves `nixosConfig.searxng.environmentFile` at its `null` default (`hosts/vega/default.nix:272` only sets `enable = true`), so the enabled branch is taken today and this is latent. Impact: If any host ever sets `nixosConfig.searxng.environmentFile`, the configuration would emit an ExecStart-less `searx-secret-key.service` instead of omitting the generator, i.e. a spurious unit rather than no unit. (The same pattern at line 66 is harmless for `searx-init`, since that unit is expected to come from the upstream service module and would merge with the empty assignment.) Suggested fix: Guard the declaration rather than its value, e.g. `config = lib.mkIf cfg.enable [ (lib.mkIf (cfg.environmentFile == null) { systemd.services.searx-secret-key = { ... }; systemd.services.searx-init = { ... }; }) ]` via `lib.mkMerge`, so no assignment to `systemd.services.searx-secret-key` exists when the generator is not wanted. - **Hermes searxngUrl default keys on module presence, not on searxng.enable or bindAddress** (modules/services/hermes.nix:99; medium confidence) `modules/services/hermes.nix:99-102` defaults `searxngUrl` to `"http://127.0.0.1:${toString config.nixosConfig.searxng.port}"` guarded only by `config.nixosConfig ? searxng`, falling back to a hardcoded `"http://127.0.0.1:8888"`. The searxng module introduced in the same change declares `options.nixosConfig.searxng.enable` (`modules/services/searxng.nix:13`) and `bindAddress` (`modules/services/searxng.nix:21`, default `"0.0.0.0"`), and wraps its whole `config` block in `lib.mkIf cfg.enable` (line 46); neither is consulted by the default. `hosts/vega/default.nix:272` sets `enable = true`, so Vega itself is consistent today. Impact: A host that imports `modules/services/searxng.nix` with `enable = false`, or that overrides `bindAddress`, would still receive `SEARXNG_URL` and the `web.search_backend = "searxng"` settings block (`modules/services/hermes.nix:181` and `:225` are gated only on `cfg.searxngUrl != null`) pointing at an address with nothing listening, silently mis-configuring Hermes web search. Suggested fix: Gate the default on `config.nixosConfig.searxng.enable` (returning `null` when disabled, which already suppresses both `SEARXNG_URL` and the `web` block through the existing `optionalAttrs`), and build the host part from `config.nixosConfig.searxng.bindAddress` instead of hardcoding `127.0.0.1`. ### Tests and validation - No configured deterministic checks. ### Questions - Does the pinned nixpkgs still declare `services.searx`? `modules/services/searxng.nix:71` sets `services.searx.enable`, `settings.server.*` and `environmentFile`, and orders against `searx-init.service` (lines 49-50, 67-68), which is not defined anywhere in this repository. If that option or unit no longer exists in nixpkgs-unstable, evaluation of Vega fails and `scripts/check-service-failure-monitor.nix` (which reads `config.systemd.services.searx` for the watched name added at `modules/services/searxng.nix:96`) would also fail. - Does SearXNG's settings loader expand `$SEARX_SECRET_KEY` from the process environment? `modules/services/searxng.nix:79` puts the literal string `"$SEARX_SECRET_KEY"` into `services.searx.settings.server.secret_key`, while the generated value is written only into `/var/lib/searx/searx-env` (line 60), which is supplied as `environmentFile` (line 74). If the loader does not expand `$VAR`, the effective secret key is a fixed public literal identical on every deployment and the generated key file is unused; the PR's 'automated secret key generation' claim would not hold. Which substitution form does the pinned module support (e.g. `!ENV`)? - Is `searx.service` ordered after `searx-init.service` by the upstream module? The new generator is ordered only `before = [ "searx-init.service" ]` and `searx-init` gets `after`/`requires` of it, so nothing in the supplied material orders the searx service itself after the key generator; a first start could race key creation. - Does Hermes' `~/.hermes/config.yaml` interpolate `${VAR}` inside `mcp_servers` headers from the process environment? `modules/mcp/redview.nix:44` and the generic http branch at `modules/mcp/default.nix:192` emit literal `${REDVIEW_MCP_API_KEY}` / `Bearer ${VAR}` strings, and `scripts/check-redview-mcp.nix:50` asserts only that literal string, so interpolation is untested here. - Does `inputs.hermes-agent.nixosModules.default` create the `hermes` user and group and run the daemon as that user? `modules/services/hermes.nix` assumes it: `users.users.hermes.extraGroups = [ "users" ]`, `users.users.${user}.extraGroups = [ "hermes" ]`, and the MCP secret override `group = "hermes"; mode = lib.mkForce "0440"` (lines 141-142), which is what lets the stdio launchers (`modules/mcp/beszel.nix`, `modules/mcp/pangolin.nix`) `cat` their `config.sops.secrets.*.path` files as the hermes user. ### Review limitations - No Nix evaluation was performed and no repository code was executed; `nix flake check`, the `check-redview-mcp` and `check-service-failure-monitor` assertions, and any live-service evidence were not independently verified. - The pinned `github:NousResearch/hermes-agent` flake and nixpkgs' `services.searx` module are not present in the checkout, so the option names and defaults consumed by the new modules (`services.hermes-agent.{mcpServers,extraDependencyGroups,settings,environment,environmentFiles,stateDir,workingDirectory,addToSystemPackages}`, `services.searx.settings`, and the `searx-init.service` unit) could not be inspected. - Only the listed changed files were diffed; unchanged consumers of `modules/mcp/default.nix` (the ai-desktop/ai-runtime/pi-pangolin profiles) were read for consistency against the new `hermesMcpServers`/`hermesEnv` branches but not compared against a base revision. - Secret material in `secrets/hermes.yaml` and `secrets/README.md` was treated as encrypted SOPS evidence only; no secret value was inspected or disclosed, and no claim is made about whether the re-encrypted `hermes/matrix/access-token` is a rotation or a re-encryption. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 14 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Addressed the advisory findings from Review #53 in commit a064cdd:

  1. SearXNG Secret Service Unit Scoping: In modules/services/searxng.nix, wrapped the systemd.services definition block in lib.mkIf (cfg.environmentFile == null) rather than assigning mkIf to unit attribute values. This guarantees no empty searx-secret-key.service unit attribute is emitted when a custom environmentFile is specified.
  2. Hermes SearXNG URL Default Gating: In modules/services/hermes.nix, gated the searxngUrl default on both module presence and config.nixosConfig.searxng.enable, resolving the effective bind address (127.0.0.1 for 0.0.0.0, or the custom bindAddress) and returning null when SearXNG is disabled or absent. When null, both SEARXNG_URL and web.search_backend are cleanly suppressed.

Validation: treefmt-check and full nix flake check passed cleanly. Pushing commit a064cdd to trigger final verification.

Addressed the advisory findings from Review #53 in commit `a064cdd`: 1. **SearXNG Secret Service Unit Scoping**: In `modules/services/searxng.nix`, wrapped the `systemd.services` definition block in `lib.mkIf (cfg.environmentFile == null)` rather than assigning `mkIf` to unit attribute values. This guarantees no empty `searx-secret-key.service` unit attribute is emitted when a custom `environmentFile` is specified. 2. **Hermes SearXNG URL Default Gating**: In `modules/services/hermes.nix`, gated the `searxngUrl` default on both module presence and `config.nixosConfig.searxng.enable`, resolving the effective bind address (`127.0.0.1` for `0.0.0.0`, or the custom `bindAddress`) and returning `null` when SearXNG is disabled or absent. When `null`, both `SEARXNG_URL` and `web.search_backend` are cleanly suppressed. Validation: `treefmt-check` and full `nix flake check` passed cleanly. Pushing commit `a064cdd` to trigger final verification.
fix(searxng,hermes): guard searxng secret services and gate hermes searxngUrl default on enable
Some checks failed
Build and Push Attic Cache / test (pull_request) Successful in 1m27s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Failing after 7m45s
a064cddc2d
clankbot left a comment

Automated code review

Reviewed commit: a064cddc2d1cd24b29b49ce1378c91f290378542

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The change wires a new Vega-only Hermes service (modules/services/hermes.nix), a new SearXNG module, a new hermes-agent flake input, its auto-update policy group, and a new Hermes view of the MCP registry (modules/mcp/default.nix hermesMcpServers/hermesEnv plus the hermes entry in modules/mcp/redview.nix). Cross-references that could be checked in the checkout line up: the new assertion in scripts/check-redview-mcp.nix matches the literal ${REDVIEW_MCP_API_KEY} header produced by modules/mcp/redview.nix:44 (the check imports the registry directly, so it is unaffected by the mode/group override in hermes.nix); hermes-agent is added both to the flake input set (flake.nix) and to the }@inputs: pattern, and is classified in lib/auto-update-policy.nix with hosts = [ "vega" ], matching the only host that imports modules/services/hermes.nix; secrets/hermes.yaml is scoped to Vega in .sops.yaml; port 8888 is unused on Vega (only Lyra uses it, for signal-cli); the added backup path is de-duplicated by modules/services/backrest.nix against the existing /srv/services parent. The reportable defects are confined to the new modules: an undeclared model provider (with a dead providers.nova entry), unguarded git config --global calls in preStart, a blanket mkForce "0440" group override over the whole MCP secret registry, an unused package in the unit PATH, and an auto-update policy change whose evidence stops at one deployment.

Blocking findings

None.

Important findings

  • model_aliases.opencode-fallback references a provider that settings.providers never declares; providers.nova is dead configuration (modules/services/hermes.nix:220; medium confidence)
    In the same module, settings.providers (lines 203-213) declares only custom and nova, and nova is referenced by nothing: settings.model.provider (line 198) and model_aliases.nova-qwen-coder.provider (line 219) both use custom. model_aliases.opencode-fallback (lines 220-223) uses provider = "opencode-go", which appears nowhere in settings; the only OpenCode Go material in the module is the OPENCODE_GO_API_KEY line of the env template (line 156), which no provider maps to. README.md:216 documents opencode-go as the intended fallback.
    Impact: The documented OpenCode Go fallback is unlikely to resolve or authenticate: its alias names an undeclared provider and the exported OPENCODE_GO_API_KEY is never bound to a provider, while an identical nova provider block is declared but never used.
    Suggested fix: Declare an opencode-go provider in settings.providers keyed to OPENCODE_GO_API_KEY (or drop the alias if the provider is built in upstream), and delete the unreferenced providers.nova block so the declared provider set matches the aliases that actually use it.

  • Unguarded git config --global calls in preStart can abort the unit; the module never sets HOME for it (modules/services/hermes.nix:249; medium confidence)
    preStart (line 243) runs ${pkgs.git}/bin/git config --global user.name ..., user.email ... and init.defaultBranch main (lines 249-251) with no guard, whereas the clone at line 254 is guarded with || { ...warning...; } and the pull uses || true. The module never sets HOME/HomeDir for the hermes-agent unit; the comparable Git/state-using services in this tree set it explicitly (modules/services/kiwifs.nix:178 Environment = [ "HOME=${cfg.dataDir}" ], modules/services/bookstack-mcp.nix:109, modules/services/navidrome-mcp.nix:108). The author values are already supplied to the unit through environment (GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL/GIT_COMMITTER_NAME/GIT_COMMITTER_EMAIL, lines 210-213).
    Impact: If the pinned upstream module does not set HOME for the service user, git config --global fails ('$HOME not set') and, being unguarded, aborts preStart and prevents hermes-agent.service from starting; the profile clone/pull and the SOUL.md/skills symlinking below would never run. The global author settings are also redundant with the GIT_AUTHOR_/GIT_COMMITTER_ environment already configured.
    Suggested fix: Drop the three global git config calls (the GIT_AUTHOR_/GIT_COMMITTER_ environment already covers authorship) or supply authorship per invocation via git -C ... -c user.name=... -c user.email=...; if global state is genuinely wanted, set HomeDir/HOME for the unit as the other service modules do and guard the commands like the clone/pull.

  • mkForce "0440" + group "hermes" is applied to every fleet MCP secret, overriding the per-server declarations (modules/services/hermes.nix:147; medium confidence)
    Lines 141-148 map over the whole mcp.sopsSecrets registry and add group = "hermes" and mode = lib.mkForce "0440". Those same secrets are declared per server as owner = user; mode = "0400" (modules/mcp/redview.nix:23-27, kiwifs.nix:20-24, navidrome.nix:19-24, trilium.nix:20-25, synthseek.nix:19-24, beszel.nix:28-33, karakeep.nix:57-62, pangolin.nix:30-35). For the http servers the token is already handed to Hermes through the hermes-env template (lines 152-161, consumed as environmentFiles at line 193) and referenced only as ${VAR} headers (modules/mcp/default.nix:192, modules/mcp/redview.nix:44), so their rendered secret files do not need to be group-readable by Hermes; only the stdio launchers actually cat the files (modules/mcp/beszel.nix:14-15, karakeep.nix read_secret).
    Impact: On Vega every fleet MCP token/credential file becomes group-readable by the newly introduced hermes group, and mkForce silently wins over the per-server mode = "0400" declarations, so a later per-server permission policy cannot be expressed without editing this module. Secret exposure is widened to the whole registry rather than to the consumers that read the files.
    Suggested fix: Restrict the group/mode override to the secrets the stdio launchers actually read (or add an explicit per-server opt-in, e.g. a hermesReadable flag in the server modules), instead of forcing one mode across the entire registry.

Suggestions

  • pkgs.nixfmt is added to the service PATH but is never invoked (modules/services/hermes.nix:308; high confidence)
    systemd.services.hermes-agent.path = [ pkgs.git pkgs.openssh pkgs.nixfmt ] (lines 305-309); neither preStart (243-290) nor preStop (291-304) nor any other part of the module calls nixfmt.
    Impact: An unused package is pulled into Vega's closure and the unit's PATH; harmless but it obscures the actual runtime dependency set of the service.
    Suggested fix: Drop pkgs.nixfmt from path, or document the agent workflow that is expected to invoke it.

  • New auto-update policy group has no no-op follow-up evidence, which AGENTS.md requires for auto-update changes (lib/auto-update-policy.nix:215; medium confidence)
    The change registers a new auto-update group (name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ]), so the producer will now bump that GitHub input and rebuild Vega without review. AGENTS.md states: 'For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue.' The supplied material records a first deployment only; no no-op follow-up appears in the supplied evidence.
    Impact: The new auto-update tier is exercised only by its first, large delta; a subsequent no-op producer run would show whether the newly classified input is handled cleanly by the isolation and publication path.
    Suggested fix: Record a no-op auto-update follow-up on Vega (e.g. just auto-update-last-run after the next scheduled run) before closing the issue, per AGENTS.md.

Tests and validation

  • No configured deterministic checks.

Questions

  • modules/services/searxng.nix:81 sets secret_key = "$SEARX_SECRET_KEY" while the generated file writes SEARX_SECRET_KEY=... (line 61). Does the SearXNG settings loader substitute bare $VAR, or does it require the ${VAR} brace form? If the latter, the literal string becomes the secret key and the generated value is never used.
  • Does nixpkgs' services.searx module actually provide a searx-init.service unit? The key generator is tied only to it (wantedBy/before at searxng.nix:48-50, after/requires at :68-69); if that unit does not exist, searx-secret-key.service is never pulled in and services.searx.environmentFile = "/var/lib/searx/searx-env" (line 75) becomes a missing EnvironmentFile.
  • Does the pinned hermes-agent flake's nixosModules.default set HOME/HomeDir for the service user, and does it create the hermes user and group that modules/services/hermes.nix:130-132 (owner = "hermes") and :165-166 (users.users.hermes.extraGroups) rely on? Both the upstream module and this file declare state about that account.
  • Is sops.templates."hermes-env" (hermes.nix:152) readable by the hermes service user? It sets no owner/group/mode, whereas every other template in this tree that is consumed by a non-root service user sets them explicitly (modules/services/immich.nix:104-110, modules/services/paperless.nix:122-125).
  • Does Hermes expand ${VAR} inside ~/.hermes/config.yaml header values (modules/mcp/default.nix:192, modules/mcp/redview.nix:44)? scripts/check-redview-mcp.nix:53 only compares the emitted string, so it does not prove runtime expansion of the values exported by the hermes-env template.
  • Is HERMES_HOME actually ${cfg.stateDir}/.hermes? preStart (line 245) and preStop (line 291, gateway.pid/.gateway-planned-stop.json) assume that path without it being declared in this module.
  • Is ${cfg.stateDir}/workspace (the workingDirectory default, hermes.nix:44) created anywhere? preStart only creates ${cfg.stateDir}/profile (via clone) and ${cfg.stateDir}/.hermes (line 271).
  • secrets/README.md:232 (unchanged) states 'The shared OpenRouter key is also exposed to Hermes on Vega', but the new module exports OPENCODE_GO_API_KEY and CUSTOM_API_KEY (the Pangolin key) only. Should that row be corrected to name opencode-go-api-key?

Review limitations

  • No Nix evaluation was performed here; nix flake check passing is taken from the pull-request text, not verified in this environment.
  • The pinned hermes-agent flake (NousResearch/hermes-agent) is not vendored in this checkout, so its nixosModules.default option names (mcpServers, extraDependencyGroups, environment, settings, stateDir, workingDirectory, addToSystemPackages, environmentFiles), its user/group provisioning, its HERMES_HOME/gateway.pid layout, and its accepted mcp_servers/model_aliases schema could not be inspected.
  • nixpkgs' services.searx module is not supplied, so its unit names (searx-init.service, searx.service), its user/state-directory handling, and its own secret-key handling could not be checked against modules/services/searxng.nix.
  • All 'live evidence' (service active, PID, clone at commit c535b28, symlinks, SearXNG JSON on 8888) is untrusted pull-request text; nothing was executed or observed here.
  • Secret material in secrets/hermes.yaml was not decrypted or compared; only the SOPS structure and the .sops.yaml scoping for secrets/hermes.yaml (Vega plus YubiKeys and the provisioning key) were read.
  • Only the changed files and their direct callers/definitions in the checked-out tree were examined; unchanged code outside those paths was not assessed for defects.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 15
  • Previous automated review: none found
  • Findings: 5
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `a064cddc2d1cd24b29b49ce1378c91f290378542` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The change wires a new Vega-only Hermes service (modules/services/hermes.nix), a new SearXNG module, a new `hermes-agent` flake input, its auto-update policy group, and a new Hermes view of the MCP registry (modules/mcp/default.nix `hermesMcpServers`/`hermesEnv` plus the `hermes` entry in modules/mcp/redview.nix). Cross-references that could be checked in the checkout line up: the new assertion in scripts/check-redview-mcp.nix matches the literal `${REDVIEW_MCP_API_KEY}` header produced by modules/mcp/redview.nix:44 (the check imports the registry directly, so it is unaffected by the mode/group override in hermes.nix); `hermes-agent` is added both to the flake input set (flake.nix) and to the `}@inputs:` pattern, and is classified in lib/auto-update-policy.nix with `hosts = [ "vega" ]`, matching the only host that imports modules/services/hermes.nix; secrets/hermes.yaml is scoped to Vega in .sops.yaml; port 8888 is unused on Vega (only Lyra uses it, for signal-cli); the added backup path is de-duplicated by modules/services/backrest.nix against the existing `/srv/services` parent. The reportable defects are confined to the new modules: an undeclared model provider (with a dead `providers.nova` entry), unguarded `git config --global` calls in `preStart`, a blanket `mkForce "0440"` group override over the whole MCP secret registry, an unused package in the unit PATH, and an auto-update policy change whose evidence stops at one deployment. ### Blocking findings None. ### Important findings - **model_aliases.opencode-fallback references a provider that settings.providers never declares; providers.nova is dead configuration** (modules/services/hermes.nix:220; medium confidence) In the same module, `settings.providers` (lines 203-213) declares only `custom` and `nova`, and `nova` is referenced by nothing: `settings.model.provider` (line 198) and `model_aliases.nova-qwen-coder.provider` (line 219) both use `custom`. `model_aliases.opencode-fallback` (lines 220-223) uses `provider = "opencode-go"`, which appears nowhere in `settings`; the only OpenCode Go material in the module is the `OPENCODE_GO_API_KEY` line of the env template (line 156), which no provider maps to. README.md:216 documents `opencode-go` as the intended fallback. Impact: The documented OpenCode Go fallback is unlikely to resolve or authenticate: its alias names an undeclared provider and the exported `OPENCODE_GO_API_KEY` is never bound to a provider, while an identical `nova` provider block is declared but never used. Suggested fix: Declare an `opencode-go` provider in `settings.providers` keyed to `OPENCODE_GO_API_KEY` (or drop the alias if the provider is built in upstream), and delete the unreferenced `providers.nova` block so the declared provider set matches the aliases that actually use it. - **Unguarded `git config --global` calls in preStart can abort the unit; the module never sets HOME for it** (modules/services/hermes.nix:249; medium confidence) `preStart` (line 243) runs `${pkgs.git}/bin/git config --global user.name ...`, `user.email ...` and `init.defaultBranch main` (lines 249-251) with no guard, whereas the clone at line 254 is guarded with `|| { ...warning...; }` and the pull uses `|| true`. The module never sets `HOME`/`HomeDir` for the `hermes-agent` unit; the comparable Git/state-using services in this tree set it explicitly (modules/services/kiwifs.nix:178 `Environment = [ "HOME=${cfg.dataDir}" ]`, modules/services/bookstack-mcp.nix:109, modules/services/navidrome-mcp.nix:108). The author values are already supplied to the unit through `environment` (`GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL`/`GIT_COMMITTER_NAME`/`GIT_COMMITTER_EMAIL`, lines 210-213). Impact: If the pinned upstream module does not set HOME for the service user, `git config --global` fails ('$HOME not set') and, being unguarded, aborts `preStart` and prevents `hermes-agent.service` from starting; the profile clone/pull and the SOUL.md/skills symlinking below would never run. The global author settings are also redundant with the GIT_AUTHOR_*/GIT_COMMITTER_* environment already configured. Suggested fix: Drop the three global `git config` calls (the GIT_AUTHOR_*/GIT_COMMITTER_* environment already covers authorship) or supply authorship per invocation via `git -C ... -c user.name=... -c user.email=...`; if global state is genuinely wanted, set `HomeDir`/`HOME` for the unit as the other service modules do and guard the commands like the clone/pull. - **mkForce "0440" + group "hermes" is applied to every fleet MCP secret, overriding the per-server declarations** (modules/services/hermes.nix:147; medium confidence) Lines 141-148 map over the whole `mcp.sopsSecrets` registry and add `group = "hermes"` and `mode = lib.mkForce "0440"`. Those same secrets are declared per server as `owner = user; mode = "0400"` (modules/mcp/redview.nix:23-27, kiwifs.nix:20-24, navidrome.nix:19-24, trilium.nix:20-25, synthseek.nix:19-24, beszel.nix:28-33, karakeep.nix:57-62, pangolin.nix:30-35). For the http servers the token is already handed to Hermes through the `hermes-env` template (lines 152-161, consumed as `environmentFiles` at line 193) and referenced only as `${VAR}` headers (modules/mcp/default.nix:192, modules/mcp/redview.nix:44), so their rendered secret files do not need to be group-readable by Hermes; only the stdio launchers actually `cat` the files (modules/mcp/beszel.nix:14-15, karakeep.nix read_secret). Impact: On Vega every fleet MCP token/credential file becomes group-readable by the newly introduced `hermes` group, and `mkForce` silently wins over the per-server `mode = "0400"` declarations, so a later per-server permission policy cannot be expressed without editing this module. Secret exposure is widened to the whole registry rather than to the consumers that read the files. Suggested fix: Restrict the group/mode override to the secrets the stdio launchers actually read (or add an explicit per-server opt-in, e.g. a `hermesReadable` flag in the server modules), instead of forcing one mode across the entire registry. ### Suggestions - **pkgs.nixfmt is added to the service PATH but is never invoked** (modules/services/hermes.nix:308; high confidence) `systemd.services.hermes-agent.path = [ pkgs.git pkgs.openssh pkgs.nixfmt ]` (lines 305-309); neither `preStart` (243-290) nor `preStop` (291-304) nor any other part of the module calls `nixfmt`. Impact: An unused package is pulled into Vega's closure and the unit's PATH; harmless but it obscures the actual runtime dependency set of the service. Suggested fix: Drop `pkgs.nixfmt` from `path`, or document the agent workflow that is expected to invoke it. - **New auto-update policy group has no no-op follow-up evidence, which AGENTS.md requires for auto-update changes** (lib/auto-update-policy.nix:215; medium confidence) The change registers a new auto-update group (`name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ]`), so the producer will now bump that GitHub input and rebuild Vega without review. AGENTS.md states: 'For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue.' The supplied material records a first deployment only; no no-op follow-up appears in the supplied evidence. Impact: The new auto-update tier is exercised only by its first, large delta; a subsequent no-op producer run would show whether the newly classified input is handled cleanly by the isolation and publication path. Suggested fix: Record a no-op auto-update follow-up on Vega (e.g. `just auto-update-last-run` after the next scheduled run) before closing the issue, per AGENTS.md. ### Tests and validation - No configured deterministic checks. ### Questions - modules/services/searxng.nix:81 sets `secret_key = "$SEARX_SECRET_KEY"` while the generated file writes `SEARX_SECRET_KEY=...` (line 61). Does the SearXNG settings loader substitute bare `$VAR`, or does it require the `${VAR}` brace form? If the latter, the literal string becomes the secret key and the generated value is never used. - Does nixpkgs' `services.searx` module actually provide a `searx-init.service` unit? The key generator is tied only to it (`wantedBy`/`before` at searxng.nix:48-50, `after`/`requires` at :68-69); if that unit does not exist, `searx-secret-key.service` is never pulled in and `services.searx.environmentFile = "/var/lib/searx/searx-env"` (line 75) becomes a missing EnvironmentFile. - Does the pinned `hermes-agent` flake's `nixosModules.default` set `HOME`/`HomeDir` for the service user, and does it create the `hermes` user and group that modules/services/hermes.nix:130-132 (`owner = "hermes"`) and :165-166 (`users.users.hermes.extraGroups`) rely on? Both the upstream module and this file declare state about that account. - Is `sops.templates."hermes-env"` (hermes.nix:152) readable by the `hermes` service user? It sets no `owner`/`group`/`mode`, whereas every other template in this tree that is consumed by a non-root service user sets them explicitly (modules/services/immich.nix:104-110, modules/services/paperless.nix:122-125). - Does Hermes expand `${VAR}` inside `~/.hermes/config.yaml` header values (modules/mcp/default.nix:192, modules/mcp/redview.nix:44)? scripts/check-redview-mcp.nix:53 only compares the emitted string, so it does not prove runtime expansion of the values exported by the `hermes-env` template. - Is `HERMES_HOME` actually `${cfg.stateDir}/.hermes`? `preStart` (line 245) and `preStop` (line 291, `gateway.pid`/`.gateway-planned-stop.json`) assume that path without it being declared in this module. - Is `${cfg.stateDir}/workspace` (the `workingDirectory` default, hermes.nix:44) created anywhere? `preStart` only creates `${cfg.stateDir}/profile` (via clone) and `${cfg.stateDir}/.hermes` (line 271). - secrets/README.md:232 (unchanged) states 'The shared OpenRouter key is also exposed to Hermes on Vega', but the new module exports `OPENCODE_GO_API_KEY` and `CUSTOM_API_KEY` (the Pangolin key) only. Should that row be corrected to name `opencode-go-api-key`? ### Review limitations - No Nix evaluation was performed here; `nix flake check` passing is taken from the pull-request text, not verified in this environment. - The pinned `hermes-agent` flake (NousResearch/hermes-agent) is not vendored in this checkout, so its `nixosModules.default` option names (`mcpServers`, `extraDependencyGroups`, `environment`, `settings`, `stateDir`, `workingDirectory`, `addToSystemPackages`, `environmentFiles`), its user/group provisioning, its `HERMES_HOME`/`gateway.pid` layout, and its accepted `mcp_servers`/`model_aliases` schema could not be inspected. - nixpkgs' `services.searx` module is not supplied, so its unit names (`searx-init.service`, `searx.service`), its user/state-directory handling, and its own secret-key handling could not be checked against modules/services/searxng.nix. - All 'live evidence' (service active, PID, clone at commit c535b28, symlinks, SearXNG JSON on 8888) is untrusted pull-request text; nothing was executed or observed here. - Secret material in secrets/hermes.yaml was not decrypted or compared; only the SOPS structure and the .sops.yaml scoping for `secrets/hermes.yaml` (Vega plus YubiKeys and the provisioning key) were read. - Only the changed files and their direct callers/definitions in the checked-out tree were examined; unchanged code outside those paths was not assessed for defects. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 15 - Previous automated review: none found - Findings: 5 </details>
Author
Owner

Implemented the resolutions for all findings in Review #54 in commit 50b0591:

  1. Provider Alignment: Added providers.opencode-go (base_url = "https://opencode.ai/zen/go/v1", key_env = "OPENCODE_GO_API_KEY") so model_aliases.opencode-fallback binds correctly, and deleted the unused providers.nova block.
  2. Unit Environment & Git Authoring: Added HOME = "${cfg.stateDir}" to serviceConfig.Environment and removed redundant global git config commands from preStart (git authorship is already provided per-process via GIT_AUTHOR_* and GIT_COMMITTER_* environment variables).
  3. MCP Secrets Permission Scoping: Restricted the mode = "0440" and group = "hermes" override to only the secrets required by stdio MCP launchers (beszel, pangolin, karakeep). Left HTTP/SSE MCP secrets unmodified at 0400 owned by the primary user.
  4. Template Ownership: Explicitly set owner = "hermes", group = "hermes", and mode = "0400" on sops.templates."hermes-env".
  5. Path Dependency Pruning: Removed unused pkgs.nixfmt from systemd.services.hermes-agent.path.
  6. Documentation: Updated secrets/README.md to reference opencode-go-api-key for Hermes fallback rather than OpenRouter.

Validation: Full nix flake check and formatting passed cleanly across all host configurations. Pushing commit 50b0591 now.

Implemented the resolutions for all findings in Review #54 in commit `50b0591`: 1. **Provider Alignment**: Added `providers.opencode-go` (`base_url = "https://opencode.ai/zen/go/v1"`, `key_env = "OPENCODE_GO_API_KEY"`) so `model_aliases.opencode-fallback` binds correctly, and deleted the unused `providers.nova` block. 2. **Unit Environment & Git Authoring**: Added `HOME = "${cfg.stateDir}"` to `serviceConfig.Environment` and removed redundant global `git config` commands from `preStart` (git authorship is already provided per-process via `GIT_AUTHOR_*` and `GIT_COMMITTER_*` environment variables). 3. **MCP Secrets Permission Scoping**: Restricted the `mode = "0440"` and `group = "hermes"` override to only the secrets required by stdio MCP launchers (`beszel`, `pangolin`, `karakeep`). Left HTTP/SSE MCP secrets unmodified at `0400` owned by the primary user. 4. **Template Ownership**: Explicitly set `owner = "hermes"`, `group = "hermes"`, and `mode = "0400"` on `sops.templates."hermes-env"`. 5. **Path Dependency Pruning**: Removed unused `pkgs.nixfmt` from `systemd.services.hermes-agent.path`. 6. **Documentation**: Updated `secrets/README.md` to reference `opencode-go-api-key` for Hermes fallback rather than OpenRouter. Validation: Full `nix flake check` and formatting passed cleanly across all host configurations. Pushing commit `50b0591` now.
fix(hermes): wire opencode-go provider, scope stdio secrets, and harden unit environment
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m29s
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
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 17m18s
50b0591c2f
clankbot left a comment

Automated code review

Reviewed commit: 50b0591c2ff874f25e308c1b4f9a94fa6a9fbb14

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

Static validation pass over the Hermes/SearXNG change. The flake plumbing checks out in the checked-out tree: hermes-agent is declared as a root input in flake.nix and threaded through the @inputs argument list, lib/auto-update-policy.nix registers a matching hermes-agent group whose input name is a root input, and hosts/vega/default.nix imports both new modules and sets nixosConfig.hermes.enable/nixosConfig.searxng.enable. scripts/check-service-failure-monitor.nix's ownership assertion is satisfiable because hermes.nix sets a non-empty systemd.services.hermes-agent.serviceConfig and searxng.nix self-registers searx. scripts/check-redview-mcp.nix's new assertion matches the hermes entry shape in modules/mcp/redview.nix exactly. The six-name group-permission list in modules/services/hermes.nix currently matches exactly the sopsSecrets of the three stdio servers (beszel, pangolin, karakeep), so no present-day permission defect is demonstrable. Four findings survive: an unexpanded secret-key reference in the SearXNG settings, contradictory Matrix auto-threading values set in two places in the same new module, a deliberately swallowed profile-clone failure that is invisible to the failure monitor, and a rollout-evidence gap required by an explicit AGENTS.md rule for auto-update policy changes.

Blocking findings

None.

Important findings

  • SearXNG secret_key is written into the settings attrset as the literal string "$SEARX_SECRET_KEY" (modules/services/searxng.nix:81; medium confidence)
    modules/services/searxng.nix:56 writes SEARX_SECRET_KEY=$(head -c 32 /dev/urandom | base64) into /var/lib/searx/searx-env; line 68 passes that same file to services.searx.environmentFile; line 81 sets settings.server.secret_key = "$SEARX_SECRET_KEY" as a plain Nix string inside the settings attrset, which is serialized into the service's settings file rather than into the environment. Nothing in the supplied material shows the settings file being expanded from an EnvironmentFile variable of that name.
    Impact: The generated random key is consumed only through the environment file, while the settings value is a fixed, publicly visible string; if the settings loader does not expand $SEARX_SECRET_KEY, every Vega generation uses the same literal secret key and the per-host random value is dead configuration.
    Suggested fix: Confirm the effective key on Vega (compare the running engine's secret across two starts). If it is the literal string, supply the key through the mechanism the service actually reads - the module's own secret/secretKeyFile option, or the expansion syntax the settings loader supports - instead of an unexpanded shell-style reference in settings.server.

  • Matrix DM auto-threading is configured twice with opposite values in the same module (modules/services/hermes.nix:196; high confidence)
    modules/services/hermes.nix:196-197 sets services.hermes-agent.environment.MATRIX_DM_AUTO_THREAD = "false" and MATRIX_REQUIRE_MENTION = "false", while the same module sets services.hermes-agent.settings.matrix.auto_thread = true and require_mention = false at lines 243-244. The same knob is therefore declared through two different interfaces with contradictory values.
    Impact: The deployed DM threading behaviour is not determinable from the configuration, and a later edit to one copy silently leaves the other stale; the README documents the gateway as a user-facing Matrix agent, so the mismatch is user-visible behaviour.
    Suggested fix: Keep one source of truth per Matrix knob: either drop the MATRIX_DM_AUTO_THREAD/MATRIX_REQUIRE_MENTION environment entries or drop the settings.matrix block, and confirm whether DM auto-threading is intended to be on or off.

Suggestions

  • A failed initial profile clone is only echoed, so the agent starts without persona or skills and no alert (modules/services/hermes.nix:271; medium confidence)
    preStart (modules/services/hermes.nix, git clone ... || { echo "hermes-agent: warning: initial clone ... failed; continuing without profile repo"; }) swallows the clone failure, and the subsequent SOUL.md, distribution.yaml and skills symlinks are each guarded by [ -f "$repo_dir/..." ]/[ -d "$repo_dir/skills" ] tests, so a failed clone leaves $hermes_home with none of them. preStart still exits 0, and services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ] (line ~325) only reacts to unit failures.
    Impact: A transient network or deploy-key failure at first activation leaves the Matrix gateway running with no persona or skills, indistinguishable from a healthy agent: no ntfy alert, no failed unit, and the condition is repaired only on a later start.
    Suggested fix: Make the degraded state observable: retry the clone with a bounded backoff inside preStart, or fail preStart (or write a marker the failure monitor can report) so a missing profile surfaces as an alert rather than only a journal line.

  • New vega-tier auto-update policy group has no recorded no-op follow-up evidence (lib/auto-update-policy.nix:215; medium confidence)
    The change adds a policy group name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ], i.e. it changes the automatic-update controller for a pull-only host (AGENTS.md:152 describes vega as "pull-only auto-update"). AGENTS.md:43 states an explicit repository rule: "For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue", and AGENTS.md:45 requires just test plus an auto-update hold when testing remotely.
    Impact: The new entry makes the updater eligible to rebuild and restart the Hermes daemon automatically on Vega; the supplied material contains no evidence of the second, no-op auto-update run that the repository's own rule requires for this class of change, nor that just test with an auto-update hold was used.
    Suggested fix: Record the rollout evidence AGENTS.md requires for an auto-update change: one genuine deployment plus a clean no-op follow-up on Vega against the same lock, with an auto-update hold around the test activation and just test used rather than a raw nixos-rebuild test.

Tests and validation

  • No configured deterministic checks.

Questions

  • modules/services/searxng.nix uses services.searx, the searx user, /var/lib/searx/searx-env and monitors the unit name sear, while the module and README call the service SearXNG. Is the legacy services.searx nixpkgs module intended, or should this be services.searxng (whose unit/user names differ)? The ordering at lines 48-62 also assumes nixpkgs defines a searx-init.service unit; if it does not, searx.service has no dependency on searx-secret-key.service and could start before /var/lib/searx/searx-env exists.
  • mcp.hermesEnv (modules/mcp/default.nix:213) emits KIWIFS_MCP_TOKEN=, NAVIDROME_MCP_TOKEN=, SYNTHSEEK_MCP_API_KEY=, TRILIUM_ETAPI_TOKEN= and REDVIEW_MCP_API_KEY= as config.sops.placeholder.* values, i.e. paths to secret files that are owner = primaryUser, mode = "0400" and are not in the group-permission override list in modules/services/hermes.nix. Does hermes-agent resolve such path values by reading the file, or does it use the value verbatim in the Authorization/X-Api-Key header? If it reads the file, the hermes user cannot read these five secrets; if it uses it verbatim, the header carries a path instead of a token.
  • The pinned hermes-agent flake (github:NousResearch/hermes-agent, rev b30f95ac...) is not present in the supplied material, so the option names used in modules/services/hermes.nix (mcpServers, extraDependencyGroups, addToSystemPackages, settings, stateDir, workingDirectory, environmentFiles), the hermes user/group, and the ${stateDir}/.hermes configuration home assumed by preStart/preStop could not be confirmed.
  • Should Hermes receive every MCP server enabled on Vega (hermesMcpServers maps all of enabledServers, currently including nixos, forgejo, trilium, synthseek, navidrome, kiwifs, bookstack, pangolin, redview), or only a subset? enableMcp is all-or-nothing as written.

Review limitations

  • No Nix evaluation, nix flake check, just test, or repository code was executed; the review is entirely static against the checked-out tree.
  • The pull-request description and its Validation section were not supplied to this pass; the claim that only a single live canary was recorded is taken from the prior review's untrusted output, so the missing no-op follow-up could not be independently confirmed.
  • The pinned hermes-agent flake, nixpkgs' services.searx module, and the SearXNG settings-file loader are not in the supplied material, so upstream option names, unit names, user creation, and environment/secret expansion semantics could not be verified.
  • Secret material in secrets/hermes.yaml was not decrypted; recipient scoping was read only from the ciphertext structure in the diff.
  • Runtime claims (service PIDs, cloned commit, symlinks, warmed model context, JSON search results) were not observed and were not used to support any finding.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 16
  • Previous automated review: none found
  • Findings: 4
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `50b0591c2ff874f25e308c1b4f9a94fa6a9fbb14` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment Static validation pass over the Hermes/SearXNG change. The flake plumbing checks out in the checked-out tree: `hermes-agent` is declared as a root input in flake.nix and threaded through the `@inputs` argument list, `lib/auto-update-policy.nix` registers a matching `hermes-agent` group whose input name is a root input, and `hosts/vega/default.nix` imports both new modules and sets `nixosConfig.hermes.enable`/`nixosConfig.searxng.enable`. `scripts/check-service-failure-monitor.nix`'s ownership assertion is satisfiable because hermes.nix sets a non-empty `systemd.services.hermes-agent.serviceConfig` and searxng.nix self-registers `searx`. `scripts/check-redview-mcp.nix`'s new assertion matches the `hermes` entry shape in `modules/mcp/redview.nix` exactly. The six-name group-permission list in modules/services/hermes.nix currently matches exactly the `sopsSecrets` of the three stdio servers (beszel, pangolin, karakeep), so no present-day permission defect is demonstrable. Four findings survive: an unexpanded secret-key reference in the SearXNG settings, contradictory Matrix auto-threading values set in two places in the same new module, a deliberately swallowed profile-clone failure that is invisible to the failure monitor, and a rollout-evidence gap required by an explicit AGENTS.md rule for auto-update policy changes. ### Blocking findings None. ### Important findings - **SearXNG secret_key is written into the settings attrset as the literal string "$SEARX_SECRET_KEY"** (modules/services/searxng.nix:81; medium confidence) modules/services/searxng.nix:56 writes `SEARX_SECRET_KEY=$(head -c 32 /dev/urandom | base64)` into `/var/lib/searx/searx-env`; line 68 passes that same file to `services.searx.environmentFile`; line 81 sets `settings.server.secret_key = "$SEARX_SECRET_KEY"` as a plain Nix string inside the `settings` attrset, which is serialized into the service's settings file rather than into the environment. Nothing in the supplied material shows the settings file being expanded from an EnvironmentFile variable of that name. Impact: The generated random key is consumed only through the environment file, while the settings value is a fixed, publicly visible string; if the settings loader does not expand `$SEARX_SECRET_KEY`, every Vega generation uses the same literal secret key and the per-host random value is dead configuration. Suggested fix: Confirm the effective key on Vega (compare the running engine's secret across two starts). If it is the literal string, supply the key through the mechanism the service actually reads - the module's own secret/secretKeyFile option, or the expansion syntax the settings loader supports - instead of an unexpanded shell-style reference in `settings.server`. - **Matrix DM auto-threading is configured twice with opposite values in the same module** (modules/services/hermes.nix:196; high confidence) modules/services/hermes.nix:196-197 sets `services.hermes-agent.environment.MATRIX_DM_AUTO_THREAD = "false"` and `MATRIX_REQUIRE_MENTION = "false"`, while the same module sets `services.hermes-agent.settings.matrix.auto_thread = true` and `require_mention = false` at lines 243-244. The same knob is therefore declared through two different interfaces with contradictory values. Impact: The deployed DM threading behaviour is not determinable from the configuration, and a later edit to one copy silently leaves the other stale; the README documents the gateway as a user-facing Matrix agent, so the mismatch is user-visible behaviour. Suggested fix: Keep one source of truth per Matrix knob: either drop the `MATRIX_DM_AUTO_THREAD`/`MATRIX_REQUIRE_MENTION` environment entries or drop the `settings.matrix` block, and confirm whether DM auto-threading is intended to be on or off. ### Suggestions - **A failed initial profile clone is only echoed, so the agent starts without persona or skills and no alert** (modules/services/hermes.nix:271; medium confidence) preStart (modules/services/hermes.nix, `git clone ... || { echo "hermes-agent: warning: initial clone ... failed; continuing without profile repo"; }`) swallows the clone failure, and the subsequent `SOUL.md`, `distribution.yaml` and `skills` symlinks are each guarded by `[ -f "$repo_dir/..." ]`/`[ -d "$repo_dir/skills" ]` tests, so a failed clone leaves `$hermes_home` with none of them. preStart still exits 0, and `services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ]` (line ~325) only reacts to unit failures. Impact: A transient network or deploy-key failure at first activation leaves the Matrix gateway running with no persona or skills, indistinguishable from a healthy agent: no ntfy alert, no failed unit, and the condition is repaired only on a later start. Suggested fix: Make the degraded state observable: retry the clone with a bounded backoff inside preStart, or fail preStart (or write a marker the failure monitor can report) so a missing profile surfaces as an alert rather than only a journal line. - **New vega-tier auto-update policy group has no recorded no-op follow-up evidence** (lib/auto-update-policy.nix:215; medium confidence) The change adds a policy group `name = "hermes-agent"; inputs = [ "hermes-agent" ]; hosts = [ "vega" ]`, i.e. it changes the automatic-update controller for a pull-only host (AGENTS.md:152 describes vega as "pull-only auto-update"). AGENTS.md:43 states an explicit repository rule: "For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue", and AGENTS.md:45 requires `just test` plus an auto-update hold when testing remotely. Impact: The new entry makes the updater eligible to rebuild and restart the Hermes daemon automatically on Vega; the supplied material contains no evidence of the second, no-op auto-update run that the repository's own rule requires for this class of change, nor that `just test` with an auto-update hold was used. Suggested fix: Record the rollout evidence AGENTS.md requires for an auto-update change: one genuine deployment plus a clean no-op follow-up on Vega against the same lock, with an auto-update hold around the test activation and `just test` used rather than a raw `nixos-rebuild test`. ### Tests and validation - No configured deterministic checks. ### Questions - modules/services/searxng.nix uses `services.searx`, the `searx` user, `/var/lib/searx/searx-env` and monitors the unit name `sear`, while the module and README call the service SearXNG. Is the legacy `services.searx` nixpkgs module intended, or should this be `services.searxng` (whose unit/user names differ)? The ordering at lines 48-62 also assumes nixpkgs defines a `searx-init.service` unit; if it does not, `searx.service` has no dependency on `searx-secret-key.service` and could start before `/var/lib/searx/searx-env` exists. - `mcp.hermesEnv` (modules/mcp/default.nix:213) emits `KIWIFS_MCP_TOKEN=`, `NAVIDROME_MCP_TOKEN=`, `SYNTHSEEK_MCP_API_KEY=`, `TRILIUM_ETAPI_TOKEN=` and `REDVIEW_MCP_API_KEY=` as `config.sops.placeholder.*` values, i.e. paths to secret files that are `owner = primaryUser, mode = "0400"` and are not in the group-permission override list in modules/services/hermes.nix. Does hermes-agent resolve such path values by reading the file, or does it use the value verbatim in the `Authorization`/`X-Api-Key` header? If it reads the file, the hermes user cannot read these five secrets; if it uses it verbatim, the header carries a path instead of a token. - The pinned `hermes-agent` flake (github:NousResearch/hermes-agent, rev b30f95ac...) is not present in the supplied material, so the option names used in modules/services/hermes.nix (`mcpServers`, `extraDependencyGroups`, `addToSystemPackages`, `settings`, `stateDir`, `workingDirectory`, `environmentFiles`), the `hermes` user/group, and the `${stateDir}/.hermes` configuration home assumed by preStart/preStop could not be confirmed. - Should Hermes receive every MCP server enabled on Vega (`hermesMcpServers` maps all of `enabledServers`, currently including nixos, forgejo, trilium, synthseek, navidrome, kiwifs, bookstack, pangolin, redview), or only a subset? `enableMcp` is all-or-nothing as written. ### Review limitations - No Nix evaluation, `nix flake check`, `just test`, or repository code was executed; the review is entirely static against the checked-out tree. - The pull-request description and its Validation section were not supplied to this pass; the claim that only a single live canary was recorded is taken from the prior review's untrusted output, so the missing no-op follow-up could not be independently confirmed. - The pinned `hermes-agent` flake, nixpkgs' `services.searx` module, and the SearXNG settings-file loader are not in the supplied material, so upstream option names, unit names, user creation, and environment/secret expansion semantics could not be verified. - Secret material in `secrets/hermes.yaml` was not decrypted; recipient scoping was read only from the ciphertext structure in the diff. - Runtime claims (service PIDs, cloned commit, symlinks, warmed model context, JSON search results) were not observed and were not used to support any finding. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 16 - Previous automated review: none found - Findings: 4 </details>
Author
Owner

Addressed the findings from Review #55 in commit e935a05:

  1. SearXNG Secret Key Expansion: Verified that Nixpkgs's searx-init.service (nixos/modules/services/networking/searx.nix:29) executes envsubst < ${settingsFile} > settings.yml with EnvironmentFile = cfg.environmentFile. The $SEARX_SECRET_KEY token in settings.server.secret_key is substituted by envsubst during unit initialization, ensuring the generated /var/lib/searx/searx-env random key is the effective secret key.
  2. Matrix Room vs. DM Auto-Threading: Explicitly exported MATRIX_AUTO_THREAD = "true" alongside MATRIX_DM_AUTO_THREAD = "false" with an in-code comment. In Hermes, MATRIX_AUTO_THREAD (and settings.matrix.auto_thread) controls automatic threading in multi-user rooms, while MATRIX_DM_AUTO_THREAD specifically controls direct messages (rooms with ≤ 2 members); they represent distinct scopes rather than conflicting settings.
  3. Bounded Clone Retries & Alerting: In preStart, wrapped the initial profile repository clone in a 3-attempt retry loop with 2s backoff. If all 3 attempts fail, preStart exits with status 1, ensuring a persistent failure causes the systemd service to enter a failed state and triggers serviceFailureMonitor.
  4. Auto-Update Evidence: Confirmed that Issue #309 remains open without closing keywords so post-merge canary rollout and the no-op auto-update follow-up check can be recorded per AGENTS.md.

Validation: Full nix flake check and formatting checks passed cleanly across all host targets. Pushing commit e935a05 now.

Addressed the findings from Review #55 in commit `e935a05`: 1. **SearXNG Secret Key Expansion**: Verified that Nixpkgs's `searx-init.service` (`nixos/modules/services/networking/searx.nix:29`) executes `envsubst < ${settingsFile} > settings.yml` with `EnvironmentFile = cfg.environmentFile`. The `$SEARX_SECRET_KEY` token in `settings.server.secret_key` is substituted by `envsubst` during unit initialization, ensuring the generated `/var/lib/searx/searx-env` random key is the effective secret key. 2. **Matrix Room vs. DM Auto-Threading**: Explicitly exported `MATRIX_AUTO_THREAD = "true"` alongside `MATRIX_DM_AUTO_THREAD = "false"` with an in-code comment. In Hermes, `MATRIX_AUTO_THREAD` (and `settings.matrix.auto_thread`) controls automatic threading in multi-user rooms, while `MATRIX_DM_AUTO_THREAD` specifically controls direct messages (rooms with ≤ 2 members); they represent distinct scopes rather than conflicting settings. 3. **Bounded Clone Retries & Alerting**: In `preStart`, wrapped the initial profile repository clone in a 3-attempt retry loop with 2s backoff. If all 3 attempts fail, `preStart` exits with status 1, ensuring a persistent failure causes the systemd service to enter a failed state and triggers `serviceFailureMonitor`. 4. **Auto-Update Evidence**: Confirmed that Issue #309 remains open without closing keywords so post-merge canary rollout and the no-op auto-update follow-up check can be recorded per `AGENTS.md`. Validation: Full `nix flake check` and formatting checks passed cleanly across all host targets. Pushing commit `e935a05` now.
fix(hermes): clarify matrix thread settings and bound clone retries in preStart
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m30s
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 / record-remediation-notify-failure (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
AI pull-request review / review (pull_request) Successful in 12m39s
e935a05e46
clankbot left a comment

Automated code review

Reviewed commit: e935a05e461e729e9bb74ccdb707f5e4035239a6

Verdict: Ready to merge

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

Overall assessment

Strict validation pass over the Vega Hermes/SearXNG feature branch against the checked-out tree. The wiring is internally consistent where it can be verified: hermes-agent is declared in flake.nix inputs and added to the flake's outputs input pattern, and it is classified in lib/auto-update-policy.nix groups (satisfying the README rule that new root flake inputs be classified); the three new SOPS keys in secrets/hermes.yaml match the hermes/matrix/access-token, hermes/pangolin/api-key, hermes/git/deploy-key lookups in modules/services/hermes.nix and the updated secrets/README.md row; the six secret names re-grouped for the hermes group (beszel-mcp-email/password, pangolin-mcp-url/api-key, karakeep-mcp-url/api-key) match exactly the names declared by modules/mcp/{beszel,pangolin,karakeep}.nix, which are the only stdio MCP servers in the registry; every HTTP MCP server that receives a ${VAR} header from hermesMcpServers also receives a matching VAR=<sops placeholder> line from hermesEnv (no MCP module declares a top-level headers key, so the optionalAttrs (s ? headers) branch cannot clobber the generated Authorization header); the derived searxngUrl (127.0.0.1 when bindAddress == "0.0.0.0", port 8888) matches the README text, and 8888 collides with no other Vega declaration (the only other use is Lyra's signal-cli); the new failure-monitor names hermes-agent and searx are self-registered in the modules and are not duplicated in hosts/vega/default.nix's explicit list, which scripts/check-service-failure-monitor.nix only rejects when a watched name has no owning unit definition; the new registry.hermesMcpServers.redview assertion in scripts/check-redview-mcp.nix matches the hermes custom entry shape in modules/mcp/redview.nix byte-for-byte. No blocking defect was demonstrable from the supplied material; the remaining items are latent robustness, documentation-drift and access-widening suggestions, plus couplings to the external hermes-agent flake module and nixpkgs' services.searx module that cannot be inspected in this checkout.

Blocking findings

None.

Important findings

None.

Suggestions

  • MCP registry header contract not updated for the new hermes custom entry and outputs (modules/mcp/default.nix:23; high confidence)
    The file's header documents the per-server return contract and its custom overrides as sopsSecrets, tokenExport, agy, opencode, codexSnippet only (lines 1-23), yet this change adds hermesMcpServers (consumed by services.hermes-agent.mcpServers), hermesEnv (consumed by the hermes-env template in modules/services/hermes.nix), both added to the returned inherit (...) set, and modules/mcp/redview.nix now supplies a hermes = { url; enabled; headers; } custom key consumed via if s ? hermes then s.hermes. AGENTS.md describes modules/mcp/ as the client registry for "Codex, OpenCode, Pi, and Antigravity CLI" only.
    Impact: The registry's stated contract no longer matches its behaviour: a future author adding an MCP server cannot tell that hermes is a valid custom key, what shape it must have, or that hermesEnv requires tokenEnvVar plus secretName to be set for a Hermes-consumable HTTP entry. Today only the registry.hermesMcpServers.redview assertion in scripts/check-redview-mcp.nix pins that shape.
    Suggested fix: Extend the header comment in modules/mcp/default.nix to document the hermes custom entry shape and the hermesMcpServers/hermesEnv outputs alongside the existing agy/opencode/codexSnippet documentation, and note the tokenEnvVar+secretName precondition for the env template.

  • Steady-state profile pull failure is silently swallowed, allowing undetected profile drift (modules/services/hermes.nix:285; high confidence)
    preStart handles the initial clone verbosely (three attempts, then echo "hermes-agent: error: initial clone ..." >&2; exit 1), but the steady-state path is GIT_SSH_COMMAND="$git_ssh" git -C "$repo_dir" pull --ff-only || true, which discards the exit status and emits no diagnostic. The module also registers hermes-agent in services.serviceFailureMonitor.services, so a swallowed pull produces no alert.
    Impact: Because the module documents the agent as committing and pushing its own skills back to nimmo/hermes (README: "synchronized bidirectionally ... allows the agent to author, commit, and push back its own skills"), a local tree that has diverged from the remote makes --ff-only fail on every start; the SOUL.md, distribution.yaml and skills symlinks then keep pointing at a stale profile with no log line and no failure-monitor signal, so prompt/skill iteration silently stops taking effect.
    Suggested fix: Capture the pull's exit status and emit an explicit hermes-agent: profile pull rejected (local history diverged) line as the clone path already does, and state the intended reconciliation policy for diverged history (rebase, force-sync, or manual intervention) in a comment so the behaviour is reviewable.

  • mkForce widens group access on MCP secrets shared with the other AI clients (modules/services/hermes.nix:148; high confidence)
    modules/mcp/beszel.nix, pangolin.nix and karakeep.nix declare beszel-mcp-email/password, pangolin-mcp-url/api-key and karakeep-mcp-url/api-key with owner = user; mode = "0400"; hermes.nix re-declares exactly those names with group = "hermes"; mode = lib.mkForce "0440", and modules/profiles/ai-agents.nix line 37 sets sops.secrets = mcp.sopsSecrets for the same option paths on every AI-client host (Vega imports them via profiles/ai-desktop.nix).
    Impact: On Vega those six secret files become group-readable to the new hermes group instead of private to the primary user, and mkForce also blocks any future host-level override of their mode/group. The same files are cated by the shared launchers used by Codex, OpenCode and Pi (tokenExports, pangolin-mcp-launcher.nix, the karakeep launcher), so this is a shared-secret permission change rather than one scoped to the Hermes consumer.
    Suggested fix: Keep the permission change scoped to the Hermes consumer: either give Hermes its own secret entries (distinct names pointing at the same SOPS keys) with owner = "hermes"; mode = "0400", or replace mkForce with a plain definition plus a documented comment so a host can still override mode/group.

  • searxng reads nixosConfig.nebula.enable without the guard or assertion used by sibling modules (modules/services/searxng.nix:92; high confidence)
    networking.firewall.interfaces = lib.mkIf config.nixosConfig.nebula.enable { "nebula.mesh".allowedTCPPorts = [ cfg.port ]; }; reads the option directly. Sibling modules either guard it (modules/services/bookstack.nix line 18 uses nebulaEnabled = lib.attrByPath [ "nixosConfig" "nebula" "enable" ] false config;) or state the requirement (modules/services/kiwifs.nix, modules/services/token-tv.nix, modules/services/trilium-web.nix use assertion = config.nixosConfig.nebula.enable; with an explicit message). The new hermes.nix guards the analogous case with config.nixosConfig ? searxng && ....
    Impact: Enabling nixosConfig.searxng.enable on a host that does not import modules/networking/nebula.nix - e.g. a future host or a potential/ draft such as potential/nova/ - fails evaluation with a bare attribute error instead of the repository's stated requirement message, which is harder to act on for a module intended to be host-portable. No defect on Vega, which imports the nebula module.
    Suggested fix: Follow the existing convention: add an assertion with a nixosConfig.searxng requires nixosConfig.nebula.enable message, or use the lib.attrByPath [...] false config default used by modules/services/bookstack.nix.

Tests and validation

  • No configured deterministic checks.

Questions

  • The hermes-agent flake input (github:NousResearch/hermes-agent, locked at rev b30f95ac...) is external and not vendored in this checkout, so I could not confirm that its nixosModules.default places the agent's configuration directory at <stateDir>/.hermes; preStart hardcodes hermes_home="${cfg.stateDir}/.hermes" for the SOUL.md, distribution.yaml and skills symlinks, and preStop hardcodes gateway.pid and .gateway-planned-stop.json. Please confirm those paths and filenames match the pinned upstream module's contract rather than only the current live deployment.
  • I could not confirm that the upstream module's service User is hermes. hermes.nix creates users.users.hermes only via extraGroups, and sets hermes-git-deploy-key to owner = "hermes"; mode = "0400" plus sops.templates."hermes-env" to owner = "hermes"; mode = "0400"; if the upstream module names its service user differently, both files would be unreadable by the unit and the profile clone would fail.
  • Is services.searx.settings.server.secret_key = "$SEARX_SECRET_KEY" (modules/services/searxng.nix line 81) expanded by the nixpkgs services.searx module, or does SearXNG require the ${SEARX_SECRET_KEY} braced form? The supplied material contains neither the nixpkgs module nor SearXNG's settings renderer, so I could not verify that the generated SEARX_SECRET_KEY in /var/lib/searx/searx-env reaches the settings file rather than being used as a literal string.
  • Does the nixpkgs services.searx module already define systemd.services.searx-init and a searx user? The added searx-secret-key unit is pulled in only through wantedBy = [ "searx-init.service" ], and systemd.services.searx-init is overridden with only after/requires; if nixpkgs does not define that unit, this module creates a no-op searx-init service at boot, and if its default service user is not searx, serviceConfig.User = "searx"/StateDirectory = "searx" would not match.
  • Should hermes-agent be in the auto-update tier at all? docs/auto-update-remediation.md states that deliberately pinned root inputs are classified in lib/auto-update-policy.nix, and this input supplies the NixOS module whose option names (mcpServers, extraDependencyGroups, settings, environmentFiles, stateDir) this repository now depends on; an automatic update would rebuild and activate Vega's gateway without human review.
  • users.users.hermes.extraGroups = [ "users" ] adds the agent's service user to the system users group while users.users.${user}.extraGroups = [ "hermes" ] does the reverse. Is the first direction required for a specific path (e.g. the /mnt/storage or /srv/services trees created by Vega's tmpfiles rules), and if so should the reason be commented in the module?
  • The PR summary states documentation was added at pages/projects/nixos-config/hermes.md, but no pages/ path exists in this checkout and it is not among the changed files. Is that page published in the separate KiwiFS workspace rather than in this repository, and is it linked from the README section that was added?

Review limitations

  • The hermes-agent flake input is external and not vendored in this checkout, so none of its services.hermes-agent option names, types, defaults, generated unit contents, or its ~/.hermes layout could be inspected; findings about settings, mcpServers, extraDependencyGroups, environmentFiles, stateDir, gateway.pid and the .gateway-planned-stop.json marker are unverified against the consumer.
  • nixpkgs' services.searx module is not supplied, so the settings, environmentFile, searx-init unit, service user, and secret-key substitution could not be checked; the flake check claim in the PR text is the only evidence that the option names exist.
  • No Nix tooling is available in this environment, so nix flake check, the flake's checks.* assertions (including service-failure-monitor-coverage, redview-mcp, nova-remote-builder-config), and any build/activation were not run here; the reported validation and live canary evidence comes only from the pull-request text.
  • No test, flake check, or justfile recipe in the supplied tree exercises the new Hermes or SearXNG wiring beyond the added redview Hermes assertion in scripts/check-redview-mcp.nix, so the derived searxngUrl, the hermes-env template contents, and the MCP header/env pairing are unverified by any deterministic check in the repository.
  • Whether the hermes-agent configuration format expands ${VAR} inside mcp_servers headers (as emitted by hermesMcpServers) against the values exported by hermesEnv could not be verified; only the pairing of names within this repository was checked.
  • The nimmo/hermes profile repository, the Matrix homeserver configuration, the Pangolin gateway, and the KiwiFS page referenced in the PR summary are outside the supplied material and were not inspected.
  • Secret material was not read or disclosed; only encrypted SOPS key names and their recipient scoping were examined.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • flake.lock: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • lib/auto-update-policy.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
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • modules/services/searxng.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-mcp.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
  • secrets/hermes.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: 17
  • Previous automated review: none found
  • Findings: 4
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `e935a05e461e729e9bb74ccdb707f5e4035239a6` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment Strict validation pass over the Vega Hermes/SearXNG feature branch against the checked-out tree. The wiring is internally consistent where it can be verified: `hermes-agent` is declared in `flake.nix` inputs and added to the flake's `outputs` input pattern, and it is classified in `lib/auto-update-policy.nix` groups (satisfying the README rule that new root flake inputs be classified); the three new SOPS keys in `secrets/hermes.yaml` match the `hermes/matrix/access-token`, `hermes/pangolin/api-key`, `hermes/git/deploy-key` lookups in `modules/services/hermes.nix` and the updated `secrets/README.md` row; the six secret names re-grouped for the `hermes` group (`beszel-mcp-email/password`, `pangolin-mcp-url/api-key`, `karakeep-mcp-url/api-key`) match exactly the names declared by `modules/mcp/{beszel,pangolin,karakeep}.nix`, which are the only stdio MCP servers in the registry; every HTTP MCP server that receives a `${VAR}` header from `hermesMcpServers` also receives a matching `VAR=<sops placeholder>` line from `hermesEnv` (no MCP module declares a top-level `headers` key, so the `optionalAttrs (s ? headers)` branch cannot clobber the generated `Authorization` header); the derived `searxngUrl` (127.0.0.1 when `bindAddress == "0.0.0.0"`, port 8888) matches the README text, and 8888 collides with no other Vega declaration (the only other use is Lyra's signal-cli); the new failure-monitor names `hermes-agent` and `searx` are self-registered in the modules and are not duplicated in `hosts/vega/default.nix`'s explicit list, which `scripts/check-service-failure-monitor.nix` only rejects when a watched name has no owning unit definition; the new `registry.hermesMcpServers.redview` assertion in `scripts/check-redview-mcp.nix` matches the `hermes` custom entry shape in `modules/mcp/redview.nix` byte-for-byte. No blocking defect was demonstrable from the supplied material; the remaining items are latent robustness, documentation-drift and access-widening suggestions, plus couplings to the external `hermes-agent` flake module and nixpkgs' `services.searx` module that cannot be inspected in this checkout. ### Blocking findings None. ### Important findings None. ### Suggestions - **MCP registry header contract not updated for the new `hermes` custom entry and outputs** (modules/mcp/default.nix:23; high confidence) The file's header documents the per-server return contract and its custom overrides as `sopsSecrets`, `tokenExport`, `agy`, `opencode`, `codexSnippet` only (lines 1-23), yet this change adds `hermesMcpServers` (consumed by `services.hermes-agent.mcpServers`), `hermesEnv` (consumed by the `hermes-env` template in `modules/services/hermes.nix`), both added to the returned `inherit (...)` set, and `modules/mcp/redview.nix` now supplies a `hermes = { url; enabled; headers; }` custom key consumed via `if s ? hermes then s.hermes`. `AGENTS.md` describes `modules/mcp/` as the client registry for "Codex, OpenCode, Pi, and Antigravity CLI" only. Impact: The registry's stated contract no longer matches its behaviour: a future author adding an MCP server cannot tell that `hermes` is a valid custom key, what shape it must have, or that `hermesEnv` requires `tokenEnvVar` plus `secretName` to be set for a Hermes-consumable HTTP entry. Today only the `registry.hermesMcpServers.redview` assertion in `scripts/check-redview-mcp.nix` pins that shape. Suggested fix: Extend the header comment in `modules/mcp/default.nix` to document the `hermes` custom entry shape and the `hermesMcpServers`/`hermesEnv` outputs alongside the existing `agy`/`opencode`/`codexSnippet` documentation, and note the `tokenEnvVar`+`secretName` precondition for the env template. - **Steady-state profile pull failure is silently swallowed, allowing undetected profile drift** (modules/services/hermes.nix:285; high confidence) `preStart` handles the initial clone verbosely (three attempts, then `echo "hermes-agent: error: initial clone ..." >&2; exit 1`), but the steady-state path is `GIT_SSH_COMMAND="$git_ssh" git -C "$repo_dir" pull --ff-only || true`, which discards the exit status and emits no diagnostic. The module also registers `hermes-agent` in `services.serviceFailureMonitor.services`, so a swallowed pull produces no alert. Impact: Because the module documents the agent as committing and pushing its own skills back to `nimmo/hermes` (README: "synchronized bidirectionally ... allows the agent to author, commit, and push back its own skills"), a local tree that has diverged from the remote makes `--ff-only` fail on every start; the `SOUL.md`, `distribution.yaml` and `skills` symlinks then keep pointing at a stale profile with no log line and no failure-monitor signal, so prompt/skill iteration silently stops taking effect. Suggested fix: Capture the pull's exit status and emit an explicit `hermes-agent: profile pull rejected (local history diverged)` line as the clone path already does, and state the intended reconciliation policy for diverged history (rebase, force-sync, or manual intervention) in a comment so the behaviour is reviewable. - **`mkForce` widens group access on MCP secrets shared with the other AI clients** (modules/services/hermes.nix:148; high confidence) `modules/mcp/beszel.nix`, `pangolin.nix` and `karakeep.nix` declare `beszel-mcp-email/password`, `pangolin-mcp-url/api-key` and `karakeep-mcp-url/api-key` with `owner = user; mode = "0400"`; `hermes.nix` re-declares exactly those names with `group = "hermes"; mode = lib.mkForce "0440"`, and `modules/profiles/ai-agents.nix` line 37 sets `sops.secrets = mcp.sopsSecrets` for the same option paths on every AI-client host (Vega imports them via `profiles/ai-desktop.nix`). Impact: On Vega those six secret files become group-readable to the new `hermes` group instead of private to the primary user, and `mkForce` also blocks any future host-level override of their mode/group. The same files are `cat`ed by the shared launchers used by Codex, OpenCode and Pi (`tokenExports`, `pangolin-mcp-launcher.nix`, the karakeep launcher), so this is a shared-secret permission change rather than one scoped to the Hermes consumer. Suggested fix: Keep the permission change scoped to the Hermes consumer: either give Hermes its own secret entries (distinct names pointing at the same SOPS keys) with `owner = "hermes"; mode = "0400"`, or replace `mkForce` with a plain definition plus a documented comment so a host can still override mode/group. - **searxng reads `nixosConfig.nebula.enable` without the guard or assertion used by sibling modules** (modules/services/searxng.nix:92; high confidence) `networking.firewall.interfaces = lib.mkIf config.nixosConfig.nebula.enable { "nebula.mesh".allowedTCPPorts = [ cfg.port ]; };` reads the option directly. Sibling modules either guard it (`modules/services/bookstack.nix` line 18 uses `nebulaEnabled = lib.attrByPath [ "nixosConfig" "nebula" "enable" ] false config;`) or state the requirement (`modules/services/kiwifs.nix`, `modules/services/token-tv.nix`, `modules/services/trilium-web.nix` use `assertion = config.nixosConfig.nebula.enable;` with an explicit message). The new `hermes.nix` guards the analogous case with `config.nixosConfig ? searxng && ...`. Impact: Enabling `nixosConfig.searxng.enable` on a host that does not import `modules/networking/nebula.nix` - e.g. a future host or a `potential/` draft such as `potential/nova/` - fails evaluation with a bare attribute error instead of the repository's stated requirement message, which is harder to act on for a module intended to be host-portable. No defect on Vega, which imports the nebula module. Suggested fix: Follow the existing convention: add an assertion with a `nixosConfig.searxng requires nixosConfig.nebula.enable` message, or use the `lib.attrByPath [...] false config` default used by `modules/services/bookstack.nix`. ### Tests and validation - No configured deterministic checks. ### Questions - The `hermes-agent` flake input (github:NousResearch/hermes-agent, locked at rev b30f95ac...) is external and not vendored in this checkout, so I could not confirm that its `nixosModules.default` places the agent's configuration directory at `<stateDir>/.hermes`; `preStart` hardcodes `hermes_home="${cfg.stateDir}/.hermes"` for the `SOUL.md`, `distribution.yaml` and `skills` symlinks, and `preStop` hardcodes `gateway.pid` and `.gateway-planned-stop.json`. Please confirm those paths and filenames match the pinned upstream module's contract rather than only the current live deployment. - I could not confirm that the upstream module's service `User` is `hermes`. `hermes.nix` creates `users.users.hermes` only via `extraGroups`, and sets `hermes-git-deploy-key` to `owner = "hermes"; mode = "0400"` plus `sops.templates."hermes-env"` to `owner = "hermes"; mode = "0400"`; if the upstream module names its service user differently, both files would be unreadable by the unit and the profile clone would fail. - Is `services.searx.settings.server.secret_key = "$SEARX_SECRET_KEY"` (modules/services/searxng.nix line 81) expanded by the nixpkgs `services.searx` module, or does SearXNG require the `${SEARX_SECRET_KEY}` braced form? The supplied material contains neither the nixpkgs module nor SearXNG's settings renderer, so I could not verify that the generated `SEARX_SECRET_KEY` in `/var/lib/searx/searx-env` reaches the settings file rather than being used as a literal string. - Does the nixpkgs `services.searx` module already define `systemd.services.searx-init` and a `searx` user? The added `searx-secret-key` unit is pulled in only through `wantedBy = [ "searx-init.service" ]`, and `systemd.services.searx-init` is overridden with only `after`/`requires`; if nixpkgs does not define that unit, this module creates a no-op `searx-init` service at boot, and if its default service user is not `searx`, `serviceConfig.User = "searx"`/`StateDirectory = "searx"` would not match. - Should `hermes-agent` be in the auto-update tier at all? `docs/auto-update-remediation.md` states that deliberately pinned root inputs are classified in `lib/auto-update-policy.nix`, and this input supplies the NixOS module whose option names (`mcpServers`, `extraDependencyGroups`, `settings`, `environmentFiles`, `stateDir`) this repository now depends on; an automatic update would rebuild and activate Vega's gateway without human review. - `users.users.hermes.extraGroups = [ "users" ]` adds the agent's service user to the system `users` group while `users.users.${user}.extraGroups = [ "hermes" ]` does the reverse. Is the first direction required for a specific path (e.g. the `/mnt/storage` or `/srv/services` trees created by Vega's tmpfiles rules), and if so should the reason be commented in the module? - The PR summary states documentation was added at `pages/projects/nixos-config/hermes.md`, but no `pages/` path exists in this checkout and it is not among the changed files. Is that page published in the separate KiwiFS workspace rather than in this repository, and is it linked from the README section that was added? ### Review limitations - The `hermes-agent` flake input is external and not vendored in this checkout, so none of its `services.hermes-agent` option names, types, defaults, generated unit contents, or its `~/.hermes` layout could be inspected; findings about `settings`, `mcpServers`, `extraDependencyGroups`, `environmentFiles`, `stateDir`, `gateway.pid` and the `.gateway-planned-stop.json` marker are unverified against the consumer. - nixpkgs' `services.searx` module is not supplied, so the `settings`, `environmentFile`, `searx-init` unit, service user, and secret-key substitution could not be checked; the `flake check` claim in the PR text is the only evidence that the option names exist. - No Nix tooling is available in this environment, so `nix flake check`, the flake's `checks.*` assertions (including `service-failure-monitor-coverage`, `redview-mcp`, `nova-remote-builder-config`), and any build/activation were not run here; the reported validation and live canary evidence comes only from the pull-request text. - No test, flake check, or justfile recipe in the supplied tree exercises the new Hermes or SearXNG wiring beyond the added redview Hermes assertion in `scripts/check-redview-mcp.nix`, so the derived `searxngUrl`, the `hermes-env` template contents, and the MCP header/env pairing are unverified by any deterministic check in the repository. - Whether the hermes-agent configuration format expands `${VAR}` inside `mcp_servers` headers (as emitted by `hermesMcpServers`) against the values exported by `hermesEnv` could not be verified; only the pairing of names within this repository was checked. - The `nimmo/hermes` profile repository, the Matrix homeserver configuration, the Pangolin gateway, and the KiwiFS page referenced in the PR summary are outside the supplied material and were not inspected. - Secret material was not read or disclosed; only encrypted SOPS key names and their recipient scoping were examined. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `flake.lock`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `lib/auto-update-policy.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 - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `modules/services/searxng.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-mcp.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch - `secrets/hermes.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: 17 - Previous automated review: none found - Findings: 4 </details>
nimmo merged commit c56b67d25a into main 2026-10-11 19:53:33 +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!311
No description provided.