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
The Swift app coordinates state transitions with wall-clock delays instead of events: 134 DispatchQueue.main.asyncAfter and 169 Task.sleep call sites. FloatingControlBar/FloatingControlBarWindow.swift alone has 10 asyncAfters, including "settle delay" patterns (askOmiSettleDelay at :961/:976/:1148) and a bare + 0.05 (:1321). These work on a fast idle machine and misfire under load, on slower Macs, or when two delayed closures interleave — the classic source of "flaky UI" bug reports that get fixed by tuning the constant (the fix/revert rate for this area supports that: ~35% of desktop commit subjects contain fix/revert).
Hotspots: FloatingControlBarWindow.swift (10), OmiApp.swift (6), plus PTT/agent-pill flows (which already needed PTTSilentMicRecoveryPolicyTests, StallDetectorTests, ReentrancyGateTests — scars of timing bugs).
Suggested fix
Not a bulk rewrite — triage the hotspots (floating bar show/hide/focus sequencing, PTT, onboarding) and replace delays with the actual signal being waited on (window didBecomeKey, animation completion handlers, state-machine transitions). The repo already has good state machines (PushToTalkStateMachine) — extend that pattern.
Add a ratchet in CI: record the current counts; fail if a PR increases them. This costs nothing and stops the pattern spreading while hotspots burn down.
Where a delay is genuinely correct (debounce, animation), route it through a named helper (Debouncer, withSettleDelay(reason:)) so intent is greppable and remaining raw asyncAfter sites are, by definition, suspicious.
Open questions
Which delays are load-bearing workarounds for AppKit/SwiftUI ordering quirks (may need to stay, but should be documented at the call site)?
Activity