Repository navigation
fix(mobile): route pendant tutorial question outcome through capture and handle voice failures (#23385) - #23391
Conversation
|
Verdict: this is a well-scoped, correctly-designed fix for the tutorial stall, with unusually strong test coverage — no blocking findings from me; leaving the merge call to a human maintainer. What I verified:
Non-blocking notes:
Performance: no new queries or algorithmic cost — control-flow/state plumbing only. Cost: no new external calls. Security: no transport, auth, or data-handling changes. USER IMPACT: the pendant tutorial's "Ask Omi a Question" step no longer gets stuck on "Processing your question…" when you're in another chat or app, or when the voice question fails — it now shows a clear localized retry or limit message and lets you try again. Still wanted from a reviewer (nothing blocking): a manual on-device pass over the press-again/grace-window UX, since widget tests can't fully reproduce the BLE timing paths. Automated review on behalf of the maintainers; leaving the merge decision to a human maintainer — no product or security concern, just a substantive behavioral refactor of the pendant capture path. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
Thanks for the request-outcome and attempt-scoping work. I compared this with current main: #23466 has already merged the original outcome-pipeline fix, with production-owner/widget and simulator coverage, so applying this broader replacement now would duplicate that implementation.
Verification did uncover a remaining native playback boundary. An outer submission timeout can return the tutorial to retry while MessageProvider is still held on native output setup/stop; it also needs safe late-cleanup ownership. Draft #23609 addresses those producer-side paths on top of main, with 99 focused tests and iOS simulator acceptance; CI is still running. No additional unique requirement from this PR was established in this pass. Leaving it unmerged and open rather than applying the same pipeline twice. #23385 stays open through the remaining fix/release/customer follow-up.
The pendant tutorial can remain on Processing with spoken replies enabled after #23466: native playback setup was awaited before starting the voice-stream deadline, and failed replies awaited native audio cleanup before releasing the voice busy guard. Bound spoken-output admission with the existing voice-reply budget and revoke late admission after failure. Finish failed questions independently of best-effort, request-scoped cleanup, using a unique playback identity. Cleanup follows the admitted playback lifecycle: a skipped mode-off, missing-headphone or revoked-admission attempt owns no new playback and must leave existing cleanup intact. An actually admitted replacement retires old cleanup after asynchronous boundaries. Refs #23385 and merged #23466. This builds on the merged outcome pipeline rather than reapplying #23391. Preserve recordings, WAL custody, settings, firmware and backend contracts. No backend deployment is needed. Keep the customer incident open until a mobile release contains the complete fix and the reporter confirms question → answer → Continue and retry. ## Review correction The initial head `385422f01a` incorrectly guarded cleanup with `_beginAttemptSeq`, which advances even when playback is skipped. The three review regressions pass on baseline and fail on that head. The revisions through `d87ea9ea8ee1467160fa3493f91115a64d7725d1` use the existing `_lifecycleToken` as cleanup ownership in both `interrupt` and an admitted begin that is clearing prior audio. Six committed regressions cover all three skips at each cleanup entry point. The existing admitted-replacement regression is preserved unchanged. Earlier green CI/no-blocker notes for `385422f01a` do not certify this revision. ## Verification - Reproduced all three review cases against baseline and the initial PR head: baseline 3/3 pass, initial head 0/3 pass. After the interruption correction, all six baseline/current comparisons pass alongside the committed service suite (27 tests total). The sibling admitted-begin cleanup cases also fail on `0cedebcf1b` before that path is corrected and now pass in the final focused suite. - Revised head `d87ea9ea8ee1467160fa3493f91115a64d7725d1`: 105 targeted provider, tutorial/widget and voice-playback tests pass. The production service, capture → external-actions → MessageProvider → tutorial owners execute with synthetic native/audio/provider I/O. No physical pendant or live-provider acceptance claim. - Final head `d87ea9ea8ee1467160fa3493f91115a64d7725d1`: analyzer ratchet and bounded pre-push passed, including 27 selected manifest/preflight checks. The local 90-day historical guard explicitly skipped in the shallow clone; full-history CI must enforce it. The affected tutorial integration flow was rerun successfully on the dedicated iPhone 16 Pro/iOS26.5 simulator via attach/hot restart and driver. Reused native debug host with current Dart and synthetic native/audio/provider I/O; no fresh native binary, physical BLE or live-provider claim. Current-head CI and maintainer re-review remain required; keep draft. - Previous head's remote CI passed 7,420 Flutter tests/four skipped and Hygiene/full-history guard. Those results remain historical and must not be reported as current-head CI. - At the implementation-time release check on 2026-10-25, original #23466 was in iOS 1.0.576 (1474), submitted for Apple review. This follow-up is absent from that binary; merging and a later signed mobile release remain separate from code verification. ## Product invariants affected - INV-CAP-1: only pendant question response/playback completion changes; BLE ingress, WAL custody, saved recordings and transcription settings are preserved. Failure-Class: new Line-Count-Exception: app/lib/providers/message_provider.dart | 1203 -> 1208 | keeps request-local playback authorization, unique ownership and best-effort cleanup beside the existing voice-stream result/finally guard without another global owner or capture pipeline. UI-Evidence: none -- layout is unchanged; the existing tutorial UI is exercised through the production-owner simulator fixture documented in app/docs/pendant-tutorial-question.md.
Closes #23385
Summary
Fixes the interactive pendant tutorial's "Ask Omi a Question" step (
SinglePressStep) stalling on"Processing your question…"when the user is viewing a non-main chat session/app or when a voice question attempt fails after submission.What changed and why
MessageProvider→CaptureExternalActions→CaptureController→DeviceOnboardingProvider):VoiceQuestionFailureandVoiceQuestionOutcomeincapture_external_actions.dartand returnedFuture<VoiceQuestionOutcome>fromMessageProvider.sendVoiceMessageStreamToServer,CaptureExternalActions.sendVoiceMessageStreamToServer, andProviderCaptureExternalActions.sendVoiceMessageStreamToServer.MessageProvider.sendVoiceMessageStreamToServer(voiceMessagesstill stays out of non-main threads, fresh chats, or app threads like Mentor) while returning the submitted request's transcribed question and final answer—or its terminal failure (noSpeech,quota,busy,audioSaveFailed,offline,timeout,server,notSignedIn,incomplete,unknown)—directly to the capture caller._voiceAudioFileSaverwith_voiceReplyTimeoutso a hung local file write cannot stall_voiceSendInFlightor the tutorial indefinitely.CaptureController._handleButtonEventno longer advancesDeviceOnboardingProvideron step 1 before capture admits the voice session. Dropped taps (such as during the 2-second auto-submit grace window or while a submission is already in flight) and non-voice button states no longer flip the tutorial UI into"Listening...".DeviceOnboardingProvidernow scopes each tutorial question attempt with a monotonicactiveAttemptId(onVoiceSessionStarted,onVoiceQuestionSubmitted,onQuestionAutoSubmitted,onVoiceResponseReceived,onVoiceQuestionFailed) and ignores callbacks from stale attempts, after step exit/completion, after disposal, or after an answer has already been received.CaptureController._processVoiceCommandBytesbounds pending submissions in time (_voiceCommandSubmissionTimeout) and routes every drop/failure (emptyFrames,sendInFlight,noDevice,codecLookupFailed, timeout, and stream/transport/quota failures) to the active tutorial attempt.cancelTutorialOwnedVoiceSessionalso cancels an in-flight tutorial submission if the user exits onboarding while"Processing your question…"is active.SinglePressStepfromMessageProvider.messagesand localized terminal failure hints:SinglePressStepnow readsuserQuestion,aiResponse,questionFailed, andquestionFailuredirectly fromDeviceOnboardingProviderinstead of listening toMessageProvider.messages, so unrelated chat traffic cannot complete or corrupt the tutorial step and answers still arrive when chat is outside the main Omi session.voiceQuestionNoSpeech,chatQuotaExceededReply,chatReplyOffline,chatReplyTimeout,chatReplyServerError,chatReplyNotSignedIn,chatReplyFailed) on every terminal failure and resumes the bounce cue for retry.Product invariants affected
app/lib/services/capture/capture_controller.dartandapp/lib/services/capture/capture_external_actions.dartare touched only on the pendant button voice-command question path (_handleButtonEvent,_beginVoiceCommandSession,_endVoiceCommandSession,_processVoiceCommandBytes). Normal pendant audio frame capture, WAL retention, batch routing, and socket streaming (streamAudioToWs) are unchanged.Line-Count-Exception
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4507 -> 4639 | scopes tutorial voice-command session admission, attempt tracking, timeout watchdog, and typed failure forwarding within the existing
_processVoiceCommandBytes/_handleButtonEventmethods that directly mutate private voice-command controller state.Failure-Class
Failure-Class: none
UI-Evidence
UI-Evidence: none -- reuses
SinglePressStep's existing layout, bounce animation, and existing localized error strings (voiceQuestionNoSpeech,chatQuotaExceededReply,chatReplyOffline,chatReplyTimeout,chatReplyServerError,chatReplyNotSignedIn,chatReplyFailed); reaching the live pendant tutorial flow requires paired BLE hardware, and the UI states are covered by widget tests inapp/test/widgets/device_onboarding_question_revisit_test.dart.Verification
flutter test test/providers/device_onboarding_provider_test.dart test/providers/omi_button_actions_controller_test.dart test/providers/message_provider_voice_test.dart test/widgets/device_onboarding_question_revisit_test.dartdart format --line-length 120 --set-exit-if-changed --output=noneon all changed Dart files