diff --git a/core/continuum-cognition/src/cognition/persona_workspace.rs b/core/continuum-cognition/src/cognition/persona_workspace.rs index c09f648cef..57658e32a1 100644 --- a/core/continuum-cognition/src/cognition/persona_workspace.rs +++ b/core/continuum-cognition/src/cognition/persona_workspace.rs @@ -44,6 +44,7 @@ use crate::cognition::rag_budget::RagSource; pub mod checkpoint_adoption; mod rehome; +pub use rehome::RehomeReason; pub use crate::cognition::handoff::SaveReason; diff --git a/core/continuum-cognition/src/cognition/persona_workspace/rehome.rs b/core/continuum-cognition/src/cognition/persona_workspace/rehome.rs index 3acadab858..68ab95e9a4 100644 --- a/core/continuum-cognition/src/cognition/persona_workspace/rehome.rs +++ b/core/continuum-cognition/src/cognition/persona_workspace/rehome.rs @@ -1,6 +1,9 @@ -//! Serving-edge model binding updates for registered residents. +//! Serving-edge model binding updates for registered residents: every LOCAL resident is +//! bound to exactly what serving reports (model AND window), corrected per persona. use super::PersonaWorkspaceRegistry; use crate::ai::adapter::AIProviderAdapter; +use crate::cognition::llm_deliberation_faculty::ModelBinding; +use std::collections::HashMap; use std::sync::Arc; use uuid::Uuid; @@ -10,55 +13,110 @@ enum Assignment { Unreadable, } +/// Why a local resident's binding moves to the served one. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RehomeReason { + /// Serving reports a different model: a new shared adapter is required. + ModelChanged, + /// Same model, a different served window (a resident materialized before the + /// snapshot was ready keeps her provisional window until this corrects it). + WindowChanged, +} + +impl RehomeReason { + fn of(binding: &ModelBinding, model: &str, context_window: u32) -> Option { + if binding.requested_model() != model { + Some(Self::ModelChanged) + } else if binding.context_window != context_window { + Some(Self::WindowChanged) + } else { + None + } + } + + fn as_str(self) -> &'static str { + match self { + Self::ModelChanged => "model_changed", + Self::WindowChanged => "window_changed", + } + } +} + impl PersonaWorkspaceRegistry { - /// Re-home EVERY resident persona onto a newly served model — atomically swap - /// the shared {adapter, model, context_window} binding on each cycle (see - /// [`crate::cognition::workspace::WorkspaceCycle::rebind_model`]). On a single-serve host ALL personas share - /// the ONE served model (INFERENCE-LANES-REALISTIC: "one base model, N persona - /// lanes"), so a served-model change re-homes them together through the ONE - /// shared `adapter` — no per-persona HTTP init. Each mind's genome + working - /// memory + admission + hippocampus are UNTOUCHED (flip-in-place, not rebuild): - /// the same continuous personas now deliberate through the new model. Returns - /// how many minds were re-homed. Driven by the serving-snapshot reconciler - /// (`ipc/mod.rs`) ONLY on an actual model change. The store is a wait-free - /// `ArcSwap` under the cycles lock — NO await held across it. - /// See [[seamless-persona-failover-model-and-genome]]. + /// The assignment of every registered resident, read once. A citizen whose brain is + /// assigned OFF-BOX keeps her remote binding: the local lane coming up is not her + /// model changing (card 1d2f65e7 slice 2). + fn assignments_at(&self, root: &std::path::Path) -> HashMap { + let templates = self.templates.lock(); + templates + .iter() + .map(|(id, cfg)| { + let assignment = match crate::cognition::extensions::is_remote_bound(root, &cfg.persona_name) { + Ok(false) => Assignment::Local, + Ok(true) => Assignment::Remote, + Err(error) => { + tracing::error!(persona = %cfg.persona_name, %error, "re-home refused: preserving current binding"); + Assignment::Unreadable + } + }; + (*id, assignment) + }) + .collect() + } + + /// What the served `(model, context_window)` asks of the local residents: `None` when + /// every one is already bound to it (the steady-state tick is free), + /// `Some(ModelChanged)` when any needs the new model (the caller builds ONE shared + /// adapter), else `Some(WindowChanged)` (each keeps her adapter). + pub fn rehome_reason_at( + &self, + root: &std::path::Path, + model: &str, + context_window: u32, + ) -> Option { + let assignments = self.assignments_at(root); + let cycles = self.cycles.lock(); + cycles + .iter() + .filter(|(id, _)| matches!(assignments.get(*id), Some(Assignment::Local))) + .filter_map(|(_, entry)| entry.cycle.current_binding()) + .filter_map(|binding| RehomeReason::of(&binding, model, context_window)) + .max_by_key(|reason| *reason == RehomeReason::ModelChanged) + } + + /// [`rehome_reason_at`](Self::rehome_reason_at) under this process's continuum root. + pub fn rehome_reason(&self, model: &str, context_window: u32) -> Option { + self.rehome_reason_at(&crate::paths::continuum_root(), model, context_window) + } + + /// Bind EVERY local resident to the served `(model, context_window)` — atomically + /// swapping the shared {adapter, model, context_window} binding on each cycle (see + /// [`crate::cognition::workspace::WorkspaceCycle::rebind_model`]). A resident already + /// bound to it is untouched. A model change rebinds through the ONE shared `adapter` + /// (no per-persona HTTP init; INFERENCE-LANES-REALISTIC: one base model, N persona + /// lanes); a window-only change keeps her own adapter and moves the window. Genome, + /// working memory, admission and hippocampus are UNTOUCHED (flip-in-place). Returns + /// how many minds were rebound. Driven by the serving-snapshot reconciler on every + /// ready snapshot. The store is a wait-free `ArcSwap` under the cycles lock — NO + /// await held across it. See [[seamless-persona-failover-model-and-genome]]. pub fn re_home_all_at( &self, root: &std::path::Path, - adapter: Arc, - model: Option, + adapter: Option>, + model: &str, context_window: u32, ) -> usize { - // A citizen whose brain is assigned OFF-BOX keeps her remote binding: the - // local lane coming up is not her model changing (card 1d2f65e7 slice 2). - let assignments: std::collections::HashMap = { - let templates = self.templates.lock(); - templates - .iter() - .map(|(id, cfg)| { - let assignment = match crate::cognition::extensions::is_remote_bound(root, &cfg.persona_name) { - Ok(false) => Assignment::Local, - Ok(true) => Assignment::Remote, - Err(error) => { - tracing::error!(persona = %cfg.persona_name, %error, "re-home refused: preserving current binding"); - Assignment::Unreadable - } - }; - (*id, assignment) - }) - .collect() - }; + let assignments = self.assignments_at(root); let cycles = self.cycles.lock(); let mut rehomed = 0usize; for (id, entry) in cycles.iter() { - let reason = match assignments.get(id) { + let kept = match assignments.get(id) { Some(Assignment::Local) => None, Some(Assignment::Remote) => Some("remote"), Some(Assignment::Unreadable) => Some("unreadable"), None => Some("missing_template"), }; - if let Some(reason) = reason { + if let Some(reason) = kept { continuum_base::probe!( class = "persona.rehome.kept_binding", persona_id = %id, @@ -67,16 +125,57 @@ impl PersonaWorkspaceRegistry { ); continue; } - entry - .cycle - .rebind_model(crate::cognition::llm_deliberation_faculty::ModelBinding { - adapter: Arc::clone(&adapter), - model: model.clone(), - context_window, - }); + let Some(current) = entry.cycle.current_binding() else { + continue; // no deliberation faculty shared a binding in: nothing to rebind. + }; + let Some(reason) = RehomeReason::of(¤t, model, context_window) else { + continue; + }; + let next_adapter = match (reason, &adapter) { + (RehomeReason::ModelChanged, Some(shared)) => Arc::clone(shared), + (RehomeReason::ModelChanged, None) => { + continuum_base::probe!( + class = "persona.rehome.kept_binding", + persona_id = %id, + reason = "model_changed_without_adapter", + "re-home skipped: the served model changed after the adapter decision; the next tick rebuilds it" + ); + continue; + } + (RehomeReason::WindowChanged, _) => Arc::clone(¤t.adapter), + }; + continuum_base::probe!( + class = "persona.rehome", + persona_id = %id, + reason = reason.as_str(), + old_model = %current.requested_model(), + new_model = %model, + old_window = current.context_window, + new_window = context_window, + "resident rebound to the served binding" + ); + entry.cycle.rebind_model(ModelBinding { + adapter: next_adapter, + model: Some(model.to_string()), + context_window, + }); rehomed += 1; } rehomed } -} + /// [`re_home_all_at`](Self::re_home_all_at) under this process's continuum root. + pub fn re_home_all( + &self, + adapter: Option>, + model: &str, + context_window: u32, + ) -> usize { + self.re_home_all_at( + &crate::paths::continuum_root(), + adapter, + model, + context_window, + ) + } +} diff --git a/core/continuum-cognition/src/cognition/persona_workspace/root_acting_workspace.rs b/core/continuum-cognition/src/cognition/persona_workspace/root_acting_workspace.rs index de866ea044..052b4479a7 100644 --- a/core/continuum-cognition/src/cognition/persona_workspace/root_acting_workspace.rs +++ b/core/continuum-cognition/src/cognition/persona_workspace/root_acting_workspace.rs @@ -632,21 +632,6 @@ impl PersonaWorkspaceRegistry { Some((Arc::clone(&cfg.admission), adapter, model)) } - /// Rebind verified local residents on a serving change; preserve remote or unreadable assignments. - pub fn re_home_all( - &self, - adapter: Arc, - model: Option, - context_window: u32, - ) -> usize { - self.re_home_all_at( - &crate::paths::continuum_root(), - adapter, - model, - context_window, - ) - } - /// How many persona minds are resident. pub fn len(&self) -> usize { self.cycles.lock().len() diff --git a/core/continuum-cognition/src/cognition/workspace/workspace_cycle.rs b/core/continuum-cognition/src/cognition/workspace/workspace_cycle.rs index 18ca42af9a..c6a7e808da 100644 --- a/core/continuum-cognition/src/cognition/workspace/workspace_cycle.rs +++ b/core/continuum-cognition/src/cognition/workspace/workspace_cycle.rs @@ -212,6 +212,13 @@ impl WorkspaceCycle { .map(|handle| handle.load().adapter.clone()) } + /// The whole live binding {adapter, model, window} as ONE read — what the re-home + /// owner compares against the served snapshot. `None` for a cycle with no + /// deliberation faculty. + pub fn current_binding(&self) -> Option> { + self.model_binding.as_ref().map(|handle| handle.load_full()) + } + /// The adapter AND the served-model id it must be asked for, as one read of /// the shared binding. Background regions must send BOTH: the model id /// selects the route/template on the serving side, and omitting it produced @@ -245,9 +252,8 @@ impl WorkspaceCycle { /// id the next generation asks for (`ModelBinding.model` doc: `None` → the /// adapter's default). This resolution matters live: the boot upstart binds /// `model: None` (the shared served adapter already carries the active model - /// as its default), and the re-home reconciler (`ipc/mod.rs`) adopts the - /// FIRST served model as baseline *without* a rebind — so on a stable host - /// the explicit id stays `None` forever. Reporting the raw field left every + /// as its default), and a binding stored without an explicit id keeps it + /// `None` until a re-home names one. Reporting the raw field left every /// live roster LOADOUT as "ctx only, no model name" (the tile regression this /// fixes). An adapter with an empty default resolves to honest-absent. pub fn model_loadout(&self) -> Option<(Option, u32)> { diff --git a/core/continuum-core/src/ipc/start_server/rehome_reconciler.rs b/core/continuum-core/src/ipc/start_server/rehome_reconciler.rs index 9e06b705be..54acc50cc6 100644 --- a/core/continuum-core/src/ipc/start_server/rehome_reconciler.rs +++ b/core/continuum-core/src/ipc/start_server/rehome_reconciler.rs @@ -3,43 +3,38 @@ use super::*; // ── Served-model re-home reconciler ───────────────────────────────────── -// The base-model sibling of LoRA/genome paging: when the serving daemon -// publishes a NEW active model — a `serving/pin`, a re-plan under memory -// pressure, or a grid failover — every ALREADY-hosted persona's deliberation -// must rebind to it (new shared adapter + new served context window) WITHOUT -// losing the genome, working memory, or admission it accumulated. This task -// owns the serving-SNAPSHOT watch and drives `re_home_all` on an ACTUAL model -// change — the seam that turns `serving/pin ` into a no-reboot, -// coherent model-sweep lever AND delivers portable-self live re-home. +// The base-model sibling of LoRA/genome paging. The serving snapshot is the ONE +// owner of "the binding a local persona deliberates through": its active model +// AND its served context window. This task owns the serving-SNAPSHOT watch and, +// on every ready snapshot, binds every local resident to exactly that pair — +// WITHOUT losing the genome, working memory, or admission she accumulated. That +// covers a `serving/pin`, a re-plan under memory pressure, a grid failover, AND a +// resident materialized before serving was ready: she was bound to her +// provisional window (2048), and the first ready snapshot corrects it (the M5, +// 2026-10-29: all four residents sat at ctx_len=2048 for the whole deploy because +// this task adopted the first ready model as a baseline and keyed only on the +// model name, so working memory discarded every result body past ~4k chars). // // Distinct from the boot spawn loop above (which reacts to the serving PLAN to // FIRST-host personas): this reacts to the serving SNAPSHOT to re-home // ALREADY-hosted personas. Both are the canonical concurrent-concern shape — // own task, `watch` receiver, no lock across await, log-and-continue, exit on -// watch close. The swap itself is wait-free (`ArcSwap` store under the cycles -// lock); the only cost per model edge is ONE shared adapter HTTP-init, reused -// by every persona lane. See [[seamless-persona-failover-model-and-genome]]. +// watch close. The comparison is per persona inside the workspace owner, so a +// steady-state tick touches nobody; a shared adapter is built only when some +// resident needs the new MODEL (one HTTP init, shared by every lane); a +// window-only correction keeps each resident's adapter. +// See [[seamless-persona-failover-model-and-genome]]. pub(super) fn spawn_rehome_reconciler( rt_handle: &tokio::runtime::Handle, serving_daemon: &Arc, ) { let mut serving_rx = serving_daemon.subscribe_serving(); rt_handle.spawn(async move { - // The model live personas are currently bound to. `None` until the - // first ready snapshot: boot binds personas via the upstart factory, - // so the FIRST ready model is NOT a re-home (they spawn already bound - // to it). We adopt it as the baseline without re-homing, and re-home - // only on a SUBSEQUENT change — avoiding a wasteful boot-time adapter - // rebuild + redundant swap. - let mut bound: Option = None; // LEVEL-TRIGGERED retry (#368): edge-only waking is how 4 citizens // stayed stranded on a torn-down model for 47 minutes — the adapter - // build failed ONCE during a wedge window, the "retry on the next - // snapshot edge" never came (the snapshot had already settled and - // never republished), and `bound != active` sat unreconciled forever. - // The interval turns that residual mismatch into a retried one: each - // tick re-reads the CURRENT snapshot, and the `bound == active` fast - // path below makes the steady-state tick free. + // build failed ONCE during a wedge window and the snapshot never + // republished. Each tick re-reads the CURRENT snapshot; a resident + // already bound to it costs nothing. let mut retry = tokio::time::interval(std::time::Duration::from_secs(30)); retry.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); loop { @@ -58,51 +53,46 @@ pub(super) fn spawn_rehome_reconciler( _ = retry.tick() => {} } let snap = serving_rx.borrow_and_update().clone(); - if !snap.ready { - continue; + if !snap.ready || snap.served_context_window == 0 { + continue; // a ready snapshot always carries its window; anything else is not yet served. } let Some(active) = snap.active_model.clone() else { continue; }; - if bound.as_deref() == Some(active.as_str()) { - continue; // same model already bound — nothing to re-home. - } - if bound.is_none() { - // The boot upstart already bound (or will bind) personas to - // this first served model; adopt it as the baseline. - bound = Some(active); - continue; - } - // Build the ONE shared served-model adapter for this edge (HTTP - // init once, shared by every persona lane). Fail LOUD into a log — - // a failed re-home leaves personas on their prior (still-live) - // binding rather than a silent wrong-brain, and retries on the - // next snapshot edge ([[fallbacks-are-illegal-fail-loud]]). - let adapter = match crate::persona::supervisor::build_served_adapter(&snap).await { - Ok(a) => a, - Err(e) => { - tracing::warn!( - model = %active, - error = %e, - "served-model re-home: adapter build failed — personas stay \ - on their prior binding; will retry on the next snapshot edge" - ); - continue; + let window = snap.served_context_window; + let workspaces = crate::cognition::persona_workspace::global(); + let Some(reason) = workspaces.rehome_reason(&active, window) else { + continue; // every local resident is already bound to (model, window). + }; + // A new model needs the ONE shared served-model adapter. Fail LOUD into + // a log — a failed build leaves residents on their prior (still-live) + // binding rather than a silent wrong-brain, and the next tick retries + // ([[fallbacks-are-illegal-fail-loud]]). + let adapter = match reason { + crate::cognition::persona_workspace::RehomeReason::WindowChanged => None, + crate::cognition::persona_workspace::RehomeReason::ModelChanged => { + match crate::persona::supervisor::build_served_adapter(&snap).await { + Ok(a) => Some(a), + Err(e) => { + tracing::warn!( + model = %active, + error = %e, + "served-model re-home: adapter build failed — personas stay \ + on their prior binding; the next tick retries" + ); + continue; + } + } } }; - let n = crate::cognition::persona_workspace::global().re_home_all( - adapter, - Some(active.clone()), - snap.served_context_window, - ); - continuum_base::probe!( - class = "persona.rehome", + let n = workspaces.re_home_all(adapter, &active, window); + tracing::info!( model = %active, - context_window = snap.served_context_window, + context_window = window, personas = n, - "served model changed — re-homed live personas onto the new binding" + ?reason, + "re-homed local residents onto the served binding" ); - bound = Some(active); } }); } diff --git a/core/continuum-core/src/test_env/mind_integration/remote_lane.rs b/core/continuum-core/src/test_env/mind_integration/remote_lane.rs index 1b7504b086..00cfa5d2a4 100644 --- a/core/continuum-core/src/test_env/mind_integration/remote_lane.rs +++ b/core/continuum-core/src/test_env/mind_integration/remote_lane.rs @@ -58,7 +58,7 @@ async fn rehome_requires_a_readable_local_assignment() { let _native = crate::paths::NativeHomeOverride::install(root.path()); let registry = PersonaWorkspaceRegistry::new(); let id = Uuid::new_v4(); - let cycle = registry.register_from_cfg(cfg_for(id)).expect("resident"); + let cycle = registry.register_from_cfg(cfg_for(id, "Ivar")).expect("resident"); let (original, original_model) = cycle.current_model_route().expect("binding"); let airc = crate::identity::citizen_path::citizen_home_path(root.path(), crate::identity::IdentityKind::Persona, None, "Ivar"); let home = crate::cognition::home::PersonaHome::from_root(airc.parent().expect("parent").to_path_buf()); @@ -67,24 +67,62 @@ async fn rehome_requires_a_readable_local_assignment() { let replacement: Arc = Arc::new(HeuristicInferenceAdapter::new()); for corrupt in [false, true] { if corrupt { std::fs::write(home.model_override_json(), b"{").expect("corrupt"); } - assert_eq!(registry.re_home_all_at(root.path(), replacement.clone(), Some("new/local".into()), 4096), 0); + assert_eq!(registry.re_home_all_at(root.path(), Some(replacement.clone()), "new/local", 4096), 0); let (actual, model) = cycle.current_model_route().expect("preserved"); assert!(Arc::ptr_eq(&original, &actual)); assert_eq!(model, original_model); } PersonaModelOverride::new("local/model", None, 2).write(&home).expect("local override"); - assert_eq!(registry.re_home_all_at(root.path(), replacement.clone(), Some("new/local".into()), 4096), 1); + assert_eq!(registry.re_home_all_at(root.path(), Some(replacement.clone()), "new/local", 4096), 1); let (actual, model) = cycle.current_model_route().expect("rebound"); assert!(Arc::ptr_eq(&replacement, &actual)); assert_eq!(model.as_deref(), Some("new/local")); } +// what this catches (the M5, 2026-10-29, core 83c000606): residents materialized while the +// engine was still loading kept their provisional 2048 window, and the reconciler keyed +// only on the model name, so the first ready snapshot never corrected it; working memory +// budgeted 2048*4 chars and discarded every result body past ~4k. The served window alone +// must rebind a local resident (same model, her own adapter), a resident already bound to +// (model, window) must cost nothing, and an off-box resident must keep her binding. +#[tokio::test] +async fn a_resident_bound_at_the_provisional_window_is_rehomed_to_the_served_window() { + use crate::cognition::persona_workspace::RehomeReason; + crate::persona::cognition_extensions::install(); + let root = tempfile::tempdir().expect("root"); + let _native = crate::paths::NativeHomeOverride::install(root.path()); + let registry = PersonaWorkspaceRegistry::new(); + let local = registry.register_from_cfg(cfg_for(Uuid::new_v4(), "Aiko")).expect("local resident"); + let remote = registry.register_from_cfg(cfg_for(Uuid::new_v4(), "Kira")).expect("remote resident"); + let airc = crate::identity::citizen_path::citizen_home_path(root.path(), crate::identity::IdentityKind::Persona, None, "Kira"); + let home = crate::cognition::home::PersonaHome::from_root(airc.parent().expect("parent").to_path_buf()); + PersonaModelOverride::new_remote("remote/model", None, 1, Uuid::new_v4().to_string()).write(&home).expect("remote override"); + let before = local.current_binding().expect("local binding"); + let remote_before = remote.current_binding().expect("remote binding"); + let model = before.requested_model().to_string(); + assert_eq!(before.context_window, crate::inference::planning::MIN_SERVE_CTX, "bound at the provisional window"); + let served = 60_672; + + assert_eq!(registry.rehome_reason_at(root.path(), &model, served), Some(RehomeReason::WindowChanged)); + assert_eq!(registry.re_home_all_at(root.path(), None, &model, served), 1, "only the local resident moves"); + let after = local.current_binding().expect("rebound"); + assert_eq!(after.context_window, served); + assert_eq!(after.requested_model(), model); + assert!(Arc::ptr_eq(&before.adapter, &after.adapter), "a window-only correction keeps her adapter"); + let remote_after = remote.current_binding().expect("remote kept"); + assert!(Arc::ptr_eq(&remote_before, &remote_after), "the off-box resident keeps her binding"); + + assert_eq!(registry.rehome_reason_at(root.path(), &model, served), None, "steady state needs nothing"); + assert_eq!(registry.re_home_all_at(root.path(), None, &model, served), 0, "already bound: untouched"); + assert!(Arc::ptr_eq(&after, &local.current_binding().expect("still bound")), "no store on a matching binding"); +} + /// A resident's brain config: the deterministic heuristic adapter, no grounding, no hands. -fn cfg_for(persona_id: uuid::Uuid) -> crate::cognition::persona_workspace::PersonaBrainConfig { +fn cfg_for(persona_id: uuid::Uuid, name: &str) -> crate::cognition::persona_workspace::PersonaBrainConfig { crate::cognition::persona_workspace::PersonaBrainConfig { persona_id, - persona_name: "Ivar".to_string(), - system_prompt: "You are Ivar, an engineer on the grid.".to_string(), + persona_name: name.to_string(), + system_prompt: format!("You are {name}, an engineer on the grid."), admission: crate::cognition::act_observe::test_support::admission(), adapter: std::sync::Arc::new(crate::ai::HeuristicInferenceAdapter::new()), capacity: None, diff --git a/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs b/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs index 54607aa7a5..f169349223 100644 --- a/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs +++ b/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs @@ -91,10 +91,14 @@ pub async fn materialize_adapters( } // Reconcile the persona's effective context window to the TRUTH the - // running gateway serves. `build_adapter` just awaited a READY serving - // snapshot, so `current_serving()` now carries the real per-slot window - // the daemon read from llama-server's own `/props` — the authoritative - // model metadata. The profile's window was provisionally set at spawn-plan + // running gateway serves. When the snapshot is ready, `current_serving()` + // carries the real per-slot window the daemon read from llama-server's own + // `/props` — the authoritative model metadata. It need NOT be ready here (a + // persona materialized while the engine is still loading after a deploy): + // she is then bound at the provisional window, and the served-model re-home + // reconciler (`ipc/start_server/rehome_reconciler.rs`) rebinds her to the + // served window on the first ready snapshot. That reconciler owns the + // correction; this pin only spares the first turns a wrong window. The profile's window was provisionally set at spawn-plan // time from the planner's `served_context_window`, which the daemon // RE-computes every tick against live memory and which drifts ABOVE the // running server's frozen, 256-padded slot. Budgeting a prompt to that @@ -157,7 +161,8 @@ pub async fn materialize_adapters( let snap = crate::inference::llama_server::current_serving(); // A ready snapshot always carries a real window (the daemon refuses to // publish ready with 0). Guard on both so a not-yet-ready/empty - // snapshot never clobbers the provisional window with 0. + // snapshot never clobbers the provisional window with 0; the re-home + // reconciler corrects the binding once serving is ready. if snap.ready && snap.served_context_window > 0 { if snap.served_context_window != profile.context_length { continuum_base::probe!(