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
feat(mcp): surface reconnect-supervisor outcomes as events (#5931)
Shanuc0f9321458d6
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.mdindex 0f5b3f666b..2ed68f1c22 100644--- a/docs/TEST-COVERAGE-MATRIX.md+++ b/docs/TEST-COVERAGE-MATRIX.md@@ -485,6 +485,7 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an| 11.1.13 | MCP HTTP-remote auth (token / Bearer / OAuth) + redirect resolution | RU/VU | `src/openhuman/mcp/registry/connections.rs` (`build_http_auth*`, `resolve_final_url`), `src/openhuman/mcp/registry/oauth.rs` (PKCE/token/bundle/callback port), `app/src/components/channels/mcp/ConnectAuthModal.test.tsx` (#3495) | ✅ | Bearer/raw scheme + custom headers; redirect-final-URL resolved before auth; OAuth dynamic client registration + PKCE + refresh; tokens MERGED into stored env; credentials stored encrypted locally, never sent to backend || 11.1.14 | MCP "Help & configure" assistant | VU/RU | `app/src/components/channels/mcp/ConfigAssistantPanel.test.tsx`, `app/src/components/channels/mcp/ConfigHelpModal.test.tsx`, `src/openhuman/mcp/registry/ops.rs` (`invoke_config_assist_agent`) (#3495) | ✅ | Server-specific prompt offered as a one-click "Get step-by-step setup help" action (on-demand, no longer auto-run on open — #4272), running an agentic turn scoped to web_search_tool/web_fetch/curl only; markdown-rendered reply; per-MCP chat persisted while on the detail page || 11.1.15 | Agent uses connected MCP servers in chat | RU | `src/openhuman/agent/registry/agents/loader.rs` (`orchestrator_subagents_include_mcp_agent`, `mcp_agent_drives_connected_servers_without_install_or_shell`, `planner_has_readonly_mcp_discovery_not_execute`), `src/openhuman/agent/registry/agents/orchestrator/prompt.rs` (`connected_mcp_block_*`), `src/openhuman/agent/harness/session/turn_tests.rs` (`mcp_announcement_fires_once_for_new_server`), `src/openhuman/mcp/registry/{tools,connections}.rs` (#3495) | ✅ | `use_mcp_server` delegate → `mcp_agent` worker (discover→list→call); `mcp_registry_list_tools` read-only discovery; orchestrator `## Connected MCP Servers` prompt block + mid-session connect announcement on the user turn; planner read-only MCP discovery (no `tool_call`) |+| 11.1.16 | MCP supervisor observability (Event Log + notifications) | RU | `src/openhuman/mcp/registry/supervisor_events_tests.rs`, `src/core/events_tests.rs` (`mcp_supervisor_events_*`, `mcp_lifecycle_events_*`), `src/openhuman/desktop/notifications/bus_tests_2_tests.rs` (`mcp_*`), `vendor/tinymcp/crates/tinymcp/src/registry/supervisor/test.rs` ("The report" section) (#5931) | ✅ | `tinymcp::Supervisor::tick` returns a `TickReport`; the host maps it to `McpServer{ProbeTimedOut,TransportDropped,Reconnected,ReconnectFailed,Parked}` domain events (Event Log, `mcp_client` domain, server name in the agent column) and the notification bridge notifies only on the first failed reconnect of an episode, on recovery after failures, and on a parked server |<!-- 11.1.9 Vault Markdown Writes — removed: Knowledge Vaults dropped (vault domain + VaultPanel deleted). -->diff --git a/gitbooks/features/integrations/mcp-and-skills.md b/gitbooks/features/integrations/mcp-and-skills.mdindex a20e11ac92..f277561f72 100644--- a/gitbooks/features/integrations/mcp-and-skills.md+++ b/gitbooks/features/integrations/mcp-and-skills.md@@ -17,7 +17,7 @@ OpenHuman has a built-in **MCP registry** that browses the open MCP ecosystem an- **Two upstream registries, merged.** Discovery fans out in parallel to [Smithery.ai](https://smithery.ai) and the official [`registry.modelcontextprotocol.io`](https://registry.modelcontextprotocol.io), then merges the results: thousands of servers across both.- **Search → install → connect.** Search the catalog, view a server's details, and install it. A local install spawns the server as a stdio subprocess; deployed servers connect over HTTP.-- **Supervised connections.** Installed servers are persisted in a local SQLite store (`mcp_clients/mcp_clients.db`) with their command, args, and transport. A supervisor loop keeps enabled servers connected, probing every ~60s with per-server exponential backoff.+- **Supervised connections.** Installed servers are persisted in a local SQLite store (`mcp_clients/mcp_clients.db`) with their command, args, and transport. A supervisor loop keeps enabled servers connected, probing every ~60s with per-server exponential backoff. Every probe outcome (a slow answer, a dropped transport, a reconnect that succeeded or failed) shows up in **Settings → Developer → Event Log** under the `mcp` badge, and a server that stays down, comes back after failing, or cannot start because its launcher runtime is missing raises a notification.Once connected, an MCP server's tools are available to the agent exactly like native tools.diff --git a/src/core/events.rs b/src/core/events.rsindex 5c17fea933..c7d66dc509 100644--- a/src/core/events.rs+++ b/src/core/events.rs@@ -1099,6 +1099,93 @@ pub enum DomainEvent {reason: String,},+ // ── MCP reconnect supervisor (#5931) ───────────────────────────────+ //+ // Published by `mcp::registry::supervisor_events` from the report+ // `tinymcp::Supervisor::tick` hands back each minute. They are what puts+ // a probe outcome on the developer Event Log, and what the notification+ // bridge reads to tell the user about a server that stays down. An+ // answered probe is deliberately not an event: one row per server per+ // minute would bury everything else in the log.+ /// A connected MCP server did not answer its liveness probe inside the+ /// window, but the session was kept: a single slow answer is not+ /// evidence of a drop. Only `teardown_after` consecutive timeouts end+ /// the session, and that tick publishes+ /// [`Self::McpServerTransportDropped`] instead of this.+ McpServerProbeTimedOut {+ server_id: String,+ /// The registry's qualified name, e.g. `"ac.inference.sh/mcp"`.+ qualified_name: String,+ /// The probe window that elapsed, in seconds.+ probe_timeout_secs: u64,+ /// How many probes in a row have now timed out, this one included.+ consecutive_timeouts: u32,+ /// The streak length at which the session is torn down.+ teardown_after: u32,+ },+ /// The supervisor ended an MCP server's session because its liveness+ /// probe found the transport unusable. A reconnect follows in the same+ /// tick and reports as [`Self::McpServerReconnected`],+ /// [`Self::McpServerReconnectFailed`] or [`Self::McpServerParked`].+ McpServerTransportDropped {+ server_id: String,+ qualified_name: String,+ /// What the probe observed: `"broken"` (the transport answered with+ /// an error), `"timed_out"` (the timeout streak reached its limit)+ /// or `"missing"` (the entry went away between the membership check+ /// and the probe).+ outcome: String,+ /// The transport error, already rendered and endpoint-redacted by+ /// `tinymcp`. `None` unless `outcome` is `"broken"`.+ detail: Option<String>,+ /// How long the failing probe took, or the window that elapsed for a+ /// timeout, in milliseconds. `None` for `"missing"`.+ elapsed_ms: Option<u64>,+ /// The timeout streak that ended the session; zero unless `outcome`+ /// is `"timed_out"`.+ consecutive_timeouts: u32,+ },+ /// The supervisor connected an MCP server, either rebuilding a session+ /// it had just ended or bringing back one that had stayed down.+ McpServerReconnected {+ server_id: String,+ qualified_name: String,+ tool_count: u32,+ /// How many consecutive attempts had failed before this one. Zero+ /// means the session was rebuilt within the tick that ended it and+ /// nobody noticed; anything else means the server's tools had been+ /// unavailable across at least one whole tick, which is what the+ /// notification bridge keys off to announce a recovery.+ after_failures: u32,+ },+ /// The supervisor failed to connect an MCP server and will retry after+ /// a backoff. Until a retry succeeds the server's tools are unavailable+ /// to the agent.+ ///+ /// Published once per attempt; the notification bridge notifies on the+ /// first failure of an episode (`failures == 1`) only.+ McpServerReconnectFailed {+ server_id: String,+ qualified_name: String,+ /// The connection error, already rendered and endpoint-redacted.+ error: String,+ /// How many consecutive attempts have now failed, this one included.+ failures: u32,+ /// Seconds until the next attempt.+ retry_in_secs: u64,+ },+ /// The supervisor gave up on an MCP server because the failure is one+ /// retrying cannot fix — today, the launcher runtime (`npx` / `uvx`) is+ /// not installed. The server stays parked until it is disabled and+ /// re-enabled.+ McpServerParked {+ server_id: String,+ qualified_name: String,+ /// The failure, already rendered, including the install guidance+ /// `tinymcp` attaches to a missing runtime.+ error: String,+ },+/// An `OPENHUMAN_APPROVAL_GATE=0` env override was observed but/// IGNORED because the host is the Tauri desktop shell. The gate is/// always installed under the desktop host; this event lets the UI@@ -1395,7 +1482,12 @@ impl DomainEvent {| Self::McpServerDisconnected { .. }| Self::McpClientToolExecuted { .. }| Self::McpSetupSecretRequested { .. }- | Self::McpToolRejected { .. } => "mcp_client",+ | Self::McpToolRejected { .. }+ | Self::McpServerProbeTimedOut { .. }+ | Self::McpServerTransportDropped { .. }+ | Self::McpServerReconnected { .. }+ | Self::McpServerReconnectFailed { .. }+ | Self::McpServerParked { .. } => "mcp_client",}}@@ -1515,6 +1607,11 @@ impl DomainEvent {Self::McpClientToolExecuted { .. } => "McpClientToolExecuted",Self::McpSetupSecretRequested { .. } => "McpSetupSecretRequested",Self::McpToolRejected { .. } => "McpToolRejected",+ Self::McpServerProbeTimedOut { .. } => "McpServerProbeTimedOut",+ Self::McpServerTransportDropped { .. } => "McpServerTransportDropped",+ Self::McpServerReconnected { .. } => "McpServerReconnected",+ Self::McpServerReconnectFailed { .. } => "McpServerReconnectFailed",+ Self::McpServerParked { .. } => "McpServerParked",Self::EmbeddingModelUnhealthy { .. } => "EmbeddingModelUnhealthy",Self::ProviderApiKeyRejected { .. } => "ProviderApiKeyRejected",Self::TaskSourceFetched { .. } => "TaskSourceFetched",@@ -1557,6 +1654,19 @@ impl DomainEvent {Self::MonitorStatusChanged { thread_id, .. } | Self::MonitorLine { thread_id, .. } => {thread_id.as_deref()}+ // The Event Log's "agent" column is the only per-row context the+ // stream carries, so an MCP row names its server there: the+ // install id for the RPC-driven lifecycle, the registry name+ // (`ac.inference.sh/mcp`) for the supervisor's verdicts, which is+ // how a user knows the server and how the log lines name it.+ Self::McpServerInstalled { server_id, .. }+ | Self::McpServerConnected { server_id, .. }+ | Self::McpServerDisconnected { server_id, .. } => Some(server_id.as_str()),+ Self::McpServerProbeTimedOut { qualified_name, .. }+ | Self::McpServerTransportDropped { qualified_name, .. }+ | Self::McpServerReconnected { qualified_name, .. }+ | Self::McpServerReconnectFailed { qualified_name, .. }+ | Self::McpServerParked { qualified_name, .. } => Some(qualified_name.as_str()),_ => None,}}diff --git a/src/core/events_tests.rs b/src/core/events_tests.rsindex b0930f98a1..27ac86c149 100644--- a/src/core/events_tests.rs+++ b/src/core/events_tests.rs@@ -503,6 +503,55 @@ fn all_variants_have_correct_domain() {},"auth",),+ // MCP reconnect supervisor (#5931)+ (+ DomainEvent::McpServerProbeTimedOut {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ probe_timeout_secs: 8,+ consecutive_timeouts: 1,+ teardown_after: 3,+ },+ "mcp_client",+ ),+ (+ DomainEvent::McpServerTransportDropped {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ outcome: "broken".into(),+ detail: Some("connection reset".into()),+ elapsed_ms: Some(1961),+ consecutive_timeouts: 0,+ },+ "mcp_client",+ ),+ (+ DomainEvent::McpServerReconnected {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ tool_count: 25,+ after_failures: 0,+ },+ "mcp_client",+ ),+ (+ DomainEvent::McpServerReconnectFailed {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ error: "connection refused".into(),+ failures: 1,+ retry_in_secs: 5,+ },+ "mcp_client",+ ),+ (+ DomainEvent::McpServerParked {+ server_id: "srv-1".into(),+ qualified_name: "@scope/server".into(),+ error: "the `uvx` launcher is not installed".into(),+ },+ "mcp_client",+ ),];for (event, expected_domain) in cases {@@ -560,3 +609,98 @@ fn memory_driver_bind_failed_domain_and_name() {assert_eq!(event.domain(), "memory");assert_eq!(event.variant_name(), "MemoryDriverBindFailed");}++/// The Event Log's "agent" column is the only per-row context the stream+/// carries, so every MCP row must name its server there (#5931): the+/// supervisor's verdicts by the registry name a user knows the server by, the+/// RPC-driven lifecycle by the install id.+#[test]+fn mcp_supervisor_events_name_themselves_and_hint_the_server() {+ let cases: Vec<(DomainEvent, &str)> = vec![+ (+ DomainEvent::McpServerProbeTimedOut {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ probe_timeout_secs: 8,+ consecutive_timeouts: 1,+ teardown_after: 3,+ },+ "McpServerProbeTimedOut",+ ),+ (+ DomainEvent::McpServerTransportDropped {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ outcome: "timed_out".into(),+ detail: None,+ elapsed_ms: Some(8_000),+ consecutive_timeouts: 3,+ },+ "McpServerTransportDropped",+ ),+ (+ DomainEvent::McpServerReconnected {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ tool_count: 25,+ after_failures: 1,+ },+ "McpServerReconnected",+ ),+ (+ DomainEvent::McpServerReconnectFailed {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ error: "connection refused".into(),+ failures: 1,+ retry_in_secs: 5,+ },+ "McpServerReconnectFailed",+ ),+ (+ DomainEvent::McpServerParked {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ error: "the `uvx` launcher is not installed".into(),+ },+ "McpServerParked",+ ),+ ];++ for (event, expected_name) in cases {+ assert_eq!(event.variant_name(), expected_name);+ assert_eq!(event.domain(), "mcp_client");+ assert_eq!(+ event.agent_hint(),+ Some("ac.inference.sh/mcp"),+ "{expected_name} should hint the registry name"+ );+ }+}++#[test]+fn mcp_lifecycle_events_hint_the_install_id() {+ let cases = vec![+ DomainEvent::McpServerInstalled {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ },+ DomainEvent::McpServerConnected {+ server_id: "srv-1".into(),+ tool_count: 3,+ },+ DomainEvent::McpServerDisconnected {+ server_id: "srv-1".into(),+ reason: Some("disabled".into()),+ },+ ];++ for event in cases {+ assert_eq!(+ event.agent_hint(),+ Some("srv-1"),+ "{} should hint the install id",+ event.variant_name()+ );+ }+}diff --git a/src/openhuman/desktop/notifications/bus.rs b/src/openhuman/desktop/notifications/bus.rsindex f7e94ae808..3261a1335d 100644--- a/src/openhuman/desktop/notifications/bus.rs+++ b/src/openhuman/desktop/notifications/bus.rs@@ -205,6 +205,67 @@ pub fn event_to_notification(event: &DomainEvent) -> Option<CoreNotificationEventimestamp_ms: ts,actions: None,}),+ // The MCP reconnect supervisor's verdicts (#5931), published by+ // `mcp::registry::supervisor_events`. Only the cases a user can act on+ // or would otherwise wonder about become notifications: a server that+ // *stays* down after a tick, its recovery, and a server the supervisor+ // has given up on. A session torn down and rebuilt within one tick, or+ // a single slow probe, is Event Log material only — nothing was+ // unavailable long enough for anyone to notice, and a banner per blip+ // would be the fourteen-a-day noise this exists to replace.+ DomainEvent::McpServerReconnectFailed {+ server_id,+ qualified_name,+ error,+ failures,+ retry_in_secs,+ } if *failures == 1 => Some(CoreNotificationEvent {+ id: format!("mcp-unavailable:{}:{}", server_id, ts),+ category: CoreNotificationCategory::System,+ title: "MCP server unavailable".into(),+ body: format!(+ "{qualified_name} stopped answering, so its tools are unavailable until it \+ reconnects (retrying in {retry_in_secs}s). {}",+ error.chars().take(120).collect::<String>()+ ),+ deep_link: Some("/connections?tab=mcp".into()),+ timestamp_ms: ts,+ actions: None,+ }),+ DomainEvent::McpServerReconnected {+ server_id,+ qualified_name,+ tool_count,+ after_failures,+ } if *after_failures > 0 => Some(CoreNotificationEvent {+ id: format!("mcp-restored:{}:{}", server_id, ts),+ category: CoreNotificationCategory::System,+ title: "MCP server reconnected".into(),+ body: format!(+ "{qualified_name} is back with {tool_count} tools after {after_failures} failed \+ attempt(s)."+ ),+ deep_link: Some("/connections?tab=mcp".into()),+ timestamp_ms: ts,+ actions: None,+ }),+ DomainEvent::McpServerParked {+ server_id,+ qualified_name,+ error,+ } => Some(CoreNotificationEvent {+ id: format!("mcp-parked:{}:{}", server_id, ts),+ category: CoreNotificationCategory::System,+ title: "MCP server can't start".into(),+ body: format!(+ "{qualified_name} will not be retried: {}. Install the missing runtime, then \+ disable and re-enable the server.",+ error.chars().take(160).collect::<String>()+ ),+ deep_link: Some("/connections?tab=mcp".into()),+ timestamp_ms: ts,+ actions: None,+ }),_ => None,}}diff --git a/src/openhuman/desktop/notifications/bus_tests_2_tests.rs b/src/openhuman/desktop/notifications/bus_tests_2_tests.rsindex b62beb287e..4a2ce54f63 100644--- a/src/openhuman/desktop/notifications/bus_tests_2_tests.rs+++ b/src/openhuman/desktop/notifications/bus_tests_2_tests.rs@@ -171,3 +171,110 @@ fn notification_triaged_unrouted_escalate_is_silent() {};assert!(event_to_notification(&ev).is_none());}++// ── MCP reconnect supervisor (#5931) ────────────────────────────────────────++#[test]+fn mcp_first_failed_reconnect_tells_the_user_tools_are_unavailable() {+ let ev = DomainEvent::McpServerReconnectFailed {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ error: "mcp transport failure for `https://api.inference.sh`: connection reset".into(),+ failures: 1,+ retry_in_secs: 5,+ };+ let n = event_to_notification(&ev).expect("the first failure of an episode notifies");+ assert_eq!(n.category, CoreNotificationCategory::System);+ assert_eq!(n.title, "MCP server unavailable");+ assert!(n.body.contains("ac.inference.sh/mcp"), "{}", n.body);+ assert!(n.body.contains("retrying in 5s"), "{}", n.body);+ assert!(n.body.contains("connection reset"), "{}", n.body);+ assert_eq!(n.deep_link.as_deref(), Some("/connections?tab=mcp"));+ assert!(n.id.starts_with("mcp-unavailable:srv-1:"));+}++#[test]+fn mcp_later_failed_reconnects_stay_quiet() {+ // The backoff retries every few minutes for as long as the server is+ // down; the user heard about it once, on the first failure.+ let ev = DomainEvent::McpServerReconnectFailed {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ error: "connection refused".into(),+ failures: 2,+ retry_in_secs: 10,+ };+ assert!(event_to_notification(&ev).is_none());+}++#[test]+fn mcp_recovery_after_failures_is_announced() {+ let ev = DomainEvent::McpServerReconnected {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ tool_count: 25,+ after_failures: 2,+ };+ let n = event_to_notification(&ev).expect("a server that had stayed down coming back notifies");+ assert_eq!(n.category, CoreNotificationCategory::System);+ assert_eq!(n.title, "MCP server reconnected");+ assert!(n.body.contains("25 tools"), "{}", n.body);+ assert!(n.body.contains("2 failed attempt"), "{}", n.body);+ assert_eq!(n.deep_link.as_deref(), Some("/connections?tab=mcp"));+ assert!(n.id.starts_with("mcp-restored:srv-1:"));+}++#[test]+fn mcp_rebuild_within_the_same_tick_is_not_a_notification() {+ // The common field case: one request failed, the session was rebuilt a+ // second later, nobody noticed. Event Log only.+ let ev = DomainEvent::McpServerReconnected {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ tool_count: 25,+ after_failures: 0,+ };+ assert!(event_to_notification(&ev).is_none());+}++#[test]+fn mcp_parked_server_tells_the_user_how_to_recover() {+ let ev = DomainEvent::McpServerParked {+ server_id: "srv-1".into(),+ qualified_name: "@modelcontextprotocol/server-github".into(),+ error: "the `uvx` launcher is not installed".into(),+ };+ let n = event_to_notification(&ev).expect("a parked server notifies");+ assert_eq!(n.category, CoreNotificationCategory::System);+ assert_eq!(n.title, "MCP server can't start");+ assert!(+ n.body.contains("@modelcontextprotocol/server-github"),+ "{}",+ n.body+ );+ assert!(n.body.contains("uvx"), "{}", n.body);+ assert!(n.body.contains("disable and re-enable"), "{}", n.body);+ assert_eq!(n.deep_link.as_deref(), Some("/connections?tab=mcp"));+ assert!(n.id.starts_with("mcp-parked:srv-1:"));+}++#[test]+fn mcp_probe_timeouts_and_transport_drops_are_event_log_only() {+ let timed_out = DomainEvent::McpServerProbeTimedOut {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ probe_timeout_secs: 8,+ consecutive_timeouts: 1,+ teardown_after: 3,+ };+ let dropped = DomainEvent::McpServerTransportDropped {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ outcome: "broken".into(),+ detail: Some("connection reset".into()),+ elapsed_ms: Some(1961),+ consecutive_timeouts: 0,+ };+ assert!(event_to_notification(&timed_out).is_none());+ assert!(event_to_notification(&dropped).is_none());+}diff --git a/src/openhuman/mcp/registry/README.md b/src/openhuman/mcp/registry/README.mdindex f9301bd3a4..c5b6bc028d 100644--- a/src/openhuman/mcp/registry/README.md+++ b/src/openhuman/mcp/registry/README.md@@ -28,7 +28,8 @@ The transport primitives themselves (stdio + HTTP MCP clients) live in the sibli| `src/openhuman/mcp/registry/registries/mcp_official.rs` | Official modelcontextprotocol/registry adapter; cursor→page mapping with a bounded sequential cursor walk; optional `MCP_OFFICIAL_REGISTRY_*` env overrides. || `src/openhuman/mcp/registry/connections.rs` | Global in-process connection registry; `connect`/`disconnect`/`call_tool`/`all_status`/`all_connected_tools`; dispatches stdio vs HTTP via `ActiveClient`. || `src/openhuman/mcp/registry/boot.rs` | `spawn_installed_servers` — boot-time connect of all installs; per-server failures logged, never fatal. |-| `src/openhuman/mcp/registry/supervisor.rs` | Background reconnect loop (#3312): every 60s probes each connected transport (`connections::probe_alive`) and reconnects dropped/never-connected enabled servers with per-server exponential backoff. Spawned once at startup after the boot pass; connectivity-only (publishes no health events). |+| `src/openhuman/mcp/registry/mod.rs` (`supervisor`) | Background reconnect loop (#3312): every 60s drives `tinymcp::Supervisor::tick` for every open workspace host — probes each connected transport and reconnects dropped / never-connected enabled servers with per-server exponential backoff (the cycle itself lives in `tinymcp`). Missed ticks are delayed, not burst. Hands each tick's `TickReport` to `supervisor_events`. |+| `src/openhuman/mcp/registry/supervisor_events.rs` | Translates a `tinymcp::TickReport` into this domain's events (#5931): `McpServerProbeTimedOut`, `McpServerTransportDropped`, `McpServerReconnected`, `McpServerReconnectFailed`, `McpServerParked`. The developer Event Log streams them; the notification bridge turns stays-down / restored / parked into user notifications. An answered probe is deliberately not an event. || `src/openhuman/mcp/registry/ops.rs` | `mcp_clients_*` RPC handler implementations + `resolve_command` + `config_assist` inference call. || `src/openhuman/mcp/registry/setup.rs` | Opaque secret-ref machinery (`SecretRef`, mint/fulfill/await/resolve/consume/gc) for the setup agent. || `src/openhuman/mcp/registry/setup_ops.rs` | `mcp_setup_*` RPC handlers (search/get/request_secret/submit_secret/test_connection/install_and_connect) + connection `pick_connection`. |diff --git a/src/openhuman/mcp/registry/mod.rs b/src/openhuman/mcp/registry/mod.rsindex ec199c5fd7..b573bee9da 100644--- a/src/openhuman/mcp/registry/mod.rs+++ b/src/openhuman/mcp/registry/mod.rs@@ -14,6 +14,9 @@//! [`super::host`] holds and publishing this application's own events.//! - [`setup_ops`] — the `mcp_setup` handlers, likewise.//! - `schemas` — the controller schemas and dispatch.+//! - [`supervisor_events`] — what the reconnect supervisor observed each+//! tick, as this domain's events; the Event Log and the notification bridge+//! read those (#5931).//! - [`tools`] — the agent-facing tools.//!//! # The naming note still applies@@ -40,6 +43,8 @@ mod schemas;#[cfg(feature = "mcp")]pub mod setup_ops;#[cfg(feature = "mcp")]+pub mod supervisor_events;+#[cfg(feature = "mcp")]pub mod tools;#[cfg(feature = "mcp")]@@ -417,6 +422,13 @@ pub mod supervisor {let start = tokio::time::Instant::now() + config.tick_interval;let mut interval = tokio::time::interval_at(start, config.tick_interval);+ // A tick walks every open workspace's installs in sequence and each+ // probe can take the whole probe window, so a tick can outlast its+ // own interval. The default behaviour would then fire the missed+ // ticks back to back, re-probing servers that were just probed. Pace+ // from when the cycle finished instead — `tinymcp::Supervisor::run`+ // does the same, and this loop is what stands in for it.+ interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);tracing::info!(tick_seconds = config.tick_interval.as_secs(),@@ -436,7 +448,7 @@ pub mod supervisor {.entry(workspace).or_insert_with(|| tinymcp::Supervisor::new(config.clone(), identity, proxy));- supervisor+ let report = supervisor.tick(service.dynamic().store(),service.dynamic().connections(),@@ -444,6 +456,10 @@ pub mod supervisor {now,).await;+ // What the tick observed becomes this domain's events, so a+ // probe outcome reaches the Event Log and a server that stays+ // down reaches the user (#5931).+ super::supervisor_events::publish(&report);}}}diff --git a/src/openhuman/mcp/registry/supervisor_events.rs b/src/openhuman/mcp/registry/supervisor_events.rsnew file mode 100644index 0000000000..be1a9ab5af--- /dev/null+++ b/src/openhuman/mcp/registry/supervisor_events.rs@@ -0,0 +1,141 @@+//! Turning what the reconnect supervisor observed into this application's+//! events.+//!+//! `tinymcp::Supervisor::tick` hands back a [`TickReport`] and publishes+//! nothing itself: which of its observations a user should hear about is the+//! host's call. This module makes that call once. Every non-nominal+//! observation becomes a [`DomainEvent`] in the `mcp_client` domain, which is+//! what puts it on the developer Event Log (`GET /events/domain`) and in front+//! of the notification bridge (`desktop::notifications::bus`), where the+//! stays-down, restored and parked cases become user notifications (#5931).+//!+//! An answered probe is the nominal case and is deliberately *not* an event:+//! one row per server per minute would bury everything else in the log.+//! `tinymcp` logs it at trace level, and that is enough.++use tinymcp::{ProbeOutcome, SupervisorEvent, TickReport};++use crate::core::bus::BUS;+use crate::core::events::DomainEvent;++const LOG_PREFIX: &str = "[mcp]";++/// The domain events a tick's observations translate to, in the order they+/// were observed.+///+/// Pure, so the mapping is testable without a bus. Observations this host has+/// no event for — an answered probe today, and whatever `tinymcp` adds to its+/// non-exhaustive report later — map to nothing.+pub fn domain_events_for(events: &[SupervisorEvent]) -> Vec<DomainEvent> {+ events.iter().filter_map(domain_event_for).collect()+}++fn domain_event_for(event: &SupervisorEvent) -> Option<DomainEvent> {+ let server = event.server();+ let server_id = server.server_id.clone();+ let qualified_name = server.qualified_name.clone();++ match event {+ SupervisorEvent::ProbeAnswered { .. } => None,+ SupervisorEvent::ProbeTimedOut {+ after,+ consecutive,+ teardown_after,+ ..+ } => Some(DomainEvent::McpServerProbeTimedOut {+ server_id,+ qualified_name,+ probe_timeout_secs: after.as_secs(),+ consecutive_timeouts: *consecutive,+ teardown_after: *teardown_after,+ }),+ SupervisorEvent::TransportDropped {+ outcome,+ consecutive_timeouts,+ ..+ } => {+ let (detail, elapsed_ms) = match outcome {+ ProbeOutcome::Broken { error, elapsed } => {+ (Some(error.clone()), Some(millis(*elapsed)))+ }+ ProbeOutcome::TimedOut { after } => (None, Some(millis(*after))),+ // `Missing` measured nothing; `Alive` never drops a session;+ // anything `tinymcp` adds later carries no detail we know of.+ _ => (None, None),+ };+ Some(DomainEvent::McpServerTransportDropped {+ server_id,+ qualified_name,+ outcome: outcome.as_str().to_string(),+ detail,+ elapsed_ms,+ consecutive_timeouts: *consecutive_timeouts,+ })+ }+ SupervisorEvent::Reconnected {+ tools,+ after_failures,+ ..+ } => Some(DomainEvent::McpServerReconnected {+ server_id,+ qualified_name,+ tool_count: u32::try_from(*tools).unwrap_or(u32::MAX),+ after_failures: *after_failures,+ }),+ SupervisorEvent::ReconnectFailed {+ error,+ failures,+ retry_in,+ ..+ } => Some(DomainEvent::McpServerReconnectFailed {+ server_id,+ qualified_name,+ error: error.clone(),+ failures: *failures,+ retry_in_secs: retry_in.as_secs(),+ }),+ SupervisorEvent::Parked { error, .. } => Some(DomainEvent::McpServerParked {+ server_id,+ qualified_name,+ error: error.clone(),+ }),+ // `SupervisorEvent` is non-exhaustive: a report entry this host does+ // not know yet is logged and skipped rather than mistranslated.+ other => {+ tracing::debug!(+ kind = other.kind(),+ server_id = %server_id,+ "{LOG_PREFIX} supervisor observation has no domain event; skipping"+ );+ None+ }+ }+}++fn millis(duration: std::time::Duration) -> u64 {+ u64::try_from(duration.as_millis()).unwrap_or(u64::MAX)+}++/// Publishes the domain events for one tick's report on the bus, in order.+///+/// Returns how many were published: zero for a quiet tick. A bus that is not+/// initialised drops them, as it does every other publish before startup.+pub fn publish(report: &TickReport) -> usize {+ let events = domain_events_for(&report.events);+ let published = events.len();+ if published > 0 {+ tracing::debug!(+ observations = report.events.len(),+ published,+ "{LOG_PREFIX} supervisor tick published domain events"+ );+ }+ for event in events {+ BUS.publish(event);+ }+ published+}++#[cfg(test)]+#[path = "supervisor_events_tests.rs"]+mod tests;diff --git a/src/openhuman/mcp/registry/supervisor_events_tests.rs b/src/openhuman/mcp/registry/supervisor_events_tests.rsnew file mode 100644index 0000000000..1b2bf206a8--- /dev/null+++ b/src/openhuman/mcp/registry/supervisor_events_tests.rs@@ -0,0 +1,208 @@+use std::time::Duration;++use tinymcp::{ProbeOutcome, ServerRef, SupervisorEvent, TickReport};++use super::*;+use crate::core::events::DomainEvent;++fn server() -> ServerRef {+ ServerRef {+ server_id: "srv-1".into(),+ qualified_name: "ac.inference.sh/mcp".into(),+ display_name: "Inference".into(),+ }+}++#[test]+fn an_answered_probe_is_not_an_event() {+ // One row per server per minute would bury everything else in the log.+ let events = domain_events_for(&[SupervisorEvent::ProbeAnswered {+ server: server(),+ elapsed: Duration::from_millis(190),+ }]);+ assert!(events.is_empty());+}++#[test]+fn a_kept_timeout_becomes_probe_timed_out_with_its_place_in_the_streak() {+ let events = domain_events_for(&[SupervisorEvent::ProbeTimedOut {+ server: server(),+ after: Duration::from_secs(8),+ consecutive: 1,+ teardown_after: 3,+ }]);+ match events.as_slice() {+ [DomainEvent::McpServerProbeTimedOut {+ server_id,+ qualified_name,+ probe_timeout_secs,+ consecutive_timeouts,+ teardown_after,+ }] => {+ assert_eq!(server_id, "srv-1");+ assert_eq!(qualified_name, "ac.inference.sh/mcp");+ assert_eq!(*probe_timeout_secs, 8);+ assert_eq!(*consecutive_timeouts, 1);+ assert_eq!(*teardown_after, 3);+ }+ other => panic!("expected one McpServerProbeTimedOut, got {other:?}"),+ }+ assert_eq!(events[0].domain(), "mcp_client");+ assert_eq!(events[0].agent_hint(), Some("ac.inference.sh/mcp"));+}++#[test]+fn a_broken_drop_carries_the_error_and_how_long_it_took_to_fail() {+ let events = domain_events_for(&[SupervisorEvent::TransportDropped {+ server: server(),+ outcome: ProbeOutcome::Broken {+ error: "mcp transport failure for `https://api.inference.sh`: connection reset".into(),+ elapsed: Duration::from_millis(1961),+ },+ consecutive_timeouts: 0,+ }]);+ match events.as_slice() {+ [DomainEvent::McpServerTransportDropped {+ outcome,+ detail,+ elapsed_ms,+ consecutive_timeouts,+ ..+ }] => {+ assert_eq!(outcome, "broken");+ assert_eq!(+ detail.as_deref(),+ Some("mcp transport failure for `https://api.inference.sh`: connection reset")+ );+ assert_eq!(*elapsed_ms, Some(1961));+ assert_eq!(*consecutive_timeouts, 0);+ }+ other => panic!("expected one McpServerTransportDropped, got {other:?}"),+ }+}++#[test]+fn a_timeout_drop_carries_the_window_and_the_streak_that_ended_the_session() {+ let events = domain_events_for(&[SupervisorEvent::TransportDropped {+ server: server(),+ outcome: ProbeOutcome::TimedOut {+ after: Duration::from_secs(8),+ },+ consecutive_timeouts: 3,+ }]);+ match events.as_slice() {+ [DomainEvent::McpServerTransportDropped {+ outcome,+ detail,+ elapsed_ms,+ consecutive_timeouts,+ ..+ }] => {+ assert_eq!(outcome, "timed_out");+ assert_eq!(*detail, None);+ assert_eq!(*elapsed_ms, Some(8_000));+ assert_eq!(*consecutive_timeouts, 3);+ }+ other => panic!("expected one McpServerTransportDropped, got {other:?}"),+ }+}++#[test]+fn a_missing_entry_drop_carries_nothing_measured() {+ let events = domain_events_for(&[SupervisorEvent::TransportDropped {+ server: server(),+ outcome: ProbeOutcome::Missing,+ consecutive_timeouts: 0,+ }]);+ match events.as_slice() {+ [DomainEvent::McpServerTransportDropped {+ outcome,+ detail,+ elapsed_ms,+ ..+ }] => {+ assert_eq!(outcome, "missing");+ assert_eq!(*detail, None);+ assert_eq!(*elapsed_ms, None);+ }+ other => panic!("expected one McpServerTransportDropped, got {other:?}"),+ }+}++#[test]+fn a_reconnect_a_failure_and_a_parking_translate_in_order() {+ let events = domain_events_for(&[+ SupervisorEvent::Reconnected {+ server: server(),+ tools: 25,+ after_failures: 2,+ },+ SupervisorEvent::ReconnectFailed {+ server: server(),+ error: "mcp error response: not accepting sessions".into(),+ failures: 1,+ retry_in: Duration::from_secs(5),+ },+ SupervisorEvent::Parked {+ server: server(),+ error: "the `npx` launcher is not installed".into(),+ },+ ]);++ match events.as_slice() {+ [DomainEvent::McpServerReconnected {+ server_id,+ tool_count,+ after_failures,+ ..+ }, DomainEvent::McpServerReconnectFailed {+ error,+ failures,+ retry_in_secs,+ ..+ }, DomainEvent::McpServerParked {+ qualified_name,+ error: parked_error,+ ..+ }] => {+ assert_eq!(server_id, "srv-1");+ assert_eq!(*tool_count, 25);+ assert_eq!(*after_failures, 2);+ assert_eq!(error, "mcp error response: not accepting sessions");+ assert_eq!(*failures, 1);+ assert_eq!(*retry_in_secs, 5);+ assert_eq!(qualified_name, "ac.inference.sh/mcp");+ assert_eq!(parked_error, "the `npx` launcher is not installed");+ }+ other => panic!("expected reconnected, reconnect_failed, parked; got {other:?}"),+ }+ let names: Vec<_> = events.iter().map(DomainEvent::variant_name).collect();+ assert_eq!(+ names,+ [+ "McpServerReconnected",+ "McpServerReconnectFailed",+ "McpServerParked"+ ]+ );+}++#[test]+fn publish_counts_only_what_became_an_event() {+ let report = TickReport {+ events: vec![+ SupervisorEvent::ProbeAnswered {+ server: server(),+ elapsed: Duration::from_millis(200),+ },+ SupervisorEvent::ReconnectFailed {+ server: server(),+ error: "connection refused".into(),+ failures: 1,+ retry_in: Duration::from_secs(5),+ },+ ],+ };+ assert_eq!(publish(&report), 1);+ assert_eq!(publish(&TickReport::default()), 0);+}diff --git a/src/openhuman/platform/about_app/catalog_part_02.rs b/src/openhuman/platform/about_app/catalog_part_02.rsindex d5f0388ad0..9161a79f40 100644--- a/src/openhuman/platform/about_app/catalog_part_02.rs+++ b/src/openhuman/platform/about_app/catalog_part_02.rs@@ -506,6 +506,16 @@ Capability {destinations: &["Configured MCP endpoint(s)"],}),},+ Capability {+ id: "channels.mcp_connection_alerts",+ name: "MCP Connection Health Alerts",+ domain: "channels",+ category: CapabilityCategory::Channels,+ description: "Watch installed MCP servers in the background. Every liveness-probe outcome (a slow answer, a dropped transport, a reconnect that succeeded or failed) is recorded in the developer Event Log, and a server that stays down, comes back after failing, or cannot start because its launcher runtime is missing raises a notification.",+ how_to: "Automatic. Settings > Developer > Event Log (filter: mcp) for the stream; Notifications for the alerts",+ status: CapabilityStatus::Beta,+ privacy: None,+ },Capability {id: "channels.mcp_tool_call",name: "Invoke MCP Server Tools",diff --git a/vendor/tinymcp b/vendor/tinymcpindex 55483d2362..2d29afbb09 160000--- a/vendor/tinymcp+++ b/vendor/tinymcp@@ -1 +1 @@-Subproject commit 55483d236288973449e73179a5c05dfd0d215034+Subproject commit 2d29afbb09ef39af4d049ccf9af36a9f41c7bdba