Repository navigation
fix: make mobile emulator and beta Firebase profiles explicit - #11273
Conversation
Failure-Class: none
There was a problem hiding this comment.
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.plistmay be superseded by target-levelRelease-devsettings that keepRunner/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
| fi | ||
| setup_firebase \ | ||
| && setup_firebase_with_service_account_ios \ | ||
| && generate_ios_custom_config Prod omi-beta \ |
There was a problem hiding this comment.
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>
| BUNDLE_NAME=Omi Dev | ||
| BUNDLE_DISPLAY_NAME=Omi Dev | ||
| AUTH_CALLBACK_SCHEME=omi-dev | ||
| INFOPLIST_FILE=Runner/Info-Dev.plist |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
💡 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".
| localDev( | ||
| name: 'local_dev', | ||
| defaultApiBaseUrl: 'http://127.0.0.1:8000/', | ||
| firebaseProjectId: 'demo-omi-local', |
There was a problem hiding this comment.
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 👍 / 👎.
| static const firebaseAuthEmulatorHost = String.fromEnvironment( | ||
| 'OMI_FIREBASE_AUTH_EMULATOR_HOST', | ||
| defaultValue: '127.0.0.1', | ||
| ); |
There was a problem hiding this comment.
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 👍 / 👎.
| 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/}" |
There was a problem hiding this comment.
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 👍 / 👎.
| --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 \ |
There was a problem hiding this comment.
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 👍 / 👎.
| 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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
💡 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/', |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 👍 / 👎.
…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 <[email protected]>
… production identity (#11418) ## What - Adds a `local_prod` mobile profile: production Firebase identity (`based-hardware`) paired with a developer-chosen backend endpoint, selected only by an explicit `--dart-define=OMI_APP_PROFILE=local_prod`. Release builds reject the profile at startup (`kReleaseMode`), so no shipped artifact can select it. `local_dev` keeps its stricter loopback/private-network rule. - Fixes the `runZonedGuarded` crash handler in `main.dart`: it called `FirebaseCrashlytics.instance` unconditionally, so any error thrown before `Firebase.initializeApp()` completed was replaced by a secondary `[core/no-app]` exception and the root cause was lost. It now prints the original error and only forwards to Crashlytics once Firebase is initialized. ## Why Since #11273 the dev flavor is emulator-first (`demo-omi-local`) and there is no sanctioned way to run the prod-flavor app against a locally served backend for development. `local_prod` fills that gap the same way `mobile_beta` did for the dev serving plane: an explicit, enumerated, build-time profile instead of an env-file or debug-flag bypass. ## INV-DATA-1 This PR changes `app/lib/env/env.dart` and `app/lib/main.dart` (INV-DATA-1 path globs). It preserves every production-family routing authority — production and mobile_beta pins are untouched and their rejection tests still pass. It amends the proposed invariant text to enumerate `local_prod` as a debug-only developer-workflow exception; because release builds reject the profile, no production-family *artifact* can leave its data plane. This is not the deliberate-migration exception. Failure-Class: none ## Verification - `cd app && flutter test test/unit/env_test.dart` — 20 passed (4 new: profile pairing, debug endpoint acceptance incl. tunnel hosts, release-build rejection, malformed-endpoint rejection). - On device: prod-flavor debug build launched with `OMI_APP_PROFILE=local_prod` and `OMI_API_BASE_URL` pointing at an ngrok tunnel to a locally served backend; app authenticated with production identity and traffic was observed arriving at the local backend. - Crash-guard: reproduced a startup `StateError` that previously surfaced only as `[core/no-app]`; with the guard the real error and stack print to the console. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11418?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
PR BasedHardware#11273 rewired `setup.sh` to build the dev flavor against the local backend harness (Python API on :8000, Firebase Auth emulator on :9099, `demo-omi-local` project), but the setup docs still described the pre-BasedHardware#11273 world. Two defects, both of which land a new contributor in issue BasedHardware#5939: 1. `AppSetup.mdx` told developers to set `API_BASE_URL=https://api.omiapi.com/` "for dev", and claimed the prebuilt Firebase configs cover "Omi's development backend". Firebase ID tokens are project-scoped, and `demo-omi-local` is an emulator-only fake project no hosted backend can verify — so that pairing returns 401 on every authenticated call while sign-in still appears to succeed, exactly the failure BasedHardware#5939 reported, reached through the docs rather than the script. 2. Neither `AppSetup.mdx` nor `app/README.md` told anyone to start the harness. `setup.sh` builds against :8000 and :9099 but starts neither, so the documented path produced connection failures with no explanation. Documentation only — no code or behavior change: - Add a "Start the local backend harness" step (`make dev-init` / `make dev-up`, `PROVIDER_MODE=offline` variant) to the Mintlify guide and `app/README.md`, linking `docs/runbooks/local-emulator-manual-qa.md`. - Name the harness prerequisites the app prerequisites omitted: Python 3.11 (backend/AGENTS.md pins 3.11, not 3.12+), a Java runtime, firebase-tools/npx. - Correct the `API_BASE_URL` row and the prebuilt-Firebase warning; state the project-scoping rule that makes a mismatch fail. - Add troubleshooting entries for both symptoms (connection refused; sign-in succeeds then 401). - Renumber the `app/README.md` quick-setup list for the inserted step. Verification: - `python3.11 .github/scripts/pr_preflight.py --lane local --base main` → "PR preflight passed: 10 checks", files=2 (check-manifest-contract, diff-hygiene, architecture-guardrails, product-invariants, failure-class-protocol, failure-class-guard-artifact-ratchet, desktop-changelog-data, deferred-work-markers, lifecycle-headers, version-prefixed-filenames). Note: plain `make preflight` defaults to `origin/main`. On a fork whose `origin` is stale (mine is 6504 commits behind) that mis-scopes the diff to ~5900 files and selects unrelated lanes; pass `--base main` explicitly. - Cross-checked every command and value against source: `make dev-init`, `dev-up`, `dev-status`, `dev-down` exist in the Makefile; ports 8000/9099 and the `demo-omi-local` project come from `scripts/dev-harness/dev_harness/config.py` and match `app/setup.sh` + `app/lib/env/env.dart`; harness prerequisites match the preflight in `scripts/dev-harness/dev_harness/cli.py`. Not verified: I did not boot the harness or exercise mobile sign-in end to end. This machine cannot run it — `backend/.venv`'s interpreter symlink is dangling (uv's CPython 3.11.15 is gone) and there is no JRE, so `make dev-up` falls back to system Python 3.9 and dies with `ModuleNotFoundError: No module named 'dotenv'`. That failure does confirm the documented ordering (`dev-init` before `dev-up`), but the end-to-end mobile path remains unexercised. Failure-Class: none
#11532) PR #11273 rewired `setup.sh` to build the dev flavor against the local backend harness (Python API on :8000, Firebase Auth emulator on :9099, `demo-omi-local` project), but the setup docs still described the pre-#11273 world. Two defects, both of which land a new contributor in issue #5939: 1. `AppSetup.mdx` told developers to set `API_BASE_URL=https://api.omiapi.com/` "for dev", and claimed the prebuilt Firebase configs cover "Omi's development backend". Firebase ID tokens are project-scoped, and `demo-omi-local` is an emulator-only fake project no hosted backend can verify — so that pairing returns 401 on every authenticated call while sign-in still appears to succeed, exactly the failure #5939 reported, reached through the docs rather than the script. 2. Neither `AppSetup.mdx` nor `app/README.md` told anyone to start the harness. `setup.sh` builds against :8000 and :9099 but starts neither, so the documented path produced connection failures with no explanation. Documentation only — no code or behavior change: - Add a "Start the local backend harness" step (`make dev-init` / `make dev-up`, `PROVIDER_MODE=offline` variant) to the Mintlify guide and `app/README.md`, linking `docs/runbooks/local-emulator-manual-qa.md`. - Name the harness prerequisites the app prerequisites omitted: Python 3.11 (backend/AGENTS.md pins 3.11, not 3.12+), a Java runtime, firebase-tools/npx. - Correct the `API_BASE_URL` row and the prebuilt-Firebase warning; state the project-scoping rule that makes a mismatch fail. - Add troubleshooting entries for both symptoms (connection refused; sign-in succeeds then 401). - Renumber the `app/README.md` quick-setup list for the inserted step. Verification: - `python3.11 .github/scripts/pr_preflight.py --lane local --base main` → "PR preflight passed: 10 checks", files=2 (check-manifest-contract, diff-hygiene, architecture-guardrails, product-invariants, failure-class-protocol, failure-class-guard-artifact-ratchet, desktop-changelog-data, deferred-work-markers, lifecycle-headers, version-prefixed-filenames). Note: plain `make preflight` defaults to `origin/main`. On a fork whose `origin` is stale (mine is 6504 commits behind) that mis-scopes the diff to ~5900 files and selects unrelated lanes; pass `--base main` explicitly. - Cross-checked every command and value against source: `make dev-init`, `dev-up`, `dev-status`, `dev-down` exist in the Makefile; ports 8000/9099 and the `demo-omi-local` project come from `scripts/dev-harness/dev_harness/config.py` and match `app/setup.sh` + `app/lib/env/env.dart`; harness prerequisites match the preflight in `scripts/dev-harness/dev_harness/cli.py`. Not verified: I did not boot the harness or exercise mobile sign-in end to end. This machine cannot run it — `backend/.venv`'s interpreter symlink is dangling (uv's CPython 3.11.15 is gone) and there is no JRE, so `make dev-up` falls back to system Python 3.9 and dies with `ModuleNotFoundError: No module named 'dotenv'`. That failure does confirm the documented ordering (`dev-init` before `dev-up`), but the end-to-end mobile path remains unexercised. Failure-Class: none
Summary
Separate from #11265, this makes mobile Firebase/API environments explicit:
devdevelopment defaults to the local API/emulator harness and the non-productiondemo-omi-localFirebase project.https://api.omiapi.com/.Usage
For a real iPhone on the local path, set
OMI_DEV_HOSTto 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 theomi-betacallback configuration.Verification
flutter test test/unit/env_test.dart— 15/15 passedNSAllowsLocalNetworking=trueandomi-devomiruby -Iios/test ios/test/rayban_dat_xcode_graph_test.rb— 9 runs, 393 assertions, 0 failuresruby -Iios/test ios/test/rayban_dat_build_wrapper_test.rb— 12 runs, 129 assertions, 0 failuresFailure-Class: none