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(transport): handle unmatched route 404 for channel message edits
Steven Enamakel2ab3d5d43998
diff --git a/crates/openhuman-tinyhumans/src/transport/error.rs b/crates/openhuman-tinyhumans/src/transport/error.rsindex d7187d233e..f25aa19937 100644--- a/crates/openhuman-tinyhumans/src/transport/error.rs+++ b/crates/openhuman-tinyhumans/src/transport/error.rs@@ -5,9 +5,30 @@use openhuman_core::backend::transport::BackendTransportError;use reqwest::Method;-use tinyhumans_sdk::classify::channel_message_path;use tinyhumans_sdk::Error as SdkError;+fn channel_message_path(path: &str) -> Option<(&str, &str)> {+ let segments = path.split('/').filter(|segment| !segment.is_empty()).collect::<Vec<_>>();+ let channels = segments.iter().position(|segment| *segment == "channels")?;+ if segments.get(channels + 2).copied() != Some("messages") {+ return None;+ }+ let provider = *segments.get(channels + 1)?;+ let message_id = *segments.get(channels + 3)?;+ if provider.is_empty() || message_id.is_empty() || segments.len() != channels + 4 {+ return None;+ }+ Some((provider, message_id))+}++fn is_unmatched_route_404(error: &SdkError) -> bool {+ let SdkError::Status { body, .. } = error else {+ return false;+ };+ body.as_str()+ .is_some_and(|body| body.contains("Cannot PATCH "))+}+/// Map the SDK's error for `method path` onto the core-owned transport error.////// A `404` on a channel-message route becomes a typed variant here, because@@ -20,7 +41,7 @@ pub fn map_sdk_error(error: SdkError, method: &Method, path: &str) -> BackendTraif let SdkError::Status { status: 404, .. } = &error {if let Some((provider, message_id)) = channel_message_path(path) {let (provider, message_id) = (provider.to_owned(), message_id.to_owned());- if *method == Method::PATCH && error.is_unmatched_route_404() {+ if *method == Method::PATCH && is_unmatched_route_404(&error) {log::debug!("[tinyhumans-transport] {method} {path}: 404 with no matching route; \channel edit route missing"