Skip to content

validation: reconcile PR 14897 on current upstream - #3

Closed
xmarre wants to merge 4 commits into
validation/pr14897-upstream-basefrom
fix/workflow-history-persistence-mirror-20260818
Closed

xmarre wants to merge 4 commits into
validation/pr14897-upstream-basefrom
fix/workflow-history-persistence-mirror-20260818

Conversation

@xmarre

@xmarre xmarre commented Aug 18, 2026

Copy link
Copy Markdown
Owner

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.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 546eea2d-79fb-4a7c-b81a-ccce146b62ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
@xmarre xmarre reopened this Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
@xmarre xmarre reopened this Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
@xmarre xmarre reopened this Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
@xmarre xmarre reopened this Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
@xmarre xmarre reopened this Aug 18, 2026
@xmarre xmarre closed this Aug 18, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:R3 PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant