uttrflow / uttrflow/uttrflow-swift

A toggle or double-tap dictation keeps recording through screen lock and sleep, and the cap then finishes it the moment the Mac wakes

Open
#611 0 comments 0 reactions 0 assignees View on GitHub
area:dictation bug help wanted P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
4h 27m
Merged PRs (30d)
286

Description

## What happens

Nothing on the dictation path observes the session going away:

- `grep -rn "willSleepNotification\|didWakeNotification\|sessionDidResignActive\|screensDidSleep\|screenIsLocked" Sources/Uttrflow Sources/UttrflowPipeline Sources/UttrflowAudio` finds only `SuggestionCoordinator`, which withdraws a suggestion ghost on display sleep (`Sources/Uttrflow/Suggestion/SuggestionCoordinator.swift:209-216`).
- A dictation started in press-to-toggle mode, or with a double tap, has no held key, so locking the screen (⌃⌘Q), closing the lid or switching user does not end it. The microphone stays open while the Mac is locked.
- The 4-minute cap runs on `ContinuousClock` (`Sources/Uttrflow/AppDelegate.swift:575`, `DictationController.watchTheLimit` at `Sources/UttrflowPipeline/DictationController.swift:317-331`). `ContinuousClock` keeps counting while the Mac sleeps, so after a sleep longer than the cap the limit task fires as soon as the process runs again and `finishAtTheLimit` finishes the recording at wake, typically with the lock screen in front.

What the audio engine delivers across sleep is hardware-dependent: CoreAudio may post a configuration change (then the recording is refused, see #604) or keep delivering.

## Why it matters

A user who started a hands-free dictation and locked the screen to step away reasonably believes the Mac is not listening. Up to four minutes of whatever is said near a locked Mac is recorded, kept on disk for retry and transcribed. On wake the dictation lands without the user asking for it, while they are typing their password.

## How to reproduce / measure

Help wanted, needs a real Mac and no one else using it:

1. Settings → activation press-to-toggle. Start a dictation.
2. Lock the screen with ⌃⌘Q, speak for 30 seconds, unlock. Observe whether the menu bar still shows listening, and what is inserted after the next toggle.
3. Repeat, then close the lid for more than 4 minutes and open it. Observe what happens at wake, and whether the text went anywhere.

Headless: a `DictationController` test with a `ManualClock` can show that nothing but the gesture queue and the cap can end a toggled dictation.

## Acceptance criteria

- Locking the screen, switching user or sleeping ends a toggle or hands-free dictation the same way a stop does (or cancels it, which is a product call: `needs-info` if unsure), before the session goes away.
- The cap does not fire on wake for time the Mac spent asleep.
- `Docs/stuck-recording.md` says what happens to a recording across lock and sleep.

Contributor guide

Open the contributing guide

Research direction

Start with Sources/Uttrflow/AppDelegate.swift:575 and Sources/UttrflowPipeline/DictationController.swift:317-331, then inspect the existing notification search and the ManualClock test path. Reproduce lock and sleep behavior on a real Mac, and verify that toggled or hands-free sessions end appropriately, the cap does not finish them because of sleep, and Docs/stuck-recording.md documents the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
audio-video-rtc, documentation, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.