matrix: drop the per-agent matrix.enable; accounts are the enable signal
`services.hyperhive.agent.matrix.enable` was a second source of truth for a fact the account set already carried: after ①-③ the hive-internal `main` account is an ordinary `matrixAccounts` entry, so "does this agent have matrix" and "does this agent have an account" were the same question asked twice, with the boolean able to disagree. The option is gone and a non-empty `matrixAccounts` now gates the daemon unit, its token path-watcher and the injected `extraMcpServers.matrix` entry. That is only a real condition because `matrixAccounts.main` is itself gated: it is declared when `matrix.url != null`, never unconditionally. A `main` with no homeserver is an account the daemon can never log in as, so declaring one always would have made the signal trivially true and turned matrix on for every agent in every hive. With the URL gate, the empty set is reachable exactly for an agent the hive gave no homeserver and whose operator declared no account of its own — the state the old `enable = false` expressed. Assertions: "extras require enable" is deleted, having become the definition of the thing it checked (an external-only account with its own homeserver is now rendered rather than rejected). `main.tokenFile` stays pinned, re-guarded on `? main` instead of on the flag, since `main` is absent whenever the URL is null and an unguarded index would throw there. Both spellings of the option get `mkRemovedOptionModule`, following ../host-modules/deploy.nix's registrationTokenFile pair rather than a silent delete: the definition whose meaning changes is `false`, and left undeclared it would be ignored and hand the agent the tools its operator turned off. Failing the eval with the replacement spelling is the only outcome that cannot. module-eval gains the three arms — URL, nothing, external-only — with the middle one carrying why it exists: it is the only thing in the suite that would notice `main` becoming unconditional again. Refs #4475
This commit is contained in:
parent
e95e988965
commit
99b141f5f2
7 changed files with 254 additions and 92 deletions
|
|
@ -18,6 +18,25 @@
|
|||
flakeInputs ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
# What an `agent.nix` still setting the dropped per-agent matrix switch is
|
||||
# told. Shared by the two `mkRemovedOptionModule` entries below, one per
|
||||
# spelling of the path.
|
||||
matrixEnableRemoved = ''
|
||||
The per-agent matrix switch is gone. Matrix is enabled for an agent exactly
|
||||
when it has at least one services.hyperhive.agent.matrixAccounts entry, and
|
||||
the hive-internal `main` entry is declared for you whenever
|
||||
services.hyperhive.agent.matrix.url is non-null.
|
||||
|
||||
- `enable = true` was the default: drop the line, nothing else to do.
|
||||
- `enable = false`: set services.hyperhive.agent.matrix.url = null instead
|
||||
(and declare no accounts of your own). That is what leaves the account set
|
||||
empty, which is now what suppresses the daemon, its path watcher and the
|
||||
injected extraMcpServers.matrix entry.
|
||||
|
||||
See docs/tools/matrix.md.
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./agent-service.nix
|
||||
|
|
@ -47,6 +66,20 @@
|
|||
The built-in Bash tool is fully disabled; agents use
|
||||
mcp__bash__run instead. Remove the setting from your agent.nix.
|
||||
'')
|
||||
# The dropped per-agent matrix switch. A removal, not a silent delete,
|
||||
# because the definition that *changes meaning* is `false`: left undeclared
|
||||
# it would be ignored and the agent would quietly gain the matrix tools its
|
||||
# operator turned off. Failing the eval with the replacement spelling is the
|
||||
# only outcome that cannot do that.
|
||||
#
|
||||
# Both spellings, for the same reason ../host-modules/deploy.nix lists both
|
||||
# of `swarm|deploy.matrix.registrationTokenFile`: an existing agent.nix may
|
||||
# carry either the pre-rename `hyperhive.*` path or the current one, and only
|
||||
# the one it actually carries will fire. The rename shim that used to bridge
|
||||
# them is gone from ./renamed-options.nix — a rename pointing at an
|
||||
# undeclared option breaks evaluation for everyone, removed or not.
|
||||
(lib.mkRemovedOptionModule [ "hyperhive" "matrix" "enable" ] matrixEnableRemoved)
|
||||
(lib.mkRemovedOptionModule [ "services" "hyperhive" "agent" "matrix" "enable" ] matrixEnableRemoved)
|
||||
];
|
||||
|
||||
options.services.hyperhive.agent.icon = lib.mkOption {
|
||||
|
|
|
|||
Loading…
Reference in a new issue