Repository navigation
Conversation
|
Thanks for extracting this into a focused draft — the scope is much easier to reason about than the larger branch, and the local Whisper quality gate is a useful direction. A couple of things I think should be addressed before this is ready for maintainer review:
Not approving because this is still a draft and there is no passing check summary available. Once the iOS path/scope mismatch is resolved and checks are available, this should be a good candidate for another pass. |
|
Addressed draft review in 160d818. Changes:
Local checks:
|
|
Good progress since the last pass — the quality gate is now wired into A few observations for the next iteration or for the human maintainer:
Not approving: still a draft with no CI checks available. Once CI confirms the new test suite passes, the Thanks for the focused extraction from the larger branch — the scope is clean and the quality gate direction is valuable for Omi's transcription reliability. |
|
Addressed review follow-up in
PR stays draft pending CI and human threshold review. |
|
Thanks for the follow-up — this addresses the concrete issues from the last pass. What looks improved now:
I’m not approving because this is still a draft and there’s no CI/check summary available here. I’d keep |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for this — the quality gate is a sensible, well-scoped approach to a real on-device hallucination problem, and the tests are solid (good coverage of the filler/dedup/low-energy branches). A few per-file notes from static review:
on_device_transcript_quality_gate.dart (new)
_lowEnergyAverageAbsThreshold = 180is ~0.55% of the int16 max (32767). For 16-bit PCM, silent/near-silent room noise can sit in the low hundreds, but a softly-spoken "no" from a mic at arm's length might also average below 180 and get silently dropped. This is the highest-stakes constant in the PR — worth validating against a few real captured clips before merge, or exposing it for tuning._lastAcceptedFillerpersists for the provider's lifetime. After a filler is accepted once, the next identical filler is dropped regardless of how much time elapsed. For a long-running session with a long gap, a legitimate repeated "no" could be suppressed. A bounded TTL (or resetting on a N-second gap) would be more robust. The comment acknowledges it only spans adjacent results; the code doesn't actually enforce adjacency-by-time._wavDataOffsetfalls back to offset 0 when nodatachunk is found, which correctly handles raw PCM; good.
on_device_apple_provider.dart
- Gate is applied to the returned
resultbefore buildingSttSegment, and bothsegmentsandrawTextusefilteredText— consistent. The dropped transcript is logged atwarning, which is the right level.durationis now computed fromaudioData.lengthInBytes / 32000.0(16kHz/16-bit/mono); the old explanatory comment was removed but the math is unchanged.
on_device_whisper_provider.dart
- The
res.text == null || res.text!.isEmpty→res.text.isEmptychange is correct.WhisperTranscribeResponse.textis declaredrequired String text(non-nullable) in the upstreamwhisper_flutter_newpackage, so the old null-check was dead code against the actual type. Good cleanup. - The braces added to the
if/else ifchain are a harmless style pass (no behavior change).
AppDelegate.swift
request.addsPunctuation = trueis iOS 16+ (SFSpeechRecognitionRequest). If Omi still targets iOS 15, this needs anif #available(iOS 16, *)guard; on iOS 15 it would crash at runtime. Worth confirming the deployment target.
on_device_transcription_upgrade_test.dart
- Good unit coverage of the gate in isolation. The two source-parsing tests (polling window + dictation hint) are string-assertion tests against source files — they're brittle to refactors but do lock in the intended config. The mocked Apple provider test correctly verifies null return on silent audio.
CI
PR Metadata Preflightis failing onfailure-class-protocol: thefix:commit subject requires aFailure-Class: FC-<slug> | new | nonetrailer. AddingFailure-Class: new(or an existing FC slug) to the commit will clear it. This is the merge blocker, not the code.
Overall this is a clean, focused transcription-quality slice. Leaving for human maintainer review on the energy-threshold calibration and the iOS 16 availability question before this comes out of draft.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Git-on-my-level
left a comment
There was a problem hiding this comment.
Follow-up on the same head (44dc9ab) — I was able to resolve the deployment-target question I'd left open in my earlier review, and it turns into one blocking issue.
Blocking: AppDelegate.swift — addsPunctuation needs an availability guard
request.addsPunctuation = true is an iOS 16.0+ API (introduced in iOS 16 / macOS 13 per Apple's documentation). The Runner target builds with IPHONEOS_DEPLOYMENT_TARGET = 15.0 in every configuration of Runner.xcodeproj (Debug/Release/Profile x standard/-prod/-dev), and Podfile pins platform :ios, '15.0' (the post_install hook only mutates pod targets, not the app target). With no #available check around it (none on SpeechRecognitionHandler or transcribe), this is a Swift compile error for the iOS app target, not just a runtime risk:
if #available(iOS 16, *) {
request.addsPunctuation = true
}request.taskHint = .dictation is fine unguarded (available since iOS 10).
Other notes (all non-blocking)
on_device_transcript_quality_gate.dart— unchanged since the last pass. The named_lowEnergyAverageAbsThreshold = 180constant is reasonable as a default, but real-device calibration evidence is still the main thing keeping this in human review: a softly-spoken short utterance could average below 180 and be dropped.on_device_apple_provider.dart— gate wiring is clean:filteredTextflows into bothsegmentsandrawText, drops are logged atwarning, and returningnullpropagates as no-transcript for the poll.on_device_whisper_provider.dart— verified theres.text == null || res.text!.isEmpty→res.text.isEmptychange against the pinnedwhisper_flutter_newfork (af6b457):WhisperTranscribeResponse.textisrequired String text, so the old null-check was dead code. Correct cleanup, and the gate application mirrors the Apple path symmetrically.on_device_transcription_upgrade_test.dart— good coverage; the mockedcom.omi.ios/speechchannel test assertingnullon silent audio is a real behavior-level check. The two source-string assertion tests (polling window, dictation hint) are brittle to refactors but acceptable as config locks.
Also noting progress since last pass: PR Metadata Preflight now passes (the Failure-Class trailer is present), and the focused unit tests cover the new gate logic, so I'm dropping needs-tests. Keeping needs-maintainer-review: once the availability guard lands, the remaining merge question is the real-device threshold/filler-token tradeoff, which is a product-quality call (false positives on short legitimate utterances like a quiet "no"), not something I can validate statically.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
Failure-Class: new
Resolved in cb1830c: request.addsPunctuation = true in AppDelegate.swift is now guarded by if #available(iOS 16, *), which was the blocking concern of this review. Checks are green at the new head; remaining open item (real-device threshold calibration) is tracked for human maintainer review.
|
Verified on Per-file pass on this head for the record:
With the blocker fixed and checks green, this is ready for maintainer sign-off. The one thing automation can't settle is real-device calibration of the gate: whether avg |sample| < 180 plus the six English filler tokens is safe against quiet-but-real short utterances (non-English filler is unaffected, since only exact English tokens are gated). That product-quality tradeoff is the crux being left with the human maintainer under the existing labels. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
fix(app): on-device transcription hallucination gate — bug fix, confidence 5/5 (stated root cause, fix(app) title on concrete defect, scoped diff 257 lines/5 files, CI green, red-then-green test added). Not already fixed on main. Merging.
Theory
On-device transcription accepted low-quality local Whisper/Speech output as final text. Short hallucinations, repeated filler, and weak local transcripts could leak into conversations instead of being rejected or falling back.
Scope
Cut from #9084
Tests
flutter test test/unit/on_device_transcription_upgrade_test.dartfailed on missingOnDeviceTranscriptQualityGate.flutter test test/unit/on_device_transcription_upgrade_test.dartpassed 5 tests.Notes
app/lib/pages/home/page.dart.Failure-Class: none