uttrflow / uttrflow/uttrflow-swift

Recording retries reuse vocabulary cached by a previous dictation instead of reading current dictionary words

Open
#785 0 comments 0 reactions 0 assignees View on GitHub
area:dictation bug confirmed P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## Problem

A saved recording retry can use the vocabulary from an earlier dictation or retry. Dictionary edits made between attempts do not reach the recogniser until a new microphone recording resets the cache. Retrying to recover a misrecognised name can therefore repeat the old recognition bias.

## Evidence

Reviewed main commit `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`.

- `Sources/UttrflowPipeline/DictationPipeline.swift:265-296`: `retry` starts a new generation and processes saved audio but does not reset `dictationWords`.
- Lines 329-330: the cache reset exists only in `beginWorkingAhead`, called by the microphone recording path.
- Lines 379-384: `vocabulary(seeing:)` returns the previous cached words without asking the provider again.
- `Sources/Uttrflow/AppDelegate.swift:553` wires this provider to the dictionary vocabulary source.

A release-mode Swift test against the unchanged production modules calls `retry` twice with distinct recording IDs. The vocabulary provider returns `["OldName"]` on its first read and `["NewName"]` on its next read. Both attempts reach the fake speech engine, but the provider is called only once and both transcription options contain `["OldName"]`. This confirms the stale request data; no claim is made about a particular model's resulting transcript.

## Fix and acceptance criteria

Reset per-dictation vocabulary when every new attempt begins, including retries. Prefer one shared attempt-initialisation path so retry and microphone recording cannot diverge. Preserve caching across pieces within the same attempt.

Add regression coverage proving that two consecutive retries consult the vocabulary provider separately, and that a retry after a microphone dictation gets fresh words. Retain a multi-piece assertion that vocabulary is fetched once within each attempt. Review the adjacent per-dictation language cache for the same lifetime mismatch.

## Related work

Closed #180 moved vocabulary ownership into the pipeline and addressed repeated reads within one dictation. This is a separate cache-lifetime bug across attempts introduced or exposed by that ownership: the cache outlives a retry boundary.

Priority: P2. Reproduced using injected speech and recording doubles; production files were unchanged.

Contributor guide

Open the contributing guide

Research direction

Start in Sources/UttrflowPipeline/DictationPipeline.swift, especially retry, beginWorkingAhead, and vocabulary(seeing:), then inspect the provider wiring at Sources/Uttrflow/AppDelegate.swift:553. Run or recreate the release-mode Swift regression using injected speech and recording doubles. Done means retries and microphone attempts fetch fresh vocabulary while multi-piece attempts still reuse it, with the adjacent language cache reviewed.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.