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
refactor(events): share one ellipsis-preserving clip; correct a stale test comment
M3gA-Mind22be3cb36abe
diff --git a/src/core/events.rs b/src/core/events.rsindex 22456f2c99..f20ae94734 100644--- a/src/core/events.rs+++ b/src/core/events.rs@@ -1363,6 +1363,22 @@ pub enum DomainEvent {ThreadGoalCleared { thread_id: String },}+/// Truncate to `max` characters, appending `…` when anything was dropped.+///+/// Counted in `char`s, so a multi-byte error cannot be split mid-character.+/// The ellipsis is the point: without it a clipped provider error reads as if+/// it ended where it was cut, and a reader cannot tell a complete message from+/// a truncated one. Shared so the Event Log summary and the notification+/// bodies cannot drift into three different truncation rules — they had.+#[must_use]+pub fn clip_to_chars(text: &str, max: usize) -> String {+ let mut out: String = text.chars().take(max).collect();+ if text.chars().nth(max).is_some() {+ out.push('…');+ }+ out+}+impl DomainEvent {/// Returns the domain name for routing and filtering.pub fn domain(&self) -> &'static str {@@ -1721,13 +1737,7 @@ impl DomainEvent {/// `char`s, so a multi-byte error cannot be split mid-character.const MAX_DETAIL_CHARS: usize = 160;- fn clip(text: &str) -> String {- let mut out: String = text.chars().take(MAX_DETAIL_CHARS).collect();- if text.chars().nth(MAX_DETAIL_CHARS).is_some() {- out.push('…');- }- out- }+ let clip = |text: &str| clip_to_chars(text, MAX_DETAIL_CHARS);match self {Self::McpServerProbeTimedOut {diff --git a/src/openhuman/desktop/notifications/bus.rs b/src/openhuman/desktop/notifications/bus.rsindex 1bede92c21..15f4d44a10 100644--- a/src/openhuman/desktop/notifications/bus.rs+++ b/src/openhuman/desktop/notifications/bus.rs@@ -364,7 +364,7 @@ pub fn event_to_notification(event: &DomainEvent) -> Option<CoreNotificationEvenbody: format!("{qualified_name} stopped answering, so its tools are unavailable until it \reconnects. It retries automatically. {}",- error.chars().take(120).collect::<String>()+ crate::core::events::clip_to_chars(error, 120)),deep_link: Some("/connections?tab=mcp".into()),timestamp_ms: ts,@@ -400,7 +400,7 @@ pub fn event_to_notification(event: &DomainEvent) -> Option<CoreNotificationEvenbody: format!("{qualified_name} will not be retried: {}. Install the missing runtime, then \disable and re-enable the server.",- error.chars().take(160).collect::<String>()+ crate::core::events::clip_to_chars(error, 160)),deep_link: Some("/connections?tab=mcp".into()),timestamp_ms: ts,diff --git a/src/openhuman/desktop/notifications/bus_tests_2_tests.rs b/src/openhuman/desktop/notifications/bus_tests_2_tests.rsindex 01c6bec5ab..7abac03bfb 100644--- a/src/openhuman/desktop/notifications/bus_tests_2_tests.rs+++ b/src/openhuman/desktop/notifications/bus_tests_2_tests.rs@@ -175,7 +175,8 @@ fn notification_triaged_unrouted_escalate_is_silent() {// ── MCP reconnect supervisor (#5931) ────────────────────────────────────────/// The workspace an MCP supervisor event is attributed to. The pure-/// translator ignores it — the bridge's `is_for_this_workspace` is what reads+/// translator ignores it — the bridge's `store_target` / `should_announce`+/// are what read/// it — so these cases all use the same one.fn mcp_workspace() -> std::path::PathBuf {std::path::PathBuf::from("/tmp/openhuman-ws")