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
fix(devices): accept snake_case tunnel:register ACK shape from backend PR #709\n\nThe tunnel registration response struct used serde rename attributes that\nonly accepted camelCase field names, but backend PR #709 changed the\nSocket.IO ACK payload to use snake_case. Add `alias` attributes so both\nshapes are accepted, preserving backward compatibility. Also add\ndiagnostic logging of the raw ACK on parse failure.\n\nCloses #5871\n
shanu6f21bd13abe8
diff --git a/src/openhuman/security/devices/tunnel_client.rs b/src/openhuman/security/devices/tunnel_client.rsindex 17519ccc58..fb4aef6a9d 100644--- a/src/openhuman/security/devices/tunnel_client.rs+++ b/src/openhuman/security/devices/tunnel_client.rs@@ -24,13 +24,17 @@ pub struct TunnelRegisterPayload {}/// Response from the `tunnel:register` ACK callback.+///+/// Accepts both camelCase (historic backend shape) and snake_case (backend+/// PR #709 shape) field names via `alias` so the client is forward- and+/// backward-compatible without a coordinated deploy.#[derive(Debug, Clone, Deserialize)]pub struct TunnelRegisterResponse {- #[serde(rename = "channelId")]+ #[serde(rename = "channelId", alias = "channel_id")]pub channel_id: String,- #[serde(rename = "pairingToken")]+ #[serde(rename = "pairingToken", alias = "pairing_token")]pub pairing_token: String,- #[serde(rename = "pairingExpiresAt")]+ #[serde(rename = "pairingExpiresAt", alias = "pairing_expires_at")]pub pairing_expires_at: String,}@@ -87,8 +91,14 @@ pub async fn emit_register() -> Result<TunnelRegisterResponse, String> {.await.map_err(|e| format!("[devices/tunnel] emit tunnel:register failed: {e}"))?;- serde_json::from_value::<TunnelRegisterResponse>(ack)- .map_err(|e| format!("[devices/tunnel] parse tunnel:register ack failed: {e}"))+ serde_json::from_value::<TunnelRegisterResponse>(ack.clone()).map_err(|e| {+ // Log the raw ACK so mismatches between backend field naming and this+ // struct's rename/alias table are immediately visible in the logs.+ log::error!(+ "[devices/tunnel] parse tunnel:register ack failed: {e}; raw ack = {ack}"+ );+ format!("[devices/tunnel] parse tunnel:register ack failed: {e}")+ })}/// Emit `tunnel:connect` to start listening on a channel as `role:"core"`.diff --git a/src/openhuman/security/devices/tunnel_client_tests.rs b/src/openhuman/security/devices/tunnel_client_tests.rsindex e69c7aaa35..5e8a92f248 100644--- a/src/openhuman/security/devices/tunnel_client_tests.rs+++ b/src/openhuman/security/devices/tunnel_client_tests.rs@@ -15,6 +15,23 @@ fn tunnel_register_response_accepts_backend_ack_shape_without_session_token() {assert_eq!(response.pairing_expires_at, "2026-06-30T15:00:00Z");}+/// Regression for #5871: backend PR #709 switched the tunnel:register ACK+/// from camelCase to snake_case. The struct must accept both shapes so the+/// client works against old and new backend versions without a forced deploy.+#[test]+fn tunnel_register_response_accepts_snake_case_ack_shape() {+ let response: TunnelRegisterResponse = serde_json::from_value(json!({+ "channel_id": "ch_456",+ "pairing_token": "pt_456",+ "pairing_expires_at": "2026-09-30T12:00:00Z"+ }))+ .expect("snake_case register ack shape (backend PR #709) should parse");++ assert_eq!(response.channel_id, "ch_456");+ assert_eq!(response.pairing_token, "pt_456");+ assert_eq!(response.pairing_expires_at, "2026-09-30T12:00:00Z");+}+#[test]fn build_core_connect_payload_omits_session_token_for_core_role() {let payload = build_core_connect_payload("ch_123");