Skip to content

fix(ptt): repair Parakeet dev routing and reconnect audio - #9422

Merged
Git-on-my-level merged 5 commits into
mainfrom
codex/fix-ptt-parakeet-reconnect-9417
Jul 11, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
codex/fix-ptt-parakeet-reconnect-9417

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #9417

Summary

  • Route the development Cloud Run backend, backend-sync, and backend-integration services to the development Parakeet endpoint; validate the selector/endpoint contract and document the topology.
  • Return a controlled 503 for missing Parakeet configuration, and include the selected STT provider/model in the desktop batch-transcription response and fallback telemetry.
  • Buffer ordered Push-to-Talk microphone chunks during a realtime-session reconnect, replay them once the original input window is restored, and defer the commit until then.

Scope

Development configuration only: this PR does not modify or deploy production configuration.

Invariant

Touches INV-CHAT-1 desktop conversation/control paths; reconnect replay preserves the original turn identity, response identifier, interruption state, and chunk order.

Verification

  • PATH="$(pwd)/.venv/bin:$PATH" backend/scripts/pre-deploy-check.sh
  • backend/.venv/bin/pytest -q tests/unit/test_backend_runtime_env_validator.py tests/unit/test_parakeet_prerecorded.py
  • backend/.venv/bin/pytest -q tests/unit/test_app_client_dart_generator.py tests/unit/test_app_client_schema_inventory.py
  • xcrun swift test -c debug --package-path Desktop --filter RealtimeHubBargeInContinuityTests (35 passed)
  • desktop/macos/scripts/agent-logic-harness.sh --swift-only (224 passed)
  • Built and exercised the named local bundle omi-ptt-reconnect-9417: PTT start/stop completed normally.
  • Repository pre-push checks passed, including the affected backend test files, OpenAPI contract, generated clients, and desktop build.

The live authenticated reconnect path could not be exercised because no development auth seed was available; the deterministic replay regression tests cover that behavior.

Review in cubic

@mintlify

mintlify Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
omi 🟢 Ready View Preview Jul 11, 2026, 12:36 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor fix failing CI

@cursor

cursor Bot commented Jul 11, 2026

Copy link
Copy Markdown

Taking a look!

Open in Web Open in Cursor 

cursoragent and others added 2 commits July 11, 2026 00:45
The dev backend-sync-backfill service clones backend-sync via a YAML
anchor, so mutating one service env dict affects the other. Deep-copy
the manifest and only strip HOSTED_PARAKEET_API_URL from Parakeet-
selecting services so Static Contracts pre-deploy-check passes again.

Verification: CI=1 backend/scripts/pre-deploy-check.sh (41 passed)

Co-authored-by: David Zhang <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor address merge conflicts

@cursor

cursor Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Merge conflicts with main are resolved and pushed (b506f5ae3).

What conflicted

main landed #9421 (dev Parakeet STT contract + backend-sync-backfill) while this PR added overlapping Parakeet routing and structured 503 errors.

How it was resolved

  1. validate-backend-runtime-env.py — Kept main’s validator (required dev Cloud Run services, GKE surfaces, secret-bound STT_PRERECORDED_MODEL).

  2. pre_recorded.py — Kept this PR’s structured PrerecordedSTTConfigurationError(provider, missing_env) for the 503 response shape in chat.py.

  3. runtime_env.yaml — Fixed a bad auto-merge:

    • Removed duplicate HOSTED_PARAKEET_API_URL / env-literal STT_PRERECORDED_MODEL entries
    • STT_PRERECORDED_MODEL stays in secrets (main’s contract)
    • HOSTED_PARAKEET_API_URL stays in env at http://parakeet.omiapi.com
  4. Tests — Updated for secret-bound STT and YAML anchor clones (backend-sync-backfill).

Verification: CI=1 backend/scripts/pre-deploy-check.sh — 43 passed; pre-push checks passed.

PR #9422 should now be mergeable with main.

Open in Web Open in Cursor 

Reconcile with #9421 dev Cloud Run Parakeet validation landed on main:
- Keep main's prerecorded STT manifest validator (required dev services + GKE)
- Keep structured PrerecordedSTTConfigurationError for 503 provider metadata
- Fix runtime_env.yaml auto-merge duplicates (STT secret binding only)
- Update regression tests for YAML anchor clones and secret-bound STT model

Verification: CI=1 backend/scripts/pre-deploy-check.sh (43 passed)

Co-authored-by: David Zhang <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit f442a12 into main Jul 11, 2026
13 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/fix-ptt-parakeet-reconnect-9417 branch July 11, 2026 00:50
Git-on-my-level added a commit that referenced this pull request Jul 11, 2026
## What changed and why

Recent macOS and backend bug-fix PRs were clustering around the same
missing contracts: re-entrant desktop state publication, duplicate
external IDs, hidden blocking work, runtime/deploy drift,
released-client schema breaks, and selective CI that could silently miss
tests. This replaces those one-off repairs with shared policies,
behavioral harnesses, compatibility checks, and fail-closed CI
selection.

The main durable changes are:

- FIFO/non-reentrant voice-turn dispatch, explicit last-write-wins
collection construction, duplicate-input tests, and a desktop
test-quality ratchet for trapping dictionaries, source-inspection debt,
and wall-clock waits.
- A pure prerecorded-STT provider contract shared by runtime selection
and deploy validation, lazy/thread-safe Deepgram construction,
controlled configuration failures, and complete dev/prod desired-state
bindings.
- Directional app-client OpenAPI compatibility checking against the
merge base, plus transitive module-local async-blocker analysis.
- One rename/delete/type-aware changed-path primitive, conservative
backend test selection, dedicated import-isolation gates, and complete
desktop agent Vitest discovery.
- Agent/PR guidance that requires a bug fix to close the failure class,
not only its current symptom. The evidence and guard hierarchy are
recorded in `docs/operational/systemic_bug_hardening.md`.

## Product invariants affected

- `INV-CHAT-1`: floating-control-bar, PTT, task-chat, and `ChatProvider`
paths are touched. The shared-transcript/session ownership model is
unchanged; the PTT coordinator now publishes transitions atomically
under nested callbacks.
- `INV-AUTH-1`: `ChatProvider.swift` is touched only to adopt
deterministic duplicate-key handling. Session invalidation and auth
recovery behavior are unchanged.
- `INV-INT-1`: `MemoryExportService.swift` is touched only to replace a
trapping dictionary constructor with the shared duplicate-key policy.
Integration ownership and capability behavior are unchanged.
- `INV-MEM-1`: the same `MemoryExportService.swift` mechanical migration
does not change memory tiers, canonical storage, or read/write routing.

## How it was verified

- `cd desktop/macos && OMI_SWIFT_TEST_SUITE_WORKERS=4
./scripts/swift-test-suites.sh` — all 219 Swift suites passed; the
desktop quality checker and its 11 fixture tests passed. Its
source-inspection ratchet is pinned to current-main debt (62 files / 171
sites) and permits no increase from this PR.
- `cd desktop/macos && rm -rf Desktop/.build && xcrun swift build -c
release --package-path Desktop --triple arm64-apple-macosx` — clean
arm64 release build passed.
- Built and launched `/Applications/omi-systemic-guards.app` with ad-hoc
signing. Exercised the real PTT semantic actions through idle →
recording → terminal-too-short; automation state reported zero invalid
and zero stale transitions.
- `cd backend && bash test.sh` — the complete selector-discovered suite
of 525 backend test files passed under file isolation and the strict
local CPU guard.
- `cd backend && PATH=/tmp/omi-python-bin:$PATH bash
scripts/pre-deploy-check.sh` — dev/prod runtime contracts and 50
deploy-safety tests passed.
- Import-purity scan: 637 production files, zero violations. Module-stub
pollution scan: 580 test files, zero violations. All-category async diff
scan: zero selected findings.
- App-client OpenAPI compatibility passed against current `origin/main`
(`2a14a9ee78153ac353afc2d5e43ffa328650a6f6`); all 19 checker tests
passed.
- `bash backend/scripts/typecheck.sh` — zero type errors.
- `scripts/pre-push` — all commit-aware local gates passed, including
OpenAPI/model freshness, actionlint, desktop suites, and the complete
desktop agent tool surface.
- Independent agent review found four test/wiring gaps; each was fixed
and the final review approved the updated tree.

No production deploy was performed. `backend/deploy/runtime_env.yaml`
changes checked-in desired state and will take effect only through the
normal deployment workflows.

## Tests

- `VoiceTurnCoordinatorTests` now reproduces nested effect/snapshot
callbacks and proves FIFO publication without recursion.
- `DictionaryDeduplicationTests` proves the shared collision policy; the
static checker rejects future trapping initializers and unreasoned
escapes.
- `test_prerecorded_stt_config.py`, provider tests, and
runtime-validator tests cover dynamic selectors, missing dependencies,
BYOK, fallback requirements, and dev/prod surfaces.
- `test_app_client_openapi_compatibility.py` covers request/response
directionality, status/media/security changes, enums, arrays, maps,
unions, constraints, and recursive references.
- `test_scan_async_blockers.py` covers transitive helpers, cycles, diff
scope, and safe executor offload.
- Workflow/path tests cover unknown sources, mixed direct+unmapped
changes, deleted tests, both rename sides, file-to-symlink type changes,
hook fallback, and full agent test discovery.

## Root cause and durable guard (bug fixes)

- Desktop lifecycle chain (`#9402`, `#9411`, `#9420`, `#9424`, `#9428`):
synchronous callbacks could advance a half-published transition. The
coordinator now owns a non-reentrant event queue, backed by
reducer-level behavior tests.
- Duplicate-ID crash class (`#9288` and adjacent sites): boundary data
was incorrectly assumed unique. A named collision policy replaces every
trapping production constructor, and CI rejects recurrence.
- Runtime/provider drift (`#9296`, `#9308`, `#9358`, `#9385`, `#9421`,
`#9422`): runtime choice and deploy dependencies had separate owners.
One pure provider contract now drives both, with lazy client
construction preserving import purity.
- Released-client break (`#9425`): schema freshness alone did not prove
compatibility. CI now compares contracts in the direction requests and
responses actually flow.
- False-green test selection: rename/deletion/type changes and unknown
production sources could escape intended gates, while the desktop agent
harness ran only a hand-picked subset. Selection now fails toward
broader coverage and discovers the complete suite.

## Scoped cleanups (optional)

- The backend test runner now caps nested BLAS/OpenMP pools per isolated
pytest worker, preventing oversubscription from corrupting per-test CPU
attribution while preserving explicit overrides.
- Runtime workflow validation reuses the already-parsed manifest instead
of reparsing it once per workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop PTT: fix Parakeet runtime drift and reconnect audio loss

2 participants