Skip to content

fix+cleanup(desktop): remove dead Deepgram proxy code, deprecate Rust endpoints, fix the critical bug on the env var fallback on deployment#6305

Merged
beastoin merged 11 commits into
mainfrom
cleanup/dead-deepgram-proxy-code
Apr 4, 2026
Merged

fix+cleanup(desktop): remove dead Deepgram proxy code, deprecate Rust endpoints, fix the critical bug on the env var fallback on deployment#6305
beastoin merged 11 commits into
mainfrom
cleanup/dead-deepgram-proxy-code

Conversation

@beastoin
Copy link
Copy Markdown
Collaborator

@beastoin beastoin commented Apr 4, 2026

Closes #6306. Follow-up to PR #6287 (desktop PTT migration to Python backend).

Removes all dead Deepgram client-side code from the desktop macOS app now that STT is fully routed through the Python backend. Adds a ~26h deprecation sunset to the Rust proxy Deepgram endpoints (410 Gone after 2026-04-05 05:00 UTC).

Critical fix: PTT live streaming broken in v0.11.223

TranscriptionService.pythonBackendBaseURL was falling back to OMI_API_URL (Rust desktop-backend on Cloud Run) instead of api.omi.me. PTT WS streaming hit the Rust backend at /v2/voice-message/transcribe-stream → 404. Fixed by removing the OMI_API_URL fallback — PTT now goes to OMI_PYTHON_API_URL or api.omi.me directly.

Changes

Desktop Swift app (-199 lines + PTT routing fix):

  • TranscriptionService.swift: removed batchTranscribeFull(), TranscriptSegment, TranscriptHandler, legacy start(onTranscript:) wrapper, proxyBaseURL, deepgramBaseURL, missingAPIKey error case; fixed pythonBackendBaseURL to not fall back to OMI_API_URL
  • PushToTalkManager.swift: migrated from legacy onTranscript to onSegments API
  • APIKeyService.swift: removed Deepgram API key fetch/store/clear/env
  • SettingsPage.swift: removed Deepgram API key developer field
  • AppState.swift: removed DEEPGRAM_API_KEY from backend-served keys

Desktop Rust backend:

  • proxy.rs: added is_deepgram_proxy_deprecated() with 2026-04-05 05:00 UTC cutoff; both DG endpoints return 410 Gone with migration message after cutoff; added 4 boundary tests

Review cycle fixes

  • Fixed deprecation timestamp: was 1_775_541_600 (April 7, 49h late), corrected to 1_775_365_200 (April 5 05:00 UTC)
  • Updated stale doc comment in TranscriptionService.swift
  • Corrected "24h" to "~26h" in deprecation comment

Tests

  • cargo test --quiet in Backend-Rust: 54 passed (4 new boundary tests)
  • pytest backend/tests/unit/test_desktop_transcribe.py -q: passed
  • Build verified on Mac Mini: app compiles, launches, binary confirms api.omi.me routing

by AI for @beastoin

beastoin and others added 6 commits April 4, 2026 07:30
…ervice

Remove batchTranscribeFull (stereo batch via Rust proxy), legacy
TranscriptSegment type, TranscriptHandler callback, proxyBaseURL,
deepgramBaseURL, BatchResponse models, and missingAPIKey error case.
All STT now goes through Python backend endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace start(onTranscript:) with start(onSegments:onEvent:) and
update handleTranscript to accept BackendSegment[] directly, removing
the intermediate TranscriptSegment conversion layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deepgram key is no longer needed client-side — all STT goes through
Python backend which manages its own DG credentials.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both /v1/proxy/deepgram/v1/listen (REST) and
/v1/proxy/deepgram/ws/v1/listen (WS) now return 410 Gone after
2026-04-05 05:00 UTC. Until then they continue proxying to Deepgram
for any old clients. Replacement endpoints are on the Python backend:
POST /v2/voice-message/transcribe and WS /v2/voice-message/transcribe-stream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 4, 2026

Greptile Summary

This PR removes dead Swift code related to the legacy Deepgram proxy path (batchTranscribeFull, TranscriptSegment, TranscriptHandler, proxyBaseURL, deepgramBaseURL, BatchResponse, and the Deepgram API key from APIKeyService/SettingsPage/AppState) and migrates PushToTalkManager to use the onSegments: API directly. On the Rust side, the two Deepgram proxy endpoints (POST /v1/proxy/deepgram/v1/listen and WS /v1/proxy/deepgram/ws/v1/listen) are kept alive temporarily with a hardcoded cutoff timestamp after which they return 410 Gone.

Key findings:

  • Incorrect deprecation timestamp (proxy.rs:194): The constant 1_775_541_600 is described in its own comment as "2026-04-05 05:00:00 UTC", but that timestamp is actually approximately 2026-04-07 06:00:00 UTC — about 49 hours later than intended. The correct value for 2026-04-05 05:00:00 UTC is 1_775_365_200. This means the "24h grace period" effectively becomes ~73 hours.
  • Stale doc comment (TranscriptionService.swift:7): The class-level doc comment still refers to "Full stereo batch: Rust proxy Deepgram endpoint (unchanged)" even though batchTranscribeFull() was removed by this PR.

Confidence Score: 3/5

Mostly safe to merge; the Swift dead-code removal is clean, but the Rust deprecation timestamp is off by ~49 hours — fix before merging if the April 5 cutoff matters.

The Swift side of this PR is a straightforward, well-scoped dead-code removal with no risky logic changes. The one concrete bug is the hardcoded Unix timestamp in proxy.rs that mismatches its own comment by ~49 hours, making the "24h grace period" effectively ~73 hours. Since the deprecation is a one-way door (returns 410 after the cutoff, no rollback path), an incorrect timestamp means the proxy silently keeps forwarding to Deepgram longer than intended. This is a meaningful correctness issue even if the practical impact is limited to extra Deepgram usage for a couple of extra days.

desktop/Backend-Rust/src/routes/proxy.rs — the DEPRECATION_TIMESTAMP constant needs correction

Important Files Changed

Filename Overview
desktop/Backend-Rust/src/routes/proxy.rs Deepgram proxy endpoints deprecated with a grace-period cutoff, but the Unix timestamp constant (1_775_541_600) mismatches its own comment by ~49 hours, causing the sunset to fire on ~April 7 instead of April 5.
desktop/Desktop/Sources/TranscriptionService.swift Dead code cleaned up; stale class-level doc comment still references the removed Rust proxy batch path but the rest of the file is correct.
desktop/Desktop/Sources/APIKeyService.swift Deepgram key handling removed cleanly; remaining keys (Gemini, Anthropic, ElevenLabs, Firebase, Calendar) are unchanged.
desktop/Desktop/Sources/FloatingControlBar/PushToTalkManager.swift Migrated from legacy onTranscript callback to onSegments API directly; logic is correct and consistent with the new TranscriptionService.
desktop/Desktop/Sources/AppState.swift Deepgram API key references removed; no issues found in the changed sections.
desktop/Desktop/Sources/MainWindow/Pages/SettingsPage.swift Deepgram API key UI removed; only remaining Deepgram mention is a user-facing description string about VAD savings, which is benign.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Desktop App Request] --> B{Request type?}
    B -->|PTT live streaming| C[Python /v2/voice-message/transcribe-stream WS]
    B -->|PTT batch| D[Python /v2/voice-message/transcribe REST]
    B -->|Conversation capture| E[Python /v4/listen WS]
    B -->|Legacy Deepgram proxy| F{is_deepgram_proxy_deprecated?}
    F -->|false - before cutoff ~Apr 7| G[Rust → Deepgram upstream]
    F -->|true - after cutoff| H[410 Gone]
    C --> I[TranscriptionService onSegments callback]
    D --> I
    E --> I
    I --> J[PushToTalkManager / AppState]
Loading

Comments Outside Diff (1)

  1. desktop/Desktop/Sources/TranscriptionService.swift, line 7 (link)

    P2 Stale doc comment references removed code

    The comment still says "Full stereo batch: Rust proxy Deepgram endpoint (unchanged)" — but this PR removes batchTranscribeFull() and the Rust Deepgram proxy is being deprecated. The line is now misleading.

    (Remove the "Full stereo batch" bullet entirely; the three remaining bullets cover the current endpoints.)

Reviews (1): Last reviewed commit: "deprecate(rust): add 24h sunset for Deep..." | Re-trigger Greptile

Comment on lines +193 to +195
// 2026-04-05 05:00:00 UTC = 1775,541,600 seconds since epoch
const DEPRECATION_TIMESTAMP: u64 = 1_775_541_600;
SystemTime::now()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Incorrect Unix timestamp — deprecation fires ~49 hours late

The comment states 2026-04-05 05:00:00 UTC = 1,775,541,600, but that arithmetic is wrong. Computing the correct Unix timestamp for 2026-04-05 05:00:00 UTC:

  • Days from epoch to 2026-01-01: 20,454 (42 regular × 365 + 14 leap × 366)
  • Days from 2026-01-01 to 2026-04-05: 31 + 28 + 31 + 4 = 94
  • Total: 20,548 × 86,400 = 1,775,347,200
  • Plus 5 hours (18,000 s): 1,775,365,200

1_775_541_600 is instead approximately 2026-04-07 06:00:00 UTC (≈49 hours late). The intended "24h grace period" becomes roughly 73 hours — the proxy will keep forwarding to Deepgram roughly two days longer than planned.

Suggested change
// 2026-04-05 05:00:00 UTC = 1775,541,600 seconds since epoch
const DEPRECATION_TIMESTAMP: u64 = 1_775_541_600;
SystemTime::now()
// 2026-04-05 05:00:00 UTC = 1_775_365_200 seconds since epoch
const DEPRECATION_TIMESTAMP: u64 = 1_775_365_200;

beastoin and others added 4 commits April 4, 2026 07:43
The epoch value 1_775_541_600 resolved to April 7 (49h late).
Correct value for April 5 05:00 UTC is 1_775_365_200.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The full stereo batch via Rust proxy was removed in this PR.
Update the class doc to reflect that.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR #6287 merged at 02:37 UTC; cutoff at 05:00 UTC is ~26h, not 24h.
Timestamp value is intentional (round number), comment was inaccurate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validates the epoch constant matches 2026-04-05 05:00 UTC and tests
before/at/after cutoff behavior. Addresses tester coverage gap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@beastoin
Copy link
Copy Markdown
Collaborator Author

beastoin commented Apr 4, 2026

CP9 Changed-Path Coverage Checklist

Classifications: level3_required=false, flow_diagram_required=false (dead code removal, no cross-service boundaries).

Path ID Sequence ID(s) Changed path (file:symbol + branch) Happy-path test (how) Non-happy-path test (how) L1 result + evidence L2 result + evidence L3 result + evidence If untested: justification
P1 N/A proxy.rs:is_deepgram_proxy_deprecated — time gate Verify proxy returns 200 before cutoff Verify proxy returns 410 after cutoff Unit test: 4 boundary tests PASS (54/54) N/A (Rust backend, no app integration for this path) N/A
P2 N/A proxy.rs:deepgram_listen_proxy — 410 branch POST to endpoint, verify normal proxy behavior After cutoff: POST returns 410 with migration message Unit tests cover constant; live: before cutoff so proxy active L2: will test from desktop app N/A
P3 N/A proxy.rs:deepgram_ws_proxy — 410 branch WS connect, verify normal proxy behavior After cutoff: WS returns 410 with migration message Unit tests cover constant; live: before cutoff so proxy active L2: will test from desktop app N/A
P4 N/A PushToTalkManager:handleTranscriptSegments — new onSegments API PTT record+send, verify transcript appears PTT record with no speech, verify graceful handling L1: build+run desktop, test PTT L2: desktop+backend, PTT e2e N/A
P5 N/A APIKeyService — Deepgram key removal App starts, no crash, Settings loads Dev key field absent, clear button works L1: build+run desktop, check Settings L2: desktop+backend, sign in flow N/A
P6 N/A SettingsPage — Deepgram field removal Settings page renders without Deepgram field Other dev key fields still work L1: build+run desktop, verify Settings L2: verify Settings with backend N/A
P7 N/A TranscriptionService — dead code removal App starts, conversation capture works PTT batch works after removal L1: build+run desktop L2: desktop+backend, full capture N/A
P8 N/A AppState:backendServedKeys — remove DEEPGRAM_API_KEY App loads API keys without error No crash on key fetch L1: build+run desktop, check logs L2: desktop+backend, sign in N/A

CP8.1 Test Detail Table

Sequence ID Path ID Scenario ID Changed path Exact test command Test name(s) Assertion intent Result Evidence link
N/A P1 S1 proxy.rs:DEEPGRAM_DEPRECATION_EPOCH cargo test --quiet in desktop/Backend-Rust deepgram_deprecation_timestamp_matches_target_date Constant == 1775365200 PASS 54/54 in this comment
N/A P1 S2 proxy.rs:is_deprecated_at cargo test --quiet in desktop/Backend-Rust deepgram_deprecation_before_cutoff epoch-1 returns false PASS 54/54
N/A P1 S3 proxy.rs:is_deprecated_at cargo test --quiet in desktop/Backend-Rust deepgram_deprecation_at_cutoff epoch returns true PASS 54/54
N/A P1 S4 proxy.rs:is_deprecated_at cargo test --quiet in desktop/Backend-Rust deepgram_deprecation_after_cutoff epoch+1 returns true PASS 54/54
N/A P4-P8 L1 Swift app paths Build + run on Mac Mini agent-swift smoke App launches, Settings renders, PTT works Pending CP9A
N/A P2-P8 L2 All paths integrated Desktop + Python backend on Mac Mini agent-swift + curl E2e PTT, Settings, no Deepgram references Pending CP9B

by AI for @beastoin

OMI_API_URL points to the Rust desktop-backend (Cloud Run), which
does not have /v2/voice-message/* endpoints. PTT streaming/batch
was routing to the wrong service and getting 404. Now PTT always
uses OMI_PYTHON_API_URL or falls back to api.omi.me directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@beastoin
Copy link
Copy Markdown
Collaborator Author

beastoin commented Apr 4, 2026

Critical bug found during CP9A: PTT live streaming routes to wrong backend

Mon identified that PTT WS streaming in v0.11.223 was hitting the Rust desktop-backend (desktop-backend-hhibjajaja-uc.a.run.app) instead of the Python backend (api.omi.me). 14 consecutive 404s on /v2/voice-message/transcribe-stream.

Root cause: TranscriptionService.pythonBackendBaseURL fell back to OMI_API_URL which is the Rust desktop-backend URL in release builds. The Rust backend has no /v2/voice-message/* endpoints.

Fix: Removed OMI_API_URL fallback. Resolution is now OMI_PYTHON_API_URL → api.omi.me only. Commit fe4a8f936.

Verification: Built on Mac Mini, strings on compiled binary confirms api.omi.me as default with no OMI_API_URL fallback in the PTT URL path.

This is a release blocker for all v0.11.223 desktop users — PTT live mode is completely broken until this merges and triggers a new release.


by AI for @beastoin

@beastoin
Copy link
Copy Markdown
Collaborator Author

beastoin commented Apr 4, 2026

CP9A L1 Synthesis (Build + Run Changed Component)

Changed components: Desktop Swift app + Desktop Rust backend.

Rust backend (P1-P3): cargo test --quiet — 54 passed. 4 new boundary tests for is_deepgram_proxy_deprecated() cover before/at/after cutoff and constant validation. All PASS.

Desktop Swift app (P4-P8): Built on Mac Mini with SWIFT_BUILD_DIR=/tmp/swift-build-beastoinagents OMI_APP_NAME=6305-cleanup ./run.sh --yolo. Compilation succeeded (260s). App launched and rendered login screen. strings on compiled binary confirms:

  • https://api.omi.me/ is the default PTT URL (P4, P7)
  • No OMI_API_URL fallback in pythonBackendBaseURL path (routing fix verified)
  • Python backend URL not configured (OMI_PYTHON_API_URL or api.omi.me) error message confirms new resolution order

Untested at L1: Full PTT live e2e (P4) — named test bundle requires fresh auth and callback URL scheme may not redirect to com.omi.6305-cleanup. This will be verified post-merge via release build or by ren with authenticated Omi Dev.

Paths proven: P1 (PASS), P2 (PASS via unit test), P3 (PASS via unit test), P5 (PASS — binary verification), P6 (PASS — binary verification), P7 (PASS — build success), P8 (PASS — build success).
Paths partially proven: P4 (build + binary URL confirmed, e2e pending auth).

CP9B L2 Status

L2 requires integrated desktop+backend testing. The app with this fix points PTT to api.omi.me (prod Python backend). Full L2 verification will happen post-merge via the release build, which will have production auth working.

Given this is a release blocker (all v0.11.223 users have broken PTT), recommending merge to unblock the fix.


by AI for @beastoin

@beastoin beastoin merged commit 41a8703 into main Apr 4, 2026
2 checks passed
@beastoin beastoin deleted the cleanup/dead-deepgram-proxy-code branch April 4, 2026 08:34
@beastoin beastoin changed the title cleanup(desktop): remove dead Deepgram proxy code, deprecate Rust endpoints fix+cleanup(desktop): remove dead Deepgram proxy code, deprecate Rust endpoints, fix the critical bug on the env var fallback on deployment Apr 4, 2026
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…points (BasedHardware#6305)

Closes BasedHardware#6306. Follow-up to PR BasedHardware#6287 (desktop PTT migration to Python
backend).

Removes all dead Deepgram client-side code from the desktop macOS app
now that STT is fully routed through the Python backend. Adds a ~26h
deprecation sunset to the Rust proxy Deepgram endpoints (410 Gone after
2026-04-05 05:00 UTC).

### Critical fix: PTT live streaming broken in v0.11.223
`TranscriptionService.pythonBackendBaseURL` was falling back to
`OMI_API_URL` (Rust desktop-backend on Cloud Run) instead of
`api.omi.me`. PTT WS streaming hit the Rust backend at
`/v2/voice-message/transcribe-stream` → 404. **Fixed by removing the
`OMI_API_URL` fallback** — PTT now goes to `OMI_PYTHON_API_URL` or
`api.omi.me` directly.

### Changes
**Desktop Swift app (-199 lines + PTT routing fix):**
- `TranscriptionService.swift`: removed `batchTranscribeFull()`,
`TranscriptSegment`, `TranscriptHandler`, legacy `start(onTranscript:)`
wrapper, `proxyBaseURL`, `deepgramBaseURL`, `missingAPIKey` error case;
**fixed `pythonBackendBaseURL` to not fall back to `OMI_API_URL`**
- `PushToTalkManager.swift`: migrated from legacy `onTranscript` to
`onSegments` API
- `APIKeyService.swift`: removed Deepgram API key fetch/store/clear/env
- `SettingsPage.swift`: removed Deepgram API key developer field
- `AppState.swift`: removed `DEEPGRAM_API_KEY` from backend-served keys

**Desktop Rust backend:**
- `proxy.rs`: added `is_deepgram_proxy_deprecated()` with 2026-04-05
05:00 UTC cutoff; both DG endpoints return 410 Gone with migration
message after cutoff; added 4 boundary tests

### Review cycle fixes
- Fixed deprecation timestamp: was `1_775_541_600` (April 7, 49h late),
corrected to `1_775_365_200` (April 5 05:00 UTC)
- Updated stale doc comment in TranscriptionService.swift
- Corrected "24h" to "~26h" in deprecation comment

### Tests
- `cargo test --quiet` in Backend-Rust: 54 passed (4 new boundary tests)
- `pytest backend/tests/unit/test_desktop_transcribe.py -q`: passed
- Build verified on Mac Mini: app compiles, launches, binary confirms
`api.omi.me` routing

---
_by AI for @beastoin_
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.

cleanup: remove dead Deepgram proxy code from desktop app

1 participant