Watch
0
0
Fork
You've already forked hyperhive
0

agent-modules: hand an api-key agent's subagent daemon the backend file

A claude agent with useApiKey gets ANTHROPIC_API_KEY through
backendEnvironmentFile, but only the harness unit loaded that file;
hive-subagent-daemon loaded it for ACP agents alone. The daemon's nested
claude inherits the daemon's environment (hive-claude adds to it, never
clears it), and an api-key agent has no OAuth session in ~/.claude, so
its claude subagents started with no credentials.

hive-subagent-daemon now loads backendEnvironmentFile when the agent is
ACP (unchanged) or has useApiKey set. Module-eval covers the api-key
claude arm; the existing claude arm (file set, useApiKey unset) still
asserts no EnvironmentFile.

Closes #5088
This commit is contained in:
atlas 2026-10-10 00:36:47 +02:00 • committed by mara
commit a5448c81c4
4 changed files with 25 additions and 7 deletions

View file

@ -269,7 +269,9 @@ is a no-op without the other:
reads from the environment — typically `ANTHROPIC_API_KEY` and
`ANTHROPIC_BASE_URL`. Loaded as an _optional_ `EnvironmentFile`
(leading `-`), so setting the option before the file exists doesn't
strand the harness at boot.
strand the harness at boot. With `useApiKey` set, the subagent daemon
(`hive-subagent-daemon`) loads the same file, so the agent's claude
subagents run on the same key.
Provision the file once, out of band (never through nix — an API key in
the store is world-readable and travels with the flake closure):