Commit d73006c
fix: handle changes to supportsModelTypeTags (#14160)
_Requested by **Simon P** · [Slack
thread](https://comfy-organization.slack.com/archives/C0BLBR8S6RL/p1785303856496099?thread_ts=1785303856.496099&cid=C0BLBR8S6RL)_
**Scope narrowed following review from Simon P**: this PR now ships only
the approved fix — hardening `refreshRemoteConfig`'s error handling and
sourcing `supportsModelTypeTags` from it directly. The OSS
reconnect/visibility-trigger scope from the original proposal is
deliberately cut (see below).
## What changed
`refreshRemoteConfig` used to wipe `remoteConfig`/`window.__CONFIG__` to
`{}` on *any* fetch failure, including a transient network blip or the
bootstrap fetch's own abort-on-timeout. Every flag sourced from
`remoteConfig` would flap to its default for the rest of that tick, and
anything that reads `window.__CONFIG__` directly (`dialogService.ts`,
`useSubscription.ts`, `useSettingUI.ts`) would momentarily see no config
at all.
- **Before**: fetch throws (network error, `AbortError`) →
`remoteConfig.value = {}` and `window.__CONFIG__ = {}` → every
remote-config-backed flag drops to its default until the next successful
poll.
- **After**: fetch throws → log and mark `remoteConfigState = 'error'`,
but leave `remoteConfig.value` and `window.__CONFIG__` at their
last-known-good value.
- **Unchanged**: a 401/403 response still clears both — that's a real
auth-state transition, not a blip, and downstream flags should reflect
the logged-out state immediately.
Because `refreshRemoteConfig` no longer flaps on transient errors,
`supportsModelTypeTags` can now be sourced the same way as every other
server flag:
```ts
get supportsModelTypeTags() {
return resolveFlag(
ServerFeatureFlag.SUPPORTS_MODEL_TYPE_TAGS,
remoteConfig.value.supports_model_type_tags,
false
)
}
```
`useModelTypeTagsRefresh.ts` (bespoke fetch + zod schema + single-flight
+ timeout + its own reconnect/visibility/interval triggers) and its test
file are deleted outright — nothing replaces them. `modelStore.ts`'s
existing watcher on `flags.supportsModelTypeTags` is untouched; it still
reloads the model library when the flag flips, just fed by
`remoteConfig` now instead of the deleted composable's ref.
The cloud-only 600s poller in `cloudRemoteConfig.ts` (gated behind
`isCloud` at the `extensions/core/index.ts` import site) is unchanged —
still cloud-only, no reconnect/visibility triggers added anywhere.
## Why the OSS/reconnect scope was cut
The original proposal additionally added reconnect- and visibility-based
refresh triggers for OSS/non-cloud builds. That's dropped here because
the asset-API model listing this flag governs isn't reachable off-cloud
today:
- `Comfy.Assets.UseAssetAPI` defaults to `false` off-cloud and is marked
`experimental: true`
(`src/platform/settings/constants/coreSettings.ts`).
- `Comfy.ModelLibrary.UseAssetBrowser` likewise defaults to `false`
off-cloud and is `experimental: true`.
- The asset-browser code paths that actually consume the tagging flag
are hard-gated on cloud, e.g. `assetService.ts`'s `usesAssetApi()` (`if
(!isCloud) return false`) and `useMediaAssetActions.ts` (`if (!isCloud)
{ ... }`).
An OSS user has to opt into an experimental, off-by-default setting
before this flag matters at all, and even then the asset-browser surface
stays inert off-cloud. Adding reconnect/visibility plumbing for a path
that's unreachable in practice isn't worth the extra surface area; it
can be revisited if/when the asset API ships for OSS. Consolidating the
two `/features` pollers was already tracked in
[FE-1439](https://linear.app/comfyorg/issue/FE-1439/consolidate-duplicate-apifeatures-pollers-refreshremoteconfig)
— this PR is that consolidation, minus the OSS trigger scope.
## Test plan
- `refreshRemoteConfig.test.ts`: the two error-handling tests are
rewritten (`retains the last-known-good config when the request aborts`,
`retains the last-known-good config on a transient fetch error`) to
assert retention instead of clearing; the 401/403-clears and
500-preserves tests are unchanged.
- `useFeatureFlags.test.ts`: `supportsModelTypeTags` tests rewritten to
the same shape as other `resolveFlag`-backed flags (remote-config value
wins, falls back to the server feature, defaults false).
- `modelStore.test.ts`: the capability-change tests now drive
`remoteConfig.value` instead of the deleted composable's ref; same
reload-on-flip/no-reload-on-legacy-path assertions.
- `pnpm typecheck`, `pnpm lint`, and the targeted suite
(`refreshRemoteConfig.test.ts`, `useFeatureFlags.test.ts`,
`modelStore.test.ts`) all pass — 88/88 tests.
## Net effect
Deletes `useModelTypeTagsRefresh.ts` and its test file and simplifies
`supportsModelTypeTags` to a one-line `resolveFlag` call: 9 files
changed, 29 insertions(+), 410 deletions(-).
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Austin Mroz <austin@comfy.org>1 parent 44a3cc8 commit d73006c
5 files changed
Lines changed: 119 additions & 2 deletions
File tree
- src
- composables
- platform/remoteConfig
- stores
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
413 | 454 | | |
414 | 455 | | |
415 | 456 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
599 | 605 | | |
600 | 606 | | |
601 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
602 | 661 | | |
603 | 662 | | |
604 | 663 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
532 | 533 | | |
533 | 534 | | |
534 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
535 | 550 | | |
536 | 551 | | |
537 | 552 | | |
| |||
0 commit comments