Watch
0
0
Fork
You've already forked hyperhive
0

remove c0re.operatorPronouns and c0re.contextWindowTokens

Both options are now ignored with a warning (the swarm-peers-removed.nix
shape), so a host that still sets one keeps evaluating.

- operatorPronouns: the agents' system prompt names the pronouns as
  she/her, the value the harness fell back to and the option's default.
  The --operator-pronouns flag, HiveEnv field, meta-flake let binding
  and HIVE_OPERATOR_PRONOUNS env var are gone.
- contextWindowTokens: the per-family defaults (haiku 200000, sonnet
  1000000, opus 1000000) move into hive-agent's harness_state as a
  table; the window the API reports after a turn still wins. The
  --context-window-tokens flag, HiveEnv field and the rendered
  HIVE_CONTEXT_WINDOW_TOKENS_<KEY> env vars are gone.
This commit is contained in:
atlas 2026-10-16 17:18:23 +02:00 • committed by mara
commit 4b5707768c
18 changed files with 151 additions and 258 deletions

View file

@ -70,11 +70,9 @@ in
`swarmctl agent inference set`) wins over this option.
Valid values are the short model names that `claude --model` accepts:
`"haiku"`, `"sonnet"`, `"opus"` (or any future identifier). Context
window sizes are looked up at runtime from the
`HIVE_CONTEXT_WINDOW_TOKENS_<KEY_UPPER>` env vars injected by the
meta flake; override sizes via `services.hyperhive.c0re.contextWindowTokens`
on the host.
`"haiku"`, `"sonnet"`, `"opus"` (or any future identifier). The
harness takes the context window from the model's own report after
each turn, and from a per-family default before the first.
'';
};

View file

@ -280,9 +280,6 @@ in
# here so both the harness binary and any user-shell `cargo run`
# inside the container resolve them from the same path.
# SHELL must be set so claude's Bash tool finds a POSIX shell.
# HIVE_CONTEXT_WINDOW_TOKENS_* are injected by the meta flake from the
# host-level `services.hyperhive.c0re.contextWindowTokens` option — not
# set here.
environment.variables = {
HIVE_ASSETS_DIR = "${config.services.hyperhive.agent.packages.assets}/share/hyperhive";
SHELL = "${pkgs.bashInteractive}/bin/bash";

View file

@ -0,0 +1,46 @@
# Removal shim for `services.hyperhive.c0re.operatorPronouns` and
# `services.hyperhive.c0re.contextWindowTokens`.
#
# A definition of either is ignored and produces a warning, so a host that
# still sets one keeps evaluating. The agents' system prompt
# (hive-agent/prompts/system.md) names the operator's pronouns itself, and
# the harness (hive-agent/src/harness_state.rs) holds the per-model context
# windows it uses until a turn reports the model's own.
#
# Self-contained and deletable, like ./swarm-peers-removed.nix: one file to
# remove when the deprecation window closes.
{ lib, config, ... }:
let
cfg = config.services.hyperhive.c0re;
in
{
options.services.hyperhive.c0re = {
operatorPronouns = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
visible = false;
internal = true;
description = "Removed and ignored. `null` is \"not set\".";
};
contextWindowTokens = lib.mkOption {
type = lib.types.nullOr (lib.types.attrsOf lib.types.int);
default = null;
visible = false;
internal = true;
description = "Removed and ignored. `null` is \"not set\".";
};
};
config.warnings =
lib.optional (cfg.operatorPronouns != null) ''
services.hyperhive.c0re.operatorPronouns is removed and ignored: the
operator's pronouns will be a per-operator profile setting. Until then
every agent's system prompt says she/her. Remove this setting.
''
++ lib.optional (cfg.contextWindowTokens != null) ''
services.hyperhive.c0re.contextWindowTokens is removed and ignored: the
agent harness uses the context window the model reports after each
turn, and before the first one its own defaults (haiku 200000, sonnet
1000000, opus 1000000 tokens). Remove this setting.
'';
}

View file

@ -85,6 +85,7 @@
./swarm-victoriametrics.nix
./swarm-wireguard.nix
./swarm.nix
./c0re-options-removed.nix
./host-ca-removed.nix
./nats-callout-removed.nix
./swarm-required-services.nix

View file

@ -112,8 +112,6 @@ let
# that caused it.
claude_code_path = cfg.claudeCodePackage;
dashboard_port = cfg.dashboardPort;
operator_pronouns = cfg.operatorPronouns;
context_window_tokens = cfg.contextWindowTokens;
agent_cpu_quota = cfg.agentCpuQuota;
agent_memory_max = cfg.agentMemoryMax;
agent_cpu_weight = cfg.agentCpuWeight;

View file

@ -171,21 +171,6 @@
default = 7000;
description = "TCP port the hive-c0re dashboard listens on.";
};
operatorPronouns = lib.mkOption {
type = lib.types.str;
default = "she/her";
example = "they/them";
description = ''
Operator pronouns, free text. Threaded into every agent
container as the `HIVE_OPERATOR_PRONOUNS` env var; the
harness substitutes it into the agent / manager system
prompt at boot so claude refers to the operator naturally
in third person ("ask her", "tell them", etc.). Changes
propagate to running agents on the next `↻ R3BU1LD` —
forwards as a meta flake env-var bump, no per-agent
approval needed.
'';
};
preBuildAgentTemplates = lib.mkOption {
type = lib.types.bool;
default = false;
@ -212,31 +197,6 @@
store.
'';
};
contextWindowTokens = lib.mkOption {
type = lib.types.attrsOf lib.types.int;
default = {
haiku = 200000;
sonnet = 1000000;
opus = 1000000;
};
example = {
haiku = 150000;
sonnet = 900000;
};
description = ''
Per-model context-window sizes in tokens. Each key is a
model-family short name matched case-insensitively as a
substring of the active model name at runtime (e.g. `"sonnet"`
matches `"claude-sonnet-4-5"`). The defaults cover the known
Anthropic families; add entries for new models or override
existing ones here to change the window for all agents at once.
Passed to `hive-c0re serve` as JSON and injected into every
container's harness service environment as
`HIVE_CONTEXT_WINDOW_TOKENS_<KEY_UPPER>`. Changes propagate
on the next `↻ R3BU1LD` — no per-agent approval needed.
'';
};
modelPrices = lib.mkOption {
type = lib.types.attrsOf (

View file

@ -48,8 +48,13 @@ let
inherit (shared) forgeHere;
# Every hive defaults the agents' queue address to the queue's name, so the
# only hive without one is a hive told to have none.
noAgentQueue = hiveWithController { deploy.hive-controller.queue.agentNatsUrl = null; };
# only hive without one is a hive told to have none. Also the host still
# setting the two removed `c0re` options; no case on its queue reads them.
noAgentQueue = hiveWithController {
deploy.hive-controller.queue.agentNatsUrl = null;
c0re.operatorPronouns = "they/them";
c0re.contextWindowTokens.sonnet = 900000;
};
# On the store's host, which mints the runner's store identity.
withCi = hive {
@ -237,6 +242,29 @@ let
in
!(e ? HIVE_AGENT_NATS_URL) && !(e ? HIVE_AGENT_OIDC_TOKEN_ENDPOINT);
}
{
# Control: `bare` sets neither option, and its serve.json carries the
# dashboard port, so the key lookup reads a real document.
name = "a definition of a removed c0re option evaluates, warns, and reaches no serve.json";
ok =
let
warned =
m: option:
lib.any (w: lib.hasInfix "services.hyperhive.c0re.${option} is removed and ignored" w) m.warnings;
options = [
"operatorPronouns"
"contextWindowTokens"
];
hasKey = m: key: lib.hasInfix "\"${key}\":" m.environment.etc."hyperhive/serve.json".text;
noRemovedKeys =
m:
hasKey m "dashboard_port" && !(hasKey m "operator_pronouns") && !(hasKey m "context_window_tokens");
in
lib.all (warned noAgentQueue) options
&& !(lib.any (warned bare) options)
&& noRemovedKeys noAgentQueue
&& noRemovedKeys bare;
}
{
# Where the store is and where the agent is told it is, one agreement
# spanning two modules. Asserted against the hive's own `BAO_ADDR`