harness: collapse Surface::DEFAULT_LABEL → single 'hive' fallback (#788)

closes #788. drops the per-role HIVE_LABEL fallback const ('hive-ag3nt'
on AgentSurface, 'hm1nd' on ManagerSurface) and replaces both with a
single literal 'hive' at the env-var unwrap site. real deploys set
HIVE_LABEL unconditionally via the meta-flake envelope; the fallback
is unreachable in production and there's no semantic reason for it to
differ per role.

nix-side standalone-eval fallback (HIVE_LABEL = 'hm1nd' in the
manager systemd unit) stays — that's wired so 'nixos-rebuild against
nixosConfigurations.manager' produces a sensibly-labelled container
even without the meta-flake wrapper.

Surface trait now: FLAVOR + FORGE_IS_MANAGER + 7 async wire methods.
next steps per #778 roadmap: #691#786#789.
This commit is contained in:
damocles 2026-05-31 15:01:04 +02:00 committed by mara
commit 2ada0e22ca

View file

@ -205,10 +205,6 @@ trait Surface {
/// system-prompt block + tool registration goes into the spawned
/// `claude` process.
const FLAVOR: mcp::Flavor;
/// Fallback agent label when `HIVE_LABEL` isn't in the environment.
/// Real deploys always set the env var; the fallback covers
/// standalone `nix run .#hive` invocations.
const DEFAULT_LABEL: &'static str;
/// `is_manager` flag passed to `forge_notify::run`. Picks which
/// wire enum (`AgentRequest::Wake` vs `ManagerRequest::Wake`) the
/// poller uses to push notifications into the harness inbox — the
@ -271,7 +267,6 @@ struct AgentSurface;
impl Surface for AgentSurface {
const FLAVOR: mcp::Flavor = mcp::Flavor::Agent;
const DEFAULT_LABEL: &'static str = "hive-ag3nt";
const FORGE_IS_MANAGER: bool = false;
async fn ack_turn(socket: &Path) {
@ -410,7 +405,6 @@ struct ManagerSurface;
impl Surface for ManagerSurface {
const FLAVOR: mcp::Flavor = mcp::Flavor::Manager;
const DEFAULT_LABEL: &'static str = "hm1nd";
const FORGE_IS_MANAGER: bool = true;
async fn ack_turn(socket: &Path) {
@ -556,7 +550,14 @@ async fn serve_main<S: Surface>(socket: &Path, poll_ms: u64) -> Result<()> {
.ok()
.and_then(|s| s.parse::<u16>().ok())
.unwrap_or(DEFAULT_WEB_PORT);
let label = std::env::var("HIVE_LABEL").unwrap_or_else(|_| S::DEFAULT_LABEL.into());
// `HIVE_LABEL` is set unconditionally by the meta-flake envelope
// for any container-deployed agent; the `"hive"` fallback here
// covers standalone `nix run .#hive` invocations and pre-meta
// dev shells. Previously this was per-role (`"hive-ag3nt"` /
// `"hm1nd"`) — closing #788 collapsed it: there's no semantic
// reason for the fallback to differ when the env var is missing,
// and both branches are unreachable in production.
let label = std::env::var("HIVE_LABEL").unwrap_or_else(|_| "hive".into());
let claude_dir = login::default_dir();
let initial = LoginState::from_dir(&claude_dir);
tracing::info!(state = ?initial, claude_dir = %claude_dir.display(), "harness boot");