Repository navigation
fix(si_server): skip Sentry for benign "session already active" start_session race (OPENHUMAN-TAURI-5H) - #1625
Conversation
…_session race (OPENHUMAN-TAURI-5H) `engine::start_session` returns `"session already active"` when the engine already has a live session (`engine.rs:107`). That happens at the embedded server entry point when something else got there first: - `screen_intelligence.enable` invoked over RPC (UI/onboarding flow) before the embedded `run()` reached its own `start_session`, or - A prior `run()` cycle left the engine session in place across a server restart. Either way, the session is *running* — the embedded server's `start_session` is a duplicate, not a failure. Today it logs at `error!` and gets captured by sentry-tracing (16 occurrences in 4 days, all macOS users on `openhuman@0.53.22`). Extend the existing `is_expected_macos_only_failure` classifier with a sibling `is_expected_session_already_active_failure`, union them in `is_expected_benign_start_session_failure`, and consume the union at both call sites (`SiServer::run` start_session arm + `start_if_enabled` spawned future). Logs the duplicate at `info!` so sentry-tracing records at most a breadcrumb — same pattern as the macOS-only skip. Tests: - `is_expected_session_already_active_failure_classifies_known_signal` covers the bare wire shape, a wrapped/prefixed form, and pins unrelated session-domain failures (permission errors, IO errors) so they still surface in Sentry. - `is_expected_benign_start_session_failure_is_union_of_classifiers` pins the union helper's contract against the union of both shapes plus the existing macOS-only path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefines screen-intelligence session-start error handling: adds detection for engine "session already active", unions it with the existing macOS classifier, applies the union at SiServer::run and embedded autostart, and adds unit tests. ChangesSession Start Failure Classification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
graycyrus
left a comment
There was a problem hiding this comment.
Walkthrough
Adds a new is_expected_session_already_active_failure classifier for the benign "session already active" error from engine::start_session, unions it with the existing is_expected_macos_only_failure via is_expected_benign_start_session_failure, and swaps both call sites to the union helper. Net effect: duplicate start_session calls log at info! instead of error!, silencing the OPENHUMAN-TAURI-5H noise in Sentry.
Change Summary
| File | Change | Description |
|---|---|---|
src/openhuman/screen_intelligence/server.rs |
Modified | Added two new classifier fns, replaced call sites, added 2 unit tests |
Analysis
Clean, focused observability fix. Follows the established pattern from is_expected_macos_only_failure exactly — private classifier, union helper, both call sites updated in lockstep. Tests cover canonical wire shape, substring matching (wrapped/prefixed), negative cases for unrelated failures, and the union contract. Good negative-case discipline (permission errors, IO errors pinned as non-benign).
One CI-blocking issue found (see inline comment).
…ps failing
Rustdoc wraps indented lines in a doc comment in `fn main() { ... }`, so the
bare `"session already active"` expression compiled as a `()`-returning main
and failed E0308 (`expected (), found &str`). Switching to a ```text``` fence
preserves the visual block and makes rustdoc skip it as a test.
…_session race (OPENHUMAN-TAURI-5H) (tinyhumansai#1625)
…_session race (OPENHUMAN-TAURI-5H) (tinyhumansai#1625)\n
Summary
start_sessionerror classifier with a new sibling,is_expected_session_already_active_failure, plus a union helperis_expected_benign_start_session_failure.SiServer::run(start_session error arm) andstart_if_enabled's spawned future now consume the union helper, so duplicatestart_sessioncalls log atinfo!instead oferror!— sentry-tracing records at most a breadcrumb.Fixes OPENHUMAN-TAURI-5H (16 macOS occurrences in 4 days on
openhuman@0.53.22).Why this is benign, not a failure
engine::start_sessionreturns"session already active"(engine.rs:107) when the engine already has a live session. This happens at the embedded server entry point when something else got there first:screen_intelligence.enableinvoked over RPC (UI/onboarding flow) before the embeddedrun()reached its ownstart_session, orrun()cycle left the engine session in place across a server restart.The session is running. The embedded server's
start_sessionis a duplicate, not a real failure — there's no remediable Sentry signal.Why introduce a union helper instead of inlining
The classifier sits at two call sites today (
SiServer::run,start_if_enabled). A union helper keeps the log-level decision in lockstep across both — same pattern as PR #1542 (is_expected_macos_only_failure).Test plan
cargo test --lib openhuman::screen_intelligence::server— 9 tests pass.is_expected_session_already_active_failure_classifies_known_signalcovers the bare wire shape, a wrapped/prefixed form, and pins unrelated session-domain failures (permission errors, IO errors) so they still surface as Sentry events.is_expected_benign_start_session_failure_is_union_of_classifierspins the union helper's contract against both known-benign shapes.cargo check --lib— no new warnings.cargo fmt.Summary by CodeRabbit
Bug Fixes
Tests