# `checks.module-eval-agent-runtime` — see ./lib.nix for the shared # rationale (why this suite exists, naming convention, "evaluates # not executes"). { pkgs, lib, self, nixosSystem, }: let inherit (import ./lib.nix { inherit pkgs lib self nixosSystem ; }) agentWith runGroup ; backendEnv = "/agents/a1/harness/backend.env"; # Both arms carry a backend file, so the claude arm's lack of one on the # subagent unit is the gate and not a missing input. agentOn = runtime: agentWith { services.hyperhive.agent = { inherit runtime; backendEnvironmentFile = backendEnv; acp.command = "/bin/agent"; acp.args = [ "acp" ]; }; }; claude = agentOn "claude"; acp = agentOn "acp"; subagent = machine: machine.systemd.services.hive-subagent-daemon; harness = machine: machine.systemd.services.hive-agent; runtimeVars = [ "HIVE_RUNTIME" "HIVE_ACP_COMMAND" "HIVE_ACP_ARGS" "HIVE_ACP_ENV" ]; cases = [ { # The daemon reads these with `hive_runtime::RuntimeSpec`, the same # parser as the harness, so equal values mean the same runtime. name = "an ACP agent's subagent daemon gets the harness's runtime selection"; ok = lib.all ( var: (subagent acp).environment.${var} or null == (harness acp).environment.${var} ) runtimeVars; } { name = "an ACP agent's subagent daemon loads the backend credentials"; ok = (subagent acp).serviceConfig.EnvironmentFile or null == "-${backendEnv}"; } { # Unset is what `RuntimeSpec` reads as claude, and a claude subagent # is not handed the backend file. name = "a claude agent's subagent daemon has no runtime selection and no backend file"; ok = lib.all (var: (subagent claude).environment.${var} or null == null) runtimeVars && !((subagent claude).serviceConfig ? EnvironmentFile); } ]; in runGroup "agent-runtime" cases