Repository navigation
fix(desktop): keep chat and PTT turns responsive - #10661
Conversation
Failure-Class: FC-split-mutation-authority
Failure-Class: FC-split-mutation-authority
Failure-Class: FC-split-mutation-authority
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43e11658b9
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| && publicWebTurn.emittedText.length === 0 | ||
| && mayBecomeAvailabilityDenial |
There was a problem hiding this comment.
Buffer denial candidates after earlier streamed sentences
When a public-web response first streams valid text and then begins a false availability disclaimer in a later delta (for example, Here is the result. I don't), this guard no longer buffers it because emittedText is nonempty. The partial disclaimer is emitted; once subsequent tokens make it removable, the sanitized text shrinks and fails the prefix check below, suppressing the rest of the answer. Since ChatProvider prefers nonempty streamed text over the terminal result, the user is left with the contradictory, truncated response. Apply the denial-prefix buffering to the current unfinished sentence rather than only the beginning of the whole response.
Useful? React with 👍 / 👎.
## Summary - keep Rust `desktop-backend` separate from the Python backend release vector, with its own immutable source, image, contract, traffic, and recovery identity - deploy development and production revisions at zero traffic, then require chat/web-search, plain follow-up, Firestore/Redis, and managed realtime-provider acceptance before routing - add protected manual production deploy and retained-revision recovery workflows under one non-cancelling Cloud Run mutation lock - require live desktop chat-contract compatibility during macOS Beta qualification and Stable promotion - remove service-account JSON from immutable image layers and prove Cloud Run metadata identity on the candidate before traffic moves ## Incident and failure boundary The latest development run shifted 100% traffic before Firebase custom-token/provider proof, then failed after the new revision was already serving ([run 30213703046](https://github.com/BasedHardware/omi/actions/runs/30213703046)). The `.131` samples also showed the public-web 400/stalled-turn symptom that #10661 repaired in source. This PR makes candidate acceptance authoritative instead of advisory and adds a reusable guard that would reject the old workflow order. The candidate probe now requires provider-reported `web_search_requests > 0`, bounded first-event and total response time, terminal SSE usage, and a same-history ordinary follow-up with zero web reuse. The managed realtime probes remain dependency checks; full macOS PTT capture, transcription, cold-start, replacement-turn, and UI terminalization remain in the app qualification boundary and are not claimed here. ## Architecture `desktop-backend` is intentionally not added to the Python Cloud Run/GKE release vector. The two planes keep independent rollout and rollback lifecycles, while shared desktop chat compatibility is explicit at candidate acceptance and app promotion. Production source admission requires an exact merged-main SHA and first-attempt Release Eligibility proof. The standard break-glass inputs can waive only that proof; they cannot waive merged-main admission or candidate acceptance. Total runner loss after traffic mutation is handled by the protected traffic-only recovery workflow. ## Product invariants affected - INV-DATA-1 — preserves the canonical production desktop Cloud Run authority and production Firebase/account universe; this is not a data-plane migration ## Failure class Failure-Class: FC-nonrecoverable-promotion The new canonical prevention artifact is `.github/scripts/check-desktop-backend-release-policy.py`; it mutation-tests zero-traffic ordering, digest identity, manual production admission, rollback/recovery, contract parity, and the no-baked-credentials boundary. ## Validation - `cargo fmt --manifest-path desktop/macos/Backend-Rust/Cargo.toml -- --check` - `cargo test --manifest-path desktop/macos/Backend-Rust/Cargo.toml` — 385 passed - candidate probe tests — 14 passed - desktop-backend release policy tests — 8 passed - desktop release-flow contract tests — 9 passed - desktop release doctor tests — 10 passed - production routing tests — 11 passed - dev-harness tests — 61 passed - deployment concurrency, Stable promotion policy, failure-class guard ratchet, actionlint, diff hygiene, and Docker-context checks passed The local Docker image build was not run because the configured OrbStack Docker daemon was unavailable. CI's desktop-backend image workflow performs that build from the credential-free context. No development or production deployment was triggered while preparing this PR. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10670?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
## Summary - Preserve the canonical PTT response identity across barge-in replacement, and fail a current-turn identity mismatch immediately instead of waiting for the provider deadline. - Repair orphaned typed-chat turns through the journal's authoritative owner and turn ID while leaving live runs authoritative. - Stream public-web text before `turn_end` and version the Pi-to-Rust chat contract so unsupported protocol revisions fail explicitly. ## Failure class Failure-Class: FC-split-mutation-authority Canonical prevention artifacts: - `desktop/macos/Desktop/Tests/RealtimeHubBargeInContinuityTests.swift` - `desktop/macos/agent/tests/conversation-journal.test.ts` - `desktop/macos/pi-mono-extension/index.test.ts` - `desktop/macos/Backend-Rust/src/routes/chat/route.rs` ## Product invariants affected - INV-AGENT-* - INV-AUTH-1 - INV-CHAT-1 - INV-VOICE-1 ## Verification - `cd desktop/macos && ./scripts/agent-logic-harness.sh --cross-surface-smoke` - `cd desktop/macos && ./scripts/swift-test-suites.sh` — 385 suites passed. - `cd desktop/macos/agent && npm test` — 601 tests passed. - `cd desktop/macos/pi-mono-extension && npm test` — 108 tests passed. - `cd desktop/macos/Backend-Rust && cargo test` — 384 tests passed. - Focused `RealtimeHubBargeInContinuityTests` — 64 tests passed after extraction. - Focused `ChatJournalWritePathTests` — 10 tests passed after extraction. - Strict desktop E2E flow coverage — all 12 changed Swift production files covered. - Isolated named bundle `omi-chat-turn-reliability`: three consecutive typed turns completed, including weather and stock public-web tool paths; a single PTT turn completed; a warm rapid three-turn PTT replacement burst completed without stale-response or identity-mismatch events. ## Follow-up evidence A cold synthetic rapid PTT burst exposed a separate startup seam: local language identification took about 16 seconds while replacement readiness expires after 4 seconds. The turn terminalized safely and the warm replacement path passed. A follow-up should decouple optional language identification from replacement readiness without weakening the canonical persistence fence. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10661?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
…0670) ## Summary - keep Rust `desktop-backend` separate from the Python backend release vector, with its own immutable source, image, contract, traffic, and recovery identity - deploy development and production revisions at zero traffic, then require chat/web-search, plain follow-up, Firestore/Redis, and managed realtime-provider acceptance before routing - add protected manual production deploy and retained-revision recovery workflows under one non-cancelling Cloud Run mutation lock - require live desktop chat-contract compatibility during macOS Beta qualification and Stable promotion - remove service-account JSON from immutable image layers and prove Cloud Run metadata identity on the candidate before traffic moves ## Incident and failure boundary The latest development run shifted 100% traffic before Firebase custom-token/provider proof, then failed after the new revision was already serving ([run 30213703046](https://github.com/BasedHardware/omi/actions/runs/30213703046)). The `.131` samples also showed the public-web 400/stalled-turn symptom that BasedHardware#10661 repaired in source. This PR makes candidate acceptance authoritative instead of advisory and adds a reusable guard that would reject the old workflow order. The candidate probe now requires provider-reported `web_search_requests > 0`, bounded first-event and total response time, terminal SSE usage, and a same-history ordinary follow-up with zero web reuse. The managed realtime probes remain dependency checks; full macOS PTT capture, transcription, cold-start, replacement-turn, and UI terminalization remain in the app qualification boundary and are not claimed here. ## Architecture `desktop-backend` is intentionally not added to the Python Cloud Run/GKE release vector. The two planes keep independent rollout and rollback lifecycles, while shared desktop chat compatibility is explicit at candidate acceptance and app promotion. Production source admission requires an exact merged-main SHA and first-attempt Release Eligibility proof. The standard break-glass inputs can waive only that proof; they cannot waive merged-main admission or candidate acceptance. Total runner loss after traffic mutation is handled by the protected traffic-only recovery workflow. ## Product invariants affected - INV-DATA-1 — preserves the canonical production desktop Cloud Run authority and production Firebase/account universe; this is not a data-plane migration ## Failure class Failure-Class: FC-nonrecoverable-promotion The new canonical prevention artifact is `.github/scripts/check-desktop-backend-release-policy.py`; it mutation-tests zero-traffic ordering, digest identity, manual production admission, rollback/recovery, contract parity, and the no-baked-credentials boundary. ## Validation - `cargo fmt --manifest-path desktop/macos/Backend-Rust/Cargo.toml -- --check` - `cargo test --manifest-path desktop/macos/Backend-Rust/Cargo.toml` — 385 passed - candidate probe tests — 14 passed - desktop-backend release policy tests — 8 passed - desktop release-flow contract tests — 9 passed - desktop release doctor tests — 10 passed - production routing tests — 11 passed - dev-harness tests — 61 passed - deployment concurrency, Stable promotion policy, failure-class guard ratchet, actionlint, diff hygiene, and Docker-context checks passed The local Docker image build was not run because the configured OrbStack Docker daemon was unavailable. CI's desktop-backend image workflow performs that build from the credential-free context. No development or production deployment was triggered while preparing this PR. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10670?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
turn_endand version the Pi-to-Rust chat contract so unsupported protocol revisions fail explicitly.Failure class
Failure-Class: FC-split-mutation-authority
Canonical prevention artifacts:
desktop/macos/Desktop/Tests/RealtimeHubBargeInContinuityTests.swiftdesktop/macos/agent/tests/conversation-journal.test.tsdesktop/macos/pi-mono-extension/index.test.tsdesktop/macos/Backend-Rust/src/routes/chat/route.rsProduct invariants affected
Verification
cd desktop/macos && ./scripts/agent-logic-harness.sh --cross-surface-smokecd desktop/macos && ./scripts/swift-test-suites.sh— 385 suites passed.cd desktop/macos/agent && npm test— 601 tests passed.cd desktop/macos/pi-mono-extension && npm test— 108 tests passed.cd desktop/macos/Backend-Rust && cargo test— 384 tests passed.RealtimeHubBargeInContinuityTests— 64 tests passed after extraction.ChatJournalWritePathTests— 10 tests passed after extraction.omi-chat-turn-reliability: three consecutive typed turns completed, including weather and stock public-web tool paths; a single PTT turn completed; a warm rapid three-turn PTT replacement burst completed without stale-response or identity-mismatch events.Follow-up evidence
A cold synthetic rapid PTT burst exposed a separate startup seam: local language identification took about 16 seconds while replacement readiness expires after 4 seconds. The turn terminalized safely and the warm replacement path passed. A follow-up should decouple optional language identification from replacement readiness without weakening the canonical persistence fence.