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
test(raw_coverage): add cross-workspace isolation assertions to MCP tool registry test
Steven Enamakel1fdcee920bf4
diff --git a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rsindex ac4fdf13bf..912df8f404 100644--- a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs+++ b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs@@ -654,6 +654,19 @@ async fn tool_registry_entries_include_connected_mcp_client_tools() {.expect("connect test mcp server");assert_eq!(tools.first().map(|tool| tool.name.as_str()), Some("echo"));+ // A second workspace, so that scoping is what the assertions below测 test.+ // With one workspace open, `registry_entries()` and the config-scoped form+ // agree, and this case would keep passing if the forwarding regressed.+ let other_tmp = tempdir().expect("second tempdir");+ let other_config = Config {+ workspace_dir: other_tmp.path().to_path_buf(),+ ..Config::default()+ };+ let other_server = test_mcp_server();+ connections::connect(&other_config, &other_server)+ .await+ .expect("connect second test mcp server");+// Config-scoped, not ambient: this case connects through// `host::for_config(&config)`, keyed by its own tempdir. `registry_entries()`// resolves through the process default instead, which returns a lone host@@ -670,10 +683,29 @@ async fn tool_registry_entries_include_connected_mcp_client_tools() {assert_eq!(client_entry.route["server_id"], json!(server.server_id));assert!(client_entry.tags.iter().any(|tag| tag == "mcp_client"));+ // The other workspace's server must NOT leak in. This is the assertion that+ // fails if a config-scoped lookup falls back to the process default.+ assert!(+ !entries.iter().any(+ |entry| entry.tool_id == format!("mcp-client::{}::echo", other_server.server_id)+ ),+ "entries for one workspace must not include another workspace's server"+ );++ // Symmetrically, from the second workspace's side.+ let other_entries = registry_entries_for_config(&other_config);+ assert!(other_entries+ .iter()+ .any(|entry| entry.tool_id == format!("mcp-client::{}::echo", other_server.server_id)));+ assert!(!other_entries+ .iter()+ .any(|entry| entry.tool_id == format!("mcp-client::{}::echo", server.server_id)));+// Config-scoped for the same reason as the lookup above: this connection// lives in the host keyed by `config`'s workspace, and the by-id form// resolves through the process default.assert!(connections::disconnect_for_config(&config, &server.server_id).await);+ assert!(connections::disconnect_for_config(&other_config, &other_server.server_id).await);}#[tokio::test]