Skip to content

fix(app): stop retrying a dead speech-profile socket, offer skip instead - #12070

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
igor-popov-dev:fix/speech-profile-graceful-skip
Aug 23, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
igor-popov-dev:fix/speech-profile-graceful-skip

Conversation

@igor-popov-dev

@igor-popov-dev igor-popov-dev commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

closeCode 1011 with zero captured user segments means the onboarding speech-profile
socket's STT backend is down server-side, not that the socket merely hiccuped. The reconnect
loop added in #11704 retried this every 5s forever: each failed reconnect re-triggers
onClosed, which re-shows the "Connection Lost" dialog (speech_profile_widget.dart /
page.dart) and reschedules another attempt, even though the same screen already has a
working "Skip for now" link (speech_profile_widget.dart:487-496) right next to it.

After 3 consecutive 1011 closes with no captured speech, SpeechProfileProvider now stops
scheduling reconnects and surfaces a distinct STT_UNAVAILABLE error instead of
SOCKET_DISCONNECTED. The onboarding widget routes that to the existing skip path
(provider.close() + widget.onSkip()) instead of a dialog whose only button just popped
the screen without marking the step skipped.

Product invariants affected

none

How it was verified

  • flutter test test/providers/speech_profile_provider_test.dart — 7/7 passed, including
    3 new regression tests (gives up and surfaces STT_UNAVAILABLE after 3×1011-with-no-speech;
    keeps retrying on an ordinary 1006 disconnect; does not give up once real speech was already
    captured).
  • dart format --line-length 120 --set-exit-if-changed on the 4 changed files — clean.
  • flutter analyze on the 4 changed files — no issues found.

Tests

Bug fix — regression tests added in test/providers/speech_profile_provider_test.dart
covering the new give-up threshold, that an ordinary disconnect is unaffected, and that
already-captured speech prevents a false give-up.

Failure class (fixes)

Failure-Class: none

Scoped cleanups (optional)

none

Review in cubic

@igor-popov-dev
igor-popov-dev force-pushed the fix/speech-profile-graceful-skip branch from 26e1a2d to a372859 Compare August 22, 2026 20:53
closeCode 1011 with no captured speech means the STT backend is down,
not a transient socket hiccup. The onboarding reconnect loop (added in
BasedHardware#11704) kept retrying it every 5s forever, repeatedly popping the
"Connection Lost" dialog with no way out besides force-quitting, even
though "Skip for now" sits right next to it in the same flow.
After 3 consecutive 1011 closes with zero user segments, give up
reconnecting and surface a distinct STT_UNAVAILABLE error so the
onboarding widget can route to the existing skip path instead.

Failure-Class: none
@igor-popov-dev
igor-popov-dev force-pushed the fix/speech-profile-graceful-skip branch from a372859 to ec4902d Compare August 22, 2026 22:11
@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Aug 23, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @igor-popov-dev — this is a well-scoped fix for a real onboarding trap, and the regression tests pin exactly the right behaviors. Verified against the head; notes below.

What checks out:

  • app/lib/providers/speech_profile_provider.dart — the new _sttUnavailableCloseCount / _maxSttUnavailableCloses = 3 gate in onClosed() correctly narrows on closeCode == 1011 && segments.isEmpty, and the premise matches the backend: backend/routers/listen/runtime.py closes this socket with 1011 on terminal STT failure, so treating it differently from a 1006 blip is right. Any non-qualifying close resets the counter, and the give-up path cancels _reconnectTimer before emitting STT_UNAVAILABLE, so no stray reconnect is left running.
  • app/lib/pages/onboarding/speech_profile_widget.dart — routing STT_UNAVAILABLE to a single-button "Skip for now" dialog that calls provider.close() + widget.onSkip() matches the existing skip link at the bottom of the same screen, and it reuses existing l10n keys (skipForNow, connectionLost, connectionLostDesc — all present in app/lib/l10n/app_en.arb), so no new translations are needed.
  • app/lib/pages/speech_profile/page.dart — folding STT_UNAVAILABLE into the existing disconnect branch is a reasonable minimal choice for the standalone speech-profile page.
  • app/test/providers/speech_profile_provider_test.dart — the three new tests (give-up after 3×1011 with no speech, ordinary 1006 keeps retrying, already-captured speech prevents a false give-up) directly pin the new behavior, and they reuse the existing _CountingSpeechProfileProvider fixture cleanly.

Two minor, non-blocking notes for a possible follow-up:

  1. close() doesn't reset _sttUnavailableCloseCount. After a give-up → skip in onboarding, the counter stays at 3, so a later speech-profile attempt in the same app process would surface STT_UNAVAILABLE on the first 1011 close instead of the third. Impact is low (same dialog, just earlier), but resetting it in close() alongside segments.clear() would keep sessions independent.
  2. In page.dart, the dialog shown for STT_UNAVAILABLE still labels its button "Try again" while the action is provider.close() + pop. That wording is inherited from the existing SOCKET_DISCONNECTED branch, so it's not a regression, but dedicated skip/close wording would read better for the STT-down case.

Neither blocks merge from my side — leaving for human maintainer review.


🤖 This comment was AI-generated on behalf of the Omi maintainer team.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified: confirmed via git history the underlying issue is not already fixed on main; CI green; scoped bug fix with regression tests. Merging (confidence gate met).

@kodjima33
kodjima33 merged commit 9fab134 into BasedHardware:main Aug 23, 2026
31 of 34 checks passed
formed2forge pushed a commit to formed2forge/omi that referenced this pull request Aug 24, 2026
…ead (BasedHardware#12070)

closeCode 1011 with no captured speech means the STT backend is down,
not a transient socket hiccup. The onboarding reconnect loop (added in
BasedHardware#11704) kept retrying it every 5s forever, repeatedly popping the
"Connection Lost" dialog with no way out besides force-quitting, even
though "Skip for now" sits right next to it in the same flow.
After 3 consecutive 1011 closes with zero user segments, give up
reconnecting and surface a distinct STT_UNAVAILABLE error so the
onboarding widget can route to the existing skip path instead.

Failure-Class: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants