Skip to content

Migrate desktop macOS app from Rust backend to Python backend #5302

@beastoin

Description

@beastoin

Problem

The desktop macOS app uses a dedicated Rust backend (desktop/Backend-Rust/, deployed as desktop-backend on Cloud Run) with 80+ endpoints that largely duplicate the Python backend's 339+ endpoints at api.omi.me. This creates dual maintenance, separate deployments, and has caused bugs (#5296 stale download).

Python backend is the source of truth. Swift app adapts to Python's existing contracts. Rust-only features get ported to Python or dropped.

Scope

Auth is NOT in scope — desktop auth (omi-desktop-auth Cloud Run) is separate.

Current Status

Already Migrated

Verified Endpoint Audit

  • ~65 endpoints: no work needed — direct Python equivalents exist
  • 11 PRs needed — see 3-day plan below
  • 4 features dropped for cutover (Crisp, LLM usage, stats, Sentry)

3-Day Migration Plan (v4)

Chat Strategy: Option A — Python CRUD compat

Add desktop-compat CRUD endpoints in Python matching Rust's message contract. Python streaming RAG untouched for mobile/web. Swift changes = zero for chat. Full ChatEngine rewrite is follow-up optimization.

Day 1: Unblock Critical Contracts (5 PRs parallel)

  • PR1: Python chat CRUD compat (/v2/desktop/messages)
  • PR2: Python chat sessions CRUD (/v2/chat-sessions)
  • PR3: Python screen activity sync (POST /v1/screen-activity/sync)
  • PR4: Swift decoder fixes (action_items key, optional fields, agent VM paths)
  • PR5: Router wiring in backend/main.py

Day 2: Port Remaining Gaps (5 PRs parallel)

  • PR6: Python focus sessions + stats
  • PR7: Python daily score + scores
  • PR8: Python AI profile + assistant settings
  • PR9: Python advice CRUD
  • PR10: Python staged tasks + promote logic (largest)

Day 3: Integration + Hardening + Cutover

  • PR11: Final compat fixes + edge cases
  • Full test pass (backend/test.sh)
  • Desktop smoke suite against Python backend
  • Cutover: OMI_API_URLapi.omi.me
  • Rust backend hot as rollback for 72h

Critical Path

PR1 (chat) + PR2 (sessions) → PR5 (wiring) → Day 3 integration
PR10 (staged tasks)         → Day 3 integration
PR4 (Swift decoders)        → Day 3 smoke test

Decision Gate

Day 2 noon: if chat compat is unstable → switch to Option B (keep Rust for chat only, migrate everything else).

Swift Must Adapt

Mismatch Rust Python Fix
Action items key "items" "action_items" Swift CodingKeys
Agent VM paths /v2/agent/* /v1/agent/vm-* Swift URL map
Memory optional fields Required Optional Swift defaults
Conversation timestamps Required Optional Swift optional

Rollback

  1. Rust backend stays hot for 72h+ after cutover
  2. Instant rollback via OMI_API_URL env var change
  3. All Python changes are additive — no destructive schema changes

Related

Full analysis in comments below.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions