Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/crates/adapters/ai-adapters/src/client/healthcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
106 changes: 61 additions & 45 deletions src/crates/assembly/core/src/agentic/coordination/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 8 additions & 4 deletions src/crates/assembly/core/src/service_agent_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
1 change: 1 addition & 0 deletions src/web-ui/src/locales/en-US/scenes/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
1 change: 1 addition & 0 deletions src/web-ui/src/locales/zh-CN/scenes/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
"available-models": "让智能体查看当前配置下可用的模型",
"model-catalog": "查看 models.dev 目录状态、手动刷新并定位本地缓存",
"advanced-request": "为供应商添加自定义 Header、请求体字段与 SSL 行为",
"smart-routing": "查看智能模式可用状态(暂未开放)",
"connection-test": "测试模型连接或图像生成,并刷新运行时客户端",
"model-pools": "管理模型池、路由策略与会话模型选择"
}
Expand Down
1 change: 1 addition & 0 deletions src/web-ui/src/locales/zh-TW/scenes/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
"available-models": "讓智能體查看當前配置下可用的模型",
"model-catalog": "查看 models.dev 目錄狀態、手動重新整理並定位本地緩存",
"advanced-request": "為供應商添加自定義 Header、請求體字段與 SSL 行為",
"smart-routing": "查看智能模式可用狀態(暫未開放)",
"connection-test": "測試模型連線或圖像生成,並重新整理執行階段用戶端",
"model-pools": "管理模型池、路由策略與工作階段模型選擇"
}
Expand Down
Loading