Repository navigation
Conversation
A spoken push-to-talk question could be silently dropped — no answer, no error, no transcript — when the realtime hub rejected the turn's context admission asynchronously. Root cause: dbd69e7 made context admission fail-closed and routed all three async rejection sites (finishContextFreshInputOnCurrentSession, finishSessionReconnectAfterReady, failContextFreshInputPreparation) through `.providerReconnectFailed`. That event means *transport failure* and the reducer maps it to terminate(reason: .providerFailed): the turn dies with no transcription fallback and the buffered audio is discarded. But an admission rejection is a context/policy decision, not a transport failure — the captured audio never reached the provider and is still intact in the capture buffer, so the turn is recoverable. The follow-up 711b3a1 restored exactly that bounded Deepgram fallback, but only for the *synchronous* rejection (`.hubAdmissionRejected`), which fires before `.providerReconnectStarted` projects the turn. The async half stayed fatal. Fix: add `.providerContextAdmissionRejected` for the three sites that discard buffered input before it reached the provider. The reducer undoes the awaitingResponse projection that `providerReconnectStarted` applied to a released turn (the transcription fallback only runs from an input phase), then takes the same bounded fallback as the synchronous case. A phase with no buffered input to rescue keeps the terminal behavior, and a genuine transport failure still terminates via `.providerReconnectFailed`. Verification: - xcrun swift build -c debug --package-path Desktop — green. - VoiceTurnReducerTests: 57/57 pass, incl. 2 new regression tests (released turn -> transcribes; still-holding turn -> keeps recording on the transcription route). - Teeth check: with the reducer forced back to terminate(), both new tests fail (10 assertions); with the fix they pass. - NOT exercised in a live app: the rejection requires a provider-side race/stale-context condition I cannot reproduce on demand. Coverage is behavioral through the production reducer API, not a source grep.
…dy (#9699) * fix(desktop): bind the hub route when the realtime transport goes ready dbd69e7 ("make realtime context admission fail closed") stopped the `hubReady` reducer case from binding `route = .hub(sessionID:)`, intending to keep transport readiness separate from context admission. But the route is what the PTT driver reads to decide it owns a hub turn — admission is fenced separately by `providerConnection` + `RealtimeInputAdmissionPolicy` inside RealtimeHubController. With the route stranded in `.hubWarmWait`, every PTT turn taken while the socket was still warming died silently: - `commitBufferedRealtimeHubTurn()` opens with `guard isHubMode` (route `.hub`), so the buffered warm-wait commit — the one function that exists to serve this path — returned immediately. - `hubCommitPending` therefore stayed false, so when admission landed, `finishContextFreshInputOnCurrentSession()` replayed the audio and called `beginInputTurn` but never `commitInputTurn`. - `hubReady` had already cancelled the `.hubWarm` deadline and the successful reconnect cancelled `.providerReconnect`, so no deadline was armed: the turn sat in `finalizing` with the thinking spinner forever — no reply, no transcription fallback, no journal row. Only a new PTT press escaped it. Mid-hold mic audio in that window never reached the hub at all. Restore the binding and widen the `hubAdmissionRejected` guard to `routeMatchesHub`, since that event is sent from inside the `prepareHubInput` effect handler — i.e. after the route is applied — so the PR #9684 transcription fallback would otherwise go stale. The fail-closed property is unchanged: `feedAudio` still parks audio in `reconnectAudioBuffer`, and `commitTurn` still defers via `hubCommitDeferred` (which also arms the `deferredCommit` deadline) until the admission policy admits the input. Verification: - Added `testBufferedWarmWaitTurnStaysCommittableAfterTransportReady` and reworked `testTransportReadyBindsHubRouteAndPreparesContext`; both fail on the pre-fix reducer and pass after it (verified by stashing the source fix). - desktop/macos/scripts/agent-logic-harness.sh --swift-only → 379 tests, 0 failures. * chore(desktop): changelog fragment for the PTT warm-wait commit fix
|
Closing — opened by an automated bot and left unreviewed. The bot policy has changed: it now tests and merges fixes directly (or reports them), and no longer leaves open PRs for review. If this fix is still wanted, reopen and it'll be landed properly (tested → merged). 🤖 |
|
Hey @kodjima33 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Bug
A spoken push-to-talk question can be silently dropped — the user holds PTT, speaks a full question, releases, and gets no answer, no transcript, and no error. The captured audio is discarded.
Root cause
dbd69e71c5("make realtime context admission fail closed") made context admission fail-closed and routed all three asynchronous rejection sites through.providerReconnectFailed:RealtimeHubController.finishContextFreshInputOnCurrentSession()RealtimeHubController.finishSessionReconnectAfterReady()RealtimeHubController.failContextFreshInputPreparation().providerReconnectFailedmeans transport failure, and the reducer maps it toterminate(reason: .providerFailed)— the turn dies with no transcription fallback.But an admission rejection is a context/policy decision, not a transport failure. The buffered audio never reached the provider and is still intact in
batchAudioBuffer, so the turn is recoverable. The follow-up711b3a13afrestored exactly that bounded Deepgram fallback — but only for the synchronous rejection (.hubAdmissionRejected), which fires before.providerReconnectStartedprojects the turn. The async half stayed fatal.Reachable without a race:
.rejectStaleProviderContextfires on any owner-scope skew between the context bind and the socket build (sessionVoiceContextFreshnessIdentityis reset to""byteardownSession()and re-derived empty whenprefetchedVoiceContextOwnerScope != ownerScope).Fix
Add
.providerContextAdmissionRejectedfor the three sites that discard buffered input before it ever reached the provider. The reducer:awaitingResponseprojection thatproviderReconnectStartedapplies to a released turn (the transcription fallback only runs from an input phase — otherwise the turn would hang instead of dying, which is worse);A phase with no buffered input to rescue keeps the terminal behavior, and a genuine transport failure (
hubDidError) still terminates via.providerReconnectFailed.Closing the class: the failed contract was conflating admission rejection with transport failure on one event. Both halves of the rejection surface now map to the same recovery, and
.providerReconnectFailedis left to mean only what it says.Verification
xcrun swift build -c debug --package-path Desktop— green.VoiceTurnReducerTests— 57/57 pass, including 2 new regression tests: a released turn transcribes instead of dying; a still-held turn keeps recording on the transcription route.terminate(), both new tests fail (10 assertions); with the fix they pass.Scope
4 files, +114/−3. Unreleased code (
dbd69e71c5is not inv0.12.72, the current prod build), so this is not live on prod — opened for review, not merged.🤖 automated by hourly watchdog; opened for review, not merged.
Product invariants affected