diff --git a/src/crates/adapters/ai-adapters/src/client/healthcheck.rs b/src/crates/adapters/ai-adapters/src/client/healthcheck.rs index 900084cfb8..0578e29fd4 100644 --- a/src/crates/adapters/ai-adapters/src/client/healthcheck.rs +++ b/src/crates/adapters/ai-adapters/src/client/healthcheck.rs @@ -390,6 +390,7 @@ mod tests { format: "openai".into(), context_window: 65_536, max_tokens: Some(128), + max_images_per_request: None, temperature: None, top_p: None, inline_think_in_text: false, diff --git a/src/crates/assembly/core/src/agentic/coordination/scheduler.rs b/src/crates/assembly/core/src/agentic/coordination/scheduler.rs index 85cac4168b..57b1f8ff53 100644 --- a/src/crates/assembly/core/src/agentic/coordination/scheduler.rs +++ b/src/crates/assembly/core/src/agentic/coordination/scheduler.rs @@ -3907,51 +3907,67 @@ mod tests { assert_eq!(scheduler.queue_depth(session_id), 0); } - #[tokio::test] - async fn idle_background_result_uses_the_session_logical_agent_route() { - let (scheduler, session_manager, _, root) = test_scheduler(); - let session_id = "external-parent-session"; - let workspace = fixture_workspace_dir(root.path().join("workspace")); - session_manager - .create_session_with_id( - Some(session_id.to_string()), - "External parent".to_string(), - "Standard".to_string(), - SessionConfig { - tool_presentation_mode: Default::default(), - workspace_path: Some(workspace.to_string_lossy().into_owned()), - model_id: Some("model-original".to_string()), - ..Default::default() - }, - ) - .await - .expect("create parent session"); - - TEST_MODEL_RESOLUTION_AI_CONFIG - .scope( - AIConfig { - models: vec![AIModelConfig { - id: "model-original".to_string(), - name: "model-original".to_string(), - model_name: "model-original".to_string(), - enabled: true, - ..Default::default() - }], - ..Default::default() - }, - scheduler.deliver_background_result( - session_id.to_string(), - "external::opencode::agentic::generation-v1".to_string(), - None, - None, - None, - "Background Bash command completed".to_string(), - None, - None, - ), - ) - .await - .expect("lifecycle delivery must follow the persisted logical session route"); + #[test] + fn idle_background_result_uses_the_session_logical_agent_route() { + // This fixture polls the lifecycle delivery inline to retain the + // task-local model configuration. Give its large debug future a + // dedicated test stack. + std::thread::Builder::new() + .stack_size(16 * 1024 * 1024) + .spawn(|| { + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap() + .block_on(async { + let (scheduler, session_manager, _, root) = test_scheduler(); + let session_id = "external-parent-session"; + let workspace = fixture_workspace_dir(root.path().join("workspace")); + session_manager + .create_session_with_id( + Some(session_id.to_string()), + "External parent".to_string(), + "Standard".to_string(), + SessionConfig { + tool_presentation_mode: Default::default(), + workspace_path: Some(workspace.to_string_lossy().into_owned()), + model_id: Some("model-original".to_string()), + ..Default::default() + }, + ) + .await + .expect("create parent session"); + + TEST_MODEL_RESOLUTION_AI_CONFIG + .scope( + AIConfig { + models: vec![AIModelConfig { + id: "model-original".to_string(), + name: "model-original".to_string(), + model_name: "model-original".to_string(), + enabled: true, + ..Default::default() + }], + ..Default::default() + }, + scheduler.deliver_background_result( + session_id.to_string(), + "external::opencode::agentic::generation-v1".to_string(), + None, + None, + None, + "Background Bash command completed".to_string(), + None, + None, + ), + ) + .await + .expect("lifecycle delivery must follow the persisted logical session route"); + }); + }) + .unwrap() + .join() + .unwrap(); } #[tokio::test] diff --git a/src/crates/assembly/core/src/service_agent_runtime.rs b/src/crates/assembly/core/src/service_agent_runtime.rs index 10823fb523..d5511a9fc8 100644 --- a/src/crates/assembly/core/src/service_agent_runtime.rs +++ b/src/crates/assembly/core/src/service_agent_runtime.rs @@ -1058,10 +1058,14 @@ fn ensure_remote_model_strategy_editable(session: &Session) -> Result<(), String if session.kind == SessionKind::Subagent { return Err("Subagent models are configured independently. Editing them is not supported from mobile or bot controls; use the GUI model selector".into()); } - if session_eligible(session) - && routing_enabled(session.config.model_routing.as_deref()) - .map_err(|error| error.to_string())? - { + // A persisted smart route must stay read-only even when this host currently + // disables smart-mode activation; otherwise a remote caller could rewrite + // the strategy behind the GUI's back. + let smart_routing = match session.config.model_routing.as_deref() { + Some("smart") => true, + mode => routing_enabled(mode).map_err(|error| error.to_string())?, + }; + if session_eligible(session) && smart_routing { return Err("Smart routing is active. Model strategy editing is not supported from mobile or bot controls; use the GUI model selector".into()); } Ok(()) diff --git a/src/web-ui/src/locales/en-US/scenes/capabilities.json b/src/web-ui/src/locales/en-US/scenes/capabilities.json index 0afd5d6975..14b14cf37e 100644 --- a/src/web-ui/src/locales/en-US/scenes/capabilities.json +++ b/src/web-ui/src/locales/en-US/scenes/capabilities.json @@ -469,6 +469,7 @@ "available-models": "Let an agent inspect models available under the current configuration", "model-catalog": "Inspect models.dev catalog status, refresh it manually, and reveal its local cache", "advanced-request": "Add custom headers, request-body fields, and SSL behavior per provider", + "smart-routing": "View smart-mode availability (not released)", "connection-test": "Test model connections or image generation and refresh the runtime client", "model-pools": "Manage model pools, routing strategies, and session model selection" } diff --git a/src/web-ui/src/locales/zh-CN/scenes/capabilities.json b/src/web-ui/src/locales/zh-CN/scenes/capabilities.json index 735a0037bd..8d05cc0b19 100644 --- a/src/web-ui/src/locales/zh-CN/scenes/capabilities.json +++ b/src/web-ui/src/locales/zh-CN/scenes/capabilities.json @@ -469,6 +469,7 @@ "available-models": "让智能体查看当前配置下可用的模型", "model-catalog": "查看 models.dev 目录状态、手动刷新并定位本地缓存", "advanced-request": "为供应商添加自定义 Header、请求体字段与 SSL 行为", + "smart-routing": "查看智能模式可用状态(暂未开放)", "connection-test": "测试模型连接或图像生成,并刷新运行时客户端", "model-pools": "管理模型池、路由策略与会话模型选择" } diff --git a/src/web-ui/src/locales/zh-TW/scenes/capabilities.json b/src/web-ui/src/locales/zh-TW/scenes/capabilities.json index 6e48fdc33f..1396b70565 100644 --- a/src/web-ui/src/locales/zh-TW/scenes/capabilities.json +++ b/src/web-ui/src/locales/zh-TW/scenes/capabilities.json @@ -469,6 +469,7 @@ "available-models": "讓智能體查看當前配置下可用的模型", "model-catalog": "查看 models.dev 目錄狀態、手動重新整理並定位本地緩存", "advanced-request": "為供應商添加自定義 Header、請求體字段與 SSL 行為", + "smart-routing": "查看智能模式可用狀態(暫未開放)", "connection-test": "測試模型連線或圖像生成,並重新整理執行階段用戶端", "model-pools": "管理模型池、路由策略與工作階段模型選擇" }