fetch the agent's backend env file from the store, seeded from the existing file
the agent's own root unit reads swarm/agents/<agent>/backend-env into /run and creates it from backendEnvironmentFile with -cas=0 when the store holds nothing. the shared agent policy gains create (not update) on that one leaf. the harness and the subagent daemon load the old file first and the fetched one after it.
This commit is contained in:
parent
5486fc0333
commit
75e9e205e3
1 changed files with 933 additions and 31 deletions
|
|
@ -201,6 +201,15 @@ in
|
|||
and on an agent with `useApiKey` set, so its subagents authenticate
|
||||
the same way the harness does.
|
||||
|
||||
On an agent with a store (`services.hyperhive.agent.bao.addr`) that uses
|
||||
`useApiKey` or the `acp` runtime, `hive-agent-backend-env.service` also
|
||||
keeps this file's text at `swarm/agents/<agent>/backend-env`, field `env`.
|
||||
A leaf nobody has written is created from this file once, with the same
|
||||
bytes, and this file is never rewritten or deleted. The harness and the
|
||||
subagent daemon load this file first and the store's copy after it, so
|
||||
a variable the store holds wins and this file carries the agent while
|
||||
the store is down. Both read at their own start.
|
||||
|
||||
On an ACP agent using the `opencode` preset, a provider key this file
|
||||
leaves unset is read from the swarm secret store at
|
||||
`swarm/agents/<agent>/acp-provider`, field `api_key`, if one is stored.
|
||||
|
|
@ -552,10 +561,11 @@ in
|
|||
User = userName;
|
||||
Group = userName;
|
||||
}
|
||||
// lib.optionalAttrs (config.services.hyperhive.agent.backendEnvironmentFile != null) {
|
||||
// lib.optionalAttrs (config.services.hyperhive.agent.backendEnvironment.environmentFiles != [ ]) {
|
||||
# See `services.hyperhive.agent.backendEnvironmentFile`'s own description for
|
||||
# the file shape and the leading-`-` rationale.
|
||||
EnvironmentFile = "-${config.services.hyperhive.agent.backendEnvironmentFile}";
|
||||
# the file shape and the leading-`-` rationale; ./backend-env.nix for
|
||||
# the second entry.
|
||||
EnvironmentFile = config.services.hyperhive.agent.backendEnvironment.environmentFiles;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue