Move Hermes profile synchronization to GitLab #351
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nix-idioms-hygiene
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!351
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/hermes-gitlab-profile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
nix flake check, shell/repository formatting and whitespace checks passed.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.
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-ignoreduring origin reconciliation and adds a real-Git regression verifying rejection, unchanged origin/HEAD and preservation of the local file.Validation for the prepared
13cbca8head: all 14 regression cases passed; fullnix 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.
Automated code review
Reviewed commit:
13cbca873a5d07d92ce32ea255d9b6f309ef9230Verdict: 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.gitReponow defaults tossh://git@de.nimmog.uk:2222/nimmo/hermes.git(modules/services/hermes.nix:81), the new flake check pins exactly that value for vega, andscripts/hermes-profile-sync.shreplaces the inline clone/pull block with a guarded origin reconciliation invoked fromsystemd.services.hermes-agent.preStart(hermes.nix:276) via${pkgs.bash}/bin/bash ${../../scripts/hermes-profile-sync.sh}, which resolves to the shipped file; the baregit/sleepcalls inside it are satisfied by the existingsystemd.services.hermes-agent.path = [ pkgs.git pkgs.openssh pkgs.coreutils ](hermes.nix:330-333). The 14 regression cases inscripts/test-hermes-profile-sync.pyexercise the state machine against real local repositories. Remaining findings are behavioural and documentary: the rejected transitional states now abort preStart (a change from the previouspull --ff-only || true), two rejection paths exit with no diagnostic, the new Git host is contacted only underStrictHostKeyChecking=accept-newdespite a pinned key already existing inkeys/hermes-fleet-known-hosts, and two documents still name the old Git host.Blocking findings
None.
Important findings
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, failedfetch/merge --ff-onlyat 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), andtest_dirty_work_is_preserved_and_cutover_rejectedshows an untracked file makesstatus --porcelain --untracked-files=allreject 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-agentdown 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 pipefailis in effect (line 2).branch="$(git -C "$repo_dir" symbolic-ref --quiet --short HEAD)"(line 31) exits non-zero for a detached head, and--quietsuppresses the message;current_url="$(git -C "$repo_dir" remote get-url origin)"(line 18) exits non-zero when the checkout has nooriginremote. Every other rejection in the script prints anhermes-agent:-prefixed explanation, and the author already used the guard idiom at line 24 (... || true).test_detached_head_rejectedasserts onlyassertNotEqual(returncode, 0)and never inspects the captured stderr.Impact: A checkout with a
.gitdirectory but nooriginremote, 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.ukis contacted with the unchangedgit_sshvalue (hermes.nix:275):-F /dev/null -i <deploy key> ... -o StrictHostKeyChecking=accept-new.keys/hermes-fleet-known-hostsalready carries an operator-trusted ed25519 entry forde.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'sGlobalKnownHostsFile, which-F /dev/nulldiscards for the clone, fetch and pull.Impact: The first origin change and every subsequent pull accept a host key for
de.nimmog.ukauto-added to${stateDir}/.ssh/known_hostsrather 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 inkeys/hermes-fleet-known-hosts- or record in the migration checklist thataccept-newis 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.ukis excluded from the fleet identity rule', and the generated configuration in modules/services/hermes-fleet-ssh.nix:36 isHost * !git.nimmog.uk. This change moves Hermes's Git host tode.nimmog.uk(hermes.nix:81), which that negated pattern does not exclude.Impact: The stated invariant is stale: the fleet identity and
IdentitiesOnly yesrule now matches the host Hermes actually uses for Git. Git itself is unaffected because it runs with-F /dev/nulland an explicit-ikey, 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(thehermes-fleet-sshcheck in flake.nix exercisesgit@git.nimmog.ukand 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/hermeswhile naming the remote asssh://git@de.nimmog.uk:2222/nimmo/hermes.git(line 299).forge.nimmog.ukoccurs nowhere else in the supplied tree; every other web reference in README.md and docs/ usesgit.nimmog.uk, andde.nimmog.ukis the Git host with a pinned key inkeys/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/hermesweb UI (or state the host pair explicitly), so the README's browse URL and the evaluatedgitRepoagree.Tests and validation
Questions
services.serviceFailureMonitor.servicesincludeshermes-agent(hermes.nix:337) and the fleet auto-updates?Host * !git.nimmog.ukin modules/services/hermes-fleet-ssh.nix be retargeted tode.nimmog.uk, or is the exclusion intentionally left as-is because Git always runs with-F /dev/null?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 protectedmain), or should a branch mismatch be a distinct diagnostic?hermes-fleet-sshflake check in flake.nix be updated to exercise the new Git host, since it currently proves the exclusion only forgit@git.nimmog.uk?Review limitations
nix flake check,just check, or the new regression suite; the reported validation results are taken from the pull-request text, not reproduced./srv/services/hermes/profilecheckout, its origin/upstream configuration, the GitLab deploy-key access-control list, and the GitLab project's default branch are outside the supplied tree.GIT_ALLOW_PROTOCOL="file"and never setsGIT_SSH_COMMAND, so the flake check proves the guard logic but not the SSH transport, the configuredgitRepovalue, or authenticated GitLab access.treefmt.nixenablesnixfmtandshfmtonly, so the repository formatting gate covers the new shell helper but not the newscripts/test-hermes-profile-sync.py.nimmo/hermesprofile repository itself (itsssh/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.Diff coverage
README.md: reviewed — included in a context-limited batchdocs/hermes-fleet-ssh.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchmodules/services/hermes.nix: reviewed — included in a context-limited batchscripts/hermes-profile-sync.sh: reviewed — included in a context-limited batchscripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batchsecrets/README.md: reviewed — included in a context-limited batchReview metadata
Assessed all findings and questions from review #111 on
13cbca8before publishing the next head.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; fullnix flake checkpasses, 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.Automated code review
Reviewed commit:
94f7424981c1823fb99a84b7f41cb8148af41488Verdict: 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 checkfails 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
stricthostkeychecking true, but the declared option value isyes(flake.nix:342; high confidence)flake.nix:342 asserts
grep -q '^stricthostkeychecking true$' gitlab-optionsagainst the output of${gitSshForTest} -G -p 2222 git@de.nimmog.uk(flake.nix:338), i.e. the evaluatedservices.hermes-agent.environment.GIT_SSH_COMMANDwith 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=yesat 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) forStrictHostKeyChecking accept-newin modules/services/hermes-fleet-ssh.nix:45, and'^batchmode yes$'forBatchMode yes- so the dump echoesyes, nevertrue.Impact: The
hermes-fleet-sshflake check cannot match the declared strict-host setting, sonix 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-runnix flake checkand 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) underset -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-syncassertsself.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 overridinggitRepois an intended configuration path and would make this assert - hencenix 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.gitRepointo 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 tocfg.gitRepo).Tests and validation
Questions
refs/heads/<current branch>and then requiresmerge --ff-onlyagainst 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 GitLabnimmo/hermesimport a history-preserving mirror whose default branch matches the checkout's branch?refs/remotes/origin/$branchand fetches with--no-tags. Should it also refresh tags andrefs/remotes/origin/HEADso later agent pushes and status views reflect the imported repository's default branch?Review limitations
stricthostkeychecking truefinding is inferred from the declared option value and the same check file's verbatim-Ggreps, not from observed ssh output.hermes-agentservice/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./srv/services/hermes/profilecheckout, the private KiwiFS recovery checkpoint, or the pre-deployment revision tag; the PR's live-comparison and deploy-key statements are unverified.keys/hermes-git-known-hostswas checked only for format and the[de.nimmog.uk]:2222pattern form; it cannot be verified as the GitLab container's actual key.Diff coverage
README.md: reviewed — included in a context-limited batchdocs/hermes-fleet-ssh.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchkeys/hermes-git-known-hosts: reviewed — included in a context-limited batchmodules/services/hermes.nix: reviewed — included in a context-limited batchscripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batchscripts/hermes-profile-sync.sh: reviewed — included in a context-limited batchscripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batchsecrets/README.md: reviewed — included in a context-limited batchReview metadata
Review follow-up for report #113 on
94f7424981; prepared commit238e956.ssh -G -F /dev/null -o StrictHostKeyChecking=yes example.invalidprintsstricthostkeychecking true. OpenSSH normalizes this option; it does not echo the literalyestoken. The exact declared-command flake check already passed, and the full check passes again. Changing the assertion toyesas suggested would break it. Added an explanatory comment.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.Automated code review
Reviewed commit:
238e95689fb213dfeee60478756ca59d019ecba6Verdict: 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 previousStrictHostKeyChecking=accept-newtransport with one sharedgitSshCommand(modules/services/hermes.nix:18, reused at :211 and :283) that pins hosts throughGlobalKnownHostsFile=/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 withscripts/hermes-profile-sync.sh. The newcheck-hermes-fleet-ssh.nixassertions (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 forde.nimmog.uk(which still matchesHost * !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. Baregit/sleepin the new script remain resolvable becausesystemd.services.hermes-agent.pathalready 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
Lines 22-26 (multiple
remote.origin.url) and 27-31 (remote.origin.pushurlnon-empty) exit 1 unconditionally, before theif [ "$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 withgit -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_rejectedonly 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.gitRepobut 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_urlcutover branch (or accept a pushurl equal toexpected_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 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.nixasserts only that the literal/etc/hermes/git-known-hostspath appears ingitSshand thatetc."hermes/git-known-hosts".source == nixosConfig.hermes.gitKnownHostsFile; nothing tiesvega.nixosConfig.hermes.gitRepo(modules/services/hermes.nix:82) to a host pattern in the evaluated pin file, even thoughgitKnownHostsFile's description (modules/services/hermes.nix:95) invites overriding both together.Impact: A specialisation that overrides
gitRepoto another endpoint without updating the pin file would still passnix flake check, then fail only at runtime whenStrictHostKeyChecking=yesrejects the unknown host - a deployment-time failure rather than an evaluation-time one.Suggested fix: Derive the
-p/host arguments and thessh-keygen -Fpattern fromvega.nixosConfig.hermes.gitRepo(or assert the parsed[host]:portfromgitRepois present in the evaluatedgitKnownHostsFile) so the check follows the configuration rather than a literal copy of it.Tests and validation
Questions
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 patternwith-f file. If-Fis not a pattern flag, the new check would error rather than verify the pin./srv/services/hermes/profilecheckout known to have noremote.origin.pushurland a singleremote.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.refs/heads/$branchfor the checkout's current branch (scripts/hermes-profile-sync.sh:52) rather than the destination's default branch; is GitLab's default branch fornimmo/hermesconfirmed to share the existing checkout's branch name, otherwise the cutover fails permanently with 'destination fetch failed'?Review limitations
nix flake check, the newhermes-profile-syncderivation, or the fleet-SSH derivation; the repository was inspected read-only, so all claimed passing validation comes from the supplied text, not from execution./srv/services/hermes/profilecheckout, 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.nimmo/hermesprofile repository (including itsssh/config) is outside this checkout, so profile-side interactions with the new endpoint are not inspectable.-GnormalisingStrictHostKeyChecking=yestotrue, thessh-keygen -F/-flookup form) and Git's worktree state after a failed--ff-onlymerge were not exercised here.Diff coverage
README.md: reviewed — included in a context-limited batchdocs/hermes-fleet-ssh.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchkeys/hermes-git-known-hosts: reviewed — included in a context-limited batchmodules/services/hermes.nix: reviewed — included in a context-limited batchscripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batchscripts/hermes-profile-sync.sh: reviewed — included in a context-limited batchscripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batchsecrets/README.md: reviewed — included in a context-limited batchReview metadata
Review follow-up for report #115 on
238e956; prepared commit4fc40c1, before pushing.ssh-keygen -F <hostname-pattern> -f <known-hosts-file>is the host lookup operation. The actual pinned endpoint lookup succeeds;-G/-Qare not its replacements. The fresh flake check executes the lookup rather than assuming the flag spelling.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 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.
Automated code review
Reviewed commit:
4fc40c170ceff1f234faee0891e8bc49d11fcd2fVerdict: 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
assert_unchanged() at scripts/test-hermes-profile-sync.py:46 asserts
git -C <checkout> remote get-url originequals 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 rungit -C <checkout> config --add remote.origin.url <new>. In that stategit remote get-url originprints 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 themultiple origin URLs require operator reconciliationguard, while test_established_origin_with_multiple_urls_can_start_offline assertsself.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.urlcompared tostr(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.urlin 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 ofremote get-url origin. Re-run the flake check after the change.Important findings
None.
Suggestions
flake.nix:358 uses
grep -Fxq "port $git_port" gitlab-optionsand flake.nix:359 usesgrep -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) andgrep -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 -Gdump 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-optionsandgrep -q "^user $git_user$" gitlab-options, leaving the existing negative fleet-identity check unchanged.Tests and validation
Questions
ssh-keygen -F "$git_pin_pattern" -f <known-hosts>(flake.nix:369) exit non-zero when the pattern is absent, and is-Fthe option intended for a host-pattern lookup against a known-hosts file? The command's stdout is redirected topinned-gitlab-keyand never asserted, so the check currently relies solely on the exit status to prove the[de.nimmog.uk]:2222pin exists.nimmo/hermesrepository use the same branch name as the branch the existing Vega checkout tracks? The cutover fetchesrefs/heads/$branchfrom the destination, so a renamed default branch would make the first cutover fail rather than reconcile.Review limitations
nix flake check, the regression tests, or any git/ssh command; the multi-URL finding rests on the documented behaviour ofgit remote get-urlprinting all configured URLs, not on observed output.ssh-keygen -Forssh -Gvalue normalisation against the installed OpenSSH version; the pass/fail of the new flake-check lines is not observable from the supplied material.nimmo/hermesrepository (default branch, history compatibility, deploy-key write/protected-branch permissions) and the currency of the pinned[de.nimmog.uk]:2222host key are outside this repository and were not inspected.Diff coverage
README.md: reviewed — included in a context-limited batchdocs/hermes-fleet-ssh.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchkeys/hermes-git-known-hosts: reviewed — included in a context-limited batchmodules/services/hermes.nix: reviewed — included in a context-limited batchscripts/check-hermes-fleet-ssh.nix: reviewed — included in a context-limited batchscripts/hermes-profile-sync.sh: reviewed — included in a context-limited batchscripts/test-hermes-profile-sync.py: reviewed — included in a context-limited batchsecrets/README.md: reviewed — included in a context-limited batchReview metadata
Completed current-head review #117 assessed against
4fc40c170ceff1f234faee0891e8bc49d11fcd2f. Both reported findings are disproved by execution; no source change or new push is warranted.Blocking multi-URL finding:
git remote get-url originreturns the first URL. Onlygit remote get-url --all originreturns all URLs. A disposable repository with/firstand/secondconfigured produced/firstfor the former and/first\n/secondfor 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.Substring assertion suggestion:
grep -Fxquses fixed strings (-F) and whole-line matching (-x). Direct probes confirmport 2222matches,port 22222does not;user gitmatches,user gitlabdoes 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.
Both findings are disproved by executed probes and the passing 18-case suite.
git remote get-url originreturns 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 referenced this pull request2026-10-16 22:24:10 +01:00