feat: make asset hashing opt-in via --enable-asset-hashing (off by default)#14663
feat: make asset hashing opt-in via --enable-asset-hashing (off by default)#14663mattmillerai wants to merge 3 commits into
Conversation
…fault Add a --enable-asset-hashing CLI flag (action=store_true, default False) and plumb it into the two asset-seeder call sites in main.py that previously hardcoded compute_hashes=True (the startup scan and the post-job output enqueue). Local runs now skip blake3 hashing unless the user opts in, avoiding the startup/per-output cost on large models directories while keeping hashing available for asset-portability features.
📝 WalkthroughWalkthroughA new CLI flag 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@main.py`:
- Line 406: The call to asset_seeder.enqueue_enrich is using
args.enable_asset_hashing for compute_hashes, but that parameter also controls
enrichment depth in app/assets/seeder.py. Update enqueue_enrich and its caller
so hashing can be toggled independently from metadata enrichment, preserving
ENRICHMENT_METADATA for startup/output assets even when hashing is off. Apply
the same fix at both enqueue_enrich call sites and use a dedicated argument or
separate flag for hash generation instead of overloading compute_hashes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0b9fed89-8361-4ee9-b164-7f10736deb01
📒 Files selected for processing (2)
comfy/cli_args.pymain.py
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
✅ No high-signal findings.
Panel: 8/8 reviewers contributed findings.
ELI-5
ComfyUI can fingerprint ("hash") every model and output file so it can later tell when two files are really the same. That hashing reads every byte of every file with blake3, which is slow the first time you start up with a big
models/folder. This PR makes that hashing optional and off by default when you run locally: nothing gets hashed unless you ask for it with a new--enable-asset-hashingflag. Asset registration still happens — only the expensive hashing step is gated.What changed
--enable-asset-hashingtocomfy/cli_args.py(action="store_true", defaultFalse). The help text explains the trade-off: hashing enables future asset-portability features (dedup, cross-machine model resolution) but adds startup + per-output cost on large models directories.main.pythat previously hardcodedcompute_hashes=True:asset_seeder.start(...))asset_seeder.enqueue_enrich(...))Both now pass
compute_hashes=args.enable_asset_hashing. No other behavior changes — this is purely the toggle. Thecompute_hashesparameter already existed throughoutapp/assets/seeder.py(defaultsFalse); this PR only adds the user-facing switch and the right default.Why
A comprehensive blake3 pass over a user's
models/directory can feel like a UX regression on slower machines. The decision was to ship registration without hashing locally and let users opt in. This ships only the mechanism, off by default; whether to ever flip the local default to on is a separate, later decision.Verification
--enable-asset-hashingparses toTrue; absence parses toFalse(default) — confirmed against the argparse parser.--helprenders the new flag with its description.ruff checkpasses on both changed files.X | Noneannotations, and torch/sqlalchemy deps were absent). The change is mechanical (onestore_trueflag + swapping a hardcodedTruefor the flag at two sites) and there are no existing tests coveringmain.py's startup wiring orcli_args;seeder.pyitself is untouched.Judgment calls
--enable-asset-hashingor--enable-hashing. I used--enable-asset-hashingto stay consistent with the companion PR already in review that uses that exact name. If the team prefers--enable-hashing, both sides should be renamed together before merge.--enable-assetsleft untouched: removing that flag is tracked separately; this PR is scoped strictly to the hashing toggle.Merge dependency
The companion cloud-side launch-config wiring must be in flight before this merges — otherwise cloud silently stops hashing the moment this default takes effect (breaking dedup and cross-pod model resolution). Do not merge ahead of it.