ComfyUI backport release v0.22.3#14141
Conversation
* [Partner Nodes] add reasoning widget to Anthropic node Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] add new OpenRouterLLM node Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] fix passing images to Grok LLM Signed-off-by: bigcat88 <bigcat88@icloud.com> --------- Signed-off-by: bigcat88 <bigcat88@icloud.com>
…Reference node (#14032) Signed-off-by: bigcat88 <bigcat88@icloud.com>
* [Partner Nodes] add new Rodin2.5 nodes Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] fixed Quality Mesh Options Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] fix: remove non-supported "usdz" Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] fix: always pass seed to server Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] fix: set the default "material" value to "Shaded" Signed-off-by: bigcat88 <bigcat88@icloud.com> --------- Signed-off-by: bigcat88 <bigcat88@icloud.com>
… 2 (#14098) * [Partner Nodes] feat: improve video references uploading for SeeDance 2 Signed-off-by: bigcat88 <bigcat88@icloud.com> * [Partner Nodes] hash video via memoryview to avoid memory copy Signed-off-by: bigcat88 <bigcat88@icloud.com> --------- Signed-off-by: bigcat88 <bigcat88@icloud.com>
📝 WalkthroughWalkthroughThis PR introduces three new LLM/3D-generation node modules (Krea2 image generation, OpenRouter chat completions, and Rodin Gen-2.5 support), adds Claude thinking behavior with per-model configuration, refactors video resizing utilities to support both downscaling and upscaling, integrates the new utilities into ByteDance Seedance with virtual-library asset uploads, and bumps package versions to 0.22.2. The changes span infrastructure (video handling), feature additions (LLM nodes, 3D generation), and utility updates (quality-mode lookup tables, response validation). 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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: 2
🤖 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 `@comfy_api_nodes/nodes_anthropic.py`:
- Around line 268-270: Validate the incoming reasoning_effort before indexing
_REASONING_BUDGET: check if reasoning_effort is a key in _REASONING_BUDGET and
if not raise a clear validation error (e.g., ValueError or a
NodeValidationError) with a message like "Invalid reasoning_effort: <value>";
only after that perform budget = _REASONING_BUDGET[reasoning_effort], apply the
min(...) cap, and construct AnthropicThinkingConfig as before (references:
_REASONING_BUDGET, reasoning_effort, AnthropicThinkingConfig, thinking_cfg).
In `@comfy_api_nodes/nodes_rodin.py`:
- Around line 581-588: The list comprehension that builds files opens file
handles via open(image, "rb") without closing them, causing a resource leak;
replace the comprehension with logic that uses a helper (e.g., _open_image_file)
to open string paths, append those open file objects to a local list, and ensure
all opened file handles are closed in a finally block after the upload/usage
completes; keep using tensor_to_filelike(image) for non-string inputs and
reference/modify the variable files and the helper _open_image_file so every
file opened is explicitly closed even on exceptions.
🪄 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: 7d9f3154-dfe0-43ad-a5f7-5f0c534e2091
⛔ Files ignored due to path filters (5)
comfy_api_nodes/apis/anthropic.pyis excluded by!comfy_api_nodes/apis/**comfy_api_nodes/apis/bytedance.pyis excluded by!comfy_api_nodes/apis/**comfy_api_nodes/apis/krea.pyis excluded by!comfy_api_nodes/apis/**comfy_api_nodes/apis/openrouter.pyis excluded by!comfy_api_nodes/apis/**comfy_api_nodes/apis/rodin.pyis excluded by!comfy_api_nodes/apis/**
📒 Files selected for processing (10)
comfy_api_nodes/nodes_anthropic.pycomfy_api_nodes/nodes_bytedance.pycomfy_api_nodes/nodes_krea.pycomfy_api_nodes/nodes_openrouter.pycomfy_api_nodes/nodes_rodin.pycomfy_api_nodes/util/__init__.pycomfy_api_nodes/util/conversions.pycomfyui_version.pypyproject.tomlrequirements.txt
| budget = _REASONING_BUDGET[reasoning_effort] | ||
| budget = min(budget, max(1024, max_tokens - 1024)) | ||
| thinking_cfg = AnthropicThinkingConfig(type="enabled", budget_tokens=budget) |
There was a problem hiding this comment.
Guard reasoning_effort before budget lookup.
_REASONING_BUDGET[reasoning_effort] can throw a KeyError if the incoming model payload is malformed (e.g., edited workflow JSON). Please fail with a clear validation error instead of an unhandled exception.
Suggested fix
- budget = _REASONING_BUDGET[reasoning_effort]
+ budget = _REASONING_BUDGET.get(reasoning_effort)
+ if budget is None:
+ raise ValueError(f"Invalid reasoning_effort: {reasoning_effort!r}")
budget = min(budget, max(1024, max_tokens - 1024))
thinking_cfg = AnthropicThinkingConfig(type="enabled", budget_tokens=budget)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| budget = _REASONING_BUDGET[reasoning_effort] | |
| budget = min(budget, max(1024, max_tokens - 1024)) | |
| thinking_cfg = AnthropicThinkingConfig(type="enabled", budget_tokens=budget) | |
| budget = _REASONING_BUDGET.get(reasoning_effort) | |
| if budget is None: | |
| raise ValueError(f"Invalid reasoning_effort: {reasoning_effort!r}") | |
| budget = min(budget, max(1024, max_tokens - 1024)) | |
| thinking_cfg = AnthropicThinkingConfig(type="enabled", budget_tokens=budget) |
🤖 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_api_nodes/nodes_anthropic.py` around lines 268 - 270, Validate the
incoming reasoning_effort before indexing _REASONING_BUDGET: check if
reasoning_effort is a key in _REASONING_BUDGET and if not raise a clear
validation error (e.g., ValueError or a NodeValidationError) with a message like
"Invalid reasoning_effort: <value>"; only after that perform budget =
_REASONING_BUDGET[reasoning_effort], apply the min(...) cap, and construct
AnthropicThinkingConfig as before (references: _REASONING_BUDGET,
reasoning_effort, AnthropicThinkingConfig, thinking_cfg).
| files = [ | ||
| ( | ||
| "images", | ||
| open(image, "rb") if isinstance(image, str) else tensor_to_filelike(image), | ||
| ) | ||
| for image in images | ||
| if image is not None | ||
| ] |
There was a problem hiding this comment.
Resource leak: file handles opened without context manager.
When isinstance(image, str) is True, open(image, "rb") creates a file handle that's never explicitly closed. This can exhaust file descriptors under heavy use.
Proposed fix using a helper to manage file lifecycle
A minimal fix is to restructure so the files list is built with proper cleanup. One approach:
+ file_handles = []
+ try:
files = None
if images:
files = [
(
"images",
- open(image, "rb") if isinstance(image, str) else tensor_to_filelike(image),
+ _open_image_file(image, file_handles),
)
for image in images
if image is not None
]
response = await sync_op(
...
)
+ finally:
+ for fh in file_handles:
+ fh.close()Where _open_image_file appends file handles to the list for later cleanup.
🤖 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_api_nodes/nodes_rodin.py` around lines 581 - 588, The list
comprehension that builds files opens file handles via open(image, "rb") without
closing them, causing a resource leak; replace the comprehension with logic that
uses a helper (e.g., _open_image_file) to open string paths, append those open
file objects to a local list, and ensure all opened file handles are closed in a
finally block after the upload/usage completes; keep using
tensor_to_filelike(image) for non-string inputs and reference/modify the
variable files and the helper _open_image_file so every file opened is
explicitly closed even on exceptions.
Backport for v0.22.3. Cherry-picks:
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms