refactor: remove hyperhive.role option — there is only one role: agent
This commit is contained in:
parent
d35408a18d
commit
41eb3f806c
23 changed files with 105 additions and 229 deletions
|
|
@ -202,46 +202,19 @@ nspawn agent. Open questions, not yet wired:
|
|||
- Filesystem: share parent's `/state` RW, or a sub-dir?
|
||||
- Identity: distinct broker recipient name, or address the parent?
|
||||
|
||||
## Harness systemd unit shape (per-role)
|
||||
## Harness systemd unit shape
|
||||
|
||||
One harness binary (`hive`), one `harness-base.nix` template, two
|
||||
systemd units depending on `hyperhive.role`:
|
||||
One harness binary (`hive`), one `harness-base.nix` template, one
|
||||
service unit (`systemd.services.hive-ag3nt`) for all agents. There
|
||||
is no longer a separate manager service name or role distinction in
|
||||
the harness — privilege differences live server-side in the broker
|
||||
socket (which tool groups and manager-surface calls each agent
|
||||
receives).
|
||||
|
||||
- `agent-base.nix` (`role = "agent"`) → `systemd.services.hive-ag3nt`
|
||||
- `manager.nix` (`role = "manager"`) → `systemd.services.hive-m1nd`
|
||||
|
||||
The unit names diverge but the binary is the same. `HIVE_ROLE` env
|
||||
var picks the surface at startup (agent vs manager); naming the
|
||||
units after the historical per-role binaries keeps dashboard log
|
||||
queries, ExecStartPre paths, and ancestor PR diffs working without a
|
||||
rename cascade.
|
||||
|
||||
### Manager-only defaults
|
||||
|
||||
`harness-base.nix` flips these when `hyperhive.role == "manager"`,
|
||||
via `lib.mkDefault` so any agent can invert if needed:
|
||||
|
||||
- `hyperhive.forge.keepSubscriptions = false`
|
||||
- `hyperhive.forge.skipNotifyReasons = [ "subscribed" "participating" ]`
|
||||
|
||||
Skips the subscription / participation firehose so the manager's
|
||||
inbox only carries direct mentions, reviews, and assignments. Sub-
|
||||
agents keep the noisier defaults so they see anything aimed at the
|
||||
repos they're working on.
|
||||
|
||||
### Standalone-eval fallbacks
|
||||
|
||||
`nixosConfigurations.manager` must build standalone (without the
|
||||
meta-flake's per-agent flake.nix wrapper). For the manager unit
|
||||
that means a hardcoded `HIVE_LABEL` env value:
|
||||
|
||||
- `HIVE_LABEL = "ruth"` — logical agent name; matches what `meta.rs`
|
||||
injects at deploy time.
|
||||
|
||||
Real deploys never read these — `meta::render_flake` overrides them
|
||||
via the generated wrapper. They exist so the manager
|
||||
`nixosConfigurations` evaluates cleanly even outside the meta-flake
|
||||
boundary.
|
||||
`agent-base.nix` and `manager.nix` both import `harness-base.nix`.
|
||||
`manager.nix` additionally sets forge defaults to suppress the
|
||||
subscription/participation firehose so ruth's inbox stays focused
|
||||
on direct mentions, reviews, and assignments.
|
||||
|
||||
### Environment variables set on the unit
|
||||
|
||||
|
|
@ -256,8 +229,6 @@ boundary.
|
|||
directly on the unit, **not** via `environment.variables`, because
|
||||
the latter only populates `/etc/profile` which systemd services
|
||||
don't inherit.
|
||||
- `HIVE_ROLE = config.hyperhive.role` — picks the binary surface
|
||||
(agent / manager) at startup.
|
||||
|
||||
### `PATH` setup (the wrapper-dir trick)
|
||||
|
||||
|
|
@ -278,8 +249,7 @@ bit set` regardless of `hyperhive.user.passwordlessSudo`.
|
|||
|
||||
### `serviceConfig` highlights
|
||||
|
||||
- `ExecStart = pkgs.hyperhive/bin/hive serve` — single binary,
|
||||
surface picked from `HIVE_ROLE`.
|
||||
- `ExecStart = pkgs.hyperhive/bin/hive serve` — single binary.
|
||||
- `Restart = on-failure`, `RestartSec = 2` — keeps the harness
|
||||
resilient across transient crashes without thundering retries.
|
||||
- `RuntimeDirectory = "hive-config"` → `/run/hive-config/` owned by
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ claude has access to in return.
|
|||
|
||||
## The loop
|
||||
|
||||
Each agent harness (`hive serve`, role set via `$HIVE_ROLE` — always
|
||||
`"agent"`, one binary) runs:
|
||||
Each agent harness (`hive serve` — one binary for all agents) runs:
|
||||
|
||||
1. Long-poll `Recv` on its socket. The host-side broker
|
||||
(`broker.rs::recv_blocking_batch`) returns immediately if there's
|
||||
|
|
@ -57,15 +56,11 @@ Each agent harness (`hive serve`, role set via `$HIVE_ROLE` — always
|
|||
|
||||
## Harness binary shape
|
||||
|
||||
One `hive` binary serves both roles. The split into
|
||||
One `hive` binary for all agents. The earlier split into
|
||||
`hive-ag3nt` + `hive-m1nd` was collapsed because the privilege
|
||||
boundary lives server-side at the broker socket
|
||||
(`/run/hive/mcp.sock`): an agent-flavor socket refuses
|
||||
`ManagerRequest` calls regardless of who sends them, so there's no
|
||||
escalation risk in shipping the same code to both. `main()` reads
|
||||
`$HIVE_ROLE` (set by `harness-base.nix` from `hyperhive.role`;
|
||||
defaults to `"agent"` for standalone `nix run` invocations) and
|
||||
dispatches.
|
||||
(`/run/hive/mcp.sock`): `ManagerRequest` calls are refused by the
|
||||
standard agent socket regardless of who sends them.
|
||||
|
||||
Three subcommands:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue