Merge ghostlight-verse/mp-lane-models: lane models come only from deploy config; the six lane env vars are required (cut-mp-lane-models-deploy-config r1, report h1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 18:00:08 +01:00
commit d40fbbb3d4
7 changed files with 131 additions and 81 deletions

View file

@ -585,13 +585,13 @@ pub(crate) mod tests {
Shared {
inference: port.clone(),
models: ControllerModels {
projector: "claude-sonnet-5-5".into(),
persona: "claude-sonnet-5-5".into(),
interpreter: "claude-haiku-5-5".into(),
operational_agent: "claude-haiku-5-5".into(),
elaborator: "claude-sonnet-5-5".into(),
projector: crate::test_support::TEST_LANE_MODEL.into(),
persona: crate::test_support::TEST_LANE_MODEL.into(),
interpreter: crate::test_support::TEST_LANE_MODEL.into(),
operational_agent: crate::test_support::TEST_LANE_MODEL.into(),
elaborator: crate::test_support::TEST_LANE_MODEL.into(),
},
play_model: "claude-sonnet-5-5".into(),
play_model: crate::test_support::TEST_LANE_MODEL.into(),
permits: Arc::new(Semaphore::new(2)),
},
fatal,

View file

@ -106,31 +106,40 @@ fn connector_binding() -> anyhow::Result<ConnectorBinding> {
})
}
/// The model each lane runs on, from env over the defaults the rulings set
/// (dungeon-models-dm-opus): Opus for the play table (the DM) and the narrator (the projector),
/// Sonnet for the NPC Personas and the elaborator (which also
/// seeds), Haiku for the interpreter and the operational agent.
fn lane_models() -> (ControllerModels, String) {
/// The model each lane runs on. The deployment names every one: a lane's model
/// is an opaque exact id the deployment writes (a provider's own id, with
/// whatever slashes, dots or colons it carries), and the binary holds none, so
/// a Dungeon with a lane unset refuses to start rather than guess a provider.
/// Which model fills which role is the deployer's choice under the role split
/// of the ruling `dungeon-models-dm-opus`: the play table (the DM) and the
/// narrator (the projector) are the heaviest roles, the NPC Personas and the
/// elaborator (which also seeds) the middle, the interpreter and the
/// operational agent the lightest.
fn lane_models() -> anyhow::Result<(ControllerModels, String)> {
lane_models_from(|name| std::env::var(name).ok())
}
fn lane_models_from(read: impl Fn(&str) -> Option<String>) -> (ControllerModels, String) {
let lane = |name: &str, default: &str| read(name).unwrap_or_else(|| default.into());
(
fn lane_models_from(
read: impl Fn(&str) -> Option<String>,
) -> anyhow::Result<(ControllerModels, String)> {
let lane = |name: &str| {
read(name).with_context(|| format!("{name} is required: it names the model this lane runs on"))
};
Ok((
ControllerModels {
projector: lane("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL", "claude-opus-5-5"),
persona: lane("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL", "claude-sonnet-5-5"),
interpreter: lane("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL", "claude-haiku-5-5"),
operational_agent: lane("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL", "claude-haiku-5-5"),
elaborator: lane("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL", "claude-sonnet-5-5"),
projector: lane("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL")?,
persona: lane("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL")?,
interpreter: lane("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL")?,
operational_agent: lane("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL")?,
elaborator: lane("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL")?,
},
lane("GHOSTLIGHT_PLAY_MODEL", "claude-opus-5-5"),
)
lane("GHOSTLIGHT_PLAY_MODEL")?,
))
}
/// The one routed inference port every timeline and lane shares.
pub(crate) fn open_shared() -> anyhow::Result<Shared> {
let (models, play_model) = lane_models();
let (models, play_model) = lane_models()?;
let mut all: Vec<&str> = models.each().to_vec();
all.push(&play_model);
let inference: Arc<dyn InferencePort> =
@ -696,33 +705,62 @@ mod tests {
report("after run-ahead", &host.world.snapshot().await.unwrap());
}
const LANES: [&str; 6] = [
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
"GHOSTLIGHT_PLAY_MODEL",
];
#[test]
fn lanes_default_to_the_ruled_tiers_and_each_reads_its_own_override() {
let (models, play) = lane_models_from(|_| None);
assert_eq!(models.projector, "claude-opus-5-5", "the narrator");
assert_eq!(models.persona, "claude-sonnet-5-5");
assert_eq!(models.elaborator, "claude-sonnet-5-5");
assert_eq!(play, "claude-opus-5-5", "the DM");
assert_eq!(models.interpreter, "claude-haiku-5-5");
assert_eq!(models.operational_agent, "claude-haiku-5-5");
for (name, lane) in [
("GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL", 0),
("GHOSTLIGHT_CONTROLLER_PERSONA_MODEL", 1),
("GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL", 2),
("GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL", 3),
("GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL", 4),
("GHOSTLIGHT_PLAY_MODEL", 5),
] {
let (models, play) = lane_models_from(|asked| (asked == name).then(|| "override".to_owned()));
let mut all = models.each().to_vec();
all.push(&play);
let overridden: Vec<usize> = all
.iter()
.enumerate()
.filter(|(_, model)| **model == "override")
.map(|(index, _)| index)
.collect();
assert_eq!(overridden, vec![lane], "{name} moves exactly its own lane");
fn lane_models_refuse_an_unset_lane_by_name() {
for unset in LANES {
let error = lane_models_from(|asked| {
(asked != unset).then(|| crate::test_support::TEST_LANE_MODEL.to_owned())
})
.err()
.unwrap_or_else(|| panic!("{unset} unset was accepted"));
let message = format!("{error:#}");
assert!(message.contains(&format!("{unset} is required")), "{message}");
for other in LANES.into_iter().filter(|other| *other != unset) {
assert!(!message.contains(other), "{unset}: the error also names {other}");
}
}
}
#[test]
fn lane_models_pass_ids_through_verbatim() {
let ids = [
"deepseek/deepseek-v4-pro",
"ollama/qwen3:8b",
"vendor/model.v1.5-x",
"plain-id",
"a/b/c:d.e",
"UPPER/Case",
];
for offset in 0..ids.len() {
// Each lane reads its own variable and nothing else: give every
// lane a distinct id and read each back from where it belongs.
let (models, play) = lane_models_from(|asked| {
LANES
.iter()
.position(|lane| *lane == asked)
.map(|at| ids[(at + offset) % ids.len()].to_owned())
})
.unwrap();
let held = [
models.projector.as_str(),
models.persona.as_str(),
models.interpreter.as_str(),
models.operational_agent.as_str(),
models.elaborator.as_str(),
play.as_str(),
];
for (at, lane) in LANES.iter().enumerate() {
assert_eq!(held[at], ids[(at + offset) % ids.len()], "{lane} at offset {offset}");
}
}
}

View file

@ -10,6 +10,10 @@ use crate::{
runtime::AppState,
timelines::Timelines,
};
/// The one neutral model id every test lane runs on: ids are opaque exact
/// strings, so no fixture names a provider or tier.
pub(crate) const TEST_LANE_MODEL: &str = "test/lane-a";
use chrono::Utc;
use ghostlight::{
InferenceFault, InferenceOutput, InferencePort, InferenceRequest, PreparedInference,
@ -159,7 +163,7 @@ mod tests {
let request = InferenceRequest::play(
ghostlight::CommandId::new(),
0,
"claude-opus-5-5",
TEST_LANE_MODEL,
"be brief",
vec![],
vec![],
@ -168,6 +172,6 @@ mod tests {
.unwrap();
let prepared = port.prepare(request).unwrap();
let seen = serde_json::to_value(&prepared).unwrap();
assert_eq!(model_of(&seen).as_deref(), Some("claude-opus-5-5"));
assert_eq!(model_of(&seen).as_deref(), Some(TEST_LANE_MODEL));
}
}

View file

@ -445,11 +445,11 @@ pub(crate) mod tests {
fn models() -> ControllerModels {
ControllerModels {
projector: "claude-sonnet-5-5".into(),
persona: "claude-sonnet-5-5".into(),
interpreter: "claude-haiku-5-5".into(),
operational_agent: "claude-haiku-5-5".into(),
elaborator: "claude-sonnet-5-5".into(),
projector: crate::test_support::TEST_LANE_MODEL.into(),
persona: crate::test_support::TEST_LANE_MODEL.into(),
interpreter: crate::test_support::TEST_LANE_MODEL.into(),
operational_agent: crate::test_support::TEST_LANE_MODEL.into(),
elaborator: crate::test_support::TEST_LANE_MODEL.into(),
}
}
@ -587,7 +587,7 @@ pub(crate) mod tests {
Shared {
inference,
models: models(),
play_model: "claude-sonnet-5-5".into(),
play_model: crate::test_support::TEST_LANE_MODEL.into(),
permits: Arc::new(Semaphore::new(2)),
},
fatal,

View file

@ -7725,6 +7725,9 @@ fn purpose_name(purpose: InferencePurpose) -> &'static str {
#[cfg(test)]
mod tests {
/// The one neutral model id the tests give every lane: ids are opaque
/// exact strings, so no fixture names a provider or tier.
const TEST_LANE_MODEL: &str = "test/lane-a";
/// The connector port's share of the no-input-text rule: a key-file path
/// and a runtime identity each arrive as a canary, and the fault names
@ -7781,7 +7784,7 @@ mod tests {
caller_runtime_id: "runtime".into(),
native_request_sha256: [1; 32],
provider_request_sha256: [2; 32],
model: "claude-haiku-5-5".into(),
model: TEST_LANE_MODEL.into(),
provider: "anthropic-messages".into(),
foreign_reasoning_dropped: 0,
outcome,
@ -8003,7 +8006,7 @@ mod tests {
#[test]
fn a_stale_invocation_is_renewed_and_a_live_one_is_sent_as_it_is() {
let skew = REQUEST_EXPIRY.as_millis() as u64;
let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap();
let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap();
let prepared = PreparedInference::prepare("runtime", 1_000_000 + skew, request).unwrap();
let live = prepared.invocation.clone();
let sent = renewed_invocation(live.clone(), 1_000_000).unwrap();
@ -8035,7 +8038,7 @@ mod tests {
let endpoint = listener.local_addr().unwrap();
let peer = std::thread::spawn(move || drop(listener.accept().unwrap()));
let port = ConnectorInferencePort::new(endpoint, "test-key".into(), "runtime").unwrap();
let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap();
let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap();
let prepared = port.prepare(request).unwrap();
let fault = port.infer(prepared).await.expect_err("a hung-up peer answered");
peer.join().unwrap();
@ -8050,7 +8053,7 @@ mod tests {
/// choose each lane's cache retention in `lane_cache_retention`.
#[test]
fn every_lane_builds_a_bounded_typed_v4_request() {
let persona = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap();
let persona = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap();
assert_eq!(persona.provider.max_output_tokens, 1_200);
assert_eq!(persona.provider.reasoning_effort, Some(ReasoningEffort::Low));
assert_eq!(persona.provider.cache_retention, None::<CacheRetention>);
@ -8059,7 +8062,7 @@ mod tests {
CommandId::new(),
0,
purpose,
"claude-haiku-5-5",
TEST_LANE_MODEL,
"Decide.",
vec![InputItem::UserText { text: "x".into() }],
Vec::new(),
@ -8081,7 +8084,7 @@ mod tests {
let play = InferenceRequest::play(
CommandId::new(),
0,
"claude-haiku-5-5",
TEST_LANE_MODEL,
"Play.",
vec![InputItem::UserText { text: "x".into() }],
Vec::new(),
@ -8091,7 +8094,7 @@ mod tests {
assert_eq!(play.provider.cache_retention, Some(CacheRetention::Long));
assert_eq!(play.uncached().provider.cache_retention, None);
let interpreter =
interpreter_request(CommandId::new(), 0, "claude-haiku-5-5", vec![InputItem::UserText { text: "x".into() }])
interpreter_request(CommandId::new(), 0, TEST_LANE_MODEL, vec![InputItem::UserText { text: "x".into() }])
.unwrap();
assert_eq!(interpreter.provider.max_output_tokens, DECISION_REQUEST_SHAPE.max_output_tokens);
assert_eq!(interpreter.provider.reasoning_effort, Some(ReasoningEffort::Medium));
@ -8175,7 +8178,7 @@ mod tests {
/// tools, automatic choice, serial calls and no output schema.
#[test]
fn the_prose_shape_gate_refuses_each_deviation() {
let request = persona_request(CommandId::new(), "claude-haiku-5-5", "Speak.".into()).unwrap();
let request = persona_request(CommandId::new(), TEST_LANE_MODEL, "Speak.".into()).unwrap();
let valid = PreparedInference::prepare("runtime", 4_102_444_800_000, request).unwrap();
assert!(prose_request_shape_is_valid(&valid));
assert!(persona_request_shape_is_valid(&valid));
@ -8216,7 +8219,7 @@ mod tests {
/// included.
#[test]
fn the_trace_renders_every_input_kind_and_the_tools() {
let mut provider = ProviderRequest::new("r", "c", "claude-haiku-5-5", "Be brief.", 100);
let mut provider = ProviderRequest::new("r", "c", TEST_LANE_MODEL, "Be brief.", 100);
provider.input = vec![
InputItem::UserText { text: "u-text".into() },
InputItem::AssistantText { text: "a-text".into() },
@ -8267,7 +8270,8 @@ mod tests {
/// The live check, run by hand on the host that carries claude-connector:
/// Ghostlight's own port completes a plain, a tool and an output-schema
/// request on haiku and a plain request on sonnet, with usage reported.
/// request on the model `GHOSTLIGHT_LIVE_MODEL_A` names and a plain request
/// on the one `GHOSTLIGHT_LIVE_MODEL_B` names, with usage reported.
/// The key reaches the process only as the systemd credential
/// `connector-key`, for example
/// `systemd-run -p LoadCredential=connector-key:<key file> ...`.
@ -8285,6 +8289,8 @@ mod tests {
)
.expect("the port opens");
let stamp = unix_ms().unwrap();
let model_a = std::env::var("GHOSTLIGHT_LIVE_MODEL_A").expect("GHOSTLIGHT_LIVE_MODEL_A names a model id");
let model_b = std::env::var("GHOSTLIGHT_LIVE_MODEL_B").expect("GHOSTLIGHT_LIVE_MODEL_B names a model id");
let build = |label: &str, model: &str, edit: &dyn Fn(&mut ProviderRequest)| {
let mut provider = ProviderRequest::new(
format!("live-{label}-{stamp}"),
@ -8322,12 +8328,12 @@ mod tests {
);
};
let cases = [
build("plain", "claude-haiku-5-5", &|_| {}),
build("tool", "claude-haiku-5-5", &tool),
build("schema", "claude-haiku-5-5", &schema),
build("sonnet", "claude-sonnet-5-5", &|_| {}),
build("plain", &model_a, &|_| {}),
build("tool", &model_a, &tool),
build("schema", &model_a, &schema),
build("second", &model_b, &|_| {}),
];
for (label, request) in ["plain", "tool", "schema", "sonnet"].into_iter().zip(cases) {
for (label, request) in ["plain", "tool", "schema", "second"].into_iter().zip(cases) {
let prepared = port.prepare(request).expect("the request prepares");
let output = port.infer(prepared).await.unwrap_or_else(|fault| {
panic!("{label}: the connector faulted: {fault:?}");
@ -11712,7 +11718,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur
operational_request(
command_id,
0,
"claude-opus-5",
TEST_LANE_MODEL,
&granted,
vec![InputItem::UserText {
text: "Hold the bridge.".into(),
@ -11748,7 +11754,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur
text: "Hold the bridge.".into(),
}]
};
let model = "claude-opus-5";
let model = TEST_LANE_MODEL;
assert!(
canonical_model(model),
"the SDK-routed model is not a canonical controller model"
@ -11835,7 +11841,7 @@ assert!(projector_text.contains("I ask about the hinge."), "the player's own tur
else {
panic!("an empty interpreter transcript finalized")
};
let request = interpreter_request(command_id, 0, "claude-opus-5", conversation).unwrap();
let request = interpreter_request(command_id, 0, TEST_LANE_MODEL, conversation).unwrap();
let work = ControllerWork::Narrative(NarrativeCheckpoint::InterpreterInFlight {
command_id,
turn: turn.clone(),

View file

@ -44,21 +44,21 @@ required_environment = [
"GAMECULT_IDUNN_RUNTIME_BUNDLE",
"GHOSTLIGHT_CONNECTOR_ADDR",
"GHOSTLIGHT_CONNECTOR_KEY_FILE",
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
"GHOSTLIGHT_HEIMDALL_APP_SECRET_FILE",
"GHOSTLIGHT_HEIMDALL_BASE_URL",
"GHOSTLIGHT_ODIN_RUDP",
"GHOSTLIGHT_PLAY_MODEL",
"GHOSTLIGHT_PUBLIC_APP_URL",
"GHOSTLIGHT_SESSION_WRAPPING_KEY_FILE",
]
optional_environment = [
"GHOSTLIGHT_AUTH_PROVIDERS",
"GHOSTLIGHT_CONTROLLER_ELABORATOR_MODEL",
"GHOSTLIGHT_CONTROLLER_INTERPRETER_MODEL",
"GHOSTLIGHT_CONTROLLER_MAX_CONCURRENT",
"GHOSTLIGHT_CONTROLLER_OPERATIONAL_MODEL",
"GHOSTLIGHT_CONTROLLER_PERSONA_MODEL",
"GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL",
"GHOSTLIGHT_PLAY_MODEL",
"RUST_LOG",
]

View file

@ -511,7 +511,9 @@ draws from it yet, and runtime readiness reads it. Changing it is a restart.
The five
controller models are configuration too (`GHOSTLIGHT_CONTROLLER_PROJECTOR_MODEL`,
`_PERSONA_MODEL`, `_INTERPRETER_MODEL`, `_OPERATIONAL_MODEL`,
`_ELABORATOR_MODEL`), each with a default when absent.
`_ELABORATOR_MODEL`, and `GHOSTLIGHT_PLAY_MODEL` for the play table), each
required: the deployment names the exact model id and an unset lane refuses
startup.
The kernel commits one decision at a time through the mailbox. After each
commit the planner derives a fresh queue. Parallel inference may speculate on