Repository navigation
Description
Decision
Ship one PR that makes desktop PTT truthful in the two places field evidence says it lies, and wires the live proof into an existing automatic pipeline so it can never go stale:
- Dead-mic recovery arms correctly — fixes the evidence policy so silent-capture turns actually trigger the existing recovery machinery (closes fix(desktop): keep PTT dead-mic recovery armed across zero-frame turns (#9081) #9677 and the macOS PTT hold mode records silent turns for 169 users with no recovery attempted #9081 failure class).
- Every dev deploy of the desktop Rust backend proves the realtime provider path end-to-end — a mint→connect→commit→response probe runs as a post-deploy step in
desktop_backend_auto_dev.yml, failing closed (closes Gemini realtime token mint still fails after #9102 diagnostics fix #9190 by live verification).
One PR, one reviewable unit, commits split per testable surface per repo convention (Swift fix / probe script / workflow wiring). No new state machines, no funnel taxonomy, no SLO dashboards, no scheduled jobs, no release-gate apparatus. The probe is alive because it rides a pipeline that already runs on every main push touching the desktop backend — not because anyone remembers to run it.
This PR closes: #9677, #9081, #9190, and this issue.
Grounding (verified in current code)
Desktop/Sources/FloatingControlBar/PushToTalkManager.swift— the dead-mic policy is a small pure function (deadMicPeakThreshold,minDeadTurnSecondsnear the top of the file). Per fix(desktop): keep PTT dead-mic recovery armed across zero-frame turns (#9081) #9677, a zero-frame turn currently resets accumulated dead-mic evidence, so the counter never reaches its threshold and the existing capture-rebuild path (fix(desktop): recover dead mic on buffered PTT silent turns (#9081) #9390) never fires. This is why macOS PTT hold mode records silent turns for 169 users with no recovery attempted #9081 measured 1,104 silent PTT turns across 169 users withrecovery_action=nonein 100% of cases.desktop/macos/Backend-Rust/src/routes/realtime.rs— the Gemini mint request shape is already fixed in code:gemini_auth_token_bodybuilds the flat v1alpha shape and a unit test (gemini_auth_token_body_is_flat_at_request_root) pins it. Gemini realtime token mint still fails after #9102 diagnostics fix #9190 remains open because no verification has ever run against the deployed service. The gap is live proof, not code..github/workflows/desktop_backend_auto_dev.yml— auto-deploys the Rust backend to dev onmainpushes and already ends with a "Verify development backend release identity" step. The probe slots directly after it.- Existing hermetic test homes:
Desktop/Tests/PTTSilentMicRecoveryPolicyTests.swift,PTTSilentTurnRecoveryWiringTests.swift,PTTAudioCaptureRaceTests.swift— extend these; do not create new suites or parallel lifecycle state.
Authoritative owners are unchanged: VoiceTurnStateMachine/VoiceTurnCoordinator own PTT semantics, PushToTalkManager is the physical capture adapter, RealtimeHubController owns provider sessions. This PR must not add a second phase machine or a new provider path.
Commit 1 — Swift: dead-mic evidence policy (closes #9677, #9081)
In PushToTalkManager's dead-mic policy, implement exactly:
- Zero frames delivered → neutral evidence. Do not reset the accumulated dead-mic count (this is the fix(desktop): keep PTT dead-mic recovery armed across zero-frame turns (#9081) #9677 defect).
- Judgeable near-zero audio (duration ≥
minDeadTurnSeconds, peak ≤deadMicPeakThreshold) → increment the count. - Audible audio → reset the count.
- Threshold reached → trigger the existing capture rebuild (fix(desktop): recover dead mic on buffered PTT silent turns (#9081) #9390 wiring — do not add a new recovery path) and record whether the next turn produced audio.
The asynchronous capture-start/finalize race that produces some zero-frame turns stays out of scope — once zero-frame turns are neutral evidence, the race costs one retry instead of disarming recovery. If someone later wants explicit capture-ready modeling, that is a new issue.
Required tests (extend PTTSilentMicRecoveryPolicyTests / PTTSilentTurnRecoveryWiringTests; they must drive the production policy and wiring, not reimplementations):
| # | Case | Asserts |
|---|---|---|
| 1 | Zero-frame turn between two near-zero turns | count preserved across the zero-frame turn (the #9677 regression test) |
| 2 | N consecutive judgeable near-zero turns | count reaches threshold, rebuild fires exactly once |
| 3 | Audible turn after near-zero turns | count resets |
| 4 | Rebuild fires → next simulated turn delivers audio | recovery outcome recorded as success; policy re-arms (the #9081 test — recovery must be proven, not just invoked) |
| 5 | Rebuild fires → next turn still near-zero | recovery recorded as failed; policy does not spin (bounded re-attempt) |
Commit 2 — Probe script: scripts/voice-provider-probe.sh
A self-contained script (bash or Python, no new dependencies beyond what CI has) that, given <openai|gemini> and a backend base URL:
- authenticates as the dev probe identity (a dedicated dev test account; token from env/secret — never a real user);
- calls the deployed realtime mint route;
- validates the typed mint response (OpenAI
ek_…secret / Geminiauth_tokens/…name); - establishes a usable provider connection with the minted credential;
- commits a deterministic non-sensitive input fixture;
- awaits a valid response event;
- closes cleanly, classifying expected-idle teardown separately from failure.
Output: one line per step with a bounded failure class (mint_http_4xx, mint_schema, connect_failed, no_response, upstream_5xx, …), sanitized (no tokens, no transcript content), exit nonzero on any failure. A 2xx mint alone does not pass; step 6 is the pass condition. This encodes the #9080→#9190 lesson: token minted ≠ provider path works.
Commit 3 — Wiring: probe runs on every dev deploy
In desktop_backend_auto_dev.yml, after "Verify development backend release identity":
- run the probe for both providers against the just-deployed revision URL;
- bounded retry (e.g. 2 retries, upstream
5xx/timeout only — schema/4xx failures never retry); - fail the workflow on probe failure, so a broken provider path is red at the moment someone merged the change that broke it (or upstream drifted), with the diff still in context;
- a
skip_provider_probeworkflow input allows override during a genuine provider outage — it must leave a visible notice in the run log, never a silent skip.
No scheduled/cron lane, no dashboard, no separate alerting: the check lives exactly where its failure has an audience. Because this workflow runs on every main push touching the desktop backend, upstream contract drift is caught within one merge cycle.
Docs in the same commit (Definition of Done): note the probe in the backend service map / desktop backend docs, and add one line to desktop/macos/AGENTS.md: verification of voice-path changes means a natural authenticated PTT turn on a named bundle — signed-out, forced-transcript, or reducer-only runs do not count; provider mint/payload changes must show a probe run.
Real-path verification (attach evidence to the PR)
- Dead-mic recovery: named bundle (
omi-ptt-recovery), fault the mic input (or physically mute), perform PTT turns until the threshold trips; confirm from logs that the rebuild fires and the next turn works. Record the log lines. - Probe: run
scripts/voice-provider-probe.shfor both providers against the deployed dev backend; paste sanitized output. The Gemini pass is the live verification that closes Gemini realtime token mint still fails after #9102 diagnostics fix #9190. - One ordinary authenticated PTT turn per provider on the named bundle (the new verification bar applied to this PR itself).
Acceptance criteria
- Tests 1–5 above pass in
desktop-swift-ci(hermetic, no live services). - Zero-frame turns provably no longer reset dead-mic evidence — test 1 fails on the pre-fix code.
- Recovery outcome (not just invocation) is asserted — test 4.
-
scripts/voice-provider-probe.shpasses for OpenAI and Gemini against deployed dev; sanitized output attached. -
desktop_backend_auto_dev.ymlfails closed on probe failure; override leaves a visible trace. - No new lifecycle state, provider path, or recovery mechanism — diff confined to the policy function, its wiring, the probe script, the workflow, and docs.
- Named-bundle real-path evidence (dead-mic recovery + one natural PTT turn per provider) recorded in the PR.
- Desktop Swift suite and
make preflightpass. - PR body records root cause, recurrence evidence (macOS PTT hold mode records silent turns for 169 users with no recovery attempted #9081, Gemini realtime token mint still fails after #9102 diagnostics fix #9190, fix(desktop): keep PTT dead-mic recovery armed across zero-frame turns (#9081) #9677), and the durable guards (regression tests + deploy-inline probe).
What was deliberately cut from the original epic, and why
The earlier version of this issue prescribed a 13-milestone turn funnel, terminal-outcome SLOs, capture-ready reducer states, an authenticated desktop canary suite, scheduled provider drift probes, staged incident-completion workflow, and beta/stable promotion gates. Those are cut, not deferred into hidden expectations:
- Funnel/SLOs/dashboards/promotion gates — standing operational surface with no owner; checks whose failure has no audience are dead checks. The deploy-inline probe preserves the live-proof intent inside a lane that already has an audience.
- Capture-ready state modeling and the full 11-case capture fault seam — demoted by the evidence-policy fix: once zero frames are neutral, the race is a one-retry annoyance, not a recovery-disarming defect. New issue if field data ever says otherwise.
- Authenticated canary suites, rotation soak, 20-turn continuity — the existing hermetic reducer/coordinator/fuzz suites already cover lifecycle semantics; the marginal live coverage did not justify a credentialed, hardware-bound pipeline nobody owns.
- Staged completion states — replaced by the concrete instance: Gemini realtime token mint still fails after #9102 diagnostics fix #9190 closes on live probe evidence, not code merge.
If any cut item is revived, write a fresh issue against then-current code with this issue's constraint: automatic-or-dead — every check must run in an existing CI/deploy lane.
Related issues
- Closes fix(desktop): keep PTT dead-mic recovery armed across zero-frame turns (#9081) #9677 — the evidence-policy fix is Commit 1.
- Closes macOS PTT hold mode records silent turns for 169 users with no recovery attempted #9081 — recovery arms and is proven on the real path; the field harm class is covered by tests 1–5.
- Closes Gemini realtime token mint still fails after #9102 diagnostics fix #9190 — the request-shape fix is already in
realtime.rs; the deploy-inline probe provides the missing live verification and guards the contract against future drift. - Builds on (unchanged): refactor(desktop): make PTT voice turns reducer-driven #9370, fix(desktop): recover dead mic on buffered PTT silent turns (#9081) #9390, fix(macos): harden shared chat and PTT agent continuity #9660, fix(desktop): rotate expired OpenAI realtime sessions #9672, fix(macos): preserve PTT spawn authority through barges #9675, fix(macos): converge agent runtime contracts #9698, fix(desktop): bind the hub route when the realtime transport goes ready #9699, Fix PTT higher-model context and cache boundary #9734, fix(desktop): restore realtime input and direct delegation #9749.
- Out of scope: Triage and reduce Desktop App Hanging Sentry clusters #9192 (app hangs), Rewind FFmpeg/storage errors create large Desktop Sentry clusters #9193 (Rewind/FFmpeg), Finish macOS update recovery for legacy clients: explicit control plane, compatibility bridge, and verified completion #9528 (updater), capture-ready reducer modeling, canary/gating infrastructure, another PTT state-machine rewrite.
Activity
[-][P1] Make desktop voice production-proven: turn outcome SLOs, authenticated canaries, and release gates[/-][+][P1] One PR: arm PTT dead-mic recovery correctly + prove the realtime provider path on every dev deploy[/+]docs(agents): collapse root AGENTS.md into a lean JIT index + budget …
Fix PTT dead-mic recovery and prove realtime providers (#9770)