Back to Signal Feed
CodeTracked since May 19, 2026

Handle stop-cancel errors during WebSocket startup to prevent unhandled rejections

Fixes a race in AionUi chat stop flow where a cancel request sent while a remote WebSocket session is still connecting could reject with a backend error and bubble to global unhandled-rejection handling. The PR updates the `handleStop` logic in all five SendBox implementations to catch those cancel errors, log a warning, and rely on existing `finally` cleanup so the UI state is still reset.

handleStopWebSocket connect racecancel request error handlingonunhandledrejection

What Happened

  • Fixes a race in AionUi chat stop flow where a cancel request sent while a remote WebSocket session is still connecting could reject with a backend error and bubble to global unhandled-rejection handling. The PR updates the `handleStop` logic in all five SendBox implementations to catch those cancel errors, log a warning, and rely on existing `finally` cleanup so the UI state is still reset.
  • Fixes a race in AionUi chat stop flow where a cancel request sent while a remote WebSocket session is still connecting could reject with a backend error and bubble to global unhandled-rejection handling. The PR updates the `handleStop` logic in all five SendBox implementations to catch those cancel errors, log a warning, and rely on existing `finally` cleanup so the UI state is still reset.
  • 1 evidence item attached for review.

What is Different

Before

Scattered source updates, isolated context, and manual follow-up across multiple feeds.

Now

Added error handling around best-effort stop/cancel requests in all SendBox stop paths so cancel failures during session establishment are treated as handled warnings, preventing exception propagation to the global unhandled-rejection handler while preserving guaranteed UI reset through `finally`.

Why Track This

Why It Matters

Users pressing Stop during remote session startup are less likely to see noisy failure reports or unstable behavior, because stop attempts now fail cleanly and still return the UI to a normal state. Technically, the change wraps `handleStop` cancellation failures in each SendBox variant with `catch` and keeps the shared finalization path intact, so the previous 500 rejection path no longer escapes to Sentry. Watch for whether frequent rapid-stop actions still leave duplicate cancel retries or backend-side cancellation drift across session types.

Impact

Users pressing Stop during remote session startup are less likely to see noisy failure reports or unstable behavior, because stop attempts now fail cleanly and still return the UI to a normal state. Technically, the change wraps `handleStop` cancellation failures in each SendBox variant with `catch` and keeps the shared finalization path intact, so the previous 500 rejection path no longer escapes to Sentry. Watch for whether frequent rapid-stop actions still leave duplicate cancel retries or backend-side cancellation drift across session types.

What To Watch Next

  • Watch whether handleStop becomes a repeated pattern.
  • Track follow-up changes around AI Workflow Automation.
  • Compare future signals against this evidence trail.
  • Re-check risk flags: remote_ws_stop_race, cancel_error_masking.
Open Topic TimelineOpen Technical EventOpen Original Sourceremote_ws_stop_race / cancel_error_masking / sentry_noise_reduction_vs_real_fault_visibility / multi_sendbox_behavior_drift

Supporting Evidence