Watch
0
0
Fork
You've already forked hyperhive
0

hand agents the queue address at container start

HIVE_AGENT_NATS_URL now reaches each container in its hive facts, from
the host's deploy.hive-controller.queue.agentNatsUrl, instead of being
rendered into the meta flake. The agent option
services.hyperhive.agent.queue.natsUrl is removed; the harness unit
imports the queue credential whenever the token endpoint is set.

On deploy every agent rebuilds once (the rendered flake loses the
address), and the harness reads the address from the facts file
hive-priv writes before each start.

Refs #4857
This commit is contained in:
atlas 2026-10-22 07:43:50 +02:00
commit f3c0a87c0f
13 changed files with 54 additions and 31 deletions

View file

@ -528,9 +528,9 @@ async fn run_with_deadline_returns_output_of_a_fast_child() {
assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), "hi");
}
/// The three per-host values reach the container as facts: the dashboard
/// port and pinned claude from the hive's config, the OTEL labels from the
/// daemon's environment.
/// The per-host values reach the container as facts: the dashboard port and
/// pinned claude from the hive's config, the OTEL labels and the queue
/// address from the daemon's environment.
#[test]
fn hive_facts_carry_the_per_host_values() {
let hive = HiveEnv {
@ -538,8 +538,10 @@ fn hive_facts_carry_the_per_host_values() {
claude_code_path: Some("/nix/store/0abc-claude-code".to_owned()),
..HiveEnv::default()
};
let facts = hive_facts_from(&hive, |name| {
(name == "HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES").then(|| "team=a".to_owned())
let facts = hive_facts_from(&hive, |name| match name {
"HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES" => Some("team=a".to_owned()),
"HIVE_AGENT_NATS_URL" => Some("tls://nats.t.local:4222".to_owned()),
_ => None,
});
assert_eq!(facts.dashboard_port, Some(7123));
assert_eq!(
@ -550,6 +552,10 @@ fn hive_facts_carry_the_per_host_values() {
facts.otel_extra_resource_attributes.as_deref(),
Some("team=a")
);
assert_eq!(
facts.agent_nats_url.as_deref(),
Some("tls://nats.t.local:4222")
);
}
/// Unset and empty both leave a fact out, so the agent falls back to its
@ -561,5 +567,6 @@ fn hive_facts_leave_unset_values_out() {
});
assert_eq!(facts.claude_code_path, None);
assert_eq!(facts.otel_extra_resource_attributes, None);
assert_eq!(facts.agent_nats_url, None);
assert_eq!(facts.name, None);
}