Repository navigation
Conversation
CompositeTranscriptionSocket tore down the user's custom STT socket whenever the Omi secondary failed to connect, closed or errored, so an Omi listen outage also stopped a healthy custom STT stream. Add an opt-in keepPrimaryWhenSecondaryFails mode, enabled for the live custom-STT composite. The composite stays connected on the primary, retries the secondary with backoff and resumes forwarding once it is back. While degraded, nothing is sent to Omi, and phone-mic WAL frames are no longer marked synced, so that audio stays durable for later sync. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un
There was a problem hiding this comment.
1 issue found across 4 files
Confidence score: 3/5
- The healthy-only coverage in
app/test/unit/composite_transcription_socket_test.dartcould miss a degraded Omi path wheredeliversToOmistays true and unsent WAL frames are marked synced. Add a service-level test for a degraded composite and assert it does not report delivery.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/test/unit/composite_transcription_socket_test.dart">
<violation number="1" location="app/test/unit/composite_transcription_socket_test.dart:315">
P2: This checks only healthy delivery and cannot catch `deliversToOmi` staying true while Omi is degraded, which would mark unsent WAL frames as synced. Exercise a degraded composite through a service and assert delivery becomes false.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| final composite = service.socket as CompositeTranscriptionSocket; | ||
|
|
||
| expect(composite.keepPrimaryWhenSecondaryFails, isTrue); | ||
| expect(service.deliversToOmi, isTrue); |
There was a problem hiding this comment.
P2: This checks only healthy delivery and cannot catch deliversToOmi staying true while Omi is degraded, which would mark unsent WAL frames as synced. Exercise a degraded composite through a service and assert delivery becomes false.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/test/unit/composite_transcription_socket_test.dart, line 315:
<comment>This checks only healthy delivery and cannot catch `deliversToOmi` staying true while Omi is degraded, which would mark unsent WAL frames as synced. Exercise a degraded composite through a service and assert delivery becomes false.</comment>
<file context>
@@ -189,6 +189,206 @@ void main() {
+ final composite = service.socket as CompositeTranscriptionSocket;
+
+ expect(composite.keepPrimaryWhenSecondaryFails, isTrue);
+ expect(service.deliversToOmi, isTrue);
+ });
+ });
</file context>
- deliversToOmi stays true when raw-audio forwarding is off, so frames from users who opted out of sending audio to Omi are not left unsynced and queued for a later upload (P1). - Clear degraded state and cancel the Omi retry timer on primary close/error and at the start of connect(), so a reused composite retries Omi again after a reconnect (P2). - Tests: default-constructor strict behaviour, service-level deliversToOmi while degraded (with and without raw-audio forwarding), and reconnect after a primary close. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un
|
Thanks @cubic-dev-ai — all four findings addressed in the latest commit:
Tests: |
@meath1981 All four look addressed — I verified each against the current diff:
The new tests in the group line up with the behaviour claims (no audio/transcripts to Omi while degraded, backoff restore, cancel on stop, primary teardown), and the One small, non-blocking race I'd note: And yes, the degraded-UI question (no transcripts shown from the primary while degraded) is a sensible follow-up — the durability fix here is the right scope. Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
A background secondary retry still pending when the composite was stopped, torn down or reconnected could finish later and act on the new session (reset the in-flight flag, reschedule a timer, or clear a freshly re-entered degraded state). Bump a degraded epoch on every _clearDegraded() (connect, stop, disconnect, primary teardown, restore), reset the in-flight flag there, and ignore a retry whose epoch is stale. Only an idle composite cleans up a stale successful connect. A retry now trusts the secondary's own connected status. Adds a regression test for a retry pending across stop and reconnect. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un
|
Thanks @cubic-dev-ai. I've taken up the non-blocking retry-race note in the latest commit:
|
@meath1981 Confirmed — the epoch fix closes the race I flagged. I checked it against the current diff:
The One optional follow-up for later, not this PR: the backoff timer doubling happens at schedule time, so a connect that hangs for a long time pauses the backoff clock — the schedule after a failed retry picks up from the already-doubled delay. Fine as-is for a 5→60 s cap, just worth knowing if the retry window ever needs to be time-bounded. Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
Collapse the three deliversToOmi guards to single-line ifs so the file does not grow against main (product-file-line-count-ratchet). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un
|
Thanks @meath1981 — reviewed the full diff on 3c2b424. This is a well-scoped fix for a real UX failure mode (a healthy custom STT being torn down every 15s because Omi's File-by-file:
Two non-blocking notes:
CI hasn't reported on this head yet, so leaving the merge decision to the maintainers. Nice first contribution — the WAL sync-marking discipline around the degraded window is exactly the kind of detail that's easy to get wrong, and you got it right. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
@meath1981 this conflicts with |
CompositeTranscriptionSocket treated a secondary (Omi /v4/listen) connect failure, close or error as fatal for both sockets, so an Omi outage also disconnected the user's working custom/local STT engine and retried it in the reconnect loop (BasedHardware#15500, BasedHardware#20381). Port of the approved BasedHardware#20382 design: when keepPrimaryWhenSecondaryFails is on (live custom STT and on-device composite), a secondary failure enters a degraded state instead — the primary keeps transcribing, the secondary is retried with backoff, and audio/suggested transcripts never reach Omi while degraded. WAL frames are marked synced only when the socket delivers to Omi, so audio Omi never received stays durable for later sync.
What
Live custom STT keeps running when Omi's own
/v4/listensocket fails, instead of the app tearing down the user's STT socket together with it. Closes #20381.Why
CompositeTranscriptionSockettreats a secondary (Omi) connect failure, close or error as fatal for both sockets. When Omi's listen socket is unavailable, the user's healthy custom STT is therefore disconnected and retried every 15 s. The app log showsConnection failed - primary: true, secondary: falseon each attempt. The STT server sees a connect followed byCloseStream~0.6 s later, with no audio.Changes
CompositeTranscriptionSocket: newkeepPrimaryWhenSecondaryFails(defaultfalse, so existing behaviour is unchanged). When it is on:secondaryDegraded = true.stop()/disconnect()cancel the retries.TranscriptSegmentSocketService.deliversToOmi: false while the composite is degraded.CaptureController: the three phone-mic paths that mark WAL frames synced on send now do so only whendeliversToOmiis true. Audio Omi never received therefore stays durable for later sync. Pendant frames already stay unsynced until transcript confirmation, so they are unchanged._createCompositeService(live custom STT) enables the new mode. The speech-profile composites keep the strict behaviour.Tests
test/unit/composite_transcription_socket_test.darthas a new group, "when the Omi socket fails" (11 tests):stop()cancels retries;deliversToOmi: false while degraded with raw-audio forwarding, true with forwarding off (no later upload of opted-out audio);stop()/connect()cannot disturb the new session;Commands run (Flutter 3.47.6 / Dart 3.13.5, Linux):
flutter test test/unit/composite_transcription_socket_test.dart: 22/22 pass.flutter teston the 16 test files referencingCaptureController,TranscriptSegmentSocketServiceorCompositeTranscriptionSocket: 351/351 pass.dart analyzeon the changed files: no new issues.dart format -l 120: no changes.scripts/pr-preflight(.github/scripts/pr_preflight.py --lane localwith this body): 22/22 checks pass.capture_controller.dartstays at its current line count, and there is a changelog fragment underapp/changelog/unreleased/.Not exercised: an on-device iOS build.
Open question for maintainers: while degraded, the live transcript UI shows nothing, because UI messages come from the secondary. The user's server keeps working. Surfacing primary segments to the UI could be a follow-up.
Failure-Class
Failure-Class: none
Invariants
none
🤖 Generated with Claude Code
https://claude.ai/code/session_01VwRBbPmTir6bzqEQdRF9un