Skip to content

feat(assets): enable asset system by default; remove --enable-assets#14699

Open
mattmillerai wants to merge 6 commits into
masterfrom
matt/be-786-phase-1-remove-enable-assets-from-oss-assets-always-on-cloud
Open

feat(assets): enable asset system by default; remove --enable-assets#14699
mattmillerai wants to merge 6 commits into
masterfrom
matt/be-786-phase-1-remove-enable-assets-from-oss-assets-always-on-cloud

Conversation

@mattmillerai

Copy link
Copy Markdown
Contributor

ELI-5

ComfyUI's asset system — the local database that tracks your models / inputs / outputs and serves the /api/assets routes — used to be hidden behind an opt-in --enable-assets flag. This turns it on for everyone by default and deletes the flag. The potentially slow part (content hashing on large model folders) stays opt-in via --enable-asset-hashing (off by default), so a normal startup costs the same as before.

What changed

  • Removed --enable-assets from comfy/cli_args.py. The asset system runs unconditionally on every startup.
  • Asset API routes are always registered (with the user manager). The runtime "assets disabled" 503 path is no longer reachable in normal operation.
  • The background asset scanner always starts. Hashing is still off by default — it remains gated behind --enable-asset-hashing, so there is no new blake3 cost on a default launch.
  • /upload/image always attempts to register the upload as an asset, and output enrichment (enrich_output_with_assets) always runs.
  • The assets server feature flag is now unconditionally true.
  • A database-init failure now degrades gracefully (logs a warning and continues) instead of hard-exiting — matching the prior default-path behavior rather than the old --enable-assets hard-exit.

Note for users

--enable-assets is removed, not kept as a no-op. Launch scripts or configs passing --enable-assets should drop it — the system is now always on. If a transitional deprecation shim is preferred over a hard removal, I'm happy to add one.

Tests

  • Dropped the now-obsolete "assets disabled" enrichment case; the remaining tests-unit/execution_test/test_enrich_output.py suite passes (13 tests).
  • tests-unit/assets_test/conftest.py no longer passes --enable-assets when launching the test server.

The asset system is now always on. Removes the --enable-assets opt-in
flag and the conditional registration it gated:

- Asset API routes are always registered (with the user manager)
- The background asset scanner always runs (hashing stays opt-in via
  --enable-asset-hashing, default off — no new blake3 cost on a default launch)
- /upload/image asset registration and output enrichment always active
- The "assets" server feature flag is now unconditionally true
- A database-init failure degrades gracefully instead of hard-exiting,
  matching the prior default-path behavior
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ff6c328-46a4-4378-8bca-9580f95adb21

📥 Commits

Reviewing files that changed from the base of the PR and between 37acd25 and d224df7.

📒 Files selected for processing (1)
  • main.py
📝 Walkthrough

Walkthrough

This PR removes --enable-assets gating from the assets stack. It adds --enable-asset-hashing, hard-codes the core assets feature flag to True, and makes runtime feature reporting read assets_enabled() from the assets routes module. Asset enrichment, server asset registration, uploaded-image asset metadata, and background asset scanning now run without the old CLI gate. Database failure handling now disables assets routes and the asset seeder instead of exiting in the non-lock error path.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: enabling the asset system by default and removing the old flag.
Description check ✅ Passed The description is directly related to the changeset and accurately summarizes the asset-system behavior changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@mattmillerai mattmillerai added the cursor-review Trigger multi-model Cursor code review label Jun 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 8 finding(s).

Severity Count
🟠 High 2
🟡 Medium 4
🟢 Low 1
⚪ Nit 1

Panel: 8/8 reviewers contributed findings.

Comment thread main.py
Comment thread server.py
Comment thread comfy_api/feature_flags.py
Comment thread server.py
Comment thread comfy/cli_args.py
Comment thread server.py
Comment thread main.py
Comment thread comfy_execution/asset_enrichment.py
…ts as no-op

Address automated review feedback on the always-on assets change:
- setup_database(): on DB init failure or missing dependencies, call
  disable_assets_routes() + asset_seeder.disable() so /api/assets/* returns a
  clean 503 instead of 500s against an uninitialized DB (restores the fail-safe
  the removed else-branch used to provide).
- feature_flags: derive the advertised 'assets' capability from live backend
  availability instead of hardcoding True, so clients degrade gracefully.
- cli_args: re-add --enable-assets as a hidden deprecated no-op so existing
  launchers still passing the flag don't abort argparse.
- routes: add assets_enabled() accessor for the feature-flag derivation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
main.py (1)

463-468: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Silent fallback when DB dependencies are missing.

The else branch correctly fails safe by calling disable_assets_routes() and asset_seeder.disable(), but nothing is logged here — unlike the except branch below (Line 481), which does log the failure. An operator with missing optional DB deps will see assets silently disabled with no startup message explaining why.

📝 Add a log line for visibility
         else:
             # Optional DB dependencies are missing, so init_db() is skipped and the
             # asset backend has no database. Disable assets so /api/assets/* returns
             # a clean 503 instead of 500s against an uninitialized DB.
+            logging.warning("Optional database dependencies are missing; assets system disabled.")
             disable_assets_routes()
             asset_seeder.disable()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@main.py` around lines 463 - 468, The optional-DB fallback in the `else`
branch silently disables assets without any startup visibility, unlike the
`except` path. Add a log message in the `disable_assets_routes()` /
`asset_seeder.disable()` branch in `main.py` that explains the database
dependencies are missing and assets are being disabled, using the same logger
pattern as the nearby startup/error handling so operators can tell why this
happened.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@main.py`:
- Around line 463-468: The optional-DB fallback in the `else` branch silently
disables assets without any startup visibility, unlike the `except` path. Add a
log message in the `disable_assets_routes()` / `asset_seeder.disable()` branch
in `main.py` that explains the database dependencies are missing and assets are
being disabled, using the same logger pattern as the nearby startup/error
handling so operators can tell why this happened.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b93bcaaa-dd26-40d7-872c-0434fd94ad3f

📥 Commits

Reviewing files that changed from the base of the PR and between 5bcb2b0 and b369532.

📒 Files selected for processing (4)
  • app/assets/api/routes.py
  • comfy/cli_args.py
  • comfy_api/feature_flags.py
  • main.py

…-remove-enable-assets-from-oss-assets-always-on-cloud
@mattmillerai

Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit nitpick: the missing-optional-DB-deps fallback in setup_database() now logs a warning ("Optional database dependencies are missing; assets system disabled.") before disabling assets, matching the exception path's logging so operators can see why /api/assets/* returns 503. Also merged latest master (branch was BEHIND).

Note on CI: the test (windows-2022) failure is a hardware-level 0xc000001d (illegal-instruction) crash in comfy/ops.py int8 quant code via comfy_quant/test_mixed_precision.py — unrelated to this PR (which touches only the asset system) and passing on master. The re-run triggered by this push should clear it.

Addresses CodeRabbit review: the missing-optional-dependency fallback in
setup_database() silently disabled the assets system with no startup
message, unlike the exception path which logs. Add a warning so operators
can tell why /api/assets/* returns 503.
@mattmillerai mattmillerai force-pushed the matt/be-786-phase-1-remove-enable-assets-from-oss-assets-always-on-cloud branch from 37acd25 to d224df7 Compare July 1, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cursor-review Trigger multi-model Cursor code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants