Skip to content

fix: make mobile emulator and beta Firebase profiles explicit - #11273

Merged
Git-on-my-level merged 2 commits into
mainfrom
codex/mobile-environment-profiles
Aug 9, 2026
Merged

fix: make mobile emulator and beta Firebase profiles explicit#11273
Git-on-my-level merged 2 commits into
mainfrom
codex/mobile-environment-profiles

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Separate from #11265, this makes mobile Firebase/API environments explicit:

  • Normal dev development defaults to the local API/emulator harness and the non-production demo-omi-local Firebase project.
  • Mobile beta/dogfood uses the production Firebase project and preserves production user IDs, while serving through https://api.omiapi.com/.
  • Profile/API/Firebase mismatches fail during startup instead of producing opaque Firebase custom-token errors.
  • iOS and Android OAuth callback schemes are flavor-scoped; local iOS networking permission is present only in dev artifacts.
  • Setup scripts and CI now use tracked local Firebase placeholders, with platform-specific production Firebase generation for beta.

Usage

# Local development
bash app/setup.sh ios

# Explicit mobile beta / dogfood (requires production Firebase service-account access)
export FIREBASE_SERVICE_ACCOUNT_KEY=/secure/path/to/firebase-service-account.json
bash app/setup.sh ios beta
# or: bash app/setup.sh android beta

For a real iPhone on the local path, set OMI_DEV_HOST to the Mac's LAN address when the local API/emulator harness is reachable from the phone. Beta requires the registered production Firebase app/bundle ID and backend acceptance of production Firebase tokens plus the omi-beta callback configuration.

Verification

  • flutter test test/unit/env_test.dart — 15/15 passed
  • iOS dev no-codesign build — passed; bundled plist contains NSAllowsLocalNetworking=true and omi-dev
  • iOS prod no-codesign build — passed; bundled plist has no local-network ATS exception and uses omi
  • ruby -Iios/test ios/test/rayban_dat_xcode_graph_test.rb — 9 runs, 393 assertions, 0 failures
  • ruby -Iios/test ios/test/rayban_dat_build_wrapper_test.rb — 12 runs, 129 assertions, 0 failures
  • shell syntax, plist/JSON/XML validation, Dart analyzer ratchet, and diff checks — passed
  • Android APK compilation was not available on the validation Mac because no Android SDK is installed

Failure-Class: none

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 28 files

Confidence score: 2/5

  • In app/setup.sh, the iOS beta Google Sign-In flow still uses the production reverse-client URL scheme, so OAuth callbacks can fail for beta builds using the beta Firebase bundle ID and users may be unable to sign in — switch to the beta-generated reverse-client scheme for beta configuration.
  • In app/ios/Flutter/devRelease.xcconfig, INFOPLIST_FILE=Runner/Info-Dev.plist may be superseded by target-level Release-dev settings that keep Runner/Info.plist, which can silently apply the wrong plist at build time and break environment-specific behavior — align/remove the target-level override in the Runner build configuration so the intended plist is used.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/setup.sh">

<violation number="1" location="app/setup.sh:216">
P1: iOS beta Google sign-in still exposes the hard-coded prod reverse-client URL scheme, not the scheme generated for the beta Firebase bundle ID, so OAuth cannot return to a beta app with its own registered Firebase configuration. Let the generated `Custom.xcconfig` value override/remove the later `GOOGLE_REVERSE_CLIENT_ID` assignments in prod flavor configs.</violation>
</file>

<file name="app/ios/Flutter/devRelease.xcconfig">

<violation number="1" location="app/ios/Flutter/devRelease.xcconfig:10">
P2: The added INFOPLIST_FILE=Runner/Info-Dev.plist may be overridden by the Runner target's Release-dev XCBuildConfiguration, which hardcodes INFOPLIST_FILE = Runner/Info.plist at target level (pbxproj), and target build settings win over .xcconfig. If that override isn't removed in this PR, the dev release build silently keeps using the wrong plist — exactly the opaque mismatch this change is meant to eliminate. Confirm the pbxproj override is updated (e.g. to $(INFOPLIST_FILE) or removed) for the devRelease config, or this line has no effect.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/setup.sh
fi
setup_firebase \
&& setup_firebase_with_service_account_ios \
&& generate_ios_custom_config Prod omi-beta \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: iOS beta Google sign-in still exposes the hard-coded prod reverse-client URL scheme, not the scheme generated for the beta Firebase bundle ID, so OAuth cannot return to a beta app with its own registered Firebase configuration. Let the generated Custom.xcconfig value override/remove the later GOOGLE_REVERSE_CLIENT_ID assignments in prod flavor configs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/setup.sh, line 216:

<comment>iOS beta Google sign-in still exposes the hard-coded prod reverse-client URL scheme, not the scheme generated for the beta Firebase bundle ID, so OAuth cannot return to a beta app with its own registered Firebase configuration. Let the generated `Custom.xcconfig` value override/remove the later `GOOGLE_REVERSE_CLIENT_ID` assignments in prod flavor configs.</comment>

<file context>
@@ -155,36 +169,83 @@ function setup_keystore_android() {
+      fi
+      setup_firebase \
+        && setup_firebase_with_service_account_ios \
+        && generate_ios_custom_config Prod omi-beta \
+        && setup_app_env mobile_beta \
+        && run_build_ios prod --dart-define=OMI_APP_PROFILE=mobile_beta
</file context>

Comment thread app/setup/scripts/setup.ps1 Outdated
Comment thread app/setup/scripts/setup.ps1 Outdated
Comment thread app/ios/Runner/Info-Dev.plist Outdated
Comment thread app/test/unit/env_test.dart Outdated
BUNDLE_NAME=Omi Dev
BUNDLE_DISPLAY_NAME=Omi Dev
AUTH_CALLBACK_SCHEME=omi-dev
INFOPLIST_FILE=Runner/Info-Dev.plist

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The added INFOPLIST_FILE=Runner/Info-Dev.plist may be overridden by the Runner target's Release-dev XCBuildConfiguration, which hardcodes INFOPLIST_FILE = Runner/Info.plist at target level (pbxproj), and target build settings win over .xcconfig. If that override isn't removed in this PR, the dev release build silently keeps using the wrong plist — exactly the opaque mismatch this change is meant to eliminate. Confirm the pbxproj override is updated (e.g. to $(INFOPLIST_FILE) or removed) for the devRelease config, or this line has no effect.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/ios/Flutter/devRelease.xcconfig, line 10:

<comment>The added INFOPLIST_FILE=Runner/Info-Dev.plist may be overridden by the Runner target's Release-dev XCBuildConfiguration, which hardcodes INFOPLIST_FILE = Runner/Info.plist at target level (pbxproj), and target build settings win over .xcconfig. If that override isn't removed in this PR, the dev release build silently keeps using the wrong plist — exactly the opaque mismatch this change is meant to eliminate. Confirm the pbxproj override is updated (e.g. to $(INFOPLIST_FILE) or removed) for the devRelease config, or this line has no effect.</comment>

<file context>
@@ -6,3 +6,5 @@
 BUNDLE_NAME=Omi Dev
 BUNDLE_DISPLAY_NAME=Omi Dev
+AUTH_CALLBACK_SCHEME=omi-dev
+INFOPLIST_FILE=Runner/Info-Dev.plist
</file context>

Comment thread app/test.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa9aabdf2e

ℹ️ 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".

Comment on lines +7 to +10
localDev(
name: 'local_dev',
defaultApiBaseUrl: 'http://127.0.0.1:8000/',
firebaseProjectId: 'demo-omi-local',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the documented dev Firebase contract

This changes the dev flavor from the documented based-hardware-dev Firebase project to demo-omi-local, but app/AGENTS.md still directs agents to use based-hardware-dev. Following that component guide now generates a project mismatch that validateFirebaseProject rejects during startup, so update the guide and its Firebase config paths as part of this change.

AGENTS.md reference: app/AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

Comment thread app/lib/env/env.dart
Comment on lines +11 to +14
static const firebaseAuthEmulatorHost = String.fromEnvironment(
'OMI_FIREBASE_AUTH_EMULATOR_HOST',
defaultValue: '127.0.0.1',
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Choose an Android-reachable emulator host by default

When a developer launches the now-local-by-default dev flavor through the documented flutter run --flavor dev command or an IDE rather than keeping setup.sh as the launcher, this default connects Firebase Auth to 127.0.0.1 inside the Android emulator, not the host machine. The setup wrapper itself recognizes that Android requires 10.0.2.2, so these ordinary subsequent launches cannot authenticate unless the same define is manually repeated; make the runtime default platform-aware or persist/document the required define.

Useful? React with 👍 / 👎.

Comment thread app/setup.sh
LOCAL_API_BASE_URL="${OMI_LOCAL_API_BASE_URL:-http://${LOCAL_DEV_HOST}:8000/}"
ANDROID_DEV_HOST="${OMI_ANDROID_DEV_HOST:-${OMI_DEV_HOST:-10.0.2.2}}"
ANDROID_LOCAL_API_BASE_URL="${OMI_LOCAL_API_BASE_URL:-http://${ANDROID_DEV_HOST}:8000/}"
BETA_API_BASE_URL="${OMI_BETA_API_BASE_URL:-https://api.omiapi.com/}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor or remove the beta API override

If OMI_BETA_API_BASE_URL is set to anything other than the default, both beta setup paths pass that value as OMI_API_BASE_URL, but startup compares it against the fixed mobileBeta.defaultApiBaseUrl and throws a StateError. Thus the newly introduced override can only make the beta build fail; either validate/use the configured beta endpoint consistently or stop exposing this override.

Useful? React with 👍 / 👎.

Comment thread app/setup.sh
--out=lib/firebase_options_prod.dart \
--ios-bundle-id=com.friend-app-with-wearable.ios12 \
--android-app-id=com.friend.ios.dev \
--android-app-id=com.friend.ios \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pass the Android package name to FlutterFire

The advertised setup.sh android beta path now executes this command, but --android-app-id expects a Firebase app identifier rather than an Android package name, so passing com.friend.ios prevents FlutterFire from resolving or generating the production Android configuration. The repository's established FlutterFire invocations in codemagic.yaml use --android-package-name=com.friend.ios; use that flag here and in the equivalent PowerShell command so Android beta setup can reach the build step.

Useful? React with 👍 / 👎.

Comment thread app/setup.sh
Comment on lines +154 to +158
if [[ "$profile" == "mobile_beta" ]]; then
env_file='.env'
api_base_url="$BETA_API_BASE_URL"
fi
printf 'API_BASE_URL=%s\nUSE_WEB_AUTH=true\nUSE_AUTH_CUSTOM_TOKEN=true\n' "$api_base_url" > "$env_file"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve existing production environment values

Both beta setup paths select .env here and then overwrite it with only API_BASE_URL, USE_WEB_AUTH, and USE_AUTH_CUSTOM_TOKEN. On any checkout whose production environment already contains PostHog, Maps, Intercom, Google OAuth, or other ProdEnv values, running the newly documented beta command silently deletes them before code generation, producing a beta app with those services unconfigured; update only the intended keys or merge from the existing file instead. The PowerShell WriteAllText path has the same destructive behavior.

Useful? React with 👍 / 👎.

Disable local Crashlytics mapping uploads and address review findings around iOS beta OAuth, plist generation, setup defaults, and profile-isolated Firebase validation.\n\nFailure-Class: none

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddd8339d80

ℹ️ 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".

enum AppEnvironmentProfile {
localDev(
name: 'local_dev',
defaultApiBaseUrl: 'http://127.0.0.1:8000/',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive a reachable WebSocket URL for local profiles

When the new default local profile supplies http://127.0.0.1:8000/ (or setup supplies http://10.0.2.2:8000/), Env.agentProxyWsUrl passes it to _agentProxyWsUrlFor, which discards the port via Uri.host and always returns wss://...; agent chat therefore attempts TLS on the default port instead of a reachable local endpoint. Preserve the authority and map HTTP to WS, or pass an explicit local agent-proxy override from setup.

AGENTS.md reference: app/AGENTS.md:L124-L127

Useful? React with 👍 / 👎.

BUNDLE_DISPLAY_NAME=Omi Dev
APP_BUNDLE_IDENTIFIER=com.friend-app-with-wearable.ios12.development
AUTH_CALLBACK_SCHEME=omi-dev
INFOPLIST_FILE=Runner/Info-Dev.plist

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Generate the dev plist from the Ray-Ban wrapper

When an existing checkout pulls this change and runs the documented scripts/rayban_dat.sh run or build path without rerunning the full iOS setup, every Ray-Ban configuration now references Runner/Info-Dev.plist, but that file is gitignored and the wrapper never invokes generate_ios_dev_info_plist.sh; Xcode therefore fails before launching or building. Generate the plist in the Ray-Ban wrapper or keep a tracked build input available.

AGENTS.md reference: app/AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit a41edea into main Aug 9, 2026
27 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/mobile-environment-profiles branch August 9, 2026 02:02
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Aug 9, 2026
…asedHardware#11273 local setup

Merge main's local/emulator Firebase default, force PowerShell Dart
projectId Matches into @(...), validate the *-local trio at setup time,
and update the CI checker/docs for the post-BasedHardware#11273 profiles.

Co-authored-by: Cursor <cursoragent@cursor.com>
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