Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d435968
feat(assets): group model library by model_type tags
synap5e Jun 18, 2026
01a51fc
refactor(assets): gate model_type grouping on supports_model_type_tags
synap5e Jun 18, 2026
86faaee
refactor(assets): run model-asset store on non-cloud builds
synap5e Jun 19, 2026
1897ec5
fix(assets): strip model_type: prefix from asset card type badge
synap5e Jun 21, 2026
31c043e
fix(assets): strip model_type: prefix from the asset browser title
synap5e Jun 22, 2026
979f01f
fix(assets): port model_type node-category resolution to resolveModel…
synap5e Jun 23, 2026
c8af4c5
fix(assets): keep reserved-tag constants local in assetMetadataUtils
synap5e Jun 23, 2026
7117caf
test(assets): restore mocks after each resolveModelNodeFromAsset test
synap5e Jun 23, 2026
ccc6a1f
fix(assets): prefer resolvable model_type over incidental slash tags
synap5e Jul 1, 2026
c34bef8
fix(assets): align badge and loader resolution with model_type tags
synap5e Jul 12, 2026
09877d7
fix(assets): surface refresh errors and harden pagination races
synap5e Jul 12, 2026
ece07cc
fix(assets): close pagination-termination and title-preservation gaps
synap5e Jul 12, 2026
d43ecf8
fix(assets): represent every category of a shared multi-type asset
synap5e Jul 12, 2026
74e4e38
fix(assets): dedupe category candidates and share pagination tolerance
synap5e Jul 20, 2026
8c3b946
test(assets): align cache tests with cursor pagination
synap5e Jul 23, 2026
b1b7b78
feat(assets): write model_type: tag from discovery
synap5e Jun 18, 2026
0f71ca4
test(assets): pin import write keeps user_metadata.model_type bare
synap5e Jun 19, 2026
c848833
fix(assets): recognize model_type: prefix in import type-mismatch guard
synap5e Jun 23, 2026
5101631
refactor(assets): require modelTypeMode on the write-path helpers
synap5e Jul 12, 2026
e0dfcd1
fix(assets): preserve sibling model_type memberships on re-type
synap5e Jul 20, 2026
179e7a3
fix(assets): guard toModelTypeTag against double-prefixing
synap5e Jul 20, 2026
8179340
fix(assets): make model type read-only on core
synap5e Jun 30, 2026
55f9047
fix(assets): explain the read-only model type and gate its save path
synap5e Jul 20, 2026
631a2df
fix(dialog): keep non-modal dialogs open when focus lands on a toast
synap5e Jul 6, 2026
647697a
feat(assets): gate model library asset view behind a runtime setting …
synap5e Jun 25, 2026
9048972
feat(assets): back the model library sidebar with the asset API
synap5e Jul 1, 2026
7a2fab6
feat(assets): rescan model roots on refresh and live-update the sidebar
synap5e Jul 2, 2026
7bfd647
feat(assets): eager-load the model library in asset mode
synap5e Jul 2, 2026
6904047
fix(assets): keep active search results live across model reloads
synap5e Jul 3, 2026
3b84528
feat(assets): filter model library folders by their registered extens…
synap5e Jul 1, 2026
b715fcf
fix(assets): harden concurrent folder reloads
synap5e Jul 6, 2026
af690b2
fix(assets): drop assets with traversal-shaped loader paths
synap5e Jul 6, 2026
2f3be8f
fix(assets): group slashed bare tags by their top-level segment
synap5e Jul 6, 2026
0490537
refactor(assets): resolve model preview urls in the model store
synap5e Jul 10, 2026
27fb266
fix(settings): open the asset browser only when the asset API is enabled
synap5e Jul 10, 2026
253602d
chore(assets): drop a comment restating behavior pinned by a test
synap5e Jul 10, 2026
dee18ea
chore(assets): drop the scan-discovery console log
synap5e Jul 10, 2026
63de33a
refactor(assets): own the scan-complete subscription in assetService
synap5e Jul 10, 2026
e43ede2
fix(assets): close eager-load and folder-refresh races in the model s…
synap5e Jul 10, 2026
9c2cf36
chore: correct an overclaiming comment on the model-library routing
synap5e Jul 10, 2026
c8a7e20
fix(models): close reload races that strand or misorder folder contents
synap5e Jul 12, 2026
7d4ce72
docs(assets): mark the multi-root pathIndex limitation at its source
synap5e Jul 12, 2026
a14a5a0
docs(assets): correct the multi-root limitation to preview-only reads
synap5e Jul 12, 2026
6a138e0
fix(assets): round-2 review fixes for the model sidebar
synap5e Jul 18, 2026
ba7ee69
feat(assets): hide folders with no models in asset mode
synap5e Jul 20, 2026
401e781
fix(assets): bound search rendering to keep large libraries responsive
synap5e Jul 20, 2026
14b8483
test(assets): e2e coverage for the assets-mode model library sidebar
synap5e Jul 10, 2026
82e9cf9
test(assets): harden e2e suite against review findings
synap5e Jul 10, 2026
2c000ba
test(assets): tighten seed-payload and ghost-arming assertions
synap5e Jul 10, 2026
7de2546
test(assets): address review nits on assets-sidebar e2e specs
christian-byrne Jul 17, 2026
94c2f97
[automated] Apply ESLint and Oxfmt fixes
actions-user Jul 17, 2026
967a411
test(assets): cover model sidebar degradation when the asset walk fails
synap5e Jul 20, 2026
231ac56
test(assets): assert v-if absence with toHaveCount instead of toBeHidden
synap5e Jul 20, 2026
c5b95af
test(assets): keep injected server flags applied across ws reconnects
synap5e Jul 24, 2026
b68776b
docs(test): point setServerFlags at the reconnect-safe helper
synap5e Jul 24, 2026
7c93d92
test(assets): close review coverage gaps in sidebar e2e suite
synap5e Jul 28, 2026
c3e470b
merge origin/main into synap5e/test/assets-sidebar-e2e
synap5e Jul 28, 2026
21f552b
fix(assets): expand search result folders surfaced by a mid-search re…
synap5e Jul 28, 2026
0c72795
fix(assets): fall back to bare-tag grouping for legacy tags in model_…
claude Jul 28, 2026
80b587e
fix(assets): group model_type-covered assets by their namespaced tags…
claude Jul 28, 2026
d7e158a
fix(e2e): give the mid-retag twin test a real loras model
claude Jul 28, 2026
21c3533
fix(e2e): scope the mid-retag twin's loras assertion to that subtree
claude Jul 28, 2026
798778a
Merge remote-tracking branch 'origin/main' into fix/assets-bare-tag-m…
claude Jul 28, 2026
4dcc160
test(assets): drop assetService unit tests duplicating e2e coverage
claude Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions browser_tests/fixtures/data/assetFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,40 @@ export const MODEL_TYPE_CHECKPOINT_PRE_CUTOVER: CoreModelAsset =
updated_at: '2025-02-18T09:00:00Z'
})

/**
* A legacy bare-tagged asset (no `model_type:` prefix) that still carries a
* `loader_path`, mimicking a `model_type:`-capable backend that has not
* finished re-tagging every asset. Asset grouping must fall back to bare-tag
* grouping for it instead of dropping it from the sidebar.
*/
export const MODEL_TYPE_CHECKPOINT_LEGACY_TAG: CoreModelAsset =
createCoreModelAsset({
id: 'mt-checkpoint-007',
name: 'legacy_tagged_checkpoint.safetensors',
tags: ['models', 'checkpoints'],
loader_path: 'legacy_tagged_checkpoint.safetensors',
created_at: '2025-02-22T09:00:00Z',
updated_at: '2025-02-22T09:00:00Z'
})

/**
* An asset caught mid-migration: it already carries the authoritative
* `model_type:checkpoints` tag alongside its pre-migration bare-tag twin
* (`checkpoints`), plus an unrelated leftover bare tag (`loras`) that happens
* to match another real folder. A `model_type:`-covered asset must group by
* its `model_type:` tags alone, so it lands in `checkpoints` exactly once and
* never cross-lists into `loras`.
*/
export const MODEL_TYPE_CHECKPOINT_MID_RETAG: CoreModelAsset =
createCoreModelAsset({
id: 'mt-checkpoint-008',
name: 'mid_retag_checkpoint.safetensors',
tags: ['models', 'model_type:checkpoints', 'checkpoints', 'loras'],
loader_path: 'mid_retag_checkpoint.safetensors',
created_at: '2025-02-23T09:00:00Z',
updated_at: '2025-02-23T09:00:00Z'
})

export const MODEL_TYPE_LORA: CoreModelAsset = createCoreModelAsset({
id: 'mt-lora-001',
name: 'detail_enhancer_v1.2.safetensors',
Expand Down
110 changes: 110 additions & 0 deletions browser_tests/tests/sidebar/modelLibraryAssetMode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { assetApiFixture } from '@e2e/fixtures/assetApiFixture'
import { comfyPageFixture } from '@e2e/fixtures/ComfyPage'
import {
MODEL_TYPE_CHECKPOINT_GGUF,
MODEL_TYPE_CHECKPOINT_LEGACY_TAG,
MODEL_TYPE_CHECKPOINT_MID_RETAG,
MODEL_TYPE_CHECKPOINT_NESTED,
MODEL_TYPE_CHECKPOINT_ORPHAN,
MODEL_TYPE_CHECKPOINT_PRE_CUTOVER,
Expand Down Expand Up @@ -350,6 +352,114 @@ test.describe('Model library sidebar - asset mode before the loader_path cutover
})
})

test.describe('Model library sidebar - asset mode with a legacy bare tag', () => {
test.beforeEach(async ({ comfyPage, assetApi }) => {
assetApi.configure(
withModels([MODEL_TYPE_CHECKPOINT_ROOT, MODEL_TYPE_CHECKPOINT_LEGACY_TAG])
)
await assetApi.mock()
await comfyPage.modelLibrary.mockModelFolders([
{
name: 'checkpoints',
folders: ['/models/checkpoints'],
extensions: ['.safetensors']
}
])
await comfyPage.setup()
await comfyPage.featureFlags.setServerFlagsPersistent({
supports_model_type_tags: true
})
})

test.afterEach(async ({ comfyPage }) => {
await comfyPage.modelLibrary.clearMocks()
})

// Regression for the AC3 bug flagged in #13574's review: on a
// model_type-capable backend, a bare (non-namespaced) tag resolved to no
// category and buildModelBuckets dropped the asset with a console.warn
// instead of falling back to legacy bare-tag grouping.
test('Falls back to legacy bare-tag grouping instead of dropping the asset', async ({
comfyPage
}) => {
await comfyPage.menu.modelLibraryTab.open()
const tab = comfyPage.menu.modelLibraryTab

await tab.getFolderRowByLabel('checkpoints').click()
await expect(tab.getLeafByLabel('v1-5-pruned-emaonly')).toBeVisible()
await expect(tab.getLeafByLabel('legacy_tagged_checkpoint')).toBeVisible()
})
})

test.describe('Model library sidebar - asset mode with a mid-retag twin tag', () => {
test.beforeEach(async ({ comfyPage, assetApi }) => {
assetApi.configure(
withModels([
MODEL_TYPE_CHECKPOINT_ROOT,
MODEL_TYPE_CHECKPOINT_MID_RETAG,
MODEL_TYPE_LORA
])
)
await assetApi.mock()
await comfyPage.modelLibrary.mockModelFolders([
{
name: 'checkpoints',
folders: ['/models/checkpoints'],
extensions: ['.safetensors']
},
{
name: 'loras',
folders: ['/models/loras'],
extensions: ['.safetensors']
}
])
await comfyPage.setup()
await comfyPage.featureFlags.setServerFlagsPersistent({
supports_model_type_tags: true
})
await comfyPage.menu.modelLibraryTab.open()
})

test.afterEach(async ({ comfyPage }) => {
await comfyPage.modelLibrary.clearMocks()
})

// Regression for the high-severity finding on #14217: an asset carrying
// both an authoritative `model_type:checkpoints` tag and a leftover bare
// `checkpoints` twin (a partial re-tagging artifact) must land in
// `checkpoints` exactly once, and its unrelated leftover `loras` bare tag
// must not cross-list it into that folder too.
test('Groups a model_type-covered asset once and ignores its bare-tag twins', async ({
comfyPage
}) => {
const tab = comfyPage.menu.modelLibraryTab

await tab.getFolderRowByLabel('checkpoints').click()
await expect(
tab.modelTree
.locator('.p-tree-node-leaf')
.filter({ hasText: 'mid_retag_checkpoint' })
).toHaveCount(1)

// loras carries a real model_type:loras asset so the folder itself
// renders (asset mode hides folders that load with zero models) —
// otherwise an absent 'loras' row would be ambiguous between "correctly
// empty" and "never loaded".
await tab.getFolderRowByLabel('loras').click()
await expect(tab.getLeafByLabel('detail_enhancer_v1.2')).toBeVisible()

// Scoped to the loras subtree, not tab.modelTree: checkpoints is still
// expanded from the assertion above, and its (correct) copy of the leaf
// would otherwise satisfy a tree-wide query on its own.
await expect(
tab
.getFolderByLabel('loras')
.locator('.p-tree-node-leaf')
.filter({ hasText: 'mid_retag_checkpoint' })
).toHaveCount(0)
})
})

test.describe('Model library sidebar - asset mode on bare-tag backends', () => {
test.beforeEach(async ({ comfyPage, assetApi }) => {
assetApi.configure(withModels([STABLE_CHECKPOINT]))
Expand Down
38 changes: 9 additions & 29 deletions src/platform/assets/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
TagsOperationResult
} from '@/platform/assets/schemas/assetSchema'
import {
MODEL_TYPE_TAG_PREFIX,
getAssetCategories,
getAssetFilename
} from '@/platform/assets/utils/assetMetadataUtils'
import { isCloud } from '@/platform/distribution/types'
Expand Down Expand Up @@ -222,26 +222,6 @@ function normalizeAssetTags(tags: string[]): string[] {
return tags.map((tag) => tag.trim()).filter(Boolean)
}

/**
* Resolves the model folder a tag represents, or undefined when the tag is not
* a folder category. `supports_model_type_tags` backends carry the category as
* a namespaced `model_type:<folder>` tag; older backends mint bare tags, which
* may carry subfolder paths (e.g. `Chatterbox/sub/model`) and group by their
* top-level segment, matching the asset browser's legacy grouping.
*/
function modelFolderFromTag(
tag: string,
modelTypeMode: boolean
): string | undefined {
if (modelTypeMode) {
return tag.startsWith(MODEL_TYPE_TAG_PREFIX)
? tag.slice(MODEL_TYPE_TAG_PREFIX.length)
: undefined
}
if (tag === MODELS_TAG || tag.length === 0) return undefined
return tag.split('/')[0]
}

/**
* Orders loader paths as subdirectories before files at every level,
* alphabetical within each group. The asset API returns models in storage
Expand Down Expand Up @@ -411,11 +391,13 @@ function createAssetService() {
}
/**
* Walks every `models`-tagged asset once and buckets each into the folder
* categories carried by its `model_type:` tags. A single asset lands in every
* category it is tagged with (e.g. a shared-root model in both `checkpoints`
* and `diffusion_models`). Which folders are actually shown is decided by
* `/experiment/models`; models with no category tag are dropped with a warning
* rather than hidden silently.
* categories `getAssetCategories` resolves for it. A single asset lands in
* every category it is tagged with (e.g. a shared-root model in both
* `checkpoints` and `diffusion_models`); an asset covered by `model_type:`
* tags is grouped by those alone, so a legacy bare-tag twin left over from a
* partial re-tagging cannot also cross-list it into another folder. Which
* folders are actually shown is decided by `/experiment/models`; models with
* no category tag are dropped with a warning rather than hidden silently.
*/
async function buildModelBuckets(
modelTypeMode: boolean
Expand All @@ -426,9 +408,7 @@ function createAssetService() {
const buckets = new Map<string, AssetItem[]>()

for (const asset of assets) {
const folders = asset.tags
.map((tag) => modelFolderFromTag(tag, modelTypeMode))
.filter((folder): folder is string => folder !== undefined)
const folders = [...new Set(getAssetCategories(asset, modelTypeMode))]

if (folders.length === 0) {
console.warn(
Expand Down
Loading