backendEnvironmentFile: use the harness dir, not state, per review

This commit is contained in:
damocles 2026-08-26 23:40:49 +02:00 committed by mara
commit 1aa35974ee
2 changed files with 18 additions and 10 deletions

View file

@ -244,7 +244,7 @@ programmatically and do not pass `--message-format json` themselves.
```nix
hyperhive.useApiKey = true; # default: false
hyperhive.backendEnvironmentFile =
"/agents/myagent/state/openrouter.env"; # default: null
"/agents/myagent/harness/openrouter.env"; # default: null
hyperhive.model = "anthropic/claude-3.5-sonnet"; # provider-specific model string
```
@ -275,14 +275,17 @@ the store is world-readable and travels with the flake closure):
```sh
# on the host, once per agent that should use an api-key backend
sudo install -m 0600 -o root /dev/stdin \
/var/lib/hyperhive/agents/<name>/state/openrouter.env <<KEYS
/var/lib/hyperhive/agents/<name>/harness/openrouter.env <<KEYS
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
ANTHROPIC_API_KEY=sk-or-...
KEYS
```
The file lives in the agent's bind-mounted state dir, so it survives
container rebuilds (not `--purge`) without needing to be re-provisioned.
The file lives in the agent's bind-mounted **harness** dir, not `state/`
`harness/` survives container rebuilds exactly like `state/` does, but
(unlike `state/`) is never bind-mounted into a parent agent's container
(see `docs/persistence.md`'s "Parent access to child state"), so an API
key placed here is reachable by nothing but this agent and the host.
⚠️ Verified end-to-end against OpenRouter has not happened as of this
writing — `ANTHROPIC_BASE_URL` support in the shipped Claude CLI is