Skip to content

fix(app): bound pendant voice playback setup and cleanup - #23609

Merged
aryanorastar merged 3 commits into
mainfrom
fix/pendant-tutorial-playback-deadline
Oct 26, 2026
Merged

aryanorastar merged 3 commits into
mainfrom
fix/pendant-tutorial-playback-deadline

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

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 fix(app): complete pendant tutorial questions from request outcomes #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.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: the fix is correct and well scoped — bounded admission, request-scoped cleanup, and lifecycle-fenced teardown all check out against the diff; nothing blocking found.

By file:

  • app/lib/services/voice_playback/omi_voice_playback_service.dart — fencing _clearInFlightState(canContinue:) by _lifecycleToken in both interrupt() and the admitted-begin prior-audio clear is the right ownership primitive: skipped mode-off / no-headphones / revoked-admission attempts never touch the token, so existing cleanup survives, while an admitted replacement retires stale cleanup at each await boundary. The new stillCurrent() checks between _cancelPreview, _stopFallback and _deactivateSession also prevent an old interrupt from deactivating a newer response's audio session.
  • app/lib/providers/message_provider.dart — the unique 'pendant:<uuid>' playback id fixes the real bug that placeholder chat rows share message.id, so delayed cleanup could kill a later question's playback; the id is used consistently in begin, updateStreamingResponse (final and non-final) and interruptResponse. Bounding beginResponse with .timeout(_voiceReplyTimeout) plus canBegin: () => playbackAuthorized correctly revokes late admission — a hung begin bails at every checkpoint before _activeMessageId is assigned. Fire-and-forget stopPlayback with catchError no longer lets a stalled native stop hold Processing or the voice busy guard.
  • app/test/services/voice_playback/omi_voice_playback_service_test.dart — the new tests cover the retired-cleanup-vs-replacement race and all three skip classes at both cleanup entry points; a solid regression matrix.
  • app/test/widgets/pendant_tutorial_question_flow_test.dart — the two widget tests verify the user-visible contract end to end: stuck setup times out and retries, a late setup cannot speak, and held cleanup does not block the no-speech failure or the next question.
  • .github/failure-classes/FC-voice-playback-gates-question-completion.json — matches the existing failure-class convention and the contract text is accurate to the code.
  • app/docs/pendant-tutorial-question.md — the one-paragraph update is source-backed by the new timeout/revoke and fencing behavior.
  • app/changelog/unreleased/pendant-tutorial-spoken-output-recovery.json — user-facing wording matches the sibling fragments.

UX: the pendant tutorial no longer strands on "Processing" when spoken-output setup or cleanup hangs; retry just works. Blast radius: only the pendant device-button voice path — the chat-screen mic path passes playResponseAudio=false and is untouched. No security/privacy surface and no new external spend.

USER IMPACT: if a spoken answer's audio setup or cleanup gets stuck, the pendant tutorial now recovers on its own — the question can be retried instead of hanging on "Processing".

Still wanted before merge: the PR checklist's own open items — record the exact-head unit/widget/analyzer results in the PR, and keep the post-release customer retest (question → answer → Continue and retry) as the incident-closure gate. CI's Dart Analyze & Tests is green on this head and covers both new test files; mark ready-for-review when you consider the checklist recorded.


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 Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Oct 25, 2026
@aryanorastar
aryanorastar marked this pull request as ready for review October 26, 2026 06:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T06:36:36.649304Z d87ea9e Draft marked ready
ℹ️ 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.

@aryanorastar
aryanorastar merged commit 42a18d4 into main Oct 26, 2026
56 of 57 checks passed
@aryanorastar
aryanorastar deleted the fix/pendant-tutorial-playback-deadline branch October 26, 2026 06:34
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.

2 participants