chore: filter ck backend info#13995
Conversation
📝 WalkthroughWalkthroughThis PR adjusts backend discovery logging and coordinates a corresponding CI test adjustment. The 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
comfy/quant_ops.py (1)
36-37: ⚡ Quick winConsider improving readability of the filtering logic.
The nested ternary conditional inside the dict comprehension is dense and difficult to parse at a glance. While functionally correct, extracting this into a helper function or using a more explicit structure would improve maintainability.
♻️ Proposed refactor for improved readability
- for k, v in ck.list_backends().items(): - filtered = {kk: vv for kk, vv in v.items() if (kk in ('disabled', 'capabilities') if v['available'] else kk in ('available', 'unavailable_reason'))} - logging.info(f"Found comfy_kitchen backend {k}: {filtered}") + for k, v in ck.list_backends().items(): + if v.get('available', False): + keys_to_show = ('disabled', 'capabilities') + else: + keys_to_show = ('available', 'unavailable_reason') + filtered = {kk: vv for kk, vv in v.items() if kk in keys_to_show} + logging.info(f"Found comfy_kitchen backend {k}: {filtered}")🤖 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 `@comfy/quant_ops.py` around lines 36 - 37, The dict comprehension that builds filtered is hard to read due to the nested ternary; refactor by extracting the inclusion logic into a small helper (e.g., a function named should_include_key or compute_allowed_keys) or by computing allowed_keys before constructing filtered and then using {kk: vv for kk, vv in v.items() if kk in allowed_keys}; update the comprehension that assigns filtered and adjust the logging line to use the clearer variable so behavior remains identical for keys when v['available'] is True or False and for the same symbols k and v.
🤖 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 @.github/workflows/test-launch.yml:
- Line 35: The current grep literal is too brittle; replace it with a
regex-based negative filter that looks for the semantic pieces instead of the
exact dict formatting: match lines containing "backend" and "triton" plus an
"available" false value and an ImportError mentioning "triton" (use a flexible
regex via grep -E -v or perl-compatible grep -Pv to allow varying spacing/quotes
and alternate ImportError text). Update the grep invocation that currently
contains the exact dict string so it filters using this regex pattern (target
the existing grep command string in the workflow).
---
Nitpick comments:
In `@comfy/quant_ops.py`:
- Around line 36-37: The dict comprehension that builds filtered is hard to read
due to the nested ternary; refactor by extracting the inclusion logic into a
small helper (e.g., a function named should_include_key or compute_allowed_keys)
or by computing allowed_keys before constructing filtered and then using {kk: vv
for kk, vv in v.items() if kk in allowed_keys}; update the comprehension that
assigns filtered and adjust the logging line to use the clearer variable so
behavior remains identical for keys when v['available'] is True or False and for
the same symbols k and v.
🪄 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
Run ID: 38e220f7-7bd6-4601-bd16-4242227306ca
📒 Files selected for processing (2)
.github/workflows/test-launch.ymlcomfy/quant_ops.py
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Current comfy_kitchen backend prints redundant information:
Filter to necessary info: when not available, indicate
availablestatus andunavailable_reason; when available, show ifdisabledand it'scapabilities: