Repository navigation
Description
Summary
macOS Desktop should treat OpenAI Realtime’s 60-minute session limit as a normal session-rotation condition, not an unclassified error. Today an expired warm socket can be reported as an error and later writes can hit a disconnected socket.
This is a focused provider-lifecycle/recovery bug, not a backend token-mint issue and not a reason to reopen the completed voice ownership convergence work.
User impact
A long-running Desktop session can hit the OpenAI provider’s maximum duration. The next voice interaction may be interrupted or delayed while the client attempts to use the expired socket. The UI must always return to an actionable state and a subsequent PTT interaction must be able to establish a healthy session.
Observed failure sequence
Production Desktop has reported the following pair from the same stable release cohort:
RealtimeHub: session error — provider=openai Your session hit the maximum duration of 60 minutes.RealtimeHub: session error — provider=openai The operation couldn’t be completed. Socket is not connected
The important behavioral fact is the provider-enforced session expiry followed by a client attempt to use the retired socket. Do not require Sentry access to reproduce, implement, or verify this issue.
Root-cause hypothesis
RealtimeHubCloseClassifier currently recognizes an expected idle teardown only for messages containing WebSocket closed (1008). OpenAI’s maximum-duration close has different text, so it bypasses the expected-lifecycle classification and is emitted as an error. The lifecycle must explicitly model provider session expiry and transition the transport to a reusable/reconnectable state.
Relevant code:
desktop/macos/Desktop/Sources/FloatingControlBar/RealtimeHubController.swiftdesktop/macos/Desktop/Tests/RealtimeHubCloseClassifierTests.swift
Required behavior
- Recognize the known OpenAI maximum-session-duration close as a typed provider lifecycle condition; do not depend on raw provider text outside the classifier boundary.
- If no logical voice turn is active, retire and re-warm/reconnect the transport quietly. Do not emit an error-level Sentry event for the expected rotation.
- If an active voice turn is affected, terminate that turn through the canonical voice lifecycle with an actionable recovery path. The floating-bar/UI projection must return to idle or a defined recoverable state.
- A subsequent PTT interaction must never attempt to send through the retired socket and must be able to obtain a healthy session.
- Preserve error-level reporting for genuinely unexpected provider failures, auth/quota failures, and reconnect failures.
Acceptance criteria
- A focused test covers the OpenAI maximum-duration message and classifies it as an expected session-rotation condition.
- A lifecycle test covers expiry of a warm session followed by another PTT turn; the next turn uses a healthy transport rather than a disconnected socket.
- A lifecycle test covers expiry during an active turn; it reaches exactly one terminal outcome and leaves the UI actionable.
- Expected session rotation is observable through a safe structured metric/breadcrumb or non-error diagnostic, without raw provider payloads or user data.
- The known expiry no longer creates an error-level Sentry event; unexpected close/reconnect failure remains observable.
- Run the relevant focused Swift tests and the Desktop voice/realtime harness or gauntlet appropriate to the changed path.
Scope boundaries
- Do not fold this into Gemini realtime token minting; that is a separate backend request-schema issue.
- Do not add a second voice-turn owner or a compatibility lifecycle.
VoiceTurnCoordinatorremains the logical turn owner, whileRealtimeHubControllerremains the socket/audio transport driver. - Do not change provider selection, authentication policy, or unrelated PTT capture behavior.
Activity
fix(desktop): rotate expired OpenAI realtime sessions (#9672)
Git-on-my-level commentedon Jul 15, 2026
Fresh production recurrence (2026-07-15 UTC)
The exact regression described in this issue is still occurring on the stable
0.12.70+12070cohort:RealtimeHub: ... maximum duration of 60 minutesis escalating.Socket is not connectedgroup is present and includes both0.12.70+12070and the newly promoted0.12.73+12073cohorts.This matches provider-enforced expiry followed by an attempt to use a retired transport. The original acceptance criteria remain appropriate; re-opening for a focused source/test review. No user identifiers, payloads, or tokens included.
Git-on-my-level commentedon Jul 15, 2026
Deployment clarification
PR #9672 is included in beta
0.12.73+12073(its merge commit is an ancestor of the candidate). However, after beta promotion, theSocket is not connectedgroup recorded a fresh0.12.73+12073event.So this issue should remain open: either another retired-transport path bypasses the new rotation logic, or the same lifecycle fix is incomplete. The 60-minute-expiry group remains stable-only in the sampled 12-hour evidence, but the disconnected-socket outcome is not fully eliminated in beta.
No user identifiers or raw event payloads included.
fix(desktop): classify retired-socket ENOTCONN as expected teardown (#…