The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(threads): stop overriding the title model with an undefined hint
M3gA-Mindb109aa05b503
diff --git a/src/openhuman/threads/ops.rs b/src/openhuman/threads/ops.rsindex bb99749b5c..b9c6b4fc7d 100644--- a/src/openhuman/threads/ops.rs+++ b/src/openhuman/threads/ops.rs@@ -20,9 +20,8 @@ use crate::openhuman::memory::{// `threads_create_new` blow the frontend's 30 s RPC budget (#5156).use crate::openhuman::memory::conversations;use crate::openhuman::threads::title::{- build_title_prompt, is_auto_generated_thread_title, sanitize_generated_title,+ build_title_request, is_auto_generated_thread_title, sanitize_generated_title,title_from_user_message, title_log_fingerprint, THREAD_TITLE_LOG_PREFIX,- THREAD_TITLE_MODEL_HINT, THREAD_TITLE_SYSTEM_PROMPT,};use crate::openhuman::threads::turn_state::{self, ClearTurnStateRequest, ClearTurnStateResponse, GetTurnStateForRequestRequest,@@ -34,8 +33,6 @@ use crate::rpc::RpcOutcome;use serde::Serialize;use std::collections::BTreeMap;use std::path::PathBuf;-use tinyagents::harness::message::Message;-use tinyagents::harness::model::ModelRequest;use tinycortex::memory::conversations::{ConversationMessage, ConversationMessagePatch, ConversationThread, CreateConversationThread,CrossThreadHit,@@ -417,41 +414,40 @@ pub async fn thread_generate_title());};- let chat_model = match provider::create_chat_model("summarization", &config, 0.2) {- Ok(model) => model,- Err(error) => {- tracing::warn!(- thread_id = %request.thread_id,- error = %error,- "{THREAD_TITLE_LOG_PREFIX} provider init failed; applying fallback title"- );- let updated =- update_thread_with_fallback_title(dir, thread, &first_user_message).await?;- return Ok(envelope(- thread_to_summary(updated),- Some(counts([("num_threads", 1)])),- None,- ));- }- };+ // `_with_model_id` rather than the plain constructor: the debug line below+ // reports the model this call actually dispatches on, and only the factory+ // knows what the `summarization` role resolved to for this configuration.+ let (chat_model, resolved_model) =+ match provider::create_chat_model_with_model_id("summarization", &config, 0.2) {+ Ok(resolved) => resolved,+ Err(error) => {+ tracing::warn!(+ thread_id = %request.thread_id,+ error = %error,+ "{THREAD_TITLE_LOG_PREFIX} provider init failed; applying fallback title"+ );+ let updated =+ update_thread_with_fallback_title(dir, thread, &first_user_message).await?;+ return Ok(envelope(+ thread_to_summary(updated),+ Some(counts([("num_threads", 1)])),+ None,+ ));+ }+ };tracing::debug!(thread_id = %request.thread_id,user_len = first_user_message.len(),assistant_len = assistant_message.len(),- model = THREAD_TITLE_MODEL_HINT,+ model = %resolved_model,"{THREAD_TITLE_LOG_PREFIX} generating thread title");let raw_title = match chat_model.invoke(&(),- ModelRequest::new(vec![- Message::system(THREAD_TITLE_SYSTEM_PROMPT),- Message::user(build_title_prompt(&first_user_message, &assistant_message)),- ])- .with_model(THREAD_TITLE_MODEL_HINT)- .with_temperature(0.2),+ build_title_request(&first_user_message, &assistant_message),).await{diff --git a/src/openhuman/threads/ops_tests.rs b/src/openhuman/threads/ops_tests.rsindex 839048cdde..61d7443dea 100644--- a/src/openhuman/threads/ops_tests.rs+++ b/src/openhuman/threads/ops_tests.rs@@ -3,6 +3,9 @@//! provider calls — they pin the behaviour of the branches that all of//! the async `ops::*` entry points rely on.use super::*;+// Re-imported here rather than through `ops`: `ops` itself no longer names+// these, so importing them there would be an unused import in a non-test build.+use crate::openhuman::threads::title::{build_title_prompt, THREAD_TITLE_SYSTEM_PROMPT};use crate::openhuman::threads::turn_state::{self, ClearTurnStateRequest, GetTurnStateRequest, TurnState,};@@ -71,6 +74,59 @@ fn counts_empty_iter_yields_empty_map() {// ── build_title_prompt ────────────────────────────────────────+// ── build_title_request: the outgoing wire model (#5637) ──────++#[test]+fn build_title_request_sends_no_per_request_model_override() {+ // The regression guard for #5637. `ModelRequest::model` is a per-request+ // override that the managed backend resolves verbatim, so anything set+ // here replaces the model the `summarization` provider already resolved.+ // It used to be `"hint:summarize"` — a string no hint-alias table in the+ // tree defines — which reached the backend as a literal model id and was+ // answered `400 Model 'hint:summarize' is not available` on every call,+ // for four months.+ //+ // Asserted as `None` rather than as some expected id on purpose: leaving+ // it unset is the only form that is correct for every branch of+ // `create_chat_model` (managed backend, Claude Agent SDK, Claude Code,+ // local runtime, BYOK cloud slug). Pinning a concrete managed tier here+ // would fix the managed route and break the other four.+ let request = crate::openhuman::threads::title::build_title_request("hi there", "hello back");++ assert!(+ request.model.is_none(),+ "the title request must carry no model override so the resolved \+ `summarization` provider decides; got {:?}",+ request.model,+ );+}++#[test]+fn build_title_request_carries_the_system_prompt_and_rendered_user_prompt() {+ // Pins the rest of the request so the `model` assertion above cannot be+ // satisfied by an empty or malformed request.+ use tinyagents::harness::message::Message;++ let request = crate::openhuman::threads::title::build_title_request("hi there", "hello back");++ assert_eq!(request.messages.len(), 2, "system + user");+ assert!(+ matches!(request.messages[0], Message::System(_)),+ "first message must be the system prompt, got {:?}",+ request.messages[0],+ );+ assert_eq!(request.messages[0].text(), THREAD_TITLE_SYSTEM_PROMPT,);+ assert!(+ matches!(request.messages[1], Message::User(_)),+ "second message must be the user prompt, got {:?}",+ request.messages[1],+ );+ assert_eq!(+ request.messages[1].text(),+ build_title_prompt("hi there", "hello back"),+ );+}+#[test]fn build_title_prompt_renders_user_and_assistant_sections_in_order() {let prompt = build_title_prompt("hi there", "hello back");diff --git a/src/openhuman/threads/title.rs b/src/openhuman/threads/title.rsindex 972d46b9ff..66bc460b26 100644--- a/src/openhuman/threads/title.rs+++ b/src/openhuman/threads/title.rs@@ -5,8 +5,10 @@use std::hash::{Hash, Hasher};+use tinyagents::harness::message::Message;+use tinyagents::harness::model::ModelRequest;+pub const THREAD_TITLE_LOG_PREFIX: &str = "[threads:title]";-pub const THREAD_TITLE_MODEL_HINT: &str = "hint:summarize";pub const THREAD_TITLE_SYSTEM_PROMPT: &str = "You name chat threads from the first user message and the assistant reply. Return only the name: at most 3 words, like Fix session handoff or Gmail OAuth retry. Lead with the verb or the subject and drop filler words. No quotes. No markdown. No punctuation.";/// Words a title carries at most. Three is the whole point of the shape: a@@ -202,6 +204,38 @@ pub fn build_title_prompt(user_message: &str, assistant_message: &str) -> String)}+/// Builds the whole title-generation request.+///+/// # It deliberately sets no model+///+/// The caller has already resolved the model by building the provider for the+/// `summarization` role, and the resolved model is the one that should+/// dispatch. `ModelRequest::model` is a *per-request override* that the+/// managed backend resolves verbatim, so anything set here replaces that+/// correct model on the wire.+///+/// This used to override it with `"hint:summarize"`, which no lookup table in+/// the tree defines — every hint-alias table spells the alias `summarization`.+/// The string matched nothing, survived translation unchanged, and reached the+/// backend as a literal model id, which answered+/// `400 Model 'hint:summarize' is not available` on every call. Title+/// generation then fell back to a keyword title for four months without+/// anything escalating (#5637).+///+/// Leaving `model` unset is also the only form that is correct for **every**+/// provider. `create_chat_model` resolves the `summarization` role to the+/// managed backend, a Claude Agent SDK / Claude Code model, a local runtime,+/// or a BYOK cloud slug; pinning any concrete tier id here would be wrong for+/// the four non-managed branches. Unset means each provider uses its own+/// construction-time default.+pub fn build_title_request(user_message: &str, assistant_message: &str) -> ModelRequest {+ ModelRequest::new(vec![+ Message::system(THREAD_TITLE_SYSTEM_PROMPT),+ Message::user(build_title_prompt(user_message, assistant_message)),+ ])+ .with_temperature(0.2)+}+#[cfg(test)]mod tests {use super::*;