diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prompt/view.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prompt/view.rs index 697701f07b..638d835d38 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prompt/view.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prompt/view.rs @@ -24,34 +24,18 @@ impl LlmDeliberationFaculty { self.prompt_view_with_feedback(ws, window, calibration) } - /// The window her prompt is fitted to: the working window - /// ([`crate::cognition::context_budget::ContextBudget::working_window`]), narrowed by the - /// provider's last observation. The binding keeps the served window: serving reads it. + /// The window her prompt is fitted to: her served slot, which the serving plan computes on + /// her node from that engine's measured KV capacity and memory, narrowed by the provider's + /// last observation. No machine's number stands in for it: a knee replayed on one box's + /// captures (49,152, the M5, 2026-10-28) was that box's constant on every other. pub fn prompt_fit(&self, binding: &ModelBinding) -> (u32, PromptCalibration) { - self.fit_within(binding, crate::cognition::context_budget::ContextBudget::working_window(binding.context_window)) - } - - /// The served window, narrowed the same way: the one rebuild when her required input - /// cannot fit the working window (`verdict/contribute.rs`), so a large required payload is - /// served from the whole slot instead of refused. - pub fn prompt_fit_served(&self, binding: &ModelBinding) -> (u32, PromptCalibration) { - self.fit_within(binding, binding.context_window) - } - - fn fit_within(&self, binding: &ModelBinding, window: u32) -> (u32, PromptCalibration) { let feedback = self.prompt_feedback.load(); feedback.as_ref().filter(|f| f.applies_to(binding)).map_or( - (window, PromptCalibration::default()), - |f| (window.min(f.available), f.calibration), + (binding.context_window, PromptCalibration::default()), + |f| (binding.context_window.min(f.available), f.calibration), ) } - /// The working window for this faculty's current binding: the shares sized from the - /// window (results, room updates, the tool surface) scale with the prompt they live in. - pub(in super::super) fn working_window(&self) -> u32 { - crate::cognition::context_budget::ContextBudget::working_window(self.binding.load().context_window) - } - /// Fixture view against an explicit window, without a prior provider observation. #[cfg(any(test, feature = "test-fixtures"))] pub fn prompt_view_within(&self, ws: &Workspace, context_window: u32) -> DeliberationPromptView { diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tool_surface.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tool_surface.rs index d1df36d585..68bac77a59 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tool_surface.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tool_surface.rs @@ -165,7 +165,7 @@ impl LlmDeliberationFaculty { if self.surface.registry().is_empty() { return; // no hands offered — nothing to fit, nothing to warn about } - let window = self.working_window(); + let window = self.binding.load().context_window; let needed = self.min_window_for_agentic_surface(); if window >= needed { return; diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/verdict/contribute.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/verdict/contribute.rs index 6c0da5af2b..e33ecd0755 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/verdict/contribute.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/verdict/contribute.rs @@ -144,23 +144,6 @@ impl LlmDeliberationFaculty { return Some(Contribution::deliberation_fault(fault.clone())); } if let Some(error) = view.capacity_error { - // Required input past the WORKING window is served from the whole slot, once, - // never refused while the slot has room (`ContextBudget::working_window`). - let (served_fit, served_calibration) = self.prompt_fit_served(&binding); - if served_fit > fit_window { - continuum_base::probe!( - class = "delib.prompt.working_window_exceeded", - persona = %self.persona_name, - required_tokens = error.required_tokens, - working_window = fit_window, - served_window = served_fit, - "required input exceeds the working window: this act is fitted to the served window instead" - ); - fit_window = served_fit; - calibration = served_calibration; - view = self.prompt_view_with_visual_feedback(ws, fit_window, calibration, visual.as_ref()); - continue; - } continuum_base::probe!( class = "delib.prompt.capacity", persona = %self.persona_name, diff --git a/core/continuum-prompt/src/context_budget.rs b/core/continuum-prompt/src/context_budget.rs index 2efccafa0c..5a6b215df0 100644 --- a/core/continuum-prompt/src/context_budget.rs +++ b/core/continuum-prompt/src/context_budget.rs @@ -115,26 +115,6 @@ impl ContextBudget { } } - /// The window her prompt is fitted to: the knee the dyno measured in her own traffic, never - /// above the served slot. Stable by construction: it does not move with load, so it never - /// turns an epoch over mid-flight. - /// - /// Why a token count from the dyno and not a rate: the knee is where a smaller window's - /// turnovers start to cost more than the smaller context saves, and it is counted in - /// tokens of her own requests, so it does not depend on how fast the engine is. A rate - /// does, and moves with load. Deriving the window from the live prefill-rate EMA - /// (f45f090a6, M5 2026-10-28) moved it 48k -> 40k -> 32k as contention lowered the rate, - /// refused Aris twice at 32k and turned epochs over 74 times in 37 minutes. Rolled back. - /// - /// Measured 2026-10-28 (continuum-context replay --append-tail over all four residents' - /// captures, `~/.continuum/evidence/2026-10-28-working-window/`): at 48k, prefill per - /// request fell ~3x (Benchy 110 -> 41 s, Aiko 81 -> 24, Aris 113 -> 33, Atlas 94 -> 20) - /// with zero handles dropped; 32k doubled turnovers. Re-measure by rerunning the replay; - /// the act inspector tracking the knee continuously is the next step. - pub fn working_window(served: u32) -> u32 { - Self::working_window_when(served, continuum_engine::inference::llama_server::current_serving().active_model.is_some()) - } - /// The served window only — the KV-capacity reading, for seams that must not be /// prefill-bounded (a test fixture, a capacity report). pub fn from_window_unbounded(context_window: u32) -> Self { @@ -311,22 +291,6 @@ fn prefill_affordable_window_for(served: u32, audience: continuum_engine::infere affordable } -/// The working window's measured knee, in tokens (see [`Self::working_window`]). -// derived-or-floor: derived — the dyno's knee over the M5 residents' own captures, 2026-10-28 -// (~/.continuum/evidence/2026-10-28-working-window/): 48k cut prefill per request ~3x with -// zero handles dropped; 32k doubled turnovers; 64k kept 1.5-2x more prefill. -const WORKING_WINDOW_TOKENS: u32 = 49_152; - -/// PURE: the working window for a served slot of `served` tokens, when a model is `serving`: the -/// measured knee, never above the slot. With nothing served (a fixture) it is the served window. -fn working_window_when(served: u32, serving: bool) -> u32 { - if served == 0 || !serving { - return served; - } - Self::WORKING_WINDOW_TOKENS.min(served) -} - - /// Whether a window is known: every bound below is a real number, not "no bound". pub fn is_known(&self) -> bool { self.total_chars.is_some() @@ -604,15 +568,4 @@ mod tests { assert_eq!(b.trail_head_chars(), usize::MAX); } - // what this catches: a working window that moves with load (f45f090a6 shrank it 48k -> - // 32k under contention and refused a resident) or exceeds the slot. With no served model - // (every test) it is the served window, as before. - #[test] - fn the_working_window_is_the_measured_knee_and_never_exceeds_the_slot() { - assert_eq!(ContextBudget::working_window_when(159_232, true), 49_152, "serving a wide slot: the measured knee"); - assert_eq!(ContextBudget::working_window_when(32_768, true), 32_768, "never above the slot"); - assert_eq!(ContextBudget::working_window_when(159_232, false), 159_232, "nothing served (a fixture): the served window"); - assert_eq!(ContextBudget::working_window_when(0, true), 0); - assert_eq!(ContextBudget::working_window(159_232), 159_232, "no served model in a test: the served window"); - } }