Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
xmarre
pushed a commit
that referenced
this pull request
Oct 30, 2026
…v Firebase (Comfy-Org#21981) ## Why IR-153: production users were intermittently signed in against the **dev** Firebase project (`dreamboothy-dev`) and production then rejected every request (`expected dreamboothy but got dreamboothy-dev`), showing a logout / "Couldn't load your workspace" until a reload. RUM, last 30 days on `cloud.comfy.org`: 119 sessions loaded the dev auth iframe (vs 17,850 on prod), with 41 Google and 19 password sign-in sessions sent to dev, mostly on slow connections. The dev project's sign-in allowlist rejects non-staff, so customers saw a failed sign-in rather than dev data. Once the page has the right config, product use and billing are unaffected. ## Root cause - `getFirebaseConfig()` uses the server's `firebase_config`, else `BUILD_TIME_CONFIG` (`src/config/firebase.ts`). - Cloud bundles (including the prod variant in `Comfy-Org/cloud` `frontend-asset-predeploy.yml`) are built without `USE_PROD_CONFIG`, so `BUILD_TIME_CONFIG` is the dev project. - At startup the anonymous `/features` read has a 5s timeout; on failure `remoteConfigState` becomes `'error'` and `firebaseIdentity` (which only guards `'unloaded'`) initializes from that dev default. - Firebase initializes once, so the later authenticated refresh / 10‑minute poll cannot repair the page. ## How On cloud, startup now retries the anonymous `/features` read with capped backoff (1s → 10s) behind the existing splash until the server names the Firebase project (`loadRemoteConfigUntilReady`). A successful read is not enough on its own: `firebase_config` is optional in the response contract, so a 200 that omits it would otherwise end bootstrap with no server config and let `getFirebaseConfig()` fall through to the build-time default — the same `dreamboothy-dev` outcome. The loop therefore also requires `hasServerFirebaseConfig()`, which counts an explicit `firebase_env: 'dev'` as server-named, since that is a server instruction rather than a build-time guess. `isCloud` is the bundle flavour, not "served by the Cloud API": a cloud bundle can be served by a local ComfyUI, whose `/features` answers 200 and never carries `firebase_config`. Waiting indefinitely there never starts the app — every cloud Playwright shard timed out that way at `59e93a79` — so the two cases are split on `isLoopbackHost(window.location.hostname)`. A deployed host keeps waiting rather than start Firebase on the bundled project; a loopback harness, whose server has no project to send, stops after one further read. A read that *fails* still retries in both, which is the shape the incident had. The first project-less read reports `startup_remote_config_without_firebase_project` (tagged `localCloud`), so a deployed Cloud omitting the field is visible while it waits rather than silent. Firebase therefore only ever starts from the server's `firebase_config`; there is no build-time fallback on cloud. A long outage shows up as a `timed_out` bootstrap report with `startup/remote-config` pending. Local and desktop keep the single read and their build-time defaults, since their server does not send `firebase_config`. Alternative considered: building the prod bundle with `USE_PROD_CONFIG=true`. That prevents the wrong project on prod but still boots on a guessed config when the server does not answer, and staging bundles keep the dev guess. ## AS IS / TO BE AS IS (`origin/main`, `pnpm dev:cloud` → testcloud, `/api/features` aborted): one request, never retried, never answered; the login page renders anyway and Firebase is initialized from the build-time default `dreamboothy-dev`. <img width="640" alt="AS IS" src="https://gist.githubusercontent.com/dante01yoon/1765936a04597e0ef15ebfa4e54fd4db/raw/da2eddeca02d8d0c58e8469e68ee67dcf6503f03/asis-final.png" /> TO BE (PR branch, same setup, `/api/features` aborted twice then let through): the splash holds during retries #1 and #2 (1s, 2s backoff), request #3 answers 200, then the login page loads with Firebase on the server's `firebase_config`. testcloud's own `firebase_config` is `dreamboothy-dev`, so the project name matches AS IS here; the difference is that it now comes from the server rather than the build default. On prod the server returns `dreamboothy`. <img width="640" alt="TO BE splash during retries" src="https://gist.githubusercontent.com/dante01yoon/1765936a04597e0ef15ebfa4e54fd4db/raw/da2eddeca02d8d0c58e8469e68ee67dcf6503f03/tobe-splash.png" /> <img width="640" alt="TO BE loaded" src="https://gist.githubusercontent.com/dante01yoon/1765936a04597e0ef15ebfa4e54fd4db/raw/da2eddeca02d8d0c58e8469e68ee67dcf6503f03/tobe-final.png" /> ## Tests `refreshRemoteConfig.test.ts`: - abort → 503 → success resolves with the server config after three reads. Fails when the loop returns after the first read. - a 200 without `firebase_config` keeps retrying and resolves on the next read that carries one. Fails with `expected "vi.fn()" to be called 2 times, but got 1 times` when the `hasServerFirebaseConfig()` gate is removed. - a 200 carrying only `firebase_env: 'dev'` resolves on the first read, pinning that branch against an accidental narrowing. - on a deployed host (`cloud.comfy.org`), repeated 200s without a project never resolve the bootstrap promise, so Firebase initialization is unreachable. Fails when the loopback guard is dropped. - on a loopback host, the same responses stop after one further read, which is what keeps the cloud e2e harness booting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporary mirror-only validation PR. Do not merge. Used to reconcile the existing Comfy-Org#14897 test deltas against current upstream and validate the final one-commit target before updating the real PR branch.