Skip to content

fix(onboarding): recover guided voice answers and show a grounded payoff - #21401

Merged
Git-on-my-level merged 11 commits into
mainfrom
lane/onb-m-voice
Oct 13, 2026
Merged

Git-on-my-level merged 11 commits into
mainfrom
lane/onb-m-voice

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

First-run voice-intro starters answer zero prompts on iOS 33% / Android 50%; about 20% encounter a transcription failure and 28% of Android / 23% of iOS starters skip without recording. Android has no live transcript during its WAV upload path. This change gives each prompt visible input feedback and a recoverable answer path, then shows what was saved and a first grounded chat answer.

  • Check transcription readiness before microphone preparation. Reuse the existing authenticated, read-only STT availability endpoint for cloud paths; use Apple engine availability on device. A known failed check offers typing without starting the microphone. A slow check is inconclusive and permits speaking; the existing streaming health signal does not prove Android batch availability.
  • Show input waveform and elapsed seconds, “Got it, transcribing…”, and the full transcript with an explicit confirmation. Question skip stays secondary and is available on confirmation. Try Speaking Again clears a failed take and resets the cap; Retry transcription resubmits the same PCM without opening the mic. Genuine pause/resume retains PCM. Primary and secondary controls share the bottom safe-area footer, which scrolls on constrained keyboards; the first prompt fits two lines on both platforms.
  • Typed answers use the existing reviewed memory/goal writes and fix(onboarding): lock submitted memory answers and dedupe retries (#20792) #21309 content/idempotency locks; typed-only introductions do not require voice enrollment. Typing a correction to a confirmed transcript preserves that clip for enrollment.
  • Preserve analytics event names, distinguish permission denial/permanent denial, engine start, timeout, HTTP and empty transcription failures, and attach on_device/cloud path. Register Payoff Shown and Payoff Continued with bounded properties; memories_count counts all saved answers, goals included. Fallback telemetry distinguishes timeout, offline and error. Explicit payoff continuation also completes partial saves, and typed-only saves do not claim a failed voice enrollment.
  • After successful saves, show saved answers and ask “What should I focus on this week?” via the existing POST /v2/messages API. Explicit saved facts avoid requiring indexed history; device tools are absent, server quotas remain enforced, and no paywall/provider UI is invoked. Emit Chat Message Sent only after HTTP 200 stream acceptance. Stop waiting after eight seconds and keep Continue enabled. If chat fails, show saved cards once and “I’ll use these to help you.”, with no repeated question/answer block. No saved answers means no payoff; stale repeated Save taps cannot replace it.

Validation: 73 focused controller, request, widget and analytics tests plus five existing onboarding-header and four resume/retention regressions; 20 light-theme render tests (ten states each on iOS and Android at 393×852 @3x, real fonts); focused flutter analyze; mobile UX/l10n/event registry gates; make preflight. All I/O is synthetic in tests. This does not claim physical-device, live-provider or production-write acceptance. The voice guide also names test/providers/speech_profile_provider_test.dart, which is absent on main; the current controller/IO tests and existing header suite were run instead.

Screenshots are tracked in .agent-artifacts/ui-evidence/onb-m-voice/ with evidence.json. iOS 001–009 plus 019 and Android 010–018 plus 020 cover idle, recording, transcribing, confirmation, failed + typing offer, typing, review, chat payoff and fallback payoff, plus genuine paused recording. Recording PCM varies in amplitude. All PNGs were opened and visually checked. These “chat” screenshots use a synthetic completed API answer.

iOS idle
iOS recording
iOS transcribing
iOS confirmation
iOS failure
iOS typing
iOS review
iOS chat payoff
iOS fallback payoff
Android idle
Android recording
Android transcribing
Android confirmation
Android failure
Android typing
Android review
Android chat payoff
Android fallback payoff

Review regression layers:

  • Controller: failed take → fresh start resets PCM/seconds/meter; pause/resume retains PCM; same-clip retry opens no mic; typed correction preserves enrollment; preflight timeout allows recording; existing typed save locks still pass.
  • Request: delayed and thrown timeouts are inconclusive; HTTP acceptance callback fires only for 200, never rejection/offline; server timeout frames retain classification; stream deadline/cancellation tests remain.
  • Analytics: saved goals are counted and timeout/offline/error fallback reasons are asserted.
  • Existing retention fixtures now explicitly confirm each heard answer; retained-answer and cross-session goal-idempotency assertions are unchanged. This fixes both failures reported by the prior full Flutter CI run.
  • Widgets: failure has no paused label, same-clip retry and confirmation Skip work; fallback displays each saved card once with no question; large text and keyboard footer regression passes.
  • Renders: 20 real-font iOS/Android states; bottom links remain inside the viewport; waveform fixture contains multiple amplitudes.

iOS paused
Android paused

Reviewer risks:

  • The reused health endpoint is streaming-primary/circuit readiness, not an active batch-provider canary; a passed check cannot guarantee the next transcription.
  • On-device readiness bypasses cloud health; recording/Speech permission or engine startup can still fail and offer typing.
  • The first chat turn uses ordinary quota and billing policy; quota errors yield saved cards plus an acknowledgment. An aborted response can still leave the submitted question in chat history.
  • Spoken confirmation adds a tap per answer. Fallback deliberately omits generated advice and the question block to avoid repeating cards.
  • New copy uses the authorized English fallback in other locales; native-device font, keyboard and recorder behavior remain for device QA.

Invariants: INV-UI-1, INV-UI-3 (shared neutral controls, localized accessible copy, scrollable receipt).
Failure-Class: new

🤖 Generated with Claude Code

Git-on-my-level and others added 7 commits October 13, 2026 19:01
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-guided-intro-transcription-has-no-answer-path

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level Git-on-my-level added the ci:full Maintainer-granted: run full CI on this fork PR label Oct 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T14:08:34.001374Z 93047da New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2b47b1cc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +54 to +55
_local = Platform.isIOS && await OnDeviceAppleProvider.isOnDeviceAvailable(_language);
return _local || await guidedVoicePreflight();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Probe the STT path actually used for transcription

When the streaming provider circuit is cooling down but prerecorded STT remains healthy, this returns false and blocks recording for every device without local iOS transcription. The probed endpoint explicitly reports STT_SERVICE_MODELS streaming availability (backend/routers/speech_profile.py:67-74), while transcribeGuidedAnswer posts to the prerecorded endpoint, whose provider is selected from STT_PRERECORDED_MODEL (backend/utils/stt/pre_recorded.py:111-118); these services can fail independently. Use a readiness signal for /v2/voice-message/transcribe, rather than the streaming speech-profile probe.

Useful? React with 👍 / 👎.

Comment thread app/lib/l10n/app_ar.arb Outdated
"moreOptions": "المزيد من الخيارات",
"filterByDate": "تصفية حسب التاريخ",
"memoryGraph": "الرسم البياني للذكريات",
"guidedVoiceExperience": "{part, select, unavailable{Voice transcription is unavailable right now. Type your answer instead.} type{Type Your Answer Instead} typing{Your answer} heard{Here's what I heard} transcribing{Got it, transcribing…} confirm{Use This Answer} answer{Save Answer} retry{Try Speaking Again} title{Here's what I'll remember} question{What should I focus on this week?} fallback{Based on what you shared} thinking{Thinking about your answers…} failed{We couldn't transcribe that answer. You can type it instead or try speaking again.} engine{The microphone couldn't start. Try again or type your answer instead.} other{}}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Translate the new onboarding selector for each locale

The new selector is copied verbatim in English into the Arabic locale, as well as every other changed non-English ARB, so users in those locales see the new transcription recovery and payoff flow switch to English. Supply locale-specific translations through the repository's localization tool instead of duplicating the English template.

AGENTS.md reference: app/AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

Comment on lines +360 to +362
transcript = text;
stage = IntroductionStage.confirmation;
_emit();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate the retained onboarding test to confirmation

Introducing this intermediate confirmation state leaves app/test/widgets/onboarding_resume_and_voice_retention_test.dart's _answerAll helper unmigrated: it calls next() four times without confirmAnswer(), so promptIndex never advances past zero and both retention/idempotency tests expecting four answers fail in the full Flutter test suite. Update that in-tree caller alongside the state-machine contract change.

AGENTS.md reference: AGENTS.md:L34-L34

Useful? React with 👍 / 👎.

);
answer.keep = answer.text.isNotEmpty;
answers.add(answer);
_recordCompletedPrompt(result: 'answered', transcriptPresent: true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark typed answers as having no transcript

When a user chooses typing—either initially or after transcription fails—submitTyped() reaches this shared method with empty audio, but the completion event still records transcript_present: true. This makes typed recovery look like successful transcription in the guided-intro funnel and obscures whether the new fallback is actually needed or working; pass the answer source into this method and emit false for typed submissions.

Useful? React with 👍 / 👎.

error = null;
try {
if (!voiceSaved) await _saveVoice();
if (!voiceSaved && answers.any((a) => a.audio.isNotEmpty)) await _saveVoice();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report typed-only saves as not attempting voice enrollment

For a typed-only introduction this new predicate correctly skips _saveVoice(), but the Guided Intro Save Submitted event emitted just above still sets voice_attempted to !voiceSaved, which is true for every such user. The save funnel therefore records a voice attempt even though io.enroll was never called; derive that property from the same nonempty-audio condition used here.

Useful? React with 👍 / 👎.

return [
_button(copy('start'), _stoppingCapture ? null : () => unawaited(_start()), 'speech_profile_start'),
const SizedBox(height: OmiSpacing.xs),
_textAction(context.l10n.guidedVoiceExperience('type'), () => unawaited(flow.typeInstead()), 'introduction_type'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Hide typing during voice-quality sample recovery

After enrollment reports a short sample, addSample() returns to the ready state specifically to collect additional audio, but this unconditional action lets the user type instead. Submitting that text adds an answer with empty audio, so the next Save and Finish retries the unchanged short recording and returns to the same error; typing cannot satisfy this recovery step. Suppress the typing action while _extraSample is active or route typed submission past voice enrollment.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 4 commits October 13, 2026 20:36
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve paused PCM and corrected transcript enrollment audio, keep every
voice control in the safe-area footer, and simplify the fallback payoff.
Allow slow preflight checks and emit accurate accepted-chat and payoff
telemetry, with controller/request/widget tests and real-font renders.

Failure-Class: FC-guided-intro-transcription-has-no-answer-path
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the retention and goal idempotency assertions while exercising the
explicit heard-you confirmation introduced by this flow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 8766c20 into main Oct 13, 2026
44 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/onb-m-voice branch October 13, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Maintainer-granted: run full CI on this fork PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant