You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Grep across src/ finds 106 instances of catch { } (or catch (Exception) { /* ignore */ }) across 41 files. Many are around method calls that don't throw (DispatcherQueue?.TryEnqueue returns false on failure rather than throwing), and many cluster in the same file with the same shape — strong AI-assisted-edit fingerprint.
Highest concentrations:
src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs — 15 instances of try { DispatcherQueue?.TryEnqueue(...) } catch { }. TryEnqueue doesn't throw. The try/catch is doing nothing.
src/OpenClaw.Tray.WinUI/Services/AudioPipeline.cs — 11 instances around DiagnosticMessage?.Invoke(...). The invoke can throw if a handler throws; the swallow loses the exception.
Hides real exceptions. When a handler genuinely faults, the swallow makes diagnosis impossible. The bug report is "the activity stream randomly stops updating" with nothing in the log.
Encourages copy-paste growth. Each new caller of DispatcherQueue wraps in try/catch by reflex; the pattern proliferates.
Conceals real intent. Was the catch defensive (handler-might-throw) or paranoid (TryEnqueue-might-throw)? The reader can't tell without auditing every site.
Proposed fix
Two helper methods:
publicstaticclassSafeDispatch{// Use when calling DispatcherQueue.TryEnqueuepublicstaticvoidSafeEnqueue(thisDispatcherQueue?q,DispatcherQueueHandleraction);// Use when invoking an event with possibly-throwing handlerspublicstaticvoidSafeInvoke<TArgs>(thisEventHandler<TArgs>?handler,objectsender,TArgsargs,IOpenClawLogger?log=null);}
SafeInvoke logs at Warn when a handler throws, identifying the handler by MethodBase.GetCurrentMethod() or similar.
Migration:
Land the helpers.
Migrate the 26 HubWindow + AudioPipeline sites in one PR.
Migrate the rest opportunistically.
Add an analyzer or grep CI check: empty catches in src/ should be exceptional and commented with why.
Severity
Medium — observable as "rare bugs that can't be reproduced."
AudioPipeline.cs — replaced 11 silent event swallows with SafeInvoke(..., _logger)
9 new unit tests covering null-safety, multi-handler firing, exception containment, and logger integration
The remaining ~80 sites across 39 other files are left for opportunistic follow-up as the issue proposes. The PR is on branch repo-assist/fix-safe-dispatch-empty-catches-365.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
az667904.vo.msecnd.net
vortex.data.microsoft.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
Closing during the post-refactor deep-review cleanup. Empty-catch cleanup is rescoped to source-only work in #372; stale broad automation PR was closed. This keeps the signal while reducing stale one-off issue noise.
Activity
fix(dispatch): remove empty catch blocks around TryEnqueue; add SafeD…
github-actions commentedon May 15, 2026
🤖 This is an automated response from Repo Assist.
I've created a PR that implements steps 1 and 2 of the proposed migration:
Helpers/SafeDispatch.cs—SafeEnqueueextension onDispatcherQueue?(no try/catch, since TryEnqueue returns bool)Helpers/SafeEventInvoke.cs—SafeInvoke<T>andSafeInvokeextensions that log aWarnwhen a handler throws instead of swallowing silentlyHubWindow.xaml.cs— removed 15 emptytry { DispatcherQueue?.TryEnqueue(...) } catch { }blocksAudioPipeline.cs— replaced 11 silent event swallows withSafeInvoke(..., _logger)The remaining ~80 sites across 39 other files are left for opportunistic follow-up as the issue proposes. The PR is on branch
repo-assist/fix-safe-dispatch-empty-catches-365.Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
az667904.vo.msecnd.netvortex.data.microsoft.comSee Network Configuration for more information.
shanselman commentedon May 18, 2026
Closing during the post-refactor deep-review cleanup. Empty-catch cleanup is rescoped to source-only work in #372; stale broad automation PR was closed. This keeps the signal while reducing stale one-off issue noise.