Skip to content

fix(desktop): defer auto-update relaunch while a call is being captured - #18842

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/desktop-update-defer-during-capture
Sep 25, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/desktop-update-defer-during-capture

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

An automatic update restarted the desktop app in the middle of a call on 2026-09-25 (0.12.386 → 0.12.387 at 02:45:01Z). The relaunch recovered the interrupted session as crash_recovery and opened a new one, so one call became two conversations.

The updater is meant to wait until nobody has spoken for 120 s, but it read VADGateService.lastSpeechAt, and nothing has created VADGateService since 32cbe7d (2026-04-05). That timestamp was always nil, so every silent auto-update installed immediately. A local Omi Beta log shows zero Sparkle: Deferring lines across four consecutive updates.

This PR:

  • Replaces the dead VAD timestamp with UpdateInstallActivity, which live capture updates:
    • a meeting-role conversation being recorded counts as active now, even through quiet stretches;
    • any transcribed segment (cloud or on-device) marks speech activity.
  • Caps a single deferral at 3 hours, so a meeting detector stuck "on" cannot block updates forever.
  • Removes the unused static lastSpeechAt / markSpeechDetected from VADGateService.
  • Adds desktop/macos/scripts/call-audio-probe.swift, a read-only diagnostic. It logs mic/speaker start and stop per process (CoreAudio listeners, no polling) plus call-window titles as JSONL. It is for measuring call boundaries across call apps (Meet→Meet switch, mute, Telegram, Zoom, …) before redesigning MeetingDetector, which today cannot tell one call from the next.

User-initiated "Install and Relaunch" is unchanged; only the silent willInstallUpdateOnQuit path is gated.

Review

Independent review by zcode (GLM-5.3), read-only: no blockers. Addressed in f9e6a2c:

  • The cap restarted whenever Sparkle re-offered or superseded an update; it now runs from the first deferral since the last install (testCapCountsFromTheFirstDeferralWhenAnUpdateIsReoffered).
  • Meeting activity now uses isLiveCapturing, so an Only-Meetings session armed with the mic paused is not treated as active (test extended).
  • Probe: unregisters CoreAudio listeners for gone processes; Ctrl-C goes through a dispatch signal source.

Not changed: the probe sits outside the swift-format/SwiftLint scope (it is a standalone diagnostic), and deleting the now-provably-dead VADGateService is left to a follow-up.

Product invariants affected

  • INV-BETA-1: touched only because UpdaterViewModel.swift is under its globs. The beta identity, feed, and channel handling are unchanged; only the timing of the silent install changes.

Verification

  • DeferredUpdateInstallTests: existing timing cases, plus the cap (still defers before it, installs at it) and start() with a zero cap.
  • UpdateInstallActivityTests: transcript activity, meeting-active-now, and that AppState publishes meeting capture only while live-capturing (not while an Only-Meetings mic is paused).
  • Local: xcrun swift build --build-tests (Xcode 27, not CI's pinned toolchain) and the 12 focused tests pass.
  • Probe run on macOS 27: emitted input_start for a live Omi Beta capture, a stdin note marker, and probe_stopped on SIGINT.

Failure class (fixes)

Failure-Class: new

Failure-class transition narrative (only when needed)

New class FC-guard-reads-unproduced-signal. Violated contract: a safety gate must read a signal that the protected live path actually produces. The Sparkle deferral read VADGateService.lastSpeechAt, whose only producer stopped being constructed in 32cbe7d, and it treated nil as "quiet". For about six months it compiled, its arithmetic tests passed, and it never deferred once. Canonical guard: the capture path publishes the signal itself (UpdateInstallActivity), and a behavioral test drives AppState state changes and asserts the gate observes them (UpdateInstallActivityTests). Evidence: this PR; 2026-09-25 mid-call relaunch split (PostHog Update Install Started 02:45:01Z during an active meeting capture).

🤖 Generated with Claude Code

Git-on-my-level and others added 3 commits September 25, 2026 12:05
The Sparkle quiet-moment gate read VADGateService.lastSpeechAt, whose only
producer has not been constructed since 32cbe7d, so every silent update
installed immediately and a mid-call relaunch split one meeting into two
conversations (crash_recovery + a new session).

Capture now publishes its own activity: an in-progress meeting-role
conversation is active now, and any transcribed segment marks speech. A
single deferral is capped at 3 hours so a stuck meeting detector cannot
block updates. Also adds a read-only call-audio probe for measuring
per-app mic/speaker boundaries ahead of a MeetingDetector redesign.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on live capture

Review follow-ups for the capture-aware update deferral:
- The 3 h cap restarted whenever Sparkle re-offered or superseded an update,
  so a stuck detector plus the hourly release train could defer forever.
  The cap now runs from the first deferral since the last install.
- Meeting activity is published from isLiveCapturing, not isTranscribing, so
  an Only-Meetings session armed with the mic paused is not "active".
- Probe: unregister CoreAudio listeners for gone processes and handle Ctrl-C
  through a dispatch signal source instead of an async-signal-unsafe handler.

Failure-Class: FC-guard-reads-unproduced-signal

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ease test compile

Desktop Swift Release Compile builds the test target in release, where the
DEBUG-gated resetForTesting() did not exist.

Failure-Class: FC-guard-reads-unproduced-signal

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 9ee6033 into main Sep 25, 2026
41 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/desktop-update-defer-during-capture branch September 25, 2026 11:45
undivisible added a commit that referenced this pull request Sep 25, 2026
Main moved capture_controller.dart forward (silent pendant capture, #18842/#18900)
and the branch conflicted. Resolution: keep main's _flushPhoneFrames() extraction
and apply this PR's phoneSync hoist inside that helper, so all four per-frame
loops still bind _wal.getSyncs().phone once.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0d866-81c0-732a-aee5-a5d50ddad64c
Co-authored-by: Max Carter <[email protected]>
undivisible added a commit that referenced this pull request Sep 25, 2026
…2405605885

Main moved capture_controller.dart forward (silent pendant capture, #18842/#18900)
and the branch conflicted. Resolution: take main's constructor and _flushPhoneFrames()
extraction wholesale, apply this PR's phoneSync hoist inside the helper, and run
dart format --line-length 120 so CI's formatter check is clean.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0d866-81c0-732a-aee5-a5d50ddad64c
Co-authored-by: Max Carter <[email protected]>
undivisible added a commit that referenced this pull request Sep 25, 2026
Main moved capture_controller.dart forward (silent pendant capture, #18842/#18900)
and the branch conflicted. Resolution: keep main's _flushPhoneFrames() extraction
and apply this PR's phoneSync hoist inside that helper, so all four per-frame
loops still bind _wal.getSyncs().phone once.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0d866-81c0-732a-aee5-a5d50ddad64c
Co-authored-by: Max Carter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant