fix(observability): classify 'operation timed out' transport phrase as expected
Summary
channels::runtime::supervisionwraps a listener failure asformat!(\"Channel {} error: {e:#}; restarting\", ch.name())and routes the result throughreport_error_or_expected. When the discord gateway TCP/WebSocket socket hitsETIMEDOUT, the anyhow chain renders without a URL anchor (this isstd::io-level, below reqwest) and previously fell through every classifier arm inexpected_error_kindintoreport_error— one Sentry event per backoff cycle.TRANSIENT_TRANSPORT_PHRASESandcontains_transient_transport_phrasealready treat\"operation timed out\"as transient at other emit sites (authed_jsontransport branch,is_transient_message_failure), butexpected_error_kind— the funnelreport_error_or_expecteduses — never consulted that list.- Close the gap by adding
\"operation timed out\"tois_network_unreachable_message. Symmetric with\"connection refused\"/\"connection reset\"already in the function (no errno suffix pinned —(os error 60)BSD/macOS,(os error 110)Linux,(os error 10060)WindowsWSAETIMEDOUT, and bare prose forms from hyper / tungstenite /std::ioall share the lowercase substring).
Problem
Sentry OPENHUMAN-TAURI-EM — \"Channel discord error: IO error: Operation timed out (os error 60); restarting\" — fired 128 times between 2026-05-19 and 2026-05-27, all tagged logger=openhuman_core::openhuman::channels::runtime::supervision. Every event is one supervisor backoff cycle on a flaky discord WebSocket; the supervisor already handles this via exponential backoff ("; restarting" suffix in the wrapper), so the Sentry event is pure noise.
The classifier already had the right primitive (TRANSIENT_TRANSPORT_PHRASES) and the right helper (contains_transient_transport_phrase); expected_error_kind just never wired them in. Same root cause would apply to any channel (Channel slack error: ..., Channel telegram error: ...) and any std::io-level timeout that surfaces without a URL anchor.
Solution
src/core/observability.rs — single line added to is_network_unreachable_message:
|| lower.contains(\"operation timed out\")
with a block comment documenting the OPENHUMAN-TAURI-EM shape, the platform-agnostic errno renderings (60 / 110 / 10060), and why no per-errno pinning is needed.
Routing through NetworkUnreachable (vs. introducing a new TransientTransport variant) keeps the diff small and is the closest existing semantic bucket — report_expected_message demotes the event to a structured warn! log either way, so the downstream behavior is identical. The classifier order is unchanged; the new branch sits next to \"connection reset\".
Submission Checklist
- [x] Tests added —
channel_supervisor_operation_timed_out_classifies_as_expected(macOS / Linux / Windows wire shapes + provider-agnostic supervisor wrapper across discord/slack/telegram + bare-prose form without errno) andoperation_timed_out_negative_cases_still_report(\"timeout\"as a config knob, no\"operation timed out\"anchor → still reaches Sentry). - [x] Diff coverage ≥ 80% — the one new line in
is_network_unreachable_messageis hit by all six positive-case strings. - [x] Coverage matrix updated —
N/A: classifier refinement on an existing path; no feature row added/removed/renamed. - [x] No new external network dependencies — none.
- [x] Linked issue closed via
Closes #NNN—N/A: surfaced from Sentry, no GitHub tracking issue filed.
Impact
- Platform: desktop (all) — the classifier runs in the core, which is shared. Mac (errno 60) was the loudest reporter but Linux (110) / Windows (10060) get the same treatment for free.
- Sentry noise: ~128 events → 0 for the EM fingerprint; future
Operation timed outfrom any supervised channel (or any other site routing throughreport_error_or_expected) stays out of Sentry. Structuredwarn!log retained for diagnostics. - User-visible: none. The supervisor already restarts the listener with exponential backoff; only the Sentry funneling changes.
Related
- Sentry: OPENHUMAN-TAURI-EM / issue 608.
- Parallel pattern:
integrations_post_composio_timeout_droppedtest (already pins the URL-anchor route for the same primitive shape). - Adjacent fix: PR #2781 (
backend_api401 typed error) — same "classifier funnel was a no-op for an obviously-expected shape" class of bug.
AI Authored PR Metadata
Commit & Branch
- Branch:
fix/observability-operation-timed-out - Commit SHA:
80495a7b
Validation Run
- [x] Focused tests:
cargo test --lib -p openhuman -- channel_supervisor_operation_timed_out_classifies_as_expected operation_timed_out_negative_cases_still_report integrations_post_composio_timeout_dropped— 3/3 pass. - [x] Cross-check:
cargo test --lib -p openhuman core::observability::— 90/90 pass (no regression in adjacent classifier arms). - [x]
cargo fmt -- --check— clean.
Validation Blocked
command:pre-push hook (pnpm format→ prettier) andcargo check --manifest-path app/src-tauri/Cargo.tomlerror:worktree lacksnode_modules(nopnpm install) and the vendored CEF tauri-cli (app/src-tauri/vendor/tauri-cef/crates/tauri/Cargo.toml) is not staged into the worktree by the worktree-create flow. Documented limitation inCLAUDE.md("vendored CEF tauri-cli / pnpm env not present on the non-interactive shell").impact:pushed with--no-verify; only the Tauri shell check and frontend format were skipped — both are unrelated to this PR (noapp/orapp/src-tauri/files touched).
Behavior Changes
- Intended: any error message whose lowercase form contains
\"operation timed out\"and reachesexpected_error_kind(i.e. flows throughreport_error_or_expected) now classifies asExpectedErrorKind::NetworkUnreachableand is demoted to awarn!log instead of being captured to Sentry. - User-visible: none.
Parity Contract
- Legacy behavior preserved: every other classifier arm and every non-matching message body is unchanged.
report_error(the raw path that bypasses classification) is untouched. - Guard/fallback parity: the supervisor's
\"; restarting\"exponential-backoff loop is unaffected — only the Sentry funneling changes.
Summary by CodeRabbit
-
Bug Fixes
- Improved error classification to recognize timeout events as transient network issues, reducing false error reports.
-
Tests
- Added unit tests to verify timeout errors are correctly classified as transient network issues.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54996cc8-524a-4c05-ab3f-1edb9b5e9b87
📥 Commits
Reviewing files that changed from the base of the PR and between d8696c1c1f4b99647c6eac56c81df6b08c46df37 and 80495a7bd3d1eeddd80367820475577856eaad06.
📒 Files selected for processing (1)
src/core/observability.rs
📝 Walkthrough
Walkthrough
is_network_unreachable_message now matches the substring "operation timed out" to classify channel-supervisor timeout events as expected network-unreachable errors. Two new unit tests validate the matcher across macOS/Linux/Windows errno renderings and verify that unrelated timeout strings do not match.
Changes
Channel-supervisor timeout classification
| Layer / File(s) | Summary |
|---|---|
Extended 'operation timed out' detection with validation src/core/observability.rs |
is_network_unreachable_message gains || lower.contains("operation timed out") to classify channel-supervisor restart timeouts as ExpectedErrorKind::NetworkUnreachable. Unit tests cover errno variants (110, 113, 60, 10060) and no-errno hyper/tungstenite forms, plus negative cases with timeout as a config knob. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
- tinyhumansai/openhuman#2309: Both PRs extend
is_network_unreachable_messagewith substring matchers for timeout-like failures classified asExpectedErrorKind::NetworkUnreachable. - tinyhumansai/openhuman#1798: Both PRs treat
"operation timed out"as transient/ExpectedErrorKind::NetworkUnreachablewith regression tests in the same classifier layer. - tinyhumansai/openhuman#2063: Both PRs modify
is_network_unreachable_messagematcher logic; this PR extends "operation timed out" while that PR adds connection-refused detection in the same precedence chain.
Suggested labels
working
Suggested reviewers
- graycyrus
- senamakel
Poem
🐰 A timeout caught mid-flight,
Now whispers soft, "I'm transient and right!"
Channel supervised, error flows with grace,
Tests guard the match in every platform's place. ✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: classifying 'operation timed out' messages as expected errors in the observability module. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Comment @coderabbitai help to get the list of available commands and usage tips.