Cut CodexConnector out of managed admission; fix Heimdall's dependency kind and recipe/binary drift

F1 (critical, Soul): managed admission still bailed without
GHOSTLIGHT_CONTROLLER_CONNECTOR and required Idunn's Expected to carry a
third, connector, dependency that no longer exists anywhere upstream.
idunn_health.rs now reads no connector env, requires exactly Ghostlight's two
real dependencies (Odin, Heimdall), and RuntimeDependencyBindings/
RuntimePresencePublisher carry no connector field. runtime.rs's
open_controller no longer takes an endpoint parameter for a lane it cannot
offer: Dungeon passes None for ConnectorBinding and says why in a comment.
configured_connector_endpoint is deleted. The library's CodexConnector
transport (crates/ghostlight) is untouched, and play.rs's own use of the
codex_connector crate for transcript types is unrelated and untouched.

F3: Heimdall is not an Idunn-v2-managed incarnation (every v2 deploy has
failed; it runs as legacy heimdall.service). Idunn projects an
[[external_capabilities]]-declared provider as provider_authority =
"external-operator-binding" with no provider_expected_projection_sha256
(Idunn's DependencySelection::expected_projection), never the managed shape a
"required" dependency expects. Recipe's Heimdall dependency kind is now
"external-operator-binding"; idunn_health.rs's required_external_dependency
checks exactly that shape. Odin stays a managed shared-infrastructure
dependency.

F2: the recipe disagreed with the binary on every declared contract, so
Warming would fail even with F1/F3 fixed. schema_generation was "world-v2"
against the daemon's "world-v3"; ghostlight.world-service provided
"foundation-v0" against the binary's actual ghostlight.world_state.consumer.v6
/ consumer-v6 (STATE_SCHEMA); controller-work's slot schema was pinned at
"v3" against the code's "v17". Fixed all three against the source constants,
and recomputed idunn_health.rs's STATE_CONTRACT_SHA256 against the corrected
[state] block using Idunn's own canonical_state_contract_sha256 (msgpack +
sha256 of the recipe's StateDeclaration) run against the finalized recipe —
not guessed. Promoted CONTROLLER_WORK_SCHEMA (ghostlight) and STORE_SCHEMA
(ghostlight-dungeon's app_session) from private to pub/pub(crate) so a test
can check itself against them instead of hand-copying version numbers.

Added one Dungeon test, recipe_matches_the_daemon_it_deploys, pinning recipe
strings against the daemon's own constants: state generation, provided
schema/compatibility, all four slot schemas, the exact dependency count and
kinds, and the absence of the retired CodexConnector dependency. No TOML
parser exists in this workspace's Cargo.lock, so it string-matches the exact
values rather than parsing into a struct — it catches value drift but not
field-placement drift a real parse would also catch (documented in the test's
own comment). Mutation-verified: corrupting schema_generation fails it;
reverted (diff-clean).

Verification: cargo test -p ghostlight-dungeon --bin ghostlight-dungeon ->
185 passed, 0 failed, 4 ignored (was 184; +1 for the new test). cargo test -p
ghostlight --lib controllers:: -> 131 passed, 0 failed, 1 ignored, unchanged.
Negative grep for CONNECTOR in crates/ghostlight-dungeon/src: zero survivors.
sudo -n idunn validate on Yggdrasil against the updated recipe + binding:
both ok.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-23 15:59:09 +02:00
commit c716b57730
6 changed files with 151 additions and 76 deletions

View file

@ -16,7 +16,9 @@ use sha2::{Digest, Sha256};
use std::{collections::BTreeMap, path::Path};
const STORE_TYPE: &str = "ghostlight.app_session_store.v2";
const STORE_SCHEMA: &str = "ghostlight.app_session_store.v2";
/// `pub(crate)` so the recipe-drift test in `idunn_health.rs` can check the
/// `app-sessions` state slot's schema against this constant.
pub(crate) const STORE_SCHEMA: &str = "ghostlight.app_session_store.v2";
const STORE_KEY: &str = "primary";
const MAX_SESSION_RECORDS: usize = 1_024;

View file

@ -46,7 +46,7 @@ pub const IDUNN_PROCESS_WRITE_LEASE_ENVIRONMENT: &str = "GAMECULT_IDUNN_PROCESS_
pub(crate) const TARGET: &str = "ghostlight";
const STATE_SCHEMA_GENERATION: &str = "world-v3";
const STATE_CONTRACT_SHA256: &str =
"sha256-bf6ec06d885a59ddb237c6224d0abb4ccceac8c7ba23761d1326d7f562a4c21e";
"sha256-4ac3d4ceabedc48b4fc5a3c143ece00ac495d8d756bdc24f10034bcc1231970f";
const CULTNET_RUDP_PROTOCOL_ID: &str = "cultnet.transport.rudp.v0";
const ODIN_CULTMESH_CATALOG_CONNECTION_ID: u32 = 0x0d1d_0002;
const RUNTIME_PRESENCE_IDENTITY_FD_NAME: &str = "gamecult-runtime-presence-identity";
@ -54,11 +54,6 @@ const WARMING_HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
const MAX_RECENT_WARMING_PROOFS: usize = 64;
const ODIN_CAPABILITY: (&str, &str, &str) =
("odin.verse-rendezvous", "odin.verse-topology.v1", "v1");
const CONNECTOR_CAPABILITY: (&str, &str, &str) = (
"gamecult.codex.subscription-inference",
"gamecult.codex.transport_envelope.v2",
"v2",
);
const HEIMDALL_CAPABILITY: (&str, &str, &str) = (
"heimdall.command-boundary",
"heimdall.command_boundary.v1",
@ -76,7 +71,6 @@ pub(crate) struct HeimdallDependencyBinding {
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct RuntimeDependencyBindings {
pub(crate) odin_rudp: SocketAddr,
pub(crate) connector: SocketAddr,
pub(crate) heimdall: HeimdallDependencyBinding,
}
@ -121,10 +115,6 @@ impl RuntimePresencePublisher {
.context("GHOSTLIGHT_ODIN_RUDP is required for runtime presence")?
.parse()
.context("GHOSTLIGHT_ODIN_RUDP is not a socket address")?;
let connector_endpoint: SocketAddr = std::env::var("GHOSTLIGHT_CONTROLLER_CONNECTOR")
.context("GHOSTLIGHT_CONTROLLER_CONNECTOR is required for managed runtime")?
.parse()
.context("GHOSTLIGHT_CONTROLLER_CONNECTOR is not a socket address")?;
let write_lease_path = PathBuf::from(
std::env::var_os(IDUNN_PROCESS_WRITE_LEASE_ENVIRONMENT)
.with_context(|| format!("{IDUNN_PROCESS_WRITE_LEASE_ENVIRONMENT} is required"))?,
@ -138,7 +128,6 @@ impl RuntimePresencePublisher {
IdunnRuntimeActivationSigner::from_credential_reader(activation_credential)?;
Ok(Some(Self::new(
odin_endpoint,
connector_endpoint,
observed_bound_endpoint,
expected,
activation,
@ -151,7 +140,6 @@ impl RuntimePresencePublisher {
#[allow(clippy::too_many_arguments)]
fn new(
odin_endpoint: SocketAddr,
connector_endpoint: SocketAddr,
observed_bound_endpoint: SocketAddr,
expected: IdunnExpectedIncarnationRecord,
activation: IdunnRuntimeActivationRecord,
@ -226,7 +214,7 @@ impl RuntimePresencePublisher {
);
}
let dependency_bindings =
runtime_dependency_bindings(&expected, odin_endpoint, connector_endpoint)?;
runtime_dependency_bindings(&expected, odin_endpoint)?;
Ok(Self {
endpoint: odin_endpoint,
@ -412,15 +400,13 @@ impl RuntimePresencePublisher {
fn runtime_dependency_bindings(
expected: &IdunnExpectedIncarnationRecord,
configured_odin: SocketAddr,
configured_connector: SocketAddr,
) -> Result<RuntimeDependencyBindings> {
ensure!(
expected.dependencies.len() == 3,
"Ghostlight Expected does not carry its exact three dependencies"
expected.dependencies.len() == 2,
"Ghostlight Expected does not carry its exact two dependencies"
);
let odin = required_managed_dependency(expected, "shared-infrastructure", ODIN_CAPABILITY)?;
let connector = required_managed_dependency(expected, "private", CONNECTOR_CAPABILITY)?;
let heimdall = required_managed_dependency(expected, "required", HEIMDALL_CAPABILITY)?;
let heimdall = required_external_dependency(expected, HEIMDALL_CAPABILITY)?;
let odin_endpoint = parse_dependency_socket_endpoint(
odin.provider_endpoint
@ -433,18 +419,6 @@ fn runtime_dependency_bindings(
odin_endpoint == configured_odin,
"GHOSTLIGHT_ODIN_RUDP differs from Expected Odin"
);
let connector_endpoint = parse_dependency_socket_endpoint(
connector
.provider_endpoint
.as_deref()
.context("Expected Connector dependency has no endpoint")?,
&["tcp://"],
"Connector dependency",
)?;
ensure!(
connector_endpoint == configured_connector,
"GHOSTLIGHT_CONTROLLER_CONNECTOR differs from Expected Connector"
);
let heimdall_endpoint = parse_dependency_socket_endpoint(
heimdall
.provider_endpoint
@ -456,7 +430,6 @@ fn runtime_dependency_bindings(
Ok(RuntimeDependencyBindings {
odin_rudp: odin_endpoint,
connector: connector_endpoint,
heimdall: HeimdallDependencyBinding {
provider_id: heimdall
.provider_id
@ -494,6 +467,40 @@ fn required_managed_dependency<'a>(
Ok(dependency)
}
/// Heimdall is not an Idunn-managed incarnation (every v2 deploy of it has
/// failed; it still runs as the legacy `heimdall.service`), so its Expected
/// dependency can never carry `managed-incarnation` authority. Idunn projects
/// an operator-declared `[[external_capabilities]]` entry as
/// `provider_authority = "external-operator-binding"` with no
/// `provider_expected_projection_sha256` (`deployment_plan.rs`'s
/// `DependencySelection::expected_projection`) — accept exactly that shape,
/// never the managed one, for Heimdall alone. Odin stays managed.
fn required_external_dependency<'a>(
expected: &'a IdunnExpectedIncarnationRecord,
identity: (&str, &str, &str),
) -> Result<&'a IdunnExpectedDependency> {
let dependency = expected
.dependencies
.iter()
.find(|dependency| {
dependency.capability == identity.0
&& dependency.schema == identity.1
&& dependency.compatibility == identity.2
})
.with_context(|| format!("Expected omits dependency {}", identity.0))?;
ensure!(
dependency.kind == "external-operator-binding"
&& dependency.startup == "before-promotion"
&& dependency.minimum_capacity > 0
&& dependency.provider_id.is_some()
&& dependency.provider_authority.as_deref() == Some("external-operator-binding")
&& dependency.provider_expected_projection_sha256.is_none(),
"Expected dependency {} is unresolved or authority-incoherent",
identity.0
);
Ok(dependency)
}
fn parse_dependency_socket_endpoint(
endpoint: &str,
allowed_schemes: &[&str],
@ -1176,6 +1183,32 @@ pub(crate) mod tests {
}
}
/// Exactly what Idunn's `DependencySelection::expected_projection`
/// projects for an `[[external_capabilities]]`-declared provider
/// (`deployment_plan.rs`): `provider_authority =
/// "external-operator-binding"` and no
/// `provider_expected_projection_sha256`, unlike a managed dependency.
fn external_dependency(
capability: &str,
schema: &str,
compatibility: &str,
provider_id: &str,
endpoint: &str,
) -> IdunnExpectedDependency {
IdunnExpectedDependency {
kind: "external-operator-binding".into(),
capability: capability.into(),
schema: schema.into(),
compatibility: compatibility.into(),
minimum_capacity: 1,
startup: "before-promotion".into(),
provider_id: Some(provider_id.into()),
provider_authority: Some("external-operator-binding".into()),
provider_expected_projection_sha256: None,
provider_endpoint: Some(endpoint.into()),
}
}
fn fixture_with_state_contract(root: &Path, state_contract_sha256: &str) -> Result<Fixture> {
let provider_path = root.join("provider.cc");
let provider =
@ -1219,20 +1252,11 @@ pub(crate) mod tests {
},
],
dependencies: vec![
managed_dependency(
"private",
CONNECTOR_CAPABILITY.0,
CONNECTOR_CAPABILITY.1,
CONNECTOR_CAPABILITY.2,
"connector-yggdrasil",
"tcp://127.0.0.1:4103",
),
managed_dependency(
"required",
external_dependency(
HEIMDALL_CAPABILITY.0,
HEIMDALL_CAPABILITY.1,
HEIMDALL_CAPABILITY.2,
"heimdall-yggdrasil",
"yggdrasil-heimdall",
"rudp://127.0.0.1:4101",
),
managed_dependency(
@ -1262,7 +1286,6 @@ pub(crate) mod tests {
)?;
let publisher = RuntimePresencePublisher::new(
"127.0.0.1:9".parse()?,
"127.0.0.1:4103".parse()?,
"127.0.0.1:18831".parse()?,
expected.clone(),
activation.clone(),
@ -1585,4 +1608,66 @@ pub(crate) mod tests {
);
Ok(())
}
/// No TOML parser is in this workspace's dependency graph (checked
/// `Cargo.lock`), so this pins the exact strings the daemon's own
/// constants require rather than parsing the recipe into a struct. It
/// still catches the drift class Soul found: the recipe naming a state
/// generation, provided schema, slot schema, or dependency shape the
/// binary does not actually have (F2). It does not prove field-level
/// placement (e.g. that the matched schema line sits under the `world`
/// slot and not merely somewhere in the file) the way a real parse would.
const RECIPE_TOML: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../deployment/idunn/recipe.toml"
));
#[test]
fn recipe_matches_the_daemon_it_deploys() {
assert!(
RECIPE_TOML.contains(&format!(
"schema_generation = \"{STATE_SCHEMA_GENERATION}\""
)),
"recipe [state] schema_generation disagrees with the daemon's STATE_SCHEMA_GENERATION"
);
assert!(
RECIPE_TOML.contains(&format!("schema = \"{STATE_SCHEMA}\"")),
"recipe does not name STATE_SCHEMA anywhere (world slot / provides)"
);
assert!(
RECIPE_TOML.contains(&format!(
"compatibility = \"{}\"",
state_schema_compatibility_tag()
)),
"recipe [[provides]] compatibility disagrees with state_schema_compatibility_tag()"
);
assert!(
RECIPE_TOML.contains(&format!(
"schema = \"{}\"",
crate::app_session::STORE_SCHEMA
)),
"recipe app-sessions slot schema disagrees with app_session::STORE_SCHEMA"
);
assert!(
RECIPE_TOML.contains(&format!("schema = \"{}\"", ghostlight::CONTROLLER_WORK_SCHEMA)),
"recipe controller-work slot schema disagrees with ghostlight::CONTROLLER_WORK_SCHEMA"
);
assert!(
RECIPE_TOML.contains("schema = \"gamecult.eve.surface.v1\""),
"recipe mesh-projection slot schema disagrees with the mesh module's eve surface schema"
);
assert_eq!(
RECIPE_TOML.matches("[[dependencies]]").count(),
2,
"recipe does not declare Ghostlight's exact two dependencies"
);
assert!(RECIPE_TOML.contains(&format!("capability = \"{}\"", ODIN_CAPABILITY.0)));
assert!(RECIPE_TOML.contains("kind = \"shared-infrastructure\""));
assert!(RECIPE_TOML.contains(&format!("capability = \"{}\"", HEIMDALL_CAPABILITY.0)));
assert!(RECIPE_TOML.contains("kind = \"external-operator-binding\""));
assert!(
!RECIPE_TOML.contains("gamecult.codex.subscription-inference"),
"recipe still declares the retired CodexConnector dependency"
);
}
}

View file

@ -368,14 +368,9 @@ pub(crate) async fn run(state_root_binding: Option<PathBuf>) -> anyhow::Result<(
require_current_write_lease(write_lease_guard.as_ref())?;
let (world, world_owner) = WorldMailbox::open(runtime_root.join("world.cc"))?;
require_no_runtime_custody_failure(&mut fatal_events)?;
let connector_endpoint = dependency_bindings
.as_ref()
.map(|bindings| bindings.connector)
.map(Ok)
.unwrap_or_else(configured_connector_endpoint)?;
let controller_permits = Arc::new(Semaphore::new(configured_controller_concurrency()));
let (controllers, play) =
match open_controller(&world, &service_root, &runtime_id, connector_endpoint) {
match open_controller(&world, &service_root, &runtime_id) {
Ok(OpenedControllers {
runner,
inference,
@ -522,7 +517,6 @@ fn open_controller(
world: &WorldMailbox,
service_root: &std::path::Path,
runtime_id: &str,
endpoint: SocketAddr,
) -> anyhow::Result<OpenedControllers> {
let models = ControllerModels {
projector: std::env::var("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL")
@ -543,13 +537,10 @@ fn open_controller(
// same transports again for the play lane alone.
let play_model =
std::env::var("GHOSTLIGHT_PLAY_MODEL").unwrap_or_else(|_| "gpt-5.6-terra".into());
let connector = std::env::var_os("GHOSTLIGHT_CONTROLLER_CREDENTIAL")
.map(PathBuf::from)
.map(|key_path| ConnectorBinding {
endpoint,
key_path,
caller_runtime_id: runtime_id.to_owned(),
});
// Dungeon no longer offers the CodexConnector lane: managed admission
// reads no connector env and expects no connector dependency (operator
// ruling 2026-09-23). The library transport stays for other callers.
let connector: Option<ConnectorBinding> = None;
// Ghostlight reads no credential for this transport. The sidecar inherits
// the ambient Claude Code login; this process never names, copies, or logs
// it.
@ -1994,13 +1985,6 @@ fn candidate_bind() -> anyhow::Result<SocketAddr> {
}
}
fn configured_connector_endpoint() -> anyhow::Result<SocketAddr> {
std::env::var("GHOSTLIGHT_CONTROLLER_CONNECTOR")
.unwrap_or_else(|_| "127.0.0.1:4103".into())
.parse()
.context("GHOSTLIGHT_CONTROLLER_CONNECTOR is not a socket address")
}
fn configured_odin_endpoint() -> anyhow::Result<SocketAddr> {
std::env::var("GHOSTLIGHT_ODIN_RUDP")
.context("GHOSTLIGHT_ODIN_RUDP is required")?

View file

@ -77,7 +77,10 @@ pub(super) const CELL_TOOL_STEP_BUDGET: usize = 2;
const HANDLE_SEPARATOR: &str = "__";
const PERSONA_WORD_BUDGET: usize = 180;
const CONTROLLER_WORK_ROW: &str = "controller_work.v17";
const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v17";
/// The `controller-work` state slot's schema. `pub` so a deploy recipe (or a
/// test pinning one, e.g. `ghostlight-dungeon`'s recipe-drift test) can check
/// itself against this constant instead of hand-copying the version number.
pub const CONTROLLER_WORK_SCHEMA: &str = "ghostlight.controller_work.v17";
/// The Interpreter's byte-span capture tool. It is not the generated `speak`
/// affordance tool: one captures an utterance out of preserved prose, the other

View file

@ -79,9 +79,10 @@ pub use consumer::{
CONSUMER_RECEIPT_SCHEMA, ConsumerRegistry, admit_document, encode_receipt,
};
pub use controllers::{
CellRun, ConnectorBinding, ControllerError, ControllerModels, ControllerNeed,
ControllerPendingReason, ControllerRunner, ControllerWork, ControllerWorkCustody,
ControllerWorkLookup, ControllerWorkStore, ControllerWorkStoreError, ControllerWorkWrite,
CONTROLLER_WORK_SCHEMA, CellRun, ConnectorBinding, ControllerError, ControllerModels,
ControllerNeed, ControllerPendingReason, ControllerRunner, ControllerWork,
ControllerWorkCustody, ControllerWorkLookup, ControllerWorkStore, ControllerWorkStoreError,
ControllerWorkWrite,
GroupedCheckpoint, InferenceEvent, InferenceFault, InferenceFaultDisposition, InferenceOutput,
InferencePort,
InferencePurpose, InferenceRequest, NarrativeCheckpoint, NarrativeRun, OperationalCheckpoint,

View file

@ -123,13 +123,13 @@ optional_environment = ["RUST_LOG"]
contract = "ghostlight.cultnet-rudp-service-health"
[state]
schema_generation = "world-v2"
schema_generation = "world-v3"
[[state.slots]]
id = "world"
relative_path = "world.cc"
kind = "cultcache-file"
schema = "ghostlight.world_state.foundation.v0"
schema = "ghostlight.world_state.consumer.v6"
writer = "process-bound-single-writer"
recovery = "preserve"
startup = "create-or-open-after-write-lease"
@ -147,7 +147,7 @@ startup = "create-or-open-after-write-lease"
id = "controller-work"
relative_path = "service/controller-work.cc"
kind = "cultcache-file"
schema = "ghostlight.controller_work.v3"
schema = "ghostlight.controller_work.v17"
writer = "process-bound-single-writer"
recovery = "preserve"
startup = "create-or-open-after-write-lease"
@ -163,8 +163,8 @@ startup = "create-or-open-after-write-lease"
[[provides]]
capability = "ghostlight.world-service"
schema = "ghostlight.world_state.foundation.v0"
compatibility = "foundation-v0"
schema = "ghostlight.world_state.consumer.v6"
compatibility = "consumer-v6"
[[provides]]
capability = "gamecult.eve.surface-provider"
@ -179,7 +179,7 @@ compatibility = "v1"
startup = "before-promotion"
[[dependencies]]
kind = "required"
kind = "external-operator-binding"
capability = "heimdall.command-boundary"
schema = "heimdall.command_boundary.v1"
compatibility = "v1"