Skip to content

fix(desktop): disable beta→dev backend routing — creating ghost Firebase accounts - #7040

Merged
kodjima33 merged 1 commit into
mainfrom
revert-pr-7014-route-beta-to-dev
Apr 26, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
revert-pr-7014-route-beta-to-dev

Conversation

@kodjima33

Copy link
Copy Markdown
Collaborator

Problem

Production-bundle macOS users on the beta update channel are landing in fresh empty Firebase accounts after sign-in. Concrete repro: signing in as [email protected] on build 0.11.365 creates new Firebase user caLCFj7IisV85UX9XrrV1aVf3pk1 (no email, no providers, created today) instead of returning the existing viUv7GtdoHXbK1UBCDlPuTDuPgJ2 that owns all of kodjima33's data. Reported as widespread across beta users.

Both UIDs are in the same based-hardware Firebase project (aud: based-hardware, iss: https://securetoken.google.com/based-hardware), so it's not a project mismatch — the dev auth flow is minting tokens for new UIDs instead of linking to existing ones.

Cause

PR #7014 (60046c19f) routed com.omi.computer-macos clients on the beta channel to:

  • Python: https://api.omiapi.com/
  • Rust: https://desktop-backend-dt5lrfkkoa-uc.a.run.app/

The OMI_AUTH_URL is unchanged (still prod omi-desktop-auth), but downstream calls through the dev Python backend during sign-in result in a different uid being returned to the client. The empty user record on the new uid (no email, no providers) indicates the path goes through signInWithCustomToken for a freshly-generated uid rather than signInWithIdp linking by email.

Fix

Surgical: shouldUseDevelopmentBackends now always returns false, so prod-beta clients keep talking to prod backends. The routing scaffolding (DesktopBackendEnvironment, env-var override paths, applyReleaseChannelDefaults) is left in place for when the auth-side issue is properly diagnosed and fixed — at that point this can be reverted.

A full git revert of #7014 conflicts with newer changes to TranscriptionService.swift and others; this 1-line approach gets the same effect with no merge surgery.

Verification

  • Codemagic build succeeds
  • Mac mini smoke test: sign in as kodjima33 on the new build, confirm uid = viUv7GtdoHXbK1UBCDlPuTDuPgJ2 and data loads
  • Confirm APIClient.baseURL resolves to https://api.omi.me/ for prod-beta
  • Confirm rustBackendURL resolves to the prod desktop-backend-hhibjajaja-uc.a.run.app (or the env-var override)

🤖 Generated with Claude Code

…irebase accounts

PR #7014 routed prod-bundle beta-channel users to api.omiapi.com + the dev
desktop-backend, with the assumption that both would still read prod
Firestore. In practice, signing in via the dev path lands users in fresh
empty Firebase accounts (e.g. caLCFj7… instead of viUv7Gtdo… for
[email protected]) — so they sign in successfully but see zero data.

Surgical fix: make `shouldUseDevelopmentBackends` always return false so
prod-beta clients keep using prod backends. Routing scaffolding is left in
place for when the auth-side issue is fixed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kodjima33
kodjima33 merged commit c796841 into main Apr 26, 2026
3 checks passed
@kodjima33
kodjima33 deleted the revert-pr-7014-route-beta-to-dev branch April 26, 2026 19:24
@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hotfixes a critical production regression where beta-channel macOS users were being signed into freshly-minted Firebase accounts (no email, no providers) instead of their existing accounts, caused by PR #7014 routing beta clients to the dev Python backend whose auth path issues new UIDs via signInWithCustomToken rather than linking by identity. The fix is a single-line return false in shouldUseDevelopmentBackends, effectively reverting the routing effect of #7014 without a conflicting full revert, while leaving all scaffolding intact for a future fix.

Confidence Score: 4/5

Safe to merge — the fix is minimal, targeted, and correctly stops ghost-account creation for beta users.

Only P2 findings (real username/UID in a source comment). The core logic change is a one-liner with matching test updates and a clear reversion path once the underlying auth issue is diagnosed.

No files require special attention beyond the minor comment wording in DesktopBackendEnvironment.swift.

Important Files Changed

Filename Overview
desktop/Desktop/Sources/DesktopBackendEnvironment.swift Core fix: shouldUseDevelopmentBackends now unconditionally returns false, keeping all channel clients (beta, staging, stable) on production backends. Scaffolding for future dev routing is preserved. Comment embeds a real username and partial Firebase UIDs.
desktop/Desktop/Tests/APIClientRoutingTests.swift Test renamed and all assertions flipped from XCTAssertTrue to XCTAssertFalse to match the new always-false routing; covers beta, staging, stable, and dev-bundle combinations correctly.
desktop/CHANGELOG.json Adds one user-facing unreleased entry describing the fix; no issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Desktop app launches] --> B[applyReleaseChannelDefaults]
    B --> C{shouldUseDevelopmentBackends}
    C -- "always false (this PR)" --> D[No env vars set by this path]
    C -- "previously: beta/staging → true" --> E[setenv OMI_PYTHON_API_URL = dev\nsetenv OMI_DESKTOP_API_URL = dev]
    D --> F[pythonBaseURL / rustBackendURL]
    E --> F
    F --> G{OMI_PYTHON_API_URL set?}
    G -- yes --> H[Use env-var URL]
    G -- no --> I[Use productionPythonAPIURL\nhttps://api.omi.me/]
    F --> J{useDevelopmentBackends?}
    J -- "false (this PR)" --> K{OMI_DESKTOP_API_URL set?}
    J -- "true (old beta path)" --> L[developmentRustBackendURL\ndt5lrfkkoa-uc.a.run.app]
    K -- yes --> M[Use env-var Rust URL]
    K -- no --> N[Return empty string]
Loading

Reviews (1): Last reviewed commit: "fix(desktop): disable beta→dev backend r..." | Re-trigger Greptile

Comment on lines +19 to +24
// Beta-to-dev routing disabled: signed-in users were landing in fresh empty
// Firebase accounts (e.g. caLCFj7… instead of viUv7Gtdo… for kodjima33),
// because the dev backend's auth path mints custom tokens for new UIDs
// instead of linking to the existing prod user. Keep beta on prod backends
// until the auth flow is fixed.
return false

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.

P2 Real user identifier in source comment

The comment embeds kodjima33 (a real email/username) and partial Firebase UIDs (caLCFj7…, viUv7Gtdo…) in tracked source code. Even truncated, these UIDs tie a real person's identity to a specific Firebase account record. Comments in VCS history are public and permanent — prefer pseudonyms or ticket references when documenting auth bugs.

Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…ase accounts (BasedHardware#7040)

## Problem

Production-bundle macOS users on the `beta` update channel are landing
in **fresh empty Firebase accounts** after sign-in. Concrete repro:
signing in as `[email protected]` on build `0.11.365` creates new
Firebase user `caLCFj7IisV85UX9XrrV1aVf3pk1` (no email, no providers,
created today) instead of returning the existing
`viUv7GtdoHXbK1UBCDlPuTDuPgJ2` that owns all of kodjima33's data.
Reported as widespread across beta users.

Both UIDs are in the same `based-hardware` Firebase project (`aud:
based-hardware`, `iss: https://securetoken.google.com/based-hardware`),
so it's not a project mismatch — the dev auth flow is minting tokens for
new UIDs instead of linking to existing ones.

## Cause

PR BasedHardware#7014 (`60046c19f`) routed `com.omi.computer-macos` clients on the
`beta` channel to:
- Python: `https://api.omiapi.com/`
- Rust: `https://desktop-backend-dt5lrfkkoa-uc.a.run.app/`

The `OMI_AUTH_URL` is unchanged (still prod `omi-desktop-auth`), but
downstream calls through the dev Python backend during sign-in result in
a different uid being returned to the client. The empty user record on
the new uid (no email, no providers) indicates the path goes through
`signInWithCustomToken` for a freshly-generated uid rather than
`signInWithIdp` linking by email.

## Fix

Surgical: `shouldUseDevelopmentBackends` now always returns `false`, so
prod-beta clients keep talking to prod backends. The routing scaffolding
(`DesktopBackendEnvironment`, env-var override paths,
`applyReleaseChannelDefaults`) is left in place for when the auth-side
issue is properly diagnosed and fixed — at that point this can be
reverted.

A full `git revert` of BasedHardware#7014 conflicts with newer changes to
`TranscriptionService.swift` and others; this 1-line approach gets the
same effect with no merge surgery.

## Verification

- [ ] Codemagic build succeeds
- [ ] Mac mini smoke test: sign in as kodjima33 on the new build,
confirm uid = `viUv7GtdoHXbK1UBCDlPuTDuPgJ2` and data loads
- [ ] Confirm `APIClient.baseURL` resolves to `https://api.omi.me/` for
prod-beta
- [ ] Confirm `rustBackendURL` resolves to the prod
`desktop-backend-hhibjajaja-uc.a.run.app` (or the env-var override)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant