Retry the initial Active presence through Odin's correlation gap

Odin refuses Active until it has correlated the lease Idunn just granted
("Ready topology state is not supported by correlated evidence"); the
first v2 candidate to get past Warming and the lease died on that single
refusal. Retry it with the helper and window the Warming publish already
uses; the periodic republish already only logs. The cadence constant now
names both presences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-23 20:11:26 +02:00
commit 203dc3658e

View file

@ -460,9 +460,20 @@ pub(crate) async fn run(state_root_binding: Option<PathBuf>) -> anyhow::Result<(
let write_lease = write_lease_guard
.as_ref()
.context("production runtime lost its process write lease")?;
publisher
.publish_active(write_lease)
.context("publishing initial active runtime presence")?;
// Odin refuses Active until it has correlated the lease Idunn just
// granted ("Ready topology state is not supported by correlated
// evidence"), the same publication gap the initial Warming publish
// retries through. Each call is a fresh sequenced message; the lease
// it names cannot change between attempts (`publish_active`).
retry_until_deadline(
|| publisher.publish_active(write_lease),
INITIAL_PRESENCE_RETRY_CADENCE,
Instant::now() + WRITE_LEASE_WAIT_TIMEOUT,
"publishing initial active runtime presence",
Instant::now,
|duration| tokio::time::sleep(duration),
)
.await?;
}
require_current_write_lease(write_lease_guard.as_ref())?;
state.runtime_health = match (idunn_health, write_lease_guard) {
@ -1928,7 +1939,7 @@ const WRITE_LEASE_WAIT_TIMEOUT: Duration = Duration::from_secs(120);
/// Muninn re-publishes its own Warming presence every 2s while tolerating
/// this same activation-publication gap (Muninn/crates/muninn-daemon/src/main.rs);
/// the initial-publish retry below matches that cadence.
const INITIAL_WARMING_RETRY_CADENCE: Duration = Duration::from_secs(2);
const INITIAL_PRESENCE_RETRY_CADENCE: Duration = Duration::from_secs(2);
/// Retries `attempt` at `cadence` until it returns `Ok` or `deadline` passes,
/// warning on every failed attempt and returning the last error once the
@ -1974,7 +1985,7 @@ async fn initialize_production_admission(
// drops.
let warming = retry_until_deadline(
|| publisher.publish_warming(),
INITIAL_WARMING_RETRY_CADENCE,
INITIAL_PRESENCE_RETRY_CADENCE,
Instant::now() + WRITE_LEASE_WAIT_TIMEOUT,
"publishing initial Warming runtime presence",
Instant::now,