Move Hermes profile synchronization to GitLab #351

Merged
nimmo merged 5 commits from feat/hermes-gitlab-profile into main 2026-10-16 22:19:19 +01:00
Owner

Move Hermes's mutable profile from Forgejo to the imported GitLab repository. Startup now reconciles an existing checkout's origin after a bounded-retry fetch validates destination access and compatible history, while preserving clean local commits ahead of the import.

The helper rejects dirty worktrees, detached HEADs, missing/unexpected upstreams, incompatible history and ambiguous remote URLs. It prevents ignored-file overwrites during the transition and never resets or pushes. A rejected origin change intentionally fails preStart and prevents the gateway starting, with a failure-monitor alert; established origins retain their existing non-fatal offline-pull behavior.

Profile Git uses the dedicated deploy identity and strict operator-verified, root-owned SSH host pins. Its direct Git SSH endpoint remains separate from the HTTPS web route and from fleet login on port 22. Both startup and normal Git operations use the same declared SSH command; the fleet identity is unchanged.

Validation:

  • 18 regression cases exercise actual isolated Git repositories, including ignored local files, actionable rejection diagnostics, transient fetch recovery and established-origin offline compatibility.
  • OpenSSH tests exercise the actual declared Git command, strict host trust, the separate fleet port/identity and pin lookup derived from the configured SSH endpoint.
  • Full nix flake check, shell/repository formatting and whitespace checks passed.
  • The exact clean Vega configuration built successfully without activation.
  • Read-only live comparison found the profile checkout clean and its tracked branch compatible with the imported default branch.

GitLab deploy-key setup and server-side read/write/default-branch authorization are verified. Actual Hermes-context authenticated operations and live activation remain pending. Fence concurrent writers and capture the complete mutable checkout/.git recovery checkpoint plus the pre-deployment revision tag before applying the change. A NixOS generation rollback alone cannot undo mutable Git state or remote writes. Private operational/recovery details are in KiwiFS; keep Forgejo available until authenticated acceptance is complete.

Refs #350. This MR does not claim live activation, a Git push from Hermes or a completed recovery checkpoint.

Move Hermes's mutable profile from Forgejo to the imported GitLab repository. Startup now reconciles an existing checkout's origin after a bounded-retry fetch validates destination access and compatible history, while preserving clean local commits ahead of the import. The helper rejects dirty worktrees, detached HEADs, missing/unexpected upstreams, incompatible history and ambiguous remote URLs. It prevents ignored-file overwrites during the transition and never resets or pushes. A rejected origin change intentionally fails preStart and prevents the gateway starting, with a failure-monitor alert; established origins retain their existing non-fatal offline-pull behavior. Profile Git uses the dedicated deploy identity and strict operator-verified, root-owned SSH host pins. Its direct Git SSH endpoint remains separate from the HTTPS web route and from fleet login on port 22. Both startup and normal Git operations use the same declared SSH command; the fleet identity is unchanged. Validation: - 18 regression cases exercise actual isolated Git repositories, including ignored local files, actionable rejection diagnostics, transient fetch recovery and established-origin offline compatibility. - OpenSSH tests exercise the actual declared Git command, strict host trust, the separate fleet port/identity and pin lookup derived from the configured SSH endpoint. - Full `nix flake check`, shell/repository formatting and whitespace checks passed. - The exact clean Vega configuration built successfully without activation. - Read-only live comparison found the profile checkout clean and its tracked branch compatible with the imported default branch. GitLab deploy-key setup and server-side read/write/default-branch authorization are verified. Actual Hermes-context authenticated operations and live activation remain pending. Fence concurrent writers and capture the complete mutable checkout/.git recovery checkpoint plus the pre-deployment revision tag before applying the change. A NixOS generation rollback alone cannot undo mutable Git state or remote writes. Private operational/recovery details are in KiwiFS; keep Forgejo available until authenticated acceptance is complete. Refs #350. This MR does not claim live activation, a Git push from Hermes or a completed recovery checkpoint.
Move Hermes profile sync to GitLab with guarded origin reconciliation
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) Has been cancelled
b01eedac18
Preserve local profile work and validate compatible destination history before updating an existing checkout. Add real Git regression coverage and document the required recovery checkpoint. Refs #350.
nimmo added this to the GitLab Pilot milestone 2026-10-16 19:56:18 +01:00
Author
Owner

Before pushing the next head, a local safety probe found that Git's default merge behavior could overwrite an ignored local profile file when the destination begins tracking the same filename. The follow-up uses merge --ff-only --no-overwrite-ignore during origin reconciliation and adds a real-Git regression verifying rejection, unchanged origin/HEAD and preservation of the local file.

Validation for the prepared 13cbca8 head: all 14 regression cases passed; full nix flake check, shell/repository formatting and whitespace checks passed; the exact clean Vega system configuration built successfully without activation. This is an additional self-review fix; the first automated-review check found no report yet and its job was queued behind another review. No review feedback has been dismissed.

The live checkout remains untouched. Pushing this fix will require a fresh current-head automated review; the earlier head's CI/review is not readiness evidence for the new head.

Before pushing the next head, a local safety probe found that Git's default merge behavior could overwrite an ignored local profile file when the destination begins tracking the same filename. The follow-up uses `merge --ff-only --no-overwrite-ignore` during origin reconciliation and adds a real-Git regression verifying rejection, unchanged origin/HEAD and preservation of the local file. Validation for the prepared `13cbca8` head: all 14 regression cases passed; full `nix flake check`, shell/repository formatting and whitespace checks passed; the exact clean Vega system configuration built successfully without activation. This is an additional self-review fix; the first automated-review check found no report yet and its job was queued behind another review. No review feedback has been dismissed. The live checkout remains untouched. Pushing this fix will require a fresh current-head automated review; the earlier head's CI/review is not readiness evidence for the new head.
Preserve ignored profile files during origin cutover
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m25s
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / build (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 13m38s
13cbca873a
clankbot left a comment

Automated code review

Reviewed commit: 13cbca873a5d07d92ce32ea255d9b6f309ef9230

Verdict: Requires further work

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

Overall assessment

The cutover is internally consistent: nixosConfig.hermes.gitRepo now defaults to ssh://git@de.nimmog.uk:2222/nimmo/hermes.git (modules/services/hermes.nix:81), the new flake check pins exactly that value for vega, and scripts/hermes-profile-sync.sh replaces the inline clone/pull block with a guarded origin reconciliation invoked from systemd.services.hermes-agent.preStart (hermes.nix:276) via ${pkgs.bash}/bin/bash ${../../scripts/hermes-profile-sync.sh}, which resolves to the shipped file; the bare git/sleep calls inside it are satisfied by the existing systemd.services.hermes-agent.path = [ pkgs.git pkgs.openssh pkgs.coreutils ] (hermes.nix:330-333). The 14 regression cases in scripts/test-hermes-profile-sync.py exercise the state machine against real local repositories. Remaining findings are behavioural and documentary: the rejected transitional states now abort preStart (a change from the previous pull --ff-only || true), two rejection paths exit with no diagnostic, the new Git host is contacted only under StrictHostKeyChecking=accept-new despite a pinned key already existing in keys/hermes-fleet-known-hosts, and two documents still name the old Git host.

Blocking findings

None.

Important findings

  • Rejected cutover states now fail preStart and take the gateway down (modules/services/hermes.nix:276; medium confidence)
    The removed block ended with git -C "$repo_dir" pull --ff-only || true, i.e. a dirty or divergent mutable profile was tolerated; the new invocation has no || true, and the helper exits 1 for every rejected transitional state (multiple origin URLs at 20-22, explicit push URLs at 25-27, missing/mismatched upstream at 32-35, dirty worktree at 37-39, failed fetch/merge --ff-only at 44-45). services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ] (hermes.nix:337, unchanged) then reports the failure. The README paragraph added at README.md:301-305 only promises that the cutover is stopped, not that the service is stopped as well. The same preStart can itself place files into the checkout (cp -rn "$hermes_home/skills/." "$repo_dir/skills/", after this call), and test_dirty_work_is_preserved_and_cutover_rejected shows an untracked file makes status --porcelain --untracked-files=all reject the cutover.
    Impact: During the migration window - while the live checkout still carries the old origin and the evaluated config names the new one - any dirty profile, detached head, lost upstream, or genuinely divergent history prevents the symlinking of SOUL.md/distribution.yaml/skills and prevents the gateway from starting at all, rather than starting on the existing local profile; if preStart's own skill copy leaves untracked files in the checkout, the automatic origin change can never happen without operator intervention.
    Suggested fix: Confirm the hard failure is intended. If the intent is 'stop the cutover but keep the agent running', mirror the established-origin branch (which already degrades non-fatally at lines 52-54): print the prefixed warning and exit 0 for the rejection states, reserving a non-zero exit for the initial clone. Otherwise state in README.md:301-305 that a rejected cutover also takes hermes-agent down and alerts the failure monitor.

Suggestions

  • Detached head and missing origin exit with no journal diagnostic (scripts/hermes-profile-sync.sh:31; high confidence)
    set -euo pipefail is in effect (line 2). branch="$(git -C "$repo_dir" symbolic-ref --quiet --short HEAD)" (line 31) exits non-zero for a detached head, and --quiet suppresses the message; current_url="$(git -C "$repo_dir" remote get-url origin)" (line 18) exits non-zero when the checkout has no origin remote. Every other rejection in the script prints an hermes-agent:-prefixed explanation, and the author already used the guard idiom at line 24 (... || true). test_detached_head_rejected asserts only assertNotEqual(returncode, 0) and never inspects the captured stderr.
    Impact: A checkout with a .git directory but no origin remote, or a detached head, fails preStart with no actionable journal line, so the operator cannot tell which state to repair; these are the least diagnosable paths in the new state machine.
    Suggested fix: Guard those commands as at line 24 and emit the same prefixed explanation, e.g. 'hermes-agent: detached profile head requires operator reconciliation' and 'hermes-agent: profile checkout has no origin remote; operator reconciliation required', and assert the expected stderr in the two regression cases.

  • New Git host is trusted only via accept-new, despite a pinned key already in the repository (modules/services/hermes.nix:81; medium confidence)
    The new default host de.nimmog.uk is contacted with the unchanged git_ssh value (hermes.nix:275): -F /dev/null -i <deploy key> ... -o StrictHostKeyChecking=accept-new. keys/hermes-fleet-known-hosts already carries an operator-trusted ed25519 entry for de.nimmog.uk, but that file is installed only as /etc/hermes/fleet-known-hosts (modules/services/hermes-fleet-ssh.nix:31) and is reachable only through the fleet config's GlobalKnownHostsFile, which -F /dev/null discards for the clone, fetch and pull.
    Impact: The first origin change and every subsequent pull accept a host key for de.nimmog.uk auto-added to ${stateDir}/.ssh/known_hosts rather than the key already pinned in this repository, so a wrong or substituted endpoint would be accepted silently on first contact.
    Suggested fix: Pin the new host for the Git transport - e.g. add -o KnownHostsFile= pointing at a root-owned file containing the entry already in keys/hermes-fleet-known-hosts - or record in the migration checklist that accept-new is the accepted policy for this host.

  • Fleet-SSH documentation still names git.nimmog.uk as the excluded Git host (docs/hermes-fleet-ssh.md:45; high confidence)
    The changed document still asserts 'git.nimmog.uk is excluded from the fleet identity rule', and the generated configuration in modules/services/hermes-fleet-ssh.nix:36 is Host * !git.nimmog.uk. This change moves Hermes's Git host to de.nimmog.uk (hermes.nix:81), which that negated pattern does not exclude.
    Impact: The stated invariant is stale: the fleet identity and IdentitiesOnly yes rule now matches the host Hermes actually uses for Git. Git itself is unaffected because it runs with -F /dev/null and an explicit -i key, so this is a documentation/defence-in-depth mismatch rather than a functional break.
    Suggested fix: Update the sentence to name the current Git host, and if the exclusion is still wanted as a guard, extend the negated pattern in modules/services/hermes-fleet-ssh.nix to cover de.nimmog.uk (the hermes-fleet-ssh check in flake.nix exercises git@git.nimmog.uk and would need the same retargeting).

  • README links the profile repository to a host that appears nowhere else in the tree (README.md:297; medium confidence)
    The added text links the repository as https://forge.nimmog.uk/nimmo/hermes while naming the remote as ssh://git@de.nimmog.uk:2222/nimmo/hermes.git (line 299). forge.nimmog.uk occurs nowhere else in the supplied tree; every other web reference in README.md and docs/ uses git.nimmog.uk, and de.nimmog.uk is the Git host with a pinned key in keys/hermes-fleet-known-hosts.
    Impact: Readers following the repository link are sent to an otherwise-unreferenced host, which is inconsistent with the remote the service actually uses and with the rest of the documentation.
    Suggested fix: Point the link at the host that actually serves the nimmo/hermes web UI (or state the host pair explicitly), so the README's browse URL and the evaluated gitRepo agree.

Tests and validation

  • No configured deterministic checks.

Questions

  • Is a non-zero preStart exit acceptable for the rejected cutover states, given services.serviceFailureMonitor.services includes hermes-agent (hermes.nix:337) and the fleet auto-updates?
  • Should Host * !git.nimmog.uk in modules/services/hermes-fleet-ssh.nix be retargeted to de.nimmog.uk, or is the exclusion intentionally left as-is because Git always runs with -F /dev/null?
  • The helper fetches only refs/heads/<local branch> from the new remote; is the GitLab project's default branch confirmed to match the existing checkout's branch name (secrets/README.md now claims push access to protected main), or should a branch mismatch be a distinct diagnostic?
  • Should the hermes-fleet-ssh flake check in flake.nix be updated to exercise the new Git host, since it currently proves the exclusion only for git@git.nimmog.uk?

Review limitations

  • The review container has no Nix, so I did not run nix flake check, just check, or the new regression suite; the reported validation results are taken from the pull-request text, not reproduced.
  • No live state was inspected: the current /srv/services/hermes/profile checkout, its origin/upstream configuration, the GitLab deploy-key access-control list, and the GitLab project's default branch are outside the supplied tree.
  • The regression suite exercises the state machine with local-path remotes under GIT_ALLOW_PROTOCOL="file" and never sets GIT_SSH_COMMAND, so the flake check proves the guard logic but not the SSH transport, the configured gitRepo value, or authenticated GitLab access.
  • treefmt.nix enables nixfmt and shfmt only, so the repository formatting gate covers the new shell helper but not the new scripts/test-hermes-profile-sync.py.
  • The nimmo/hermes profile repository itself (its ssh/config, default branch, protected-branch rules, and any .gitignore) is not part of this checkout, so statements about untracked or ignored files in the working tree are inferred from the helper and preStart code only.
  • I did not edit source files, execute repository code, or publish anything; findings are limited to the supplied diff and the checked-out files I read (modules/services/hermes.nix, modules/services/hermes-fleet-ssh.nix, scripts/hermes-profile-sync.sh, scripts/test-hermes-profile-sync.py, flake.nix, scripts/check-hermes-fleet-ssh.nix, keys/hermes-fleet-known-hosts, treefmt.nix, AGENTS.md, README.md, docs/hermes-fleet-ssh.md, secrets/README.md, hosts/vega/default.nix).

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • docs/hermes-fleet-ssh.md: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • scripts/hermes-profile-sync.sh: reviewed — included in a context-limited batch
  • scripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batch
  • secrets/README.md: 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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 2
  • Previous automated review: none found
  • Findings: 5
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `13cbca873a5d07d92ce32ea255d9b6f309ef9230` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The cutover is internally consistent: `nixosConfig.hermes.gitRepo` now defaults to `ssh://git@de.nimmog.uk:2222/nimmo/hermes.git` (modules/services/hermes.nix:81), the new flake check pins exactly that value for vega, and `scripts/hermes-profile-sync.sh` replaces the inline clone/pull block with a guarded origin reconciliation invoked from `systemd.services.hermes-agent.preStart` (hermes.nix:276) via `${pkgs.bash}/bin/bash ${../../scripts/hermes-profile-sync.sh}`, which resolves to the shipped file; the bare `git`/`sleep` calls inside it are satisfied by the existing `systemd.services.hermes-agent.path = [ pkgs.git pkgs.openssh pkgs.coreutils ]` (hermes.nix:330-333). The 14 regression cases in `scripts/test-hermes-profile-sync.py` exercise the state machine against real local repositories. Remaining findings are behavioural and documentary: the rejected transitional states now abort preStart (a change from the previous `pull --ff-only || true`), two rejection paths exit with no diagnostic, the new Git host is contacted only under `StrictHostKeyChecking=accept-new` despite a pinned key already existing in `keys/hermes-fleet-known-hosts`, and two documents still name the old Git host. ### Blocking findings None. ### Important findings - **Rejected cutover states now fail preStart and take the gateway down** (modules/services/hermes.nix:276; medium confidence) The removed block ended with `git -C "$repo_dir" pull --ff-only || true`, i.e. a dirty or divergent mutable profile was tolerated; the new invocation has no `|| true`, and the helper exits 1 for every rejected transitional state (multiple origin URLs at 20-22, explicit push URLs at 25-27, missing/mismatched upstream at 32-35, dirty worktree at 37-39, failed `fetch`/`merge --ff-only` at 44-45). `services.serviceFailureMonitor.services = lib.mkAfter [ "hermes-agent" ]` (hermes.nix:337, unchanged) then reports the failure. The README paragraph added at README.md:301-305 only promises that the cutover is stopped, not that the service is stopped as well. The same preStart can itself place files into the checkout (`cp -rn "$hermes_home/skills/." "$repo_dir/skills/"`, after this call), and `test_dirty_work_is_preserved_and_cutover_rejected` shows an untracked file makes `status --porcelain --untracked-files=all` reject the cutover. Impact: During the migration window - while the live checkout still carries the old origin and the evaluated config names the new one - any dirty profile, detached head, lost upstream, or genuinely divergent history prevents the symlinking of SOUL.md/distribution.yaml/skills and prevents the gateway from starting at all, rather than starting on the existing local profile; if preStart's own skill copy leaves untracked files in the checkout, the automatic origin change can never happen without operator intervention. Suggested fix: Confirm the hard failure is intended. If the intent is 'stop the cutover but keep the agent running', mirror the established-origin branch (which already degrades non-fatally at lines 52-54): print the prefixed warning and exit 0 for the rejection states, reserving a non-zero exit for the initial clone. Otherwise state in README.md:301-305 that a rejected cutover also takes `hermes-agent` down and alerts the failure monitor. ### Suggestions - **Detached head and missing origin exit with no journal diagnostic** (scripts/hermes-profile-sync.sh:31; high confidence) `set -euo pipefail` is in effect (line 2). `branch="$(git -C "$repo_dir" symbolic-ref --quiet --short HEAD)"` (line 31) exits non-zero for a detached head, and `--quiet` suppresses the message; `current_url="$(git -C "$repo_dir" remote get-url origin)"` (line 18) exits non-zero when the checkout has no `origin` remote. Every other rejection in the script prints an `hermes-agent:`-prefixed explanation, and the author already used the guard idiom at line 24 (`... || true`). `test_detached_head_rejected` asserts only `assertNotEqual(returncode, 0)` and never inspects the captured stderr. Impact: A checkout with a `.git` directory but no `origin` remote, or a detached head, fails preStart with no actionable journal line, so the operator cannot tell which state to repair; these are the least diagnosable paths in the new state machine. Suggested fix: Guard those commands as at line 24 and emit the same prefixed explanation, e.g. 'hermes-agent: detached profile head requires operator reconciliation' and 'hermes-agent: profile checkout has no origin remote; operator reconciliation required', and assert the expected stderr in the two regression cases. - **New Git host is trusted only via accept-new, despite a pinned key already in the repository** (modules/services/hermes.nix:81; medium confidence) The new default host `de.nimmog.uk` is contacted with the unchanged `git_ssh` value (hermes.nix:275): `-F /dev/null -i <deploy key> ... -o StrictHostKeyChecking=accept-new`. `keys/hermes-fleet-known-hosts` already carries an operator-trusted ed25519 entry for `de.nimmog.uk`, but that file is installed only as `/etc/hermes/fleet-known-hosts` (modules/services/hermes-fleet-ssh.nix:31) and is reachable only through the fleet config's `GlobalKnownHostsFile`, which `-F /dev/null` discards for the clone, fetch and pull. Impact: The first origin change and every subsequent pull accept a host key for `de.nimmog.uk` auto-added to `${stateDir}/.ssh/known_hosts` rather than the key already pinned in this repository, so a wrong or substituted endpoint would be accepted silently on first contact. Suggested fix: Pin the new host for the Git transport - e.g. add `-o KnownHostsFile=` pointing at a root-owned file containing the entry already in `keys/hermes-fleet-known-hosts` - or record in the migration checklist that `accept-new` is the accepted policy for this host. - **Fleet-SSH documentation still names git.nimmog.uk as the excluded Git host** (docs/hermes-fleet-ssh.md:45; high confidence) The changed document still asserts '`git.nimmog.uk` is excluded from the fleet identity rule', and the generated configuration in modules/services/hermes-fleet-ssh.nix:36 is `Host * !git.nimmog.uk`. This change moves Hermes's Git host to `de.nimmog.uk` (hermes.nix:81), which that negated pattern does not exclude. Impact: The stated invariant is stale: the fleet identity and `IdentitiesOnly yes` rule now matches the host Hermes actually uses for Git. Git itself is unaffected because it runs with `-F /dev/null` and an explicit `-i` key, so this is a documentation/defence-in-depth mismatch rather than a functional break. Suggested fix: Update the sentence to name the current Git host, and if the exclusion is still wanted as a guard, extend the negated pattern in modules/services/hermes-fleet-ssh.nix to cover `de.nimmog.uk` (the `hermes-fleet-ssh` check in flake.nix exercises `git@git.nimmog.uk` and would need the same retargeting). - **README links the profile repository to a host that appears nowhere else in the tree** (README.md:297; medium confidence) The added text links the repository as `https://forge.nimmog.uk/nimmo/hermes` while naming the remote as `ssh://git@de.nimmog.uk:2222/nimmo/hermes.git` (line 299). `forge.nimmog.uk` occurs nowhere else in the supplied tree; every other web reference in README.md and docs/ uses `git.nimmog.uk`, and `de.nimmog.uk` is the Git host with a pinned key in `keys/hermes-fleet-known-hosts`. Impact: Readers following the repository link are sent to an otherwise-unreferenced host, which is inconsistent with the remote the service actually uses and with the rest of the documentation. Suggested fix: Point the link at the host that actually serves the `nimmo/hermes` web UI (or state the host pair explicitly), so the README's browse URL and the evaluated `gitRepo` agree. ### Tests and validation - No configured deterministic checks. ### Questions - Is a non-zero preStart exit acceptable for the rejected cutover states, given `services.serviceFailureMonitor.services` includes `hermes-agent` (hermes.nix:337) and the fleet auto-updates? - Should `Host * !git.nimmog.uk` in modules/services/hermes-fleet-ssh.nix be retargeted to `de.nimmog.uk`, or is the exclusion intentionally left as-is because Git always runs with `-F /dev/null`? - The helper fetches only `refs/heads/<local branch>` from the new remote; is the GitLab project's default branch confirmed to match the existing checkout's branch name (secrets/README.md now claims push access to protected `main`), or should a branch mismatch be a distinct diagnostic? - Should the `hermes-fleet-ssh` flake check in flake.nix be updated to exercise the new Git host, since it currently proves the exclusion only for `git@git.nimmog.uk`? ### Review limitations - The review container has no Nix, so I did not run `nix flake check`, `just check`, or the new regression suite; the reported validation results are taken from the pull-request text, not reproduced. - No live state was inspected: the current `/srv/services/hermes/profile` checkout, its origin/upstream configuration, the GitLab deploy-key access-control list, and the GitLab project's default branch are outside the supplied tree. - The regression suite exercises the state machine with local-path remotes under `GIT_ALLOW_PROTOCOL="file"` and never sets `GIT_SSH_COMMAND`, so the flake check proves the guard logic but not the SSH transport, the configured `gitRepo` value, or authenticated GitLab access. - `treefmt.nix` enables `nixfmt` and `shfmt` only, so the repository formatting gate covers the new shell helper but not the new `scripts/test-hermes-profile-sync.py`. - The `nimmo/hermes` profile repository itself (its `ssh/config`, default branch, protected-branch rules, and any `.gitignore`) is not part of this checkout, so statements about untracked or ignored files in the working tree are inferred from the helper and preStart code only. - I did not edit source files, execute repository code, or publish anything; findings are limited to the supplied diff and the checked-out files I read (modules/services/hermes.nix, modules/services/hermes-fleet-ssh.nix, scripts/hermes-profile-sync.sh, scripts/test-hermes-profile-sync.py, flake.nix, scripts/check-hermes-fleet-ssh.nix, keys/hermes-fleet-known-hosts, treefmt.nix, AGENTS.md, README.md, docs/hermes-fleet-ssh.md, secrets/README.md, hosts/vega/default.nix). ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `docs/hermes-fleet-ssh.md`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `scripts/hermes-profile-sync.sh`: **reviewed** — included in a context-limited batch - `scripts/test-hermes-profile-sync.py`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 2 - Previous automated review: none found - Findings: 5 </details>
Author
Owner

Assessed all findings and questions from review #111 on 13cbca8 before publishing the next head.

  • Rejected-cutover availability: hard failure is intentional. A failed origin transition must not quietly keep the gateway writing to the old repository. README now explicitly says preStart fails, the gateway does not start and the failure monitor alerts. Established-origin offline pulls retain the prior behavior. The private operator checklist requires fencing writers/checkpointing before activation.
  • Missing-origin/detached-HEAD diagnostics: added explicit prefixed errors and stderr assertions, including a new missing-origin case.
  • Git host trust: added independently verified Git endpoint pins, installed root-owned and used by the actual shared startup/runtime GIT_SSH_COMMAND with strict checking and no mutable user known-hosts file. The existing fleet port-22 pin cannot be substituted for GitLab's separate container listener. Retained the trusted legacy Git pin for intentional rollback and exposed a known-hosts-file override for alternative repository endpoints.
  • Fleet exclusion: deliberately did not exclude the new hostname wholesale, because it remains a legitimate fleet-login destination on port 22. Git uses -F /dev/null with the separate deploy identity on port 2222. Documentation now explains this, and OpenSSH configuration tests exercise the actual declared Git command and the separate fleet-login case.
  • Web link: retained the verified GitLab web URL. Its difference from the direct Git SSH endpoint is intentional (existing HTTPS proxy route versus direct SSH), now stated explicitly in README. Replacing it with the SSH hostname would point readers at the wrong web endpoint.

Live branch/upstream and imported default-branch agreement were checked read-only. Actual live Hermes-context authenticated Git operations remain pending, not implied by the unit tests or server-side authorization checks.

Validation for prepared head 94f7424: all 15 real-Git regression cases pass; full nix flake check passes, including the actual declared SSH transport, fleet port/identity separation, pinned Git endpoint lookup and formatting; exact clean Vega system build passes. No private key was read or rotated, and no live service activation occurred. Pushing next to request a fresh current-head review.

Assessed all findings and questions from review #111 on `13cbca8` before publishing the next head. - Rejected-cutover availability: hard failure is intentional. A failed origin transition must not quietly keep the gateway writing to the old repository. README now explicitly says preStart fails, the gateway does not start and the failure monitor alerts. Established-origin offline pulls retain the prior behavior. The private operator checklist requires fencing writers/checkpointing before activation. - Missing-origin/detached-HEAD diagnostics: added explicit prefixed errors and stderr assertions, including a new missing-origin case. - Git host trust: added independently verified Git endpoint pins, installed root-owned and used by the actual shared startup/runtime GIT_SSH_COMMAND with strict checking and no mutable user known-hosts file. The existing fleet port-22 pin cannot be substituted for GitLab's separate container listener. Retained the trusted legacy Git pin for intentional rollback and exposed a known-hosts-file override for alternative repository endpoints. - Fleet exclusion: deliberately did not exclude the new hostname wholesale, because it remains a legitimate fleet-login destination on port 22. Git uses -F /dev/null with the separate deploy identity on port 2222. Documentation now explains this, and OpenSSH configuration tests exercise the actual declared Git command and the separate fleet-login case. - Web link: retained the verified GitLab web URL. Its difference from the direct Git SSH endpoint is intentional (existing HTTPS proxy route versus direct SSH), now stated explicitly in README. Replacing it with the SSH hostname would point readers at the wrong web endpoint. Live branch/upstream and imported default-branch agreement were checked read-only. Actual live Hermes-context authenticated Git operations remain pending, not implied by the unit tests or server-side authorization checks. Validation for prepared head `94f7424`: all 15 real-Git regression cases pass; full `nix flake check` passes, including the actual declared SSH transport, fleet port/identity separation, pinned Git endpoint lookup and formatting; exact clean Vega system build passes. No private key was read or rotated, and no live service activation occurred. Pushing next to request a fresh current-head review.
Address Hermes cutover review with strict Git host trust and diagnostics
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m26s
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 18m55s
94f7424981
clankbot requested changes 2026-10-16 21:06:24 +01:00
Dismissed
clankbot left a comment

Automated code review

Reviewed commit: 94f7424981c1823fb99a84b7f41cb8148af41488

Verdict: Requires further work

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

Overall assessment

The cutover helper (scripts/hermes-profile-sync.sh) and its regression tests are internally consistent with the documented design: origin reconciliation is guarded by upstream/dirty/pushurl checks, uses fetch + merge --ff-only with no reset or force push, and keeps a non-fatal pull only once the origin already matches. The new Nix-level assertions in scripts/check-hermes-fleet-ssh.nix match the declared GIT_SSH_COMMAND in modules/services/hermes.nix:18. One concrete defect stands out: the extended hermes-fleet-ssh flake check greps for '^stricthostkeychecking true$' while the declared option value is StrictHostKeyChecking=yes, and the same check file matches OpenSSH -G output verbatim for every other option (accept-new, batchmode yes), so the grep cannot match and nix flake check fails on this head commit. Two lower-severity items are the missing retry/transport-vs-rejection separation in the cutover fetch and a hardcoded endpoint literal in the new flake check.

Blocking findings

  • hermes-fleet-ssh check greps for stricthostkeychecking true, but the declared option value is yes (flake.nix:342; high confidence)
    flake.nix:342 asserts grep -q '^stricthostkeychecking true$' gitlab-options against the output of ${gitSshForTest} -G -p 2222 git@de.nimmog.uk (flake.nix:338), i.e. the evaluated services.hermes-agent.environment.GIT_SSH_COMMAND with only the identity path substituted. That command is declared in modules/services/hermes.nix:18 as ... -o StrictHostKeyChecking=yes (also asserted verbatim as -o StrictHostKeyChecking=yes at scripts/check-hermes-fleet-ssh.nix:29). The same check file matches ssh -G output verbatim for the option token as declared elsewhere: '^stricthostkeychecking accept-new$' (flake.nix:306) for StrictHostKeyChecking accept-new in modules/services/hermes-fleet-ssh.nix:45, and '^batchmode yes$' for BatchMode yes - so the dump echoes yes, never true.
    Impact: The hermes-fleet-ssh flake check cannot match the declared strict-host setting, so nix flake check - the repository's deterministic gate - fails on this head commit instead of proving the strict host trust the PR claims to exercise. The runtime policy itself is unchanged and still enforced by the Nix-level assert in scripts/check-hermes-fleet-ssh.nix, so this is a broken test assertion, not a weakened policy.
    Suggested fix: Change the grep to '^stricthostkeychecking yes$' to match the declared value (or derive the expected token from the evaluated GIT_SSH_COMMAND rather than hardcoding it), then re-run nix flake check and report the result.

Important findings

None.

Suggestions

  • Cutover fetch has no retry and does not separate transport failure from a genuine rejection (scripts/hermes-profile-sync.sh:50; medium confidence)
    The clone path retries three times with a 2s gap (lines 8-15). The cutover path runs git -C "$repo_dir" fetch --no-tags -- "$expected_url" "refs/heads/$branch" once (line 50) under set -euo pipefail (line 2), so any transport failure - DNS, GitLab outage, host-pin mismatch - exits non-zero. That exit propagates through the preStart invocation in modules/services/hermes.nix:285 (GIT_SSH_COMMAND="$git_ssh" ${pkgs.bash}/bin/bash ${../../scripts/hermes-profile-sync.sh} ...), which has no || true, whereas the previous implementation's equivalent network step was non-fatal (git ... pull --ff-only || true).
    Impact: On the first activation after this change, a transient network or SSH failure is indistinguishable from a deliberately rejected cutover: the gateway does not start and the failure monitor reports an alert, even though nothing about the checkout or history is incompatible. This is a behaviour change introduced by the diff on the startup path.
    Suggested fix: Retry the cutover fetch a bounded number of times as the clone path does, or distinguish transport failures (retry, then non-fatal with an actionable message) from history/dirty-state/pushurl rejections (fatal), keeping the diagnostics actionable in either case.

  • New flake check pins the GitLab endpoint as a literal rather than the evaluated configuration (flake.nix:247; medium confidence)
    checks.x86_64-linux.hermes-profile-sync asserts self.nixosConfigurations.vega.config.nixosConfig.hermes.gitRepo == "ssh://git@de.nimmog.uk:2222/nimmo/hermes.git", duplicating the option default at modules/services/hermes.nix:82. The sibling option's description (modules/services/hermes.nix:95, gitKnownHostsFile) states "Override alongside gitRepo for another endpoint", so overriding gitRepo is an intended configuration path and would make this assert - hence nix flake check - fail.
    Impact: The regression check is coupled to the option default rather than to the configured value: a future endpoint override breaks evaluation with no defect present. This is brittleness in the config gate, not a current regression (vega uses the default).
    Suggested fix: Interpolate the evaluated cfg.gitRepo into the helper invocation and keep the literal comparison only as a deliberate pin on the default (or drop it in favour of asserting the helper is wired to cfg.gitRepo).

Tests and validation

  • No configured deterministic checks.

Questions

  • The cutover fetches only refs/heads/<current branch> and then requires merge --ff-only against FETCH_HEAD. If the GitLab import's default branch is not the checkout's tracked branch name, or if the import re-created commit SHAs so the histories are unrelated, the cutover is rejected and the gateway will not start. Is the GitLab nimmo/hermes import a history-preserving mirror whose default branch matches the checkout's branch?
  • After a successful cutover the script updates only refs/remotes/origin/$branch and fetches with --no-tags. Should it also refresh tags and refs/remotes/origin/HEAD so later agent pushes and status views reflect the imported repository's default branch?

Review limitations

  • No Nix, OpenSSH, or Git execution was performed; the stricthostkeychecking true finding is inferred from the declared option value and the same check file's verbatim -G greps, not from observed ssh output.
  • The hermes-agent service/package wrapper comes from an external flake input that was not supplied, so the unit's PATH, Restart, and preStart failure handling could not be inspected beyond the declarations in modules/services/hermes.nix.
  • No access to the GitLab repository, the live Vega /srv/services/hermes/profile checkout, the private KiwiFS recovery checkpoint, or the pre-deployment revision tag; the PR's live-comparison and deploy-key statements are unverified.
  • The host-key material in keys/hermes-git-known-hosts was checked only for format and the [de.nimmog.uk]:2222 pattern form; it cannot be verified as the GitLab container's actual key.
  • Only the listed changed files plus their callers in the checked-out tree were examined; unchanged code outside those paths was not assessed.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • docs/hermes-fleet-ssh.md: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • keys/hermes-git-known-hosts: reviewed — included in a context-limited batch
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • scripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batch
  • scripts/hermes-profile-sync.sh: reviewed — included in a context-limited batch
  • scripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batch
  • secrets/README.md: 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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 3
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `94f7424981c1823fb99a84b7f41cb8148af41488` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The cutover helper (scripts/hermes-profile-sync.sh) and its regression tests are internally consistent with the documented design: origin reconciliation is guarded by upstream/dirty/pushurl checks, uses fetch + merge --ff-only with no reset or force push, and keeps a non-fatal pull only once the origin already matches. The new Nix-level assertions in scripts/check-hermes-fleet-ssh.nix match the declared GIT_SSH_COMMAND in modules/services/hermes.nix:18. One concrete defect stands out: the extended hermes-fleet-ssh flake check greps for '^stricthostkeychecking true$' while the declared option value is StrictHostKeyChecking=yes, and the same check file matches OpenSSH -G output verbatim for every other option (accept-new, batchmode yes), so the grep cannot match and `nix flake check` fails on this head commit. Two lower-severity items are the missing retry/transport-vs-rejection separation in the cutover fetch and a hardcoded endpoint literal in the new flake check. ### Blocking findings - **hermes-fleet-ssh check greps for `stricthostkeychecking true`, but the declared option value is `yes`** (flake.nix:342; high confidence) flake.nix:342 asserts `grep -q '^stricthostkeychecking true$' gitlab-options` against the output of `${gitSshForTest} -G -p 2222 git@de.nimmog.uk` (flake.nix:338), i.e. the evaluated `services.hermes-agent.environment.GIT_SSH_COMMAND` with only the identity path substituted. That command is declared in modules/services/hermes.nix:18 as `... -o StrictHostKeyChecking=yes` (also asserted verbatim as `-o StrictHostKeyChecking=yes` at scripts/check-hermes-fleet-ssh.nix:29). The same check file matches ssh -G output verbatim for the option token as declared elsewhere: `'^stricthostkeychecking accept-new$'` (flake.nix:306) for `StrictHostKeyChecking accept-new` in modules/services/hermes-fleet-ssh.nix:45, and `'^batchmode yes$'` for `BatchMode yes` - so the dump echoes `yes`, never `true`. Impact: The `hermes-fleet-ssh` flake check cannot match the declared strict-host setting, so `nix flake check` - the repository's deterministic gate - fails on this head commit instead of proving the strict host trust the PR claims to exercise. The runtime policy itself is unchanged and still enforced by the Nix-level assert in scripts/check-hermes-fleet-ssh.nix, so this is a broken test assertion, not a weakened policy. Suggested fix: Change the grep to `'^stricthostkeychecking yes$'` to match the declared value (or derive the expected token from the evaluated GIT_SSH_COMMAND rather than hardcoding it), then re-run `nix flake check` and report the result. ### Important findings None. ### Suggestions - **Cutover fetch has no retry and does not separate transport failure from a genuine rejection** (scripts/hermes-profile-sync.sh:50; medium confidence) The clone path retries three times with a 2s gap (lines 8-15). The cutover path runs `git -C "$repo_dir" fetch --no-tags -- "$expected_url" "refs/heads/$branch"` once (line 50) under `set -euo pipefail` (line 2), so any transport failure - DNS, GitLab outage, host-pin mismatch - exits non-zero. That exit propagates through the preStart invocation in modules/services/hermes.nix:285 (`GIT_SSH_COMMAND="$git_ssh" ${pkgs.bash}/bin/bash ${../../scripts/hermes-profile-sync.sh} ...`), which has no `|| true`, whereas the previous implementation's equivalent network step was non-fatal (`git ... pull --ff-only || true`). Impact: On the first activation after this change, a transient network or SSH failure is indistinguishable from a deliberately rejected cutover: the gateway does not start and the failure monitor reports an alert, even though nothing about the checkout or history is incompatible. This is a behaviour change introduced by the diff on the startup path. Suggested fix: Retry the cutover fetch a bounded number of times as the clone path does, or distinguish transport failures (retry, then non-fatal with an actionable message) from history/dirty-state/pushurl rejections (fatal), keeping the diagnostics actionable in either case. - **New flake check pins the GitLab endpoint as a literal rather than the evaluated configuration** (flake.nix:247; medium confidence) `checks.x86_64-linux.hermes-profile-sync` asserts `self.nixosConfigurations.vega.config.nixosConfig.hermes.gitRepo == "ssh://git@de.nimmog.uk:2222/nimmo/hermes.git"`, duplicating the option default at modules/services/hermes.nix:82. The sibling option's description (modules/services/hermes.nix:95, `gitKnownHostsFile`) states "Override alongside gitRepo for another endpoint", so overriding `gitRepo` is an intended configuration path and would make this assert - hence `nix flake check` - fail. Impact: The regression check is coupled to the option default rather than to the configured value: a future endpoint override breaks evaluation with no defect present. This is brittleness in the config gate, not a current regression (vega uses the default). Suggested fix: Interpolate the evaluated `cfg.gitRepo` into the helper invocation and keep the literal comparison only as a deliberate pin on the default (or drop it in favour of asserting the helper is wired to `cfg.gitRepo`). ### Tests and validation - No configured deterministic checks. ### Questions - The cutover fetches only `refs/heads/<current branch>` and then requires `merge --ff-only` against FETCH_HEAD. If the GitLab import's default branch is not the checkout's tracked branch name, or if the import re-created commit SHAs so the histories are unrelated, the cutover is rejected and the gateway will not start. Is the GitLab `nimmo/hermes` import a history-preserving mirror whose default branch matches the checkout's branch? - After a successful cutover the script updates only `refs/remotes/origin/$branch` and fetches with `--no-tags`. Should it also refresh tags and `refs/remotes/origin/HEAD` so later agent pushes and status views reflect the imported repository's default branch? ### Review limitations - No Nix, OpenSSH, or Git execution was performed; the `stricthostkeychecking true` finding is inferred from the declared option value and the same check file's verbatim `-G` greps, not from observed ssh output. - The `hermes-agent` service/package wrapper comes from an external flake input that was not supplied, so the unit's PATH, Restart, and preStart failure handling could not be inspected beyond the declarations in modules/services/hermes.nix. - No access to the GitLab repository, the live Vega `/srv/services/hermes/profile` checkout, the private KiwiFS recovery checkpoint, or the pre-deployment revision tag; the PR's live-comparison and deploy-key statements are unverified. - The host-key material in `keys/hermes-git-known-hosts` was checked only for format and the `[de.nimmog.uk]:2222` pattern form; it cannot be verified as the GitLab container's actual key. - Only the listed changed files plus their callers in the checked-out tree were examined; unchanged code outside those paths was not assessed. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `docs/hermes-fleet-ssh.md`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `keys/hermes-git-known-hosts`: **reviewed** — included in a context-limited batch - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `scripts/check-hermes-fleet-ssh.nix`: **reviewed** — included in a context-limited batch - `scripts/hermes-profile-sync.sh`: **reviewed** — included in a context-limited batch - `scripts/test-hermes-profile-sync.py`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 3 - Previous automated review: none found - Findings: 3 </details>
Author
Owner

Review follow-up for report #113 on 94f7424981; prepared commit 238e956.

  • Blocking SSH assertion finding: dismissed with execution evidence. ssh -G -F /dev/null -o StrictHostKeyChecking=yes example.invalid prints stricthostkeychecking true. OpenSSH normalizes this option; it does not echo the literal yes token. The exact declared-command flake check already passed, and the full check passes again. Changing the assertion to yes as suggested would break it. Added an explanatory comment.
  • Cutover fetch suggestion: implemented three bounded attempts with an explicit destination access/connectivity/host-trust diagnostic if all fail. Origin remains unchanged and startup remains intentionally fail-closed after exhaustion, as documented. Added a real-Git transient-failure/recovery regression and strengthened the unavailable-destination diagnostic test.
  • Configuration coupling suggestion: removed the literal repository URL assertion. The Nix gate now checks that startup uses the evaluated configured URL and the shared helper.
  • Branch/history question: the earlier read-only live comparison confirmed a history-preserving import and matching main/origin/main. No inference from the URL alone is used.
  • Tags/origin HEAD question: the cutover intentionally fetches only the tracked branch to prove compatibility before changing origin. It preserves other refs and makes no unrelated tag changes. The imported default branch matches the existing checkout; subsequent ordinary pulls retain normal configured fetch behavior. No additional default-branch/tag migration is required for this checkout.

Validation before this follow-up push: all 16 actual-Git cases pass under nix flake check; full flake checks and formatting pass, including the strict SSH assertion. The exact clean Vega system build is running without activation. Existing upstream stdenv deprecation warnings are unrelated. Private recovery checkpoint, writer fencing and live Hermes-context acceptance remain deployment prerequisites.

Review follow-up for report #113 on 94f7424981c1823fb99a84b7f41cb8148af41488; prepared commit 238e956. - Blocking SSH assertion finding: dismissed with execution evidence. `ssh -G -F /dev/null -o StrictHostKeyChecking=yes example.invalid` prints `stricthostkeychecking true`. OpenSSH normalizes this option; it does not echo the literal `yes` token. The exact declared-command flake check already passed, and the full check passes again. Changing the assertion to `yes` as suggested would break it. Added an explanatory comment. - Cutover fetch suggestion: implemented three bounded attempts with an explicit destination access/connectivity/host-trust diagnostic if all fail. Origin remains unchanged and startup remains intentionally fail-closed after exhaustion, as documented. Added a real-Git transient-failure/recovery regression and strengthened the unavailable-destination diagnostic test. - Configuration coupling suggestion: removed the literal repository URL assertion. The Nix gate now checks that startup uses the evaluated configured URL and the shared helper. - Branch/history question: the earlier read-only live comparison confirmed a history-preserving import and matching main/origin/main. No inference from the URL alone is used. - Tags/origin HEAD question: the cutover intentionally fetches only the tracked branch to prove compatibility before changing origin. It preserves other refs and makes no unrelated tag changes. The imported default branch matches the existing checkout; subsequent ordinary pulls retain normal configured fetch behavior. No additional default-branch/tag migration is required for this checkout. Validation before this follow-up push: all 16 actual-Git cases pass under `nix flake check`; full flake checks and formatting pass, including the strict SSH assertion. The exact clean Vega system build is running without activation. Existing upstream stdenv deprecation warnings are unrelated. Private recovery checkpoint, writer fencing and live Hermes-context acceptance remain deployment prerequisites.
Retry Hermes cutover fetch and verify configured repository wiring
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m37s
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 18m59s
238e95689f
clankbot left a comment

Automated code review

Reviewed commit: 238e95689fb213dfeee60478756ca59d019ecba6

Verdict: Requires further work

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

Overall assessment

The supplied changes retarget the Hermes profile Git endpoint to ssh://git@de.nimmog.uk:2222/nimmo/hermes.git (modules/services/hermes.nix:82), replace the previous StrictHostKeyChecking=accept-new transport with one shared gitSshCommand (modules/services/hermes.nix:18, reused at :211 and :283) that pins hosts through GlobalKnownHostsFile=/etc/hermes/git-known-hosts + UserKnownHostsFile=/dev/null + StrictHostKeyChecking=yes, install the new root-owned pin file (modules/services/hermes.nix:269, keys/hermes-git-known-hosts), and replace the inline clone/pull preStart with scripts/hermes-profile-sync.sh. The new check-hermes-fleet-ssh.nix assertions (lines 27-42) tie the declared transport, the pin file, the escaped preStart invocation and the script store path together, and the new flake check (flake.nix:330-347) exercises both the fleet route for de.nimmog.uk (which still matches Host * !git.nimmog.uk, modules/services/hermes-fleet-ssh.nix:36, so port 22 + fleet identity assertions hold) and the Git transport with -F /dev/null -p 2222. Bare git/sleep in the new script remain resolvable because systemd.services.hermes-agent.path already includes pkgs.git, pkgs.openssh, pkgs.coreutils (modules/services/hermes.nix:339-342). Two issues survive validation: the new origin-ambiguity guards sit outside the cutover branch and therefore turn the previously non-fatal established-origin path into a hard preStart failure, and the new flake check hard-codes the GitLab host/port instead of deriving them from the configuration it claims to validate. The missing-diagnostic and other stylistic points from the initial review were dropped as non-defect observations.

Blocking findings

None.

Important findings

  • Origin-ambiguity guards run before the origin-match test, so an already-established origin with a pushurl or multiple URLs now fails preStart instead of taking the documented non-fatal path (scripts/hermes-profile-sync.sh:27; medium confidence)
    Lines 22-26 (multiple remote.origin.url) and 27-31 (remote.origin.pushurl non-empty) exit 1 unconditionally, before the if [ "$current_url" != "$expected_url" ] branch at line 33; the non-fatal branch is only reachable at lines 68-71. The diff shows the replaced preStart ended with git -C "$repo_dir" pull --ff-only || true, i.e. an established origin could never fail startup. README.md states these conditions 'stop the cutover for operator reconciliation' and that 'after a successful cutover, a failed ordinary pull retains the prior offline-start behavior', which the code does not implement for an established origin. test_explicit_push_url_rejected only covers the case where the origin still differs from the configured URL, so the established-origin case is untested.
    Impact: A profile checkout that already matches nixosConfig.hermes.gitRepo but carries a push URL or a second origin URL would exit 1 on every gateway start: the Hermes service never starts, the service-failure monitor alerts on each attempt, and no automatic recovery path exists, whereas the same checkout previously started with a best-effort pull.
    Suggested fix: Move the multi-URL and pushurl rejections inside the current_url != expected_url cutover branch (or accept a pushurl equal to expected_url), so an established origin keeps the documented non-fatal offline-start behaviour at lines 68-71; add a regression for the established-origin-with-pushurl case if the current behaviour is intended.

Suggestions

  • The new GitLab pin check hard-codes the host and port instead of deriving them from the configuration it validates (flake.nix:347; medium confidence)
    The added block derives the transport from configuration (gitSshForTest, flake.nix:262-266) but hard-codes the destination in the invocation (-p 2222 git@de.nimmog.uk, line 335) and in the pin lookup (ssh-keygen -F '[de.nimmog.uk]:2222' -f ...gitKnownHostsFile, line 347). check-hermes-fleet-ssh.nix asserts only that the literal /etc/hermes/git-known-hosts path appears in gitSsh and that etc."hermes/git-known-hosts".source == nixosConfig.hermes.gitKnownHostsFile; nothing ties vega.nixosConfig.hermes.gitRepo (modules/services/hermes.nix:82) to a host pattern in the evaluated pin file, even though gitKnownHostsFile's description (modules/services/hermes.nix:95) invites overriding both together.
    Impact: A specialisation that overrides gitRepo to another endpoint without updating the pin file would still pass nix flake check, then fail only at runtime when StrictHostKeyChecking=yes rejects the unknown host - a deployment-time failure rather than an evaluation-time one.
    Suggested fix: Derive the -p/host arguments and the ssh-keygen -F pattern from vega.nixosConfig.hermes.gitRepo (or assert the parsed [host]:port from gitRepo is present in the evaluated gitKnownHostsFile) so the check follows the configuration rather than a literal copy of it.

Tests and validation

  • No configured deterministic checks.

Questions

  • flake.nix:347 uses ssh-keygen -F '[de.nimmog.uk]:2222' -f <pin file>; please confirm that is the intended known-hosts lookup form, since the documented host-lookup flags are -G pattern/-Q pattern with -f file. If -F is not a pattern flag, the new check would error rather than verify the pin.
  • Is the live /srv/services/hermes/profile checkout known to have no remote.origin.pushurl and a single remote.origin.url? That state decides whether the guards at scripts/hermes-profile-sync.sh:22-31 turn the existing offline-start path into a hard preStart failure after the cutover.
  • The cutover fetches refs/heads/$branch for the checkout's current branch (scripts/hermes-profile-sync.sh:52) rather than the destination's default branch; is GitLab's default branch for nimmo/hermes confirmed to share the existing checkout's branch name, otherwise the cutover fails permanently with 'destination fetch failed'?

Review limitations

  • I did not run nix flake check, the new hermes-profile-sync derivation, or the fleet-SSH derivation; the repository was inspected read-only, so all claimed passing validation comes from the supplied text, not from execution.
  • No access to the live Vega host, the existing /srv/services/hermes/profile checkout, or the GitLab repository, so the checkout's remote/pushurl state, its default branch, and the deploy-key write access described in secrets/README.md cannot be confirmed.
  • The nimmo/hermes profile repository (including its ssh/config) is outside this checkout, so profile-side interactions with the new endpoint are not inspectable.
  • OpenSSH behaviours relied on by the new check (-G normalising StrictHostKeyChecking=yes to true, the ssh-keygen -F/-f lookup form) and Git's worktree state after a failed --ff-only merge were not exercised here.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • docs/hermes-fleet-ssh.md: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • keys/hermes-git-known-hosts: reviewed — included in a context-limited batch
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • scripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batch
  • scripts/hermes-profile-sync.sh: reviewed — included in a context-limited batch
  • scripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batch
  • secrets/README.md: 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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 4
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `238e95689fb213dfeee60478756ca59d019ecba6` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The supplied changes retarget the Hermes profile Git endpoint to `ssh://git@de.nimmog.uk:2222/nimmo/hermes.git` (modules/services/hermes.nix:82), replace the previous `StrictHostKeyChecking=accept-new` transport with one shared `gitSshCommand` (modules/services/hermes.nix:18, reused at :211 and :283) that pins hosts through `GlobalKnownHostsFile=/etc/hermes/git-known-hosts` + `UserKnownHostsFile=/dev/null` + `StrictHostKeyChecking=yes`, install the new root-owned pin file (modules/services/hermes.nix:269, keys/hermes-git-known-hosts), and replace the inline clone/pull preStart with `scripts/hermes-profile-sync.sh`. The new `check-hermes-fleet-ssh.nix` assertions (lines 27-42) tie the declared transport, the pin file, the escaped preStart invocation and the script store path together, and the new flake check (flake.nix:330-347) exercises both the fleet route for `de.nimmog.uk` (which still matches `Host * !git.nimmog.uk`, modules/services/hermes-fleet-ssh.nix:36, so port 22 + fleet identity assertions hold) and the Git transport with `-F /dev/null -p 2222`. Bare `git`/`sleep` in the new script remain resolvable because `systemd.services.hermes-agent.path` already includes pkgs.git, pkgs.openssh, pkgs.coreutils (modules/services/hermes.nix:339-342). Two issues survive validation: the new origin-ambiguity guards sit outside the cutover branch and therefore turn the previously non-fatal established-origin path into a hard preStart failure, and the new flake check hard-codes the GitLab host/port instead of deriving them from the configuration it claims to validate. The missing-diagnostic and other stylistic points from the initial review were dropped as non-defect observations. ### Blocking findings None. ### Important findings - **Origin-ambiguity guards run before the origin-match test, so an already-established origin with a pushurl or multiple URLs now fails preStart instead of taking the documented non-fatal path** (scripts/hermes-profile-sync.sh:27; medium confidence) Lines 22-26 (multiple `remote.origin.url`) and 27-31 (`remote.origin.pushurl` non-empty) exit 1 unconditionally, before the `if [ "$current_url" != "$expected_url" ]` branch at line 33; the non-fatal branch is only reachable at lines 68-71. The diff shows the replaced preStart ended with `git -C "$repo_dir" pull --ff-only || true`, i.e. an established origin could never fail startup. README.md states these conditions 'stop the cutover for operator reconciliation' and that 'after a successful cutover, a failed ordinary pull retains the prior offline-start behavior', which the code does not implement for an established origin. `test_explicit_push_url_rejected` only covers the case where the origin still differs from the configured URL, so the established-origin case is untested. Impact: A profile checkout that already matches `nixosConfig.hermes.gitRepo` but carries a push URL or a second origin URL would exit 1 on every gateway start: the Hermes service never starts, the service-failure monitor alerts on each attempt, and no automatic recovery path exists, whereas the same checkout previously started with a best-effort pull. Suggested fix: Move the multi-URL and pushurl rejections inside the `current_url != expected_url` cutover branch (or accept a pushurl equal to `expected_url`), so an established origin keeps the documented non-fatal offline-start behaviour at lines 68-71; add a regression for the established-origin-with-pushurl case if the current behaviour is intended. ### Suggestions - **The new GitLab pin check hard-codes the host and port instead of deriving them from the configuration it validates** (flake.nix:347; medium confidence) The added block derives the transport from configuration (`gitSshForTest`, flake.nix:262-266) but hard-codes the destination in the invocation (`-p 2222 git@de.nimmog.uk`, line 335) and in the pin lookup (`ssh-keygen -F '[de.nimmog.uk]:2222' -f ...gitKnownHostsFile`, line 347). `check-hermes-fleet-ssh.nix` asserts only that the literal `/etc/hermes/git-known-hosts` path appears in `gitSsh` and that `etc."hermes/git-known-hosts".source == nixosConfig.hermes.gitKnownHostsFile`; nothing ties `vega.nixosConfig.hermes.gitRepo` (modules/services/hermes.nix:82) to a host pattern in the evaluated pin file, even though `gitKnownHostsFile`'s description (modules/services/hermes.nix:95) invites overriding both together. Impact: A specialisation that overrides `gitRepo` to another endpoint without updating the pin file would still pass `nix flake check`, then fail only at runtime when `StrictHostKeyChecking=yes` rejects the unknown host - a deployment-time failure rather than an evaluation-time one. Suggested fix: Derive the `-p`/host arguments and the `ssh-keygen -F` pattern from `vega.nixosConfig.hermes.gitRepo` (or assert the parsed `[host]:port` from `gitRepo` is present in the evaluated `gitKnownHostsFile`) so the check follows the configuration rather than a literal copy of it. ### Tests and validation - No configured deterministic checks. ### Questions - flake.nix:347 uses `ssh-keygen -F '[de.nimmog.uk]:2222' -f <pin file>`; please confirm that is the intended known-hosts lookup form, since the documented host-lookup flags are `-G pattern`/`-Q pattern` with `-f file`. If `-F` is not a pattern flag, the new check would error rather than verify the pin. - Is the live `/srv/services/hermes/profile` checkout known to have no `remote.origin.pushurl` and a single `remote.origin.url`? That state decides whether the guards at scripts/hermes-profile-sync.sh:22-31 turn the existing offline-start path into a hard preStart failure after the cutover. - The cutover fetches `refs/heads/$branch` for the checkout's current branch (scripts/hermes-profile-sync.sh:52) rather than the destination's default branch; is GitLab's default branch for `nimmo/hermes` confirmed to share the existing checkout's branch name, otherwise the cutover fails permanently with 'destination fetch failed'? ### Review limitations - I did not run `nix flake check`, the new `hermes-profile-sync` derivation, or the fleet-SSH derivation; the repository was inspected read-only, so all claimed passing validation comes from the supplied text, not from execution. - No access to the live Vega host, the existing `/srv/services/hermes/profile` checkout, or the GitLab repository, so the checkout's remote/pushurl state, its default branch, and the deploy-key write access described in secrets/README.md cannot be confirmed. - The `nimmo/hermes` profile repository (including its `ssh/config`) is outside this checkout, so profile-side interactions with the new endpoint are not inspectable. - OpenSSH behaviours relied on by the new check (`-G` normalising `StrictHostKeyChecking=yes` to `true`, the `ssh-keygen -F`/`-f` lookup form) and Git's worktree state after a failed `--ff-only` merge were not exercised here. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `docs/hermes-fleet-ssh.md`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `keys/hermes-git-known-hosts`: **reviewed** — included in a context-limited batch - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `scripts/check-hermes-fleet-ssh.nix`: **reviewed** — included in a context-limited batch - `scripts/hermes-profile-sync.sh`: **reviewed** — included in a context-limited batch - `scripts/test-hermes-profile-sync.py`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 4 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Review follow-up for report #115 on 238e956; prepared commit 4fc40c1, before pushing.

  • Important finding: fixed. Origin-ambiguity guards now apply only when changing origin. An already-matching origin retains the previous best-effort pull/start behavior, including existing pushurl/multiple-URL configurations. Two new real-Git regressions cover these established-origin offline cases and confirm configuration is preserved; cutover rejection cases remain covered.
  • Endpoint/pin suggestion: fixed. The SSH config test now parses the evaluated repository URL, derives its host, port, optional user and known-hosts lookup form, exercises the declared transport with those values, and checks the corresponding configured pin file. It handles the default SSH port without a port-qualified lookup and fails clearly for non-SSH endpoints.
  • ssh-keygen question: ssh-keygen -F <hostname-pattern> -f <known-hosts-file> is the host lookup operation. The actual pinned endpoint lookup succeeds; -G/-Q are not its replacements. The fresh flake check executes the lookup rather than assuming the flag spelling.
  • Live origin and branch questions: read-only operator checks confirmed the checkout is suitable for the guarded transition and still uses the prior origin. The prior imported-main history/default-branch comparison remains applicable. Detailed live evidence stays private.

Validation: all 18 actual-Git regression cases, full nix flake check, formatting and whitespace checks pass, including the configured endpoint pin lookup. The exact clean Vega build is running without activation. The private recovery checkpoint, writer fencing, pre-deployment tag and live Hermes-context authentication remain rollout prerequisites.

Review follow-up for report #115 on 238e956; prepared commit 4fc40c1, before pushing. - Important finding: fixed. Origin-ambiguity guards now apply only when changing origin. An already-matching origin retains the previous best-effort pull/start behavior, including existing pushurl/multiple-URL configurations. Two new real-Git regressions cover these established-origin offline cases and confirm configuration is preserved; cutover rejection cases remain covered. - Endpoint/pin suggestion: fixed. The SSH config test now parses the evaluated repository URL, derives its host, port, optional user and known-hosts lookup form, exercises the declared transport with those values, and checks the corresponding configured pin file. It handles the default SSH port without a port-qualified lookup and fails clearly for non-SSH endpoints. - ssh-keygen question: `ssh-keygen -F <hostname-pattern> -f <known-hosts-file>` is the host lookup operation. The actual pinned endpoint lookup succeeds; `-G`/`-Q` are not its replacements. The fresh flake check executes the lookup rather than assuming the flag spelling. - Live origin and branch questions: read-only operator checks confirmed the checkout is suitable for the guarded transition and still uses the prior origin. The prior imported-main history/default-branch comparison remains applicable. Detailed live evidence stays private. Validation: all 18 actual-Git regression cases, full `nix flake check`, formatting and whitespace checks pass, including the configured endpoint pin lookup. The exact clean Vega build is running without activation. The private recovery checkpoint, writer fencing, pre-deployment tag and live Hermes-context authentication remain rollout prerequisites.
Preserve established Hermes origins and check configured SSH endpoint
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 21m27s
4fc40c170c
Author
Owner

Review response-window outcome for current head 4fc40c170ceff1f234faee0891e8bc49d11fcd2f: checked at five-minute intervals after the follow-up push; no current-head report arrived within 30 minutes (final check 2026-10-16 21:12 UTC). The AI review run is still running; polling is now stopped and the MR remains open. Earlier reports are stale and are not evidence of current-head readiness.

All valid findings/suggestions from reports #113 and #115 were addressed or dismissed with execution evidence before the respective follow-up pushes. Current-head CI run 1306 passed; all 18 actual-Git cases, full flake checks and exact clean Vega system build passed without activation. No live origin change or service activation was performed. The private checkpoint and actual Hermes-context acceptance remain rollout prerequisites.

Review response-window outcome for current head `4fc40c170ceff1f234faee0891e8bc49d11fcd2f`: checked at five-minute intervals after the follow-up push; no current-head report arrived within 30 minutes (final check 2026-10-16 21:12 UTC). The AI review run is still running; polling is now stopped and the MR remains open. Earlier reports are stale and are not evidence of current-head readiness. All valid findings/suggestions from reports #113 and #115 were addressed or dismissed with execution evidence before the respective follow-up pushes. Current-head CI run 1306 passed; all 18 actual-Git cases, full flake checks and exact clean Vega system build passed without activation. No live origin change or service activation was performed. The private checkpoint and actual Hermes-context acceptance remain rollout prerequisites.
clankbot requested changes 2026-10-16 22:12:43 +01:00
Dismissed
clankbot left a comment

Automated code review

Reviewed commit: 4fc40c170ceff1f234faee0891e8bc49d11fcd2f

Verdict: Requires further work

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

Overall assessment

The supplied change repoints the Hermes profile remote to ssh://git@de.nimmog.uk:2222/nimmo/hermes.git, replaces the inline preStart clone/pull with scripts/hermes-profile-sync.sh, adds a root-owned host-pin file (keys/hermes-git-known-hosts) installed at /etc/hermes/git-known-hosts, and tightens GIT_SSH_COMMAND to StrictHostKeyChecking=yes with explicit GlobalKnownHostsFile/UserKnownHostsFile. The guard ordering in the helper does keep origin unchanged on the rejected paths, and the established-origin path preserves the previous non-fatal pull. One concrete contradiction is demonstrated between the new helper and the new regression test for an origin carrying multiple URLs; the remaining item is an assertion-strength suggestion in the new flake check.

Blocking findings

  • Multi-URL origin: the helper's routing and the new test's expectations contradict each other (scripts/test-hermes-profile-sync.py:46; medium confidence)
    assert_unchanged() at scripts/test-hermes-profile-sync.py:46 asserts git -C <checkout> remote get-url origin equals a single URL string, and it is called by test_multiple_origin_urls_rejected and test_established_origin_with_multiple_urls_can_start_offline, both of which first run git -C <checkout> config --add remote.origin.url <new>. In that state git remote get-url origin prints every configured URL, so the comparison yields two lines. The same multi-line value drives scripts/hermes-profile-sync.sh:22 (if [ "$current_url" != "$expected_url" ]; then): for an origin whose first URL already equals the configured endpoint, the helper still enters the cutover branch and exits 1 at the multiple origin URLs require operator reconciliation guard, while test_established_origin_with_multiple_urls_can_start_offline asserts self.assertEqual(self.sync(self.old).returncode, 0). The test author was aware of multi-line output elsewhere in that same test (config --get-all remote.origin.url compared to str(self.old) + "\n" + str(self.new)), which shows the single-string comparison is an oversight.
    Impact: Both multi-URL tests fail, so the new checks.x86_64-linux.hermes-profile-sync derivation fails and nix flake check (the repository's gate for this change) does not pass as submitted. Independently of the test, the helper rejects an already-established origin that carries extra URLs, so such a checkout cannot take the documented offline-start path and preStart fails instead.
    Suggested fix: Pick one behaviour and make both sides agree: either read the URL set with git config --get-all remote.origin.url in the helper and treat a set that contains the expected URL as the established-origin path (moving the multi-URL rejection into the cutover-only case), or make assert_unchanged compare the full URL list (e.g. config --get-all remote.origin.url) instead of remote get-url origin. Re-run the flake check after the change.

Important findings

None.

Suggestions

  • New Git transport assertions in the fleet-SSH check are unanchored substring matches (flake.nix:358; medium confidence)
    flake.nix:358 uses grep -Fxq "port $git_port" gitlab-options and flake.nix:359 uses grep -Fxq "user $git_user" gitlab-options, while the adjacent assertions in the same derivation are anchored: grep -q '^port 22$' de-fleet-options (flake.nix:332 region) and grep -q '^stricthostkeychecking true$' gitlab-options (flake.nix:362), grep -q '^globalknownhostsfile /etc/hermes/git-known-hosts$' (flake.nix:363).
    Impact: The check proves the declared port/user appear somewhere in the ssh -G dump but does not pin the resolved values, so a future gitRepo edit producing a superstring (e.g. port 22222, user gitlab) would keep passing while the real Git connection would use a different port or account.
    Suggested fix: Anchor these two assertions to the surrounding style, e.g. grep -q "^port $git_port$" gitlab-options and grep -q "^user $git_user$" gitlab-options, leaving the existing negative fleet-identity check unchanged.

Tests and validation

  • No configured deterministic checks.

Questions

  • For an origin whose URL set contains the configured endpoint plus additional URLs, is the intended behaviour the documented offline-start path (as test_established_origin_with_multiple_urls_can_start_offline asserts) or the operator-reconciliation rejection currently produced by the guard order at scripts/hermes-profile-sync.sh:22?
  • Does ssh-keygen -F "$git_pin_pattern" -f <known-hosts> (flake.nix:369) exit non-zero when the pattern is absent, and is -F the option intended for a host-pattern lookup against a known-hosts file? The command's stdout is redirected to pinned-gitlab-key and never asserted, so the check currently relies solely on the exit status to prove the [de.nimmog.uk]:2222 pin exists.
  • Does the imported GitLab nimmo/hermes repository use the same branch name as the branch the existing Vega checkout tracks? The cutover fetches refs/heads/$branch from the destination, so a renamed default branch would make the first cutover fail rather than reconcile.

Review limitations

  • I did not run nix flake check, the regression tests, or any git/ssh command; the multi-URL finding rests on the documented behaviour of git remote get-url printing all configured URLs, not on observed output.
  • I could not verify OpenSSH's option semantics for ssh-keygen -F or ssh -G value normalisation against the installed OpenSSH version; the pass/fail of the new flake-check lines is not observable from the supplied material.
  • The live Hermes profile checkout, the GitLab nimmo/hermes repository (default branch, history compatibility, deploy-key write/protected-branch permissions) and the currency of the pinned [de.nimmog.uk]:2222 host key are outside this repository and were not inspected.
  • Only the listed changed files plus the checked-out sources of modules/services/hermes.nix, scripts/check-hermes-fleet-ssh.nix and flake.nix were examined; no CI or attic-cache output was supplied, so I cannot confirm the check gate ran.

Diff coverage

  • README.md: reviewed — included in a context-limited batch
  • docs/hermes-fleet-ssh.md: reviewed — included in a context-limited batch
  • flake.nix: reviewed — included in a context-limited batch
  • keys/hermes-git-known-hosts: reviewed — included in a context-limited batch
  • modules/services/hermes.nix: reviewed — included in a context-limited batch
  • scripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batch
  • scripts/hermes-profile-sync.sh: reviewed — included in a context-limited batch
  • scripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batch
  • secrets/README.md: 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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 5
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `4fc40c170ceff1f234faee0891e8bc49d11fcd2f` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The supplied change repoints the Hermes profile remote to ssh://git@de.nimmog.uk:2222/nimmo/hermes.git, replaces the inline preStart clone/pull with scripts/hermes-profile-sync.sh, adds a root-owned host-pin file (keys/hermes-git-known-hosts) installed at /etc/hermes/git-known-hosts, and tightens GIT_SSH_COMMAND to StrictHostKeyChecking=yes with explicit GlobalKnownHostsFile/UserKnownHostsFile. The guard ordering in the helper does keep origin unchanged on the rejected paths, and the established-origin path preserves the previous non-fatal pull. One concrete contradiction is demonstrated between the new helper and the new regression test for an origin carrying multiple URLs; the remaining item is an assertion-strength suggestion in the new flake check. ### Blocking findings - **Multi-URL origin: the helper's routing and the new test's expectations contradict each other** (scripts/test-hermes-profile-sync.py:46; medium confidence) assert_unchanged() at scripts/test-hermes-profile-sync.py:46 asserts `git -C <checkout> remote get-url origin` equals a single URL string, and it is called by test_multiple_origin_urls_rejected and test_established_origin_with_multiple_urls_can_start_offline, both of which first run `git -C <checkout> config --add remote.origin.url <new>`. In that state `git remote get-url origin` prints every configured URL, so the comparison yields two lines. The same multi-line value drives scripts/hermes-profile-sync.sh:22 (`if [ "$current_url" != "$expected_url" ]; then`): for an origin whose first URL already equals the configured endpoint, the helper still enters the cutover branch and exits 1 at the `multiple origin URLs require operator reconciliation` guard, while test_established_origin_with_multiple_urls_can_start_offline asserts `self.assertEqual(self.sync(self.old).returncode, 0)`. The test author was aware of multi-line output elsewhere in that same test (`config --get-all remote.origin.url` compared to `str(self.old) + "\n" + str(self.new)`), which shows the single-string comparison is an oversight. Impact: Both multi-URL tests fail, so the new checks.x86_64-linux.hermes-profile-sync derivation fails and `nix flake check` (the repository's gate for this change) does not pass as submitted. Independently of the test, the helper rejects an already-established origin that carries extra URLs, so such a checkout cannot take the documented offline-start path and preStart fails instead. Suggested fix: Pick one behaviour and make both sides agree: either read the URL set with `git config --get-all remote.origin.url` in the helper and treat a set that contains the expected URL as the established-origin path (moving the multi-URL rejection into the cutover-only case), or make assert_unchanged compare the full URL list (e.g. `config --get-all remote.origin.url`) instead of `remote get-url origin`. Re-run the flake check after the change. ### Important findings None. ### Suggestions - **New Git transport assertions in the fleet-SSH check are unanchored substring matches** (flake.nix:358; medium confidence) flake.nix:358 uses `grep -Fxq "port $git_port" gitlab-options` and flake.nix:359 uses `grep -Fxq "user $git_user" gitlab-options`, while the adjacent assertions in the same derivation are anchored: `grep -q '^port 22$' de-fleet-options` (flake.nix:332 region) and `grep -q '^stricthostkeychecking true$' gitlab-options` (flake.nix:362), `grep -q '^globalknownhostsfile /etc/hermes/git-known-hosts$'` (flake.nix:363). Impact: The check proves the declared port/user appear somewhere in the `ssh -G` dump but does not pin the resolved values, so a future gitRepo edit producing a superstring (e.g. port 22222, user gitlab) would keep passing while the real Git connection would use a different port or account. Suggested fix: Anchor these two assertions to the surrounding style, e.g. `grep -q "^port $git_port$" gitlab-options` and `grep -q "^user $git_user$" gitlab-options`, leaving the existing negative fleet-identity check unchanged. ### Tests and validation - No configured deterministic checks. ### Questions - For an origin whose URL set contains the configured endpoint plus additional URLs, is the intended behaviour the documented offline-start path (as test_established_origin_with_multiple_urls_can_start_offline asserts) or the operator-reconciliation rejection currently produced by the guard order at scripts/hermes-profile-sync.sh:22? - Does `ssh-keygen -F "$git_pin_pattern" -f <known-hosts>` (flake.nix:369) exit non-zero when the pattern is absent, and is `-F` the option intended for a host-pattern lookup against a known-hosts file? The command's stdout is redirected to `pinned-gitlab-key` and never asserted, so the check currently relies solely on the exit status to prove the `[de.nimmog.uk]:2222` pin exists. - Does the imported GitLab `nimmo/hermes` repository use the same branch name as the branch the existing Vega checkout tracks? The cutover fetches `refs/heads/$branch` from the destination, so a renamed default branch would make the first cutover fail rather than reconcile. ### Review limitations - I did not run `nix flake check`, the regression tests, or any git/ssh command; the multi-URL finding rests on the documented behaviour of `git remote get-url` printing all configured URLs, not on observed output. - I could not verify OpenSSH's option semantics for `ssh-keygen -F` or `ssh -G` value normalisation against the installed OpenSSH version; the pass/fail of the new flake-check lines is not observable from the supplied material. - The live Hermes profile checkout, the GitLab `nimmo/hermes` repository (default branch, history compatibility, deploy-key write/protected-branch permissions) and the currency of the pinned `[de.nimmog.uk]:2222` host key are outside this repository and were not inspected. - Only the listed changed files plus the checked-out sources of modules/services/hermes.nix, scripts/check-hermes-fleet-ssh.nix and flake.nix were examined; no CI or attic-cache output was supplied, so I cannot confirm the check gate ran. ### Diff coverage - `README.md`: **reviewed** — included in a context-limited batch - `docs/hermes-fleet-ssh.md`: **reviewed** — included in a context-limited batch - `flake.nix`: **reviewed** — included in a context-limited batch - `keys/hermes-git-known-hosts`: **reviewed** — included in a context-limited batch - `modules/services/hermes.nix`: **reviewed** — included in a context-limited batch - `scripts/check-hermes-fleet-ssh.nix`: **reviewed** — included in a context-limited batch - `scripts/hermes-profile-sync.sh`: **reviewed** — included in a context-limited batch - `scripts/test-hermes-profile-sync.py`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **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/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 5 - Previous automated review: none found - Findings: 2 </details>
Author
Owner

Completed current-head review #117 assessed against 4fc40c170ceff1f234faee0891e8bc49d11fcd2f. Both reported findings are disproved by execution; no source change or new push is warranted.

  1. Blocking multi-URL finding: git remote get-url origin returns the first URL. Only git remote get-url --all origin returns all URLs. A disposable repository with /first and /second configured produced /first for the former and /first\n/second for the latter. The helper therefore correctly uses the first fetch URL to select the established-origin path. It rejects multiple URLs only when transitioning, while preserving existing matching-origin configurations. The full 18-case real-Git suite passes again, including both multi-URL tests. Treating any URL in the set as established, as suggested, would incorrectly ignore which URL Git actually fetches from.

  2. Substring assertion suggestion: grep -Fxq uses fixed strings (-F) and whole-line matching (-x). Direct probes confirm port 2222 matches, port 22222 does not; user git matches, user gitlab does not. The existing assertions already enforce the requested exact values and safely treat usernames literally. Replacing them with regex interpolation offers no correction.

Questions also assessed: ssh-keygen -F <pattern> -f <known-hosts-file> is the intended lookup. A configured-pin lookup returned 0 with nonempty output; an absent fixture returned 1 with empty output, so the flake check fails if the pin is absent. Preparation checks confirmed imported main and the live tracked main/origin-main branch agree; no branch rename is part of this change.

Current-head CI and the completed review workflow both report success. The earlier full flake checks and exact clean Vega build passed, and the 18-case suite was rerun successfully during this assessment. There is no actionable current-head review feedback remaining; the request-changes review is being dismissed with this evidence. This establishes code review readiness, not live cutover: the private checkpoint, writer fencing, pre-deployment tag and actual Hermes-context authentication remain deployment prerequisites.

Completed current-head review #117 assessed against `4fc40c170ceff1f234faee0891e8bc49d11fcd2f`. Both reported findings are disproved by execution; no source change or new push is warranted. 1. Blocking multi-URL finding: `git remote get-url origin` returns the first URL. Only `git remote get-url --all origin` returns all URLs. A disposable repository with `/first` and `/second` configured produced `/first` for the former and `/first\n/second` for the latter. The helper therefore correctly uses the first fetch URL to select the established-origin path. It rejects multiple URLs only when transitioning, while preserving existing matching-origin configurations. The full 18-case real-Git suite passes again, including both multi-URL tests. Treating any URL in the set as established, as suggested, would incorrectly ignore which URL Git actually fetches from. 2. Substring assertion suggestion: `grep -Fxq` uses fixed strings (`-F`) and whole-line matching (`-x`). Direct probes confirm `port 2222` matches, `port 22222` does not; `user git` matches, `user gitlab` does not. The existing assertions already enforce the requested exact values and safely treat usernames literally. Replacing them with regex interpolation offers no correction. Questions also assessed: `ssh-keygen -F <pattern> -f <known-hosts-file>` is the intended lookup. A configured-pin lookup returned 0 with nonempty output; an absent fixture returned 1 with empty output, so the flake check fails if the pin is absent. Preparation checks confirmed imported main and the live tracked main/origin-main branch agree; no branch rename is part of this change. Current-head CI and the completed review workflow both report success. The earlier full flake checks and exact clean Vega build passed, and the 18-case suite was rerun successfully during this assessment. There is no actionable current-head review feedback remaining; the request-changes review is being dismissed with this evidence. This establishes code review readiness, not live cutover: the private checkpoint, writer fencing, pre-deployment tag and actual Hermes-context authentication remain deployment prerequisites.
nimmo dismissed clankbot's review 2026-10-16 22:18:41 +01:00
Reason:

Both findings are disproved by executed probes and the passing 18-case suite. git remote get-url origin returns only the first URL without --all; grep -Fxq is already an exact whole-line literal match. Full evidence and all review questions assessed in the MR discussion. No actionable feedback remains; no code change warranted.

nimmo merged commit 51cf664a61 into main 2026-10-16 22:19:19 +01:00
nimmo deleted branch feat/hermes-gitlab-profile 2026-10-16 22:19:20 +01:00
Sign in to join this conversation.
No reviewers
No milestone
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!351
No description provided.