From 3a14ccb1e427362fac152b5df107f6ff842933f3 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 14:17:39 -0600 Subject: [PATCH 1/5] Her request continues her last served response, and the warm pass that truncated her generated tokens is deleted Her request names itself (request_id) and the request whose response her engine holds as her newest (continues). Our fork (CambrianTech/llama.cpp#149) then serves it from her slot's tokens for that response (her reasoning and her call as she generated them) plus only what is new, instead of re-rendering her response without its reasoning and rewinding to a checkpoint to recompute it (the M5, 2026-11-17: a 2,048-token gap on every act). Inert until the pin includes #149: an engine that does not read the fields ignores them. The warm pass during her tool (prefill_during_tool) re-sent the prompt she was served, which truncated her generated tokens out of her KV; it is deleted. Her slot keeps her tokens; a slot another mind took is paged in by her real request, and becomes the 4.14 persona bind. CONTINUUM-ENGINE 4.14 slice (c). -271 +74 lines. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../dream_consolidation/distiller.rs | 1 + .../cognition/generate_recipe/orchestrator.rs | 1 + .../src/cognition/generate_response.rs | 1 + .../src/cognition/llm_deliberation_faculty.rs | 9 +- .../prefill_during_tool.rs | 193 ------------------ .../llm_deliberation_faculty/request.rs | 6 + .../tests/verdicts/mod.rs | 1 - .../tests/verdicts/prefill_during_tool.rs | 70 ------- .../verdict/contribute.rs | 2 - .../cognition/rate_proposals/orchestrator.rs | 1 + .../src/cognition/should_respond.rs | 1 + .../src/cognition/validate_response.rs | 1 + .../src/ai/heuristic_adapter.rs | 1 + core/continuum-engine/src/ai/types.rs | 7 + .../inference/airc_remote/adapter/tests.rs | 1 + .../src/inference/airc_remote/protocol.rs | 1 + .../inference/airc_remote/transport/tests.rs | 1 + .../src/inference/handle_module/tests.rs | 1 + .../src/inference/handle_store.rs | 1 + .../src/inference/llamacpp_adapter.rs | 1 + .../src/inference/llamacpp_adapter/tests.rs | 2 + .../src/inference/llm_module_service.rs | 1 + .../src/inference/request_body.rs | 28 +++ core/continuum-genome/src/genome/teach.rs | 1 + .../continuum-mind/src/persona/rag_inspect.rs | 1 + core/continuum-models/src/commands/try_.rs | 2 + .../typescript/ai/TextGenerationRequest.ts | 9 +- 27 files changed, 74 insertions(+), 271 deletions(-) delete mode 100644 core/continuum-cognition/src/cognition/llm_deliberation_faculty/prefill_during_tool.rs delete mode 100644 core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/prefill_during_tool.rs diff --git a/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs b/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs index 0ee3988f86..2115415b4e 100644 --- a/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs +++ b/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs @@ -343,6 +343,7 @@ impl SemanticDistiller { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: Some(DistilledLesson::format(listed)?), active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs b/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs index 71b2a5e049..0569f7e073 100644 --- a/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs +++ b/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs @@ -135,6 +135,7 @@ pub async fn generate_recipe_with_ai( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/generate_response.rs b/core/continuum-cognition/src/cognition/generate_response.rs index 94eb36c0e4..9c527cea5b 100644 --- a/core/continuum-cognition/src/cognition/generate_response.rs +++ b/core/continuum-cognition/src/cognition/generate_response.rs @@ -396,6 +396,7 @@ pub fn build_response_generation_request( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, // Local Qwen takes plain text; no JSON-mode constraint here. response_format: Some(ResponseFormat::Text), diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs index 48028fdd24..5ccfce739c 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs @@ -103,7 +103,6 @@ mod read_receipt; pub use read_receipt::ReadReceipt; use self::reply_claim::*; mod verdict; -mod prefill_during_tool; mod tool_surface; use super::tool_surface::{SelectedSurface, ToolSurface}; @@ -239,8 +238,10 @@ pub struct LlmDeliberationFaculty { held_blocks: parking_lot::Mutex>, /// A measurement fork's (`fork_eval_cycle`): its turns warm their own page, never hers. forked: bool, - /// Her prompt, prefilled into her slot while her tool runs (`prefill_during_tool.rs`). - prefix_warm: prefill_during_tool::PendingPrefix, + /// The id of the request whose response her engine holds as her newest: her next request + /// continues it (`continues`), so her generated tokens are kept, never re-rendered and + /// recomputed (CONTINUUM-ENGINE 4.14). Set when a response is served, never by a refused attempt. + served_request: parking_lot::Mutex>, } impl LlmDeliberationFaculty { @@ -275,7 +276,7 @@ impl LlmDeliberationFaculty { held_blocks: parking_lot::Mutex::new(std::collections::HashMap::new()), reading: Default::default(), forked: false, - prefix_warm: Default::default(), + served_request: parking_lot::Mutex::new(None), } } diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prefill_during_tool.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prefill_during_tool.rs deleted file mode 100644 index 54b7accdd9..0000000000 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/prefill_during_tool.rs +++ /dev/null @@ -1,193 +0,0 @@ -//! Prefill during the tool (card 377d4afa; CONTINUUM-ENGINE.md 2.4: the act is a dependency graph, -//! independent passes overlap). -//! -//! When her act dispatches a tool, the prompt she just sent is already known, and her view only -//! appends within an epoch, so it is the head of her next prompt (replay of the M5 captures, -//! 2026-11-13: every tool continuation's prompt began with the whole previous one). The -//! [`WarmPrefix`] pass prefills it into her page's slot WHILE the tool runs, through the same -//! adapter path and admission as any of her turns: a one-token generation with the prompt cache on, -//! holding no serving lane (it is adapter-owned work) and waiting for a decode permit like any -//! request. Where her slot kept her KV, the engine finds it whole and the pass costs one token; -//! where another mind took the slot, the pass pages or prefills it back before her result lands. -//! -//! Her next generation subscribes to the pass's artifact, never a timer: settled ready, it starts -//! on a warm prefix and the probe credits the prefill that ran inside the tool; failed, abandoned -//! or superseded, she prefills as before and the probe says why. Her next generation asks only once -//! her tool's result is in her view, so a pass already settled then was warm before the result. - -use continuum_kernel::runtime::stage::{ - spawn_when_ready, Arrival, DependentStage, Inputs, Settled, Subscribes, TopicName, -}; - -use super::*; -use crate::ai::adapter::PromptCache; -use crate::ai::inference_error::InferenceError; -use crate::ai::types::{DispatchTerms, Think}; -use crate::inference::slots::PageKey; - -/// The artifact the warm pass produces and her next generation subscribes to. -const PREFIX_WARM: TopicName = TopicName("cognition/prefix.warm"); - -/// Her previous prompt, prefilled into her slot while her tool ran: the engine's own receipt. -#[derive(Debug)] -pub(super) struct PrefixWarm { - /// The prompt tokens the slot now holds for her (reused plus prefilled by the pass). - prefix_tokens: u32, - /// What the pass prefilled: zero when her slot had kept her KV. - prefill: std::time::Duration, -} - -/// Why the pass left nothing to credit: her next generation prefills as it always did. -#[derive(Debug)] -pub(super) enum PrefixMiss { - /// The engine refused or failed the pass. - Refused(InferenceError), - /// The engine answered without its timing receipt, so no warmth can be claimed. - Unmeasured, -} - -/// The warm pass. It depends on nothing but the dispatch that spawns it. -struct WarmPrefix { - adapter: Arc, - request: TextGenerationRequest, -} - -#[async_trait] -impl DependentStage for WarmPrefix { - type Inputs = (); - type Produces = PrefixWarm; - type Fails = PrefixMiss; - - fn produces(&self) -> TopicName { - PREFIX_WARM - } - - async fn run(self, _inputs: <() as Inputs>::Settled) -> Result { - let response = self - .adapter - .generate_under(self.request, DispatchTerms::thinking(Think::ModelDefault)) - .await - .map_err(PrefixMiss::Refused)?; - let timing = response.timing.ok_or(PrefixMiss::Unmeasured)?; - let prefill = std::time::Duration::try_from_secs_f64(timing.prefill_ms / 1000.0) - .map_err(|_| PrefixMiss::Unmeasured)?; - Ok(PrefixWarm { prefix_tokens: timing.cached_tokens.saturating_add(timing.prefill_tokens), prefill }) - } -} - -/// The pass in flight for her page, until her next generation takes it. -struct Warming { - page: PageKey, - warm: Subscribes, -} - -/// The faculty's one pending warm pass. -#[derive(Default)] -pub(super) struct PendingPrefix(parking_lot::Mutex>); - -/// Her next generation found no warmth to credit, and why. -fn missed(reason: &'static str, persona: &str) { - continuum_base::probe!( - class = "delib.prefill.during_tool.missed", - persona = %persona, - reason = reason, - "her prefix was not warmed during the tool: her next generation prefills it as before" - ); -} - -impl LlmDeliberationFaculty { - /// Her act dispatched its tool: warm the prompt she just sent (`template` with `view`'s messages) into - /// her page's slot while the tool runs. Never blocks the act; a newer pass supersedes an older - /// one nobody took. It names the same view end as her act (`view_messages`): a warm pass that - /// named none made the engine forget where her next prompt diverges, so her saved page dropped - /// that checkpoint and her next act re-prefilled from the head (the M5, 2026-11-16: 83 of 95 - /// view-end-less pages followed a warm pass; ~100k-token re-prefills). - pub(super) fn prefill_during_tool( - &self, - adapter: &Arc, - room: Uuid, - template: Option<&TextGenerationRequest>, - view: &DeliberationPromptView, - ) { - let (Some(page), Some(template), PromptCache::PinnedSlot) = (self.page(room), template, adapter.prompt_cache()) else { - return; - }; - let request = warm_request(template, &view.messages, view.resumes_at()); - let pass = WarmPrefix { adapter: Arc::clone(adapter), request }; - let warm = spawn_when_ready(pass, ()); - if self.prefix_warm.0.lock().replace(Warming { page, warm }).is_some() { - missed("superseded", &self.persona_name); - } - } - - /// Her next generation's subscription to the warm pass for `room`'s page: it starts when the - /// pass has settled, whatever it settled with. - pub(super) async fn prefix_warm_settled(&self, room: Uuid) { - let page = self.page(room); - let taken = { - let mut pending = self.prefix_warm.0.lock(); - let ours = pending.as_ref().is_some_and(|warming| Some(warming.page) == page); - if ours { pending.take() } else { None } - }; - let Some(mut warming) = taken else { - return; - }; - let met = warming.warm.settled().await; - match met.settled { - Settled::Ready(warm) => { - let (warmed_before_result, saved) = match met.arrival { - Arrival::AlreadySettled => (true, warm.prefill), - Arrival::WaitedFor(waited) => (false, warm.prefill.saturating_sub(waited)), - }; - continuum_base::probe!( - class = "delib.prefill.during_tool", - persona = %self.persona_name, - prefix_tokens = warm.prefix_tokens as u64, - warmed_before_result = warmed_before_result, - saved_ms = saved.as_millis() as u64, - "her prefix was prefilled while her tool ran" - ); - } - Settled::Failed(miss) => match &*miss { - PrefixMiss::Refused(error) => { - continuum_base::probe!( - class = "delib.prefill.during_tool.missed", - persona = %self.persona_name, - reason = "refused", - error = ?error, - "the engine refused her warm pass: her next generation prefills as before" - ); - } - PrefixMiss::Unmeasured => missed("unmeasured", &self.persona_name), - }, - Settled::Abandoned => missed("abandoned", &self.persona_name), - } - } -} - -/// The warm pass's request: her act's template and prompt, her act's view end, one token. -fn warm_request(template: &TextGenerationRequest, messages: &[ChatMessage], view_messages: Option) -> TextGenerationRequest { - let mut request = TextGenerationRequest::clone(template); - request.messages = messages.to_vec(); - request.view_messages = view_messages; - request.max_tokens = Some(1); - request.request_id = Some(Uuid::new_v4().to_string()); - request -} - -#[cfg(test)] -mod tests { - use super::*; - - // what this catches: the warm pass sending her prompt with no view end, which made the engine - // forget where her next prompt diverges (regression, the M5 2026-11-16: ~100k-token re-prefills) - #[test] - fn the_warm_pass_names_her_acts_view_end() { - let template = TextGenerationRequest { view_messages: None, max_tokens: Some(900), ..Default::default() }; - let messages = vec![ChatMessage::text("system", "s"), ChatMessage::text("user", "board"), ChatMessage::text("user", "pick")]; - let warm = warm_request(&template, &messages, Some(2)); - assert_eq!(warm.view_messages, Some(2), "the warm pass carries her act's view end"); - assert_eq!(warm.max_tokens, Some(1), "it decodes one token"); - assert_eq!(warm.messages.len(), 3, "it sends the prompt she just sent"); - } -} diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs index 9be772f3fb..d63dba7086 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs @@ -145,6 +145,9 @@ impl LlmDeliberationFaculty { .request_id .get_or_insert_with(|| Uuid::new_v4().to_string()) .clone(); + // Her engine holds her last served response: this request continues it, so her generated + // tokens stand for it and only what follows is new (CONTINUUM-ENGINE 4.14). + request.continues = self.served_request.lock().clone(); // How much of this prompt her previous request already held (card 5b09111e). crate::cognition::prompt_prefix::observe(self.persona_id, &request); // Stage the request for the reuse split (card 9e4d61e8); settled below on its result. @@ -282,6 +285,8 @@ impl LlmDeliberationFaculty { ); let receipt = match &gen_result { Ok(response) => { + // Her engine now holds this response: her next request continues it. + *self.served_request.lock() = Some(request_id.clone()); crate::ai::provenance::GenerationReceipt::from_response(request_id, response) } Err(error) => { @@ -389,6 +394,7 @@ impl LlmDeliberationFaculty { tools, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, // Page in the persona's current genome (wait-free read). Empty → None, diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/mod.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/mod.rs index 2b912a18a5..2fb0b876f2 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/mod.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/mod.rs @@ -13,4 +13,3 @@ mod act_output_room; mod unpriced_need; -mod prefill_during_tool; diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/prefill_during_tool.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/prefill_during_tool.rs deleted file mode 100644 index e6ec8f490b..0000000000 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/prefill_during_tool.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![cfg(test)] - -//! Prefill during the tool (`prefill_during_tool.rs`): her act warms the prompt she just sent -//! into her slot while the tool runs, and her next generation starts only once that warm pass -//! has settled. Event order only, never elapsed time. - -use super::*; - -fn act() -> TextGenerationResponse { - let call = ToolCall { id: "t1".to_string(), name: "code/read".to_string(), input: json!({ "path": "deploy.md" }) }; - make_response(FinishReason::ToolUse, "", Some(vec![call])) -} - -fn warmed() -> TextGenerationResponse { - let mut warm = make_response(FinishReason::Length, "", None); - warm.timing = Some(crate::ai::types::GenerationTiming { cached_tokens: 900, ..Default::default() }); - warm -} - -fn ivar(adapter: Arc) -> LlmDeliberationFaculty { - LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", adapter) - .with_tools(vec![read_tool()]) - .with_context_window(32_768) -} - -fn caching(responses: Vec) -> Arc { - Arc::new(ScriptedAdapter { prompt_cache: crate::ai::adapter::PromptCache::PinnedSlot, ..ScriptedAdapter::new(responses) }) -} - -// what this catches: the warm pass sending anything but the prompt she just sent (then the -// engine warms a prefix her next prompt does not begin with), and her next generation reaching -// the engine before the pass settled (then the two race for her slot and the pass buys nothing). -#[tokio::test] -async fn her_next_generation_starts_after_the_pass_warmed_the_prompt_she_sent() { - let adapter = caching(vec![act(), warmed(), make_response(FinishReason::Stop, "deploy.md says it landed", None)]); - let faculty = ivar(Arc::clone(&adapter)); - let ws = Workspace::new("teammate asks: did the deploy fix land?"); - let first = faculty.contribute(&ws).await.expect("verdict"); - assert!(matches!(first.decision, Some(Decision::Act { .. })), "her act dispatches the tool"); - faculty.contribute(&ws).await.expect("verdict"); - - let seen = adapter.seen.lock().expect("fixture request log"); - assert_eq!(seen.len(), 3, "her act, the warm pass, then her next generation"); - assert_eq!(seen[1].max_tokens, Some(1), "the pass only prefills"); - let sent = |at: usize| serde_json::to_value(&seen[at].messages).ok(); - assert_eq!(sent(1), sent(0), "the pass warms exactly the prompt she sent"); - assert_ne!(seen[2].max_tokens, Some(1), "her next generation came after the pass settled"); -} - -// what this catches: a failed pass that blocks or drops her next generation: she must prefill -// normally, and an adapter that keeps no prompt must never be sent a pass at all. -#[tokio::test] -async fn a_refused_pass_degrades_to_a_normal_prefill_and_no_cache_means_no_pass() { - let adapter = caching(vec![act(), make_response(FinishReason::Stop, "done", None)]); - *adapter.on_request.lock().expect("fixture hook") = Some(Box::new(|request: &TextGenerationRequest| { - (request.max_tokens == Some(1)).then(|| crate::ai::inference_error::InferenceError::Unavailable("engine refused the pass".into())) - })); - let faculty = ivar(Arc::clone(&adapter)); - let ws = Workspace::new("teammate asks: did the deploy fix land?"); - faculty.contribute(&ws).await.expect("verdict"); - let next = faculty.contribute(&ws).await.expect("her next generation still runs"); - assert!(next.decision.is_some(), "the refused pass cost her nothing but the pass"); - assert_eq!(adapter.call_count(), 3, "her act, the refused pass, her next generation"); - - let plain = Arc::new(ScriptedAdapter::new(vec![act(), make_response(FinishReason::Stop, "done", None)])); - let faculty = ivar(Arc::clone(&plain)); - faculty.contribute(&ws).await.expect("verdict"); - faculty.contribute(&ws).await.expect("verdict"); - assert_eq!(plain.call_count(), 2, "no prompt cache, no pass"); -} 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 63195c569f..2a2c0627f8 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 @@ -351,7 +351,6 @@ impl LlmDeliberationFaculty { // A rebuilt request with no max_tokens keeps the last one sent (the read of the // previous value is also what keeps the initializer honest). sent_allowance = request.max_tokens.or(sent_allowance); - self.prefix_warm_settled(ws.room_id).await; // her prefix, warmed while her last tool ran let result = self .generate_for_workspace(ws, &binding, fit_window, request, terms, allocation, receipts) .await?; @@ -841,7 +840,6 @@ impl LlmDeliberationFaculty { return Some(v); } if !calls.is_empty() { - self.prefill_during_tool(&binding.adapter, ws.room_id, request_template.as_ref(), &view); return Some(self.act_verdict(calls, &resp, ws.activity_room_id)); } } diff --git a/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs b/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs index d380bb7dcf..efe77dd1f7 100644 --- a/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs +++ b/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs @@ -110,6 +110,7 @@ pub async fn rate_proposals_with_ai( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/should_respond.rs b/core/continuum-cognition/src/cognition/should_respond.rs index 73afd9ad05..e6a5acccd9 100644 --- a/core/continuum-cognition/src/cognition/should_respond.rs +++ b/core/continuum-cognition/src/cognition/should_respond.rs @@ -215,6 +215,7 @@ pub async fn evaluate_gating( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: Some(ResponseFormat::JsonObject), active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/validate_response.rs b/core/continuum-cognition/src/cognition/validate_response.rs index fc5033dbfe..d78cabe6d0 100644 --- a/core/continuum-cognition/src/cognition/validate_response.rs +++ b/core/continuum-cognition/src/cognition/validate_response.rs @@ -241,6 +241,7 @@ fn build_validate_generation_request( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: Some(ResponseFormat::Text), active_adapters: None, diff --git a/core/continuum-engine/src/ai/heuristic_adapter.rs b/core/continuum-engine/src/ai/heuristic_adapter.rs index 55be95f456..9e380dd36d 100644 --- a/core/continuum-engine/src/ai/heuristic_adapter.rs +++ b/core/continuum-engine/src/ai/heuristic_adapter.rs @@ -607,6 +607,7 @@ mod tests { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/ai/types.rs b/core/continuum-engine/src/ai/types.rs index 721c610390..9de2166eb1 100644 --- a/core/continuum-engine/src/ai/types.rs +++ b/core/continuum-engine/src/ai/types.rs @@ -281,6 +281,13 @@ pub struct TextGenerationRequest { #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub view_messages: Option, + /// The `request_id` of the request whose response this one continues: a llama.cpp-family engine + /// serves it from the tokens her slot holds for that response (her reasoning and her call as she + /// generated them) plus only what is new, never re-rendering and recomputing them (CONTINUUM-ENGINE + /// 4.14). `None` when the request continues nothing. + #[serde(skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub continues: Option, #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub tool_choice: Option, diff --git a/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs b/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs index 03b3536419..cb936d6483 100644 --- a/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs +++ b/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs @@ -33,6 +33,7 @@ fn req(text: &str) -> TextGenerationRequest { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/airc_remote/protocol.rs b/core/continuum-engine/src/inference/airc_remote/protocol.rs index 567e15b29c..05bd3da235 100644 --- a/core/continuum-engine/src/inference/airc_remote/protocol.rs +++ b/core/continuum-engine/src/inference/airc_remote/protocol.rs @@ -208,6 +208,7 @@ mod tests { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/airc_remote/transport/tests.rs b/core/continuum-engine/src/inference/airc_remote/transport/tests.rs index 9253161b55..b104e0db98 100644 --- a/core/continuum-engine/src/inference/airc_remote/transport/tests.rs +++ b/core/continuum-engine/src/inference/airc_remote/transport/tests.rs @@ -101,6 +101,7 @@ fn req(text: &str) -> RemoteInferenceRequest { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/handle_module/tests.rs b/core/continuum-engine/src/inference/handle_module/tests.rs index 1a8a387bb9..64b3acee6f 100644 --- a/core/continuum-engine/src/inference/handle_module/tests.rs +++ b/core/continuum-engine/src/inference/handle_module/tests.rs @@ -29,6 +29,7 @@ fn empty_request() -> TextGenerationRequest { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/handle_store.rs b/core/continuum-engine/src/inference/handle_store.rs index 7e5f5ecb47..7c732f06d9 100644 --- a/core/continuum-engine/src/inference/handle_store.rs +++ b/core/continuum-engine/src/inference/handle_store.rs @@ -440,6 +440,7 @@ mod tests { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/llamacpp_adapter.rs b/core/continuum-engine/src/inference/llamacpp_adapter.rs index 210a1ed9c1..b48df1e307 100644 --- a/core/continuum-engine/src/inference/llamacpp_adapter.rs +++ b/core/continuum-engine/src/inference/llamacpp_adapter.rs @@ -286,6 +286,7 @@ impl AIProviderAdapter for LlamaCppAdapter { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs b/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs index 268873f984..ea3d23c88d 100644 --- a/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs +++ b/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs @@ -57,6 +57,7 @@ fn text_request(response_format: Option) -> TextGenerationReques tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format, active_adapters: None, @@ -289,6 +290,7 @@ async fn owned_gene_page_in_changes_output() { tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: Some(ResponseFormat::Text), active_adapters: adapters, diff --git a/core/continuum-engine/src/inference/llm_module_service.rs b/core/continuum-engine/src/inference/llm_module_service.rs index 0e900f5f84..3d4f84d43b 100644 --- a/core/continuum-engine/src/inference/llm_module_service.rs +++ b/core/continuum-engine/src/inference/llm_module_service.rs @@ -400,6 +400,7 @@ pub(super) async fn run_adapter_inference( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/request_body.rs b/core/continuum-engine/src/inference/request_body.rs index d9f5bfe852..e8d8836172 100644 --- a/core/continuum-engine/src/inference/request_body.rs +++ b/core/continuum-engine/src/inference/request_body.rs @@ -523,6 +523,17 @@ pub(crate) fn build_base_body( if let (true, Some(view_end)) = (cfg.llamacpp_sampling_extensions, view_end) { body["view_messages"] = json!(view_end); } + // Her request names itself, and the request whose response it continues: our fork serves it + // from the tokens her slot holds for that response plus only what is new, so her reasoning and + // her call are never re-rendered and recomputed (CONTINUUM-ENGINE 4.14). + if cfg.llamacpp_sampling_extensions { + if let Some(id) = &request.request_id { + body["request_id"] = json!(id); + } + if let Some(continues) = &request.continues { + body["continues"] = json!(continues); + } + } // max_tokens — the MODEL owns its generation length, enforced server-side // by llama.cpp / the cloud provider. We forward a ceiling ONLY @@ -722,6 +733,23 @@ mod tests { assert!(build_base_body(&gateway(false), &request, "m", true, true).get("view_messages").is_none()); } + // what this catches: her request not naming the response it continues, so our fork re-renders + // her reasoning and call and recomputes them every act (the M5, 2026-11-17: a 2,048-token + // checkpoint gap on every act), or a stock server sent fields it would reject. + #[test] + fn her_request_names_itself_and_the_response_it_continues() { + let request = TextGenerationRequest { + messages: vec![ChatMessage::text("user", "next")], + request_id: Some("act-2".into()), + continues: Some("act-1".into()), + ..Default::default() + }; + let ours = build_base_body(&gateway(true), &request, "m", true, true); + assert_eq!((ours["request_id"].clone(), ours["continues"].clone()), (json!("act-2"), json!("act-1"))); + let stock = build_base_body(&gateway(false), &request, "m", true, true); + assert!(stock.get("request_id").is_none() && stock.get("continues").is_none()); + } + // what this catches: a tail-loaded verb not reaching a llama.cpp-family server (she could // read its schema and never call it), the non-standard field going to a cloud provider // that rejects unknown fields, or a tail silently dropped (Codex on #5491). diff --git a/core/continuum-genome/src/genome/teach.rs b/core/continuum-genome/src/genome/teach.rs index a31ae9e458..e449d14030 100644 --- a/core/continuum-genome/src/genome/teach.rs +++ b/core/continuum-genome/src/genome/teach.rs @@ -135,6 +135,7 @@ pub async fn teacher_generate( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-mind/src/persona/rag_inspect.rs b/core/continuum-mind/src/persona/rag_inspect.rs index 199d4aa592..e070d211c7 100644 --- a/core/continuum-mind/src/persona/rag_inspect.rs +++ b/core/continuum-mind/src/persona/rag_inspect.rs @@ -454,6 +454,7 @@ async fn run_inference_probe( tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, // The substrate's cognition contract: JSON-grammar-constrained // output. LlamaCpp wires this to GBNF grammar so the sampler diff --git a/core/continuum-models/src/commands/try_.rs b/core/continuum-models/src/commands/try_.rs index 5ed4357029..c8e7a0638a 100644 --- a/core/continuum-models/src/commands/try_.rs +++ b/core/continuum-models/src/commands/try_.rs @@ -135,6 +135,7 @@ async fn run_text_probe(registry: &AdapterRegistry, model_id: &str) -> (bool, Op tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, @@ -213,6 +214,7 @@ async fn run_vision_probe(registry: &AdapterRegistry, model_id: &str) -> (bool, tools: None, tail_tools: None, view_messages: None, + continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/protocol/typescript/ai/TextGenerationRequest.ts b/protocol/typescript/ai/TextGenerationRequest.ts index 912bc3b679..deb143f49d 100644 --- a/protocol/typescript/ai/TextGenerationRequest.ts +++ b/protocol/typescript/ai/TextGenerationRequest.ts @@ -39,7 +39,14 @@ tailTools?: Array, * so a page-in resumes at the end of her view rather than at the shared head (card * 3512f496). `None` when the prompt has no view. */ -viewMessages?: number, toolChoice?: ToolChoice, +viewMessages?: number, +/** + * The `request_id` of the request whose response this one continues: a llama.cpp-family engine + * serves it from the tokens her slot holds for that response (her reasoning and her call as she + * generated them) plus only what is new, never re-rendering and recomputing them (CONTINUUM-ENGINE + * 4.14). `None` when the request continues nothing. + */ +continues?: string, toolChoice?: ToolChoice, /** * Force the model to output a specific format (e.g. JSON object). * OpenAI-compatible: serializes as `{"type": "json_object"}` etc. The From 05dd4ba84404f4b24fcc46ef61a1573d7f595952 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 14:47:46 -0600 Subject: [PATCH 2/5] Narrow to the warm-pass deletion: the continues wire field waits for the token-id append (4.14), and 21 touched literals tripped touched-file ratchets Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../dream_consolidation/distiller.rs | 1 - .../cognition/generate_recipe/orchestrator.rs | 1 - .../src/cognition/generate_response.rs | 1 - .../src/cognition/llm_deliberation_faculty.rs | 5 ---- .../llm_deliberation_faculty/request.rs | 6 ---- .../cognition/rate_proposals/orchestrator.rs | 1 - .../src/cognition/should_respond.rs | 1 - .../src/cognition/validate_response.rs | 1 - .../src/ai/heuristic_adapter.rs | 1 - core/continuum-engine/src/ai/types.rs | 7 ----- .../inference/airc_remote/adapter/tests.rs | 1 - .../src/inference/airc_remote/protocol.rs | 1 - .../inference/airc_remote/transport/tests.rs | 1 - .../src/inference/handle_module/tests.rs | 1 - .../src/inference/handle_store.rs | 1 - .../src/inference/llamacpp_adapter.rs | 1 - .../src/inference/llamacpp_adapter/tests.rs | 2 -- .../src/inference/llm_module_service.rs | 1 - .../src/inference/request_body.rs | 28 ------------------- core/continuum-genome/src/genome/teach.rs | 1 - .../continuum-mind/src/persona/rag_inspect.rs | 1 - core/continuum-models/src/commands/try_.rs | 2 -- .../typescript/ai/TextGenerationRequest.ts | 9 +----- 23 files changed, 1 insertion(+), 74 deletions(-) diff --git a/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs b/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs index 2115415b4e..0ee3988f86 100644 --- a/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs +++ b/core/continuum-academy/src/cognition/dream_consolidation/distiller.rs @@ -343,7 +343,6 @@ impl SemanticDistiller { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: Some(DistilledLesson::format(listed)?), active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs b/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs index 0569f7e073..71b2a5e049 100644 --- a/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs +++ b/core/continuum-cognition/src/cognition/generate_recipe/orchestrator.rs @@ -135,7 +135,6 @@ pub async fn generate_recipe_with_ai( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/generate_response.rs b/core/continuum-cognition/src/cognition/generate_response.rs index 9c527cea5b..94eb36c0e4 100644 --- a/core/continuum-cognition/src/cognition/generate_response.rs +++ b/core/continuum-cognition/src/cognition/generate_response.rs @@ -396,7 +396,6 @@ pub fn build_response_generation_request( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, // Local Qwen takes plain text; no JSON-mode constraint here. response_format: Some(ResponseFormat::Text), diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs index 5ccfce739c..18b5b4020f 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty.rs @@ -238,10 +238,6 @@ pub struct LlmDeliberationFaculty { held_blocks: parking_lot::Mutex>, /// A measurement fork's (`fork_eval_cycle`): its turns warm their own page, never hers. forked: bool, - /// The id of the request whose response her engine holds as her newest: her next request - /// continues it (`continues`), so her generated tokens are kept, never re-rendered and - /// recomputed (CONTINUUM-ENGINE 4.14). Set when a response is served, never by a refused attempt. - served_request: parking_lot::Mutex>, } impl LlmDeliberationFaculty { @@ -276,7 +272,6 @@ impl LlmDeliberationFaculty { held_blocks: parking_lot::Mutex::new(std::collections::HashMap::new()), reading: Default::default(), forked: false, - served_request: parking_lot::Mutex::new(None), } } diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs index d63dba7086..9be772f3fb 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/request.rs @@ -145,9 +145,6 @@ impl LlmDeliberationFaculty { .request_id .get_or_insert_with(|| Uuid::new_v4().to_string()) .clone(); - // Her engine holds her last served response: this request continues it, so her generated - // tokens stand for it and only what follows is new (CONTINUUM-ENGINE 4.14). - request.continues = self.served_request.lock().clone(); // How much of this prompt her previous request already held (card 5b09111e). crate::cognition::prompt_prefix::observe(self.persona_id, &request); // Stage the request for the reuse split (card 9e4d61e8); settled below on its result. @@ -285,8 +282,6 @@ impl LlmDeliberationFaculty { ); let receipt = match &gen_result { Ok(response) => { - // Her engine now holds this response: her next request continues it. - *self.served_request.lock() = Some(request_id.clone()); crate::ai::provenance::GenerationReceipt::from_response(request_id, response) } Err(error) => { @@ -394,7 +389,6 @@ impl LlmDeliberationFaculty { tools, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, // Page in the persona's current genome (wait-free read). Empty → None, diff --git a/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs b/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs index efe77dd1f7..d380bb7dcf 100644 --- a/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs +++ b/core/continuum-cognition/src/cognition/rate_proposals/orchestrator.rs @@ -110,7 +110,6 @@ pub async fn rate_proposals_with_ai( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/should_respond.rs b/core/continuum-cognition/src/cognition/should_respond.rs index e6a5acccd9..73afd9ad05 100644 --- a/core/continuum-cognition/src/cognition/should_respond.rs +++ b/core/continuum-cognition/src/cognition/should_respond.rs @@ -215,7 +215,6 @@ pub async fn evaluate_gating( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: Some(ResponseFormat::JsonObject), active_adapters: None, diff --git a/core/continuum-cognition/src/cognition/validate_response.rs b/core/continuum-cognition/src/cognition/validate_response.rs index d78cabe6d0..fc5033dbfe 100644 --- a/core/continuum-cognition/src/cognition/validate_response.rs +++ b/core/continuum-cognition/src/cognition/validate_response.rs @@ -241,7 +241,6 @@ fn build_validate_generation_request( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: Some(ResponseFormat::Text), active_adapters: None, diff --git a/core/continuum-engine/src/ai/heuristic_adapter.rs b/core/continuum-engine/src/ai/heuristic_adapter.rs index 9e380dd36d..55be95f456 100644 --- a/core/continuum-engine/src/ai/heuristic_adapter.rs +++ b/core/continuum-engine/src/ai/heuristic_adapter.rs @@ -607,7 +607,6 @@ mod tests { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/ai/types.rs b/core/continuum-engine/src/ai/types.rs index 9de2166eb1..721c610390 100644 --- a/core/continuum-engine/src/ai/types.rs +++ b/core/continuum-engine/src/ai/types.rs @@ -281,13 +281,6 @@ pub struct TextGenerationRequest { #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub view_messages: Option, - /// The `request_id` of the request whose response this one continues: a llama.cpp-family engine - /// serves it from the tokens her slot holds for that response (her reasoning and her call as she - /// generated them) plus only what is new, never re-rendering and recomputing them (CONTINUUM-ENGINE - /// 4.14). `None` when the request continues nothing. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(optional)] - pub continues: Option, #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub tool_choice: Option, diff --git a/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs b/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs index cb936d6483..03b3536419 100644 --- a/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs +++ b/core/continuum-engine/src/inference/airc_remote/adapter/tests.rs @@ -33,7 +33,6 @@ fn req(text: &str) -> TextGenerationRequest { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/airc_remote/protocol.rs b/core/continuum-engine/src/inference/airc_remote/protocol.rs index 05bd3da235..567e15b29c 100644 --- a/core/continuum-engine/src/inference/airc_remote/protocol.rs +++ b/core/continuum-engine/src/inference/airc_remote/protocol.rs @@ -208,7 +208,6 @@ mod tests { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/airc_remote/transport/tests.rs b/core/continuum-engine/src/inference/airc_remote/transport/tests.rs index b104e0db98..9253161b55 100644 --- a/core/continuum-engine/src/inference/airc_remote/transport/tests.rs +++ b/core/continuum-engine/src/inference/airc_remote/transport/tests.rs @@ -101,7 +101,6 @@ fn req(text: &str) -> RemoteInferenceRequest { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/handle_module/tests.rs b/core/continuum-engine/src/inference/handle_module/tests.rs index 64b3acee6f..1a8a387bb9 100644 --- a/core/continuum-engine/src/inference/handle_module/tests.rs +++ b/core/continuum-engine/src/inference/handle_module/tests.rs @@ -29,7 +29,6 @@ fn empty_request() -> TextGenerationRequest { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/handle_store.rs b/core/continuum-engine/src/inference/handle_store.rs index 7c732f06d9..7e5f5ecb47 100644 --- a/core/continuum-engine/src/inference/handle_store.rs +++ b/core/continuum-engine/src/inference/handle_store.rs @@ -440,7 +440,6 @@ mod tests { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/llamacpp_adapter.rs b/core/continuum-engine/src/inference/llamacpp_adapter.rs index b48df1e307..210a1ed9c1 100644 --- a/core/continuum-engine/src/inference/llamacpp_adapter.rs +++ b/core/continuum-engine/src/inference/llamacpp_adapter.rs @@ -286,7 +286,6 @@ impl AIProviderAdapter for LlamaCppAdapter { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs b/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs index ea3d23c88d..268873f984 100644 --- a/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs +++ b/core/continuum-engine/src/inference/llamacpp_adapter/tests.rs @@ -57,7 +57,6 @@ fn text_request(response_format: Option) -> TextGenerationReques tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format, active_adapters: None, @@ -290,7 +289,6 @@ async fn owned_gene_page_in_changes_output() { tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: Some(ResponseFormat::Text), active_adapters: adapters, diff --git a/core/continuum-engine/src/inference/llm_module_service.rs b/core/continuum-engine/src/inference/llm_module_service.rs index 3d4f84d43b..0e900f5f84 100644 --- a/core/continuum-engine/src/inference/llm_module_service.rs +++ b/core/continuum-engine/src/inference/llm_module_service.rs @@ -400,7 +400,6 @@ pub(super) async fn run_adapter_inference( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-engine/src/inference/request_body.rs b/core/continuum-engine/src/inference/request_body.rs index e8d8836172..d9f5bfe852 100644 --- a/core/continuum-engine/src/inference/request_body.rs +++ b/core/continuum-engine/src/inference/request_body.rs @@ -523,17 +523,6 @@ pub(crate) fn build_base_body( if let (true, Some(view_end)) = (cfg.llamacpp_sampling_extensions, view_end) { body["view_messages"] = json!(view_end); } - // Her request names itself, and the request whose response it continues: our fork serves it - // from the tokens her slot holds for that response plus only what is new, so her reasoning and - // her call are never re-rendered and recomputed (CONTINUUM-ENGINE 4.14). - if cfg.llamacpp_sampling_extensions { - if let Some(id) = &request.request_id { - body["request_id"] = json!(id); - } - if let Some(continues) = &request.continues { - body["continues"] = json!(continues); - } - } // max_tokens — the MODEL owns its generation length, enforced server-side // by llama.cpp / the cloud provider. We forward a ceiling ONLY @@ -733,23 +722,6 @@ mod tests { assert!(build_base_body(&gateway(false), &request, "m", true, true).get("view_messages").is_none()); } - // what this catches: her request not naming the response it continues, so our fork re-renders - // her reasoning and call and recomputes them every act (the M5, 2026-11-17: a 2,048-token - // checkpoint gap on every act), or a stock server sent fields it would reject. - #[test] - fn her_request_names_itself_and_the_response_it_continues() { - let request = TextGenerationRequest { - messages: vec![ChatMessage::text("user", "next")], - request_id: Some("act-2".into()), - continues: Some("act-1".into()), - ..Default::default() - }; - let ours = build_base_body(&gateway(true), &request, "m", true, true); - assert_eq!((ours["request_id"].clone(), ours["continues"].clone()), (json!("act-2"), json!("act-1"))); - let stock = build_base_body(&gateway(false), &request, "m", true, true); - assert!(stock.get("request_id").is_none() && stock.get("continues").is_none()); - } - // what this catches: a tail-loaded verb not reaching a llama.cpp-family server (she could // read its schema and never call it), the non-standard field going to a cloud provider // that rejects unknown fields, or a tail silently dropped (Codex on #5491). diff --git a/core/continuum-genome/src/genome/teach.rs b/core/continuum-genome/src/genome/teach.rs index e449d14030..a31ae9e458 100644 --- a/core/continuum-genome/src/genome/teach.rs +++ b/core/continuum-genome/src/genome/teach.rs @@ -135,7 +135,6 @@ pub async fn teacher_generate( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/core/continuum-mind/src/persona/rag_inspect.rs b/core/continuum-mind/src/persona/rag_inspect.rs index e070d211c7..199d4aa592 100644 --- a/core/continuum-mind/src/persona/rag_inspect.rs +++ b/core/continuum-mind/src/persona/rag_inspect.rs @@ -454,7 +454,6 @@ async fn run_inference_probe( tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, // The substrate's cognition contract: JSON-grammar-constrained // output. LlamaCpp wires this to GBNF grammar so the sampler diff --git a/core/continuum-models/src/commands/try_.rs b/core/continuum-models/src/commands/try_.rs index c8e7a0638a..5ed4357029 100644 --- a/core/continuum-models/src/commands/try_.rs +++ b/core/continuum-models/src/commands/try_.rs @@ -135,7 +135,6 @@ async fn run_text_probe(registry: &AdapterRegistry, model_id: &str) -> (bool, Op tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, @@ -214,7 +213,6 @@ async fn run_vision_probe(registry: &AdapterRegistry, model_id: &str) -> (bool, tools: None, tail_tools: None, view_messages: None, - continues: None, tool_choice: None, response_format: None, active_adapters: None, diff --git a/protocol/typescript/ai/TextGenerationRequest.ts b/protocol/typescript/ai/TextGenerationRequest.ts index deb143f49d..912bc3b679 100644 --- a/protocol/typescript/ai/TextGenerationRequest.ts +++ b/protocol/typescript/ai/TextGenerationRequest.ts @@ -39,14 +39,7 @@ tailTools?: Array, * so a page-in resumes at the end of her view rather than at the shared head (card * 3512f496). `None` when the prompt has no view. */ -viewMessages?: number, -/** - * The `request_id` of the request whose response this one continues: a llama.cpp-family engine - * serves it from the tokens her slot holds for that response (her reasoning and her call as she - * generated them) plus only what is new, never re-rendering and recomputing them (CONTINUUM-ENGINE - * 4.14). `None` when the request continues nothing. - */ -continues?: string, toolChoice?: ToolChoice, +viewMessages?: number, toolChoice?: ToolChoice, /** * Force the model to output a specific format (e.g. JSON object). * OpenAI-compatible: serializes as `{"type": "json_object"}` etc. The From 7ae5c50428d17223c01d53be1764584c02e9bd29 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 14:49:18 -0600 Subject: [PATCH 3/5] A regression for the deleted warm pass: her act and her next generation are the only requests on her slot Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../tests/verdicts/act_verdicts.rs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs index 9830a176ae..d0334b0b42 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs @@ -667,3 +667,29 @@ async fn empty_prose_with_no_tools_is_a_pass() { .expect("verdict"); assert_eq!(c.decision, Some(Decision::pass())); } + +// what this catches: a one-token "warm" request sent between her act and her next generation (the +// deleted prefill_during_tool). It re-sent the prompt she was served, so the engine truncated her +// generated reasoning and call out of her KV and her next generation recomputed them (the M5, +// 2026-11-17). Her act, then her next generation: exactly two calls, neither a one-token pass. +#[tokio::test] +async fn her_act_and_her_next_generation_are_the_only_requests_on_her_slot() { + let call = ToolCall { id: "t1".to_string(), name: "code/read".to_string(), input: json!({ "path": "deploy.md" }) }; + let adapter = Arc::new(ScriptedAdapter { + prompt_cache: crate::ai::adapter::PromptCache::PinnedSlot, + ..ScriptedAdapter::new(vec![ + make_response(FinishReason::ToolUse, "", Some(vec![call])), + make_response(FinishReason::Stop, "deploy.md says it landed", None), + ]) + }); + let faculty = LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", Arc::clone(&adapter)) + .with_tools(vec![read_tool()]) + .with_context_window(32_768); + let ws = Workspace::new("teammate asks: did the deploy fix land?"); + let first = faculty.contribute(&ws).await.expect("verdict"); + assert!(matches!(first.decision, Some(Decision::Act { .. })), "her act dispatches the tool"); + faculty.contribute(&ws).await.expect("verdict"); + let seen = adapter.seen.lock().expect("fixture request log"); + assert_eq!(seen.len(), 2, "her act, then her next generation: nothing between them on her slot"); + assert!(seen.iter().all(|request| request.max_tokens != Some(1)), "no one-token pass truncates what she generated"); +} From dd849727073bb16ebf4fd610a79251ba8e14e5fb Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 14:58:04 -0600 Subject: [PATCH 4/5] act_verdicts: coerce the scripted adapter at the constructor (E0308) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../llm_deliberation_faculty/tests/verdicts/act_verdicts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs index d0334b0b42..e8dd87a96e 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs @@ -682,7 +682,7 @@ async fn her_act_and_her_next_generation_are_the_only_requests_on_her_slot() { make_response(FinishReason::Stop, "deploy.md says it landed", None), ]) }); - let faculty = LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", Arc::clone(&adapter)) + let faculty = LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", adapter.clone()) .with_tools(vec![read_tool()]) .with_context_window(32_768); let ws = Workspace::new("teammate asks: did the deploy fix land?"); From e10c2279a2ed546b177c777dabb42bb1467dc701 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 15:08:14 -0600 Subject: [PATCH 5/5] act_verdicts: share the scripted adapter by Arc::clone with its trait object type (contract_shape: no .clone() in a call argument) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../llm_deliberation_faculty/tests/verdicts/act_verdicts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs index e8dd87a96e..f90b92bea6 100644 --- a/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs +++ b/core/continuum-cognition/src/cognition/llm_deliberation_faculty/tests/verdicts/act_verdicts.rs @@ -682,7 +682,7 @@ async fn her_act_and_her_next_generation_are_the_only_requests_on_her_slot() { make_response(FinishReason::Stop, "deploy.md says it landed", None), ]) }); - let faculty = LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", adapter.clone()) + let faculty = LlmDeliberationFaculty::new(Uuid::new_v4(), "Ivar", "You are Ivar.", Arc::clone(&adapter) as Arc) .with_tools(vec![read_tool()]) .with_context_window(32_768); let ws = Workspace::new("teammate asks: did the deploy fix land?");