Skip to content

Feat/add comfy env var support#478

Open
johnwbrisbin wants to merge 7 commits into
Comfy-Org:mainfrom
johnwbrisbin:feat/add-comfy-env-var-support
Open

Feat/add comfy env var support#478
johnwbrisbin wants to merge 7 commits into
Comfy-Org:mainfrom
johnwbrisbin:feat/add-comfy-env-var-support

Conversation

@johnwbrisbin

@johnwbrisbin johnwbrisbin commented Jul 1, 2026

Copy link
Copy Markdown

Title: Feature support COMFY_HOST, COMFY_PORT, COMFY_HOST_PORT and COMFY_BACKEND environment variables

Body:

Plan

The goal was to add first-class support for environment variables so the comfy tool can be configured to talk to a non-local ComfyUI backend without always requiring --host/--port flags or relying on hardcoded defaults. This was driven by the need for reliable, scriptable, non-interactive usage (e.g., in containers, CI, or multi-machine setups) while keeping CLI flags as the highest-precedence option.

Spec

  • New supported env vars (names chosen to track the CLI parameters closely, with COMFY_ prefix for clarity):
    • COMFY_HOST
    • COMFY_PORT
    • COMFY_HOST_PORT (combined host:port form)
    • COMFY_BACKEND (combined form, kept for compatibility)
  • Resolution order (highest to lowest):
    1. Explicit CLI flags (--host / --port).
    2. Environment variables (combined via COMFY_BACKEND or COMFY_HOST_PORT, or separate COMFY_HOST + COMFY_PORT).
    3. Built-in defaults (localhost:8188).
  • The resolver (_get_backend_from_env) lives in both comfy_cli/cmdline.py (main entry) and comfy_cli/command/jobs.py (job-related paths) to ensure consistent behavior.
  • No other files or behaviors were changed. The feature is strictly additive and backward-compatible.

Tests performed (all on the modified source from the fork, using visible shell simulation via terminal, one or two vars at a time

  • Cloned the fork, checked out the branch, installed editable (pip install -e .).
  • Verified the resolver directly (Python one-liners with envs):
    • COMFY_HOST=172.29.112.112 + COMFY_PORT=8188 → resolved to ('172.29.112.112', 8188)
    • COMFY_BACKEND=172.29.112.112:8188 → resolved correctly
    • COMFY_HOST_PORT=172.29.112.112:8188 → resolved correctly (combined path)
  • Server reachability: curl -I http://172.29.112.112:8188 returned HTTP 200 OK.
  • CLI commands (prefixed === INPUT:):
    • comfy --help (with COMFY_HOST + COMFY_PORT)
    • comfy (bare, with vars set) → showed full agent-aware banner + quick-start (no localhost fallback)
    • comfy nodes ls (with COMFY_HOST + COMFY_PORT) → returned live object_info from the remote server (1861 nodes, including packs like ImpactPack, KJNodes, InspirePack, partner nodes for Tripo/ByteDance/Vidu/Wan, etc.). This is the key proof: the data came from 172.29.112.112:8188, not defaults.
  • All resolver + CLI runs used the exact modified source (not the old pipx install in Scripts).
  • Repeated with different combinations (separate vs. combined vars) to confirm precedence and resolution.

The tests prove the env vars are not only read but are actually wired into the backend connection used by real commands.

Additional notes

  • Tested in the Windows git-bash environment matching the user's setup.

  • No localhost/127.0.0.1/0.0.0.0 references were introduced or left in the changed code.

- COMFY_BACKEND=host:port (one variable, colon-separated)
- COMFY_HOST and COMFY_PORT (separate variables)

These provide fallback when --host/--port are not passed on the command line.
Resolves the missing environment variable oversight for backend configuration.
…d COMFY_BACKEND env vars

- Extend _get_backend_from_env to handle COMFY_HOST_PORT (and keep COMFY_BACKEND for combined form)
- Update docstrings and usage in cmdline.py and jobs.py
- CLI flags still take precedence as before
- This matches the requested env var naming (tracking CLI params closely)
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6789f41b-83b1-4df6-8d61-dec366b8fb34

📥 Commits

Reviewing files that changed from the base of the PR and between 9e168c2 and 2d3dd92.

📒 Files selected for processing (1)
  • comfy_cli/cmdline.py

📝 Walkthrough

Walkthrough

This PR adds a shared host_port.py module and an env_backend.py module to parse and resolve backend host/port values from CLI flags, environment variables, and config, wiring them into comfy run and comfy validate. It also bumps the default ROCm version option in comfy install.

Changes

Host/Port Resolution and Environment Fallback

Layer / File(s) Summary
Env-variable backend parsing
comfy_cli/env_backend.py
New get_backend_from_env() reads COMFY_BACKEND/COMFY_HOST_PORT/COMFY_HOST/COMFY_PORT, strips URL schemes, parses host/port (including bracketed IPv6) via _split_host_port, and validates ports via _valid_port, logging warnings and returning (None, None) when unset.
Shared host/port module
comfy_cli/host_port.py
New module defines DEFAULT_HOST/DEFAULT_PORT, validate_host to reject unsafe characters, parse_host_port_arg to parse combined host[:port]/IPv6 forms, and resolve_host_port to layer explicit args, environment values, persisted config.background, and defaults, bracketing IPv6 as needed.
Cmdline wiring for run/validate
comfy_cli/cmdline.py
comfy run local mode replaces manual host/port handling with parse_host_port_arg() and resolve_host_port(); comfy validate fills unset host/port from get_backend_from_env() before Graph.load.

ROCm Default Version Bump

Layer / File(s) Summary
Install command default
comfy_cli/cmdline.py
The rocm_version option default in comfy install changes from ROCmVersion.v6_3 to ROCmVersion.v7_2.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Cmdline as comfy_cli.cmdline
  participant HostPort as comfy_cli.host_port
  participant EnvBackend as comfy_cli.env_backend
  participant Config as persisted config

  User->>Cmdline: comfy run [--host]
  Cmdline->>HostPort: parse_host_port_arg(host)
  Cmdline->>HostPort: resolve_host_port(host, port)
  HostPort->>EnvBackend: check env vars if not provided
  HostPort->>Config: check config.background if still unset
  HostPort-->>Cmdline: resolved host, port

  User->>Cmdline: comfy validate
  Cmdline->>EnvBackend: get_backend_from_env() if host/port unset
  EnvBackend-->>Cmdline: env_h, env_p
  Cmdline->>Cmdline: Graph.load(host, port)
Loading

Possibly related PRs

  • Comfy-Org/comfy-cli#476: Both PRs change the same rocm_version default from ROCmVersion.v6_3 to ROCmVersion.v7_2 in the install command.

Suggested reviewers: bigcat88

No pun intended, but this host/port refactor really resolves itself nicely — and the ROCm bump? Just version-y business as usual! 🎈

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

❤️ Share

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

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 1, 2026

@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.

Actionable comments posted: 2

♻️ Duplicate comments (1)
comfy_cli/command/jobs.py (1)

38-64: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Same helper, twice the maintenance burden.

Identical to _get_backend_from_env() in comfy_cli/cmdline.py (docstring, IPv6 rsplit gap, silent ValueError swallow, and the local import os shadowing the module-level import at line 23 — flagged by Pylint W0621/W0404/C0415, all included). See the detailed fix suggestion on the cmdline.py copy; the punchline here is the same: extract once, import twice, and this bug-fixing duet becomes a solo.

🤖 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_cli/command/jobs.py` around lines 38 - 64, The helper
_get_backend_from_env in jobs.py is a duplicate of the same logic in cmdline.py
and should not be maintained in two places. Move the backend parsing into one
shared helper and have both callers import/use that single implementation,
keeping the existing behavior for COMFY_BACKEND/COMFY_HOST_PORT and
COMFY_HOST/COMFY_PORT while preserving the same return shape. Also remove the
local import os inside _get_backend_from_env so it uses the module-level import,
matching the shared cleanup.

Source: Linters/SAST tools

🤖 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_cli/cmdline.py`:
- Around line 912-916: The validate command’s envvar handling is inconsistent
with run() because it only uses Typer envvar bindings for COMFY_HOST/COMFY_PORT
and ignores COMFY_BACKEND/COMFY_HOST_PORT. Update the validate path in
comfy_cli/cmdline.py to use the same backend resolution logic as
_get_backend_from_env(), or a shared helper, so both validate and run honor the
same environment variables. Keep the fix anchored around validate() and
_get_backend_from_env() to preserve parity for where-aware commands.
- Around line 47-73: The env-backend parsing helper is duplicated and should be
centralized so `cmdline.py` and `command/jobs.py` both use a shared function
instead of copy-pasting `_get_backend_from_env`. Move the logic into a common
module and import it at each call site, then remove the local `import os` from
`_get_backend_from_env` since `os` is already available at module scope. While
refactoring, make the parser handle IPv6/bracketed hosts correctly and avoid
silently swallowing invalid port values; keep the shared helper consistent with
the host/port resolution behavior used elsewhere such as `_resolve_host_port`.

---

Duplicate comments:
In `@comfy_cli/command/jobs.py`:
- Around line 38-64: The helper _get_backend_from_env in jobs.py is a duplicate
of the same logic in cmdline.py and should not be maintained in two places. Move
the backend parsing into one shared helper and have both callers import/use that
single implementation, keeping the existing behavior for
COMFY_BACKEND/COMFY_HOST_PORT and COMFY_HOST/COMFY_PORT while preserving the
same return shape. Also remove the local import os inside _get_backend_from_env
so it uses the module-level import, matching the shared cleanup.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7419be01-7f4d-4455-89cc-09fe789e7847

📥 Commits

Reviewing files that changed from the base of the PR and between 7e87c77 and f16e802.

📒 Files selected for processing (2)
  • comfy_cli/cmdline.py
  • comfy_cli/command/jobs.py

Comment thread comfy_cli/cmdline.py Outdated
Comment thread comfy_cli/cmdline.py Outdated
@johnwbrisbin

Copy link
Copy Markdown
Author

I have read and agree to the Contributor License Agreement

comfy-legal added a commit to Comfy-Org/comfy-cla that referenced this pull request Jul 5, 2026
- Extract duplicate helper from cmdline.py and jobs.py into comfy_cli/env_backend.py
- Add IPv6 bracketed host support ([::1]:8188)
- Log warning on invalid port values instead of silent swallow
- Remove local 'import os' (was Pylint W0621/W0404/C0415)
- Route validate() through same env fallback as run() for feature parity
- Remove Typer envvar= bindings from validate (was COMFY_HOST/COMFY_PORT only)

Addresses CodeRabbit review feedback on PR Comfy-Org#478.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 5, 2026

@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.

Actionable comments posted: 3

🤖 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_cli/cmdline.py`:
- Around line 885-892: The help text for the host and port options no longer
surfaces the new environment-variable fallback, so update the Typer option
descriptions in cmdline.py where the host and port parameters are defined.
Adjust the help strings for the host/port options (and any related backend
option if present) to mention that values can come from COMFY_HOST, COMFY_PORT,
or COMFY_BACKEND via _get_backend_from_env(), keeping the docs aligned with the
new manual resolution behavior.

In `@comfy_cli/env_backend.py`:
- Line 17: The _IPV6_RE regex is defined but unused, so either remove the dead
constant or update _split_host_port to use it for IPv6 host detection. Inspect
the existing manual parsing in _split_host_port and the _IPV6_RE symbol
together, then keep only the approach that is actually referenced and intended.
- Around line 39-59: The COMFY_PORT validation path in the environment backend
still uses logging.getLogger(...) without a module-level import, so an
out-of-range port can hit an unbound logging reference and crash. Move the
logging import to the top of comfy_cli/env_backend.py and remove the inline
import inside the ValueError branch in the env parsing function that reads
COMFY_HOST and COMFY_PORT. While updating that block, also simplify the
redundant port is not None check in the same parsing logic so the behavior stays
clean and consistent.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6e3ad308-b330-41fa-809f-fd5f29b7f187

📥 Commits

Reviewing files that changed from the base of the PR and between f16e802 and f94aa73.

📒 Files selected for processing (3)
  • comfy_cli/cmdline.py
  • comfy_cli/command/jobs.py
  • comfy_cli/env_backend.py

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

🤖 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_cli/cmdline.py`:
- Around line 885-892: The help text for the host and port options no longer
surfaces the new environment-variable fallback, so update the Typer option
descriptions in cmdline.py where the host and port parameters are defined.
Adjust the help strings for the host/port options (and any related backend
option if present) to mention that values can come from COMFY_HOST, COMFY_PORT,
or COMFY_BACKEND via _get_backend_from_env(), keeping the docs aligned with the
new manual resolution behavior.

In `@comfy_cli/env_backend.py`:
- Line 17: The _IPV6_RE regex is defined but unused, so either remove the dead
constant or update _split_host_port to use it for IPv6 host detection. Inspect
the existing manual parsing in _split_host_port and the _IPV6_RE symbol
together, then keep only the approach that is actually referenced and intended.
- Around line 39-59: The COMFY_PORT validation path in the environment backend
still uses logging.getLogger(...) without a module-level import, so an
out-of-range port can hit an unbound logging reference and crash. Move the
logging import to the top of comfy_cli/env_backend.py and remove the inline
import inside the ValueError branch in the env parsing function that reads
COMFY_HOST and COMFY_PORT. While updating that block, also simplify the
redundant port is not None check in the same parsing logic so the behavior stays
clean and consistent.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6e3ad308-b330-41fa-809f-fd5f29b7f187

📥 Commits

Reviewing files that changed from the base of the PR and between f16e802 and f94aa73.

📒 Files selected for processing (3)
  • comfy_cli/cmdline.py
  • comfy_cli/command/jobs.py
  • comfy_cli/env_backend.py
🛑 Comments failed to post (3)
comfy_cli/cmdline.py (1)

885-892: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Help text doesn't mention the new env var fallback.

--host/--port previously relied on Typer's envvar= binding, which auto-documents the env var in --help. Now that resolution is manual via _get_backend_from_env(), the help strings ("default 127.0.0.1"/"default 8188") no longer hint that COMFY_HOST/COMFY_PORT/COMFY_BACKEND can also drive these values — a small loss of discoverability for the very feature this PR ships, punny as that irony is.

✏️ Suggested help text tweak
     host: Annotated[
         str | None,
-        typer.Option(show_default=False, help="ComfyUI host (default 127.0.0.1)."),
+        typer.Option(show_default=False, help="ComfyUI host (default 127.0.0.1; env: COMFY_HOST/COMFY_BACKEND)."),
     ] = None,
     port: Annotated[
         int | None,
-        typer.Option(show_default=False, help="ComfyUI port (default 8188)."),
+        typer.Option(show_default=False, help="ComfyUI port (default 8188; env: COMFY_PORT/COMFY_BACKEND)."),
     ] = None,
📝 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.

    host: Annotated[
        str | None,
        typer.Option(show_default=False, help="ComfyUI host (default 127.0.0.1; env: COMFY_HOST/COMFY_BACKEND)."),
    ] = None,
    port: Annotated[
        int | None,
        typer.Option(show_default=False, help="ComfyUI port (default 8188; env: COMFY_PORT/COMFY_BACKEND)."),
    ] = None,
🤖 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_cli/cmdline.py` around lines 885 - 892, The help text for the host and
port options no longer surfaces the new environment-variable fallback, so update
the Typer option descriptions in cmdline.py where the host and port parameters
are defined. Adjust the help strings for the host/port options (and any related
backend option if present) to mention that values can come from COMFY_HOST,
COMFY_PORT, or COMFY_BACKEND via _get_backend_from_env(), keeping the docs
aligned with the new manual resolution behavior.
comfy_cli/env_backend.py (2)

17-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unused _IPV6_RE — dead weight, or a regex that never gets its regex-ercise.

_IPV6_RE is defined but never referenced; _split_host_port does its own manual bracket/colon-count parsing instead. Consider removing it, or wiring it in if it was meant to drive the IPv6 detection path.

🤖 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_cli/env_backend.py` at line 17, The _IPV6_RE regex is defined but
unused, so either remove the dead constant or update _split_host_port to use it
for IPv6 host detection. Inspect the existing manual parsing in _split_host_port
and the _IPV6_RE symbol together, then keep only the approach that is actually
referenced and intended.

39-59: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the target file and show the relevant section with line numbers.
git ls-files comfy_cli/env_backend.py
wc -l comfy_cli/env_backend.py
sed -n '1,140p' comfy_cli/env_backend.py | cat -n

# Run a tiny Python repro for the scoping behavior in question.
python3 - <<'PY'
def repro(p):
    if p:
        try:
            port = int(p)
        except ValueError:
            import logging
            return "value error path"
        if port > 100:
            logging.getLogger(__name__).warning("oops")
            return None
    return None

for value in ["999", "0", "abc", None, "42"]:
    try:
        print(value, "->", repro(value))
    except Exception as e:
        print(value, "->", type(e).__name__, e)
PY

Repository: Comfy-Org/comfy-cli

Length of output: 4443


Hoist logging to module scope

Tiny typo, big topple: logging is only imported on the ValueError path, so an out-of-range COMFY_PORT reaches logging.getLogger(...) with an unbound local and crashes the CLI. Move the import to the top of the module; the duplicate port is not None check can go too, while the imp is at it.

🧰 Tools
🪛 Pylint (4.0.6)

[convention] 47-47: Import outside toplevel (logging)

(C0415)

🤖 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_cli/env_backend.py` around lines 39 - 59, The COMFY_PORT validation
path in the environment backend still uses logging.getLogger(...) without a
module-level import, so an out-of-range port can hit an unbound logging
reference and crash. Move the logging import to the top of
comfy_cli/env_backend.py and remove the inline import inside the ValueError
branch in the env parsing function that reads COMFY_HOST and COMFY_PORT. While
updating that block, also simplify the redundant port is not None check in the
same parsing logic so the behavior stays clean and consistent.

Source: Linters/SAST tools

… module

Conflict resolution:
- Upstream extracted host/port logic into comfy_cli/host_port.py
- Our env var support now lives in env_backend.py (complementary module)
- resolve_host_port() calls get_backend_from_env() internally — all 6 jobs.py
  call sites and cmdline.py run() get env var support automatically
- validate() uses inline env fallback (doesn't go through resolve_host_port)
- No duplicate code — single env_backend.py, single host_port.py
- IPv6 handling from upstream's host_port.py preserved
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 5, 2026
…var-support

# Conflicts:
#	comfy_cli/host_port.py
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jul 5, 2026

@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.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
comfy_cli/cql/loader.py (1)

83-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Bracket IPv6 hosts before building the local object_info URL

http://{host}:{port}/object_info breaks for host="::1": urlsplit() can't recover a usable hostname from the unbracketed netloc, so the loopback check sees "" and rejects a valid IPv6 localhost target. Bracketing the host here keeps ::1 reachable, not just on paper—tiny fix, big payoff.

🩹 Proposed fix
 def _load_from_server(host: str, port: int, *, timeout: float) -> dict[str, Any]:
-    url = f"http://{host}:{port}/object_info"
+    host_for_url = f"[{host}]" if ":" in host else host
+    url = f"http://{host_for_url}:{port}/object_info"
🤖 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_cli/cql/loader.py` around lines 83 - 90, The URL construction in
_load_from_server is not handling IPv6 localhost hosts correctly, since an
unbracketed host like "::1" breaks urllib.parse.urlsplit and causes the loopback
check to reject it. Update the host formatting in _load_from_server so IPv6
addresses are bracketed before building the object_info URL, while keeping the
existing is_loopback_host validation in place for the parsed hostname.
comfy_cli/cmdline.py (1)

914-923: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Reuse resolve_host_port() here
validate() still hand-rolls env fallback, so it misses config.background and the validate_host() checks that the shared resolver already applies. Graph.load() brackets IPv6 later, so that part is already covered; using the shared helper keeps host resolution consistent.

🤖 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_cli/cmdline.py` around lines 914 - 923, `validate()` is duplicating
host/port fallback logic instead of using the shared resolver, so it can miss
`config.background` and the `validate_host()` checks applied elsewhere. Update
`validate()` to call `resolve_host_port()` and use its returned host/port before
invoking `Graph.load()`, so host resolution stays consistent with `comfy run`
and the rest of the command flow.
🤖 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_cli/host_port.py`:
- Around line 73-80: The _to_port helper currently loses the original ValueError
when int(s) fails, so update the exception handling in _to_port to chain the
caught ValueError into the typer.BadParameter raise. Keep the existing
validation and messages, but preserve the traceback by re-raising with the
original exception attached.

In `@comfy_cli/uv.py`:
- Around line 125-129: The ROCm and CUDA URLs/backends in uv.py are still
hardcoded, which duplicates version strings that already live in constants.
Update the setup in uv.py to derive rocmPytorchUrl, nvidiaPytorchUrl, and
rocmTorchBackend/cpuTorchBackend from constants.ROCmVersion and
constants.CUDAVersion instead of embedding the values directly, and make the
same source-of-truth adjustment anywhere install.py or related helpers reference
these strings so future version bumps only need constants.py.

In `@tests/comfy_cli/command/test_workflow_saved.py`:
- Around line 246-249: The test for order normalization only checks env["ok"],
so it can pass even if --order is ignored; strengthen
test_order_normalized_case_insensitively by asserting the request made through
the patched URL helper contains the normalized lowercase order value, similar to
the sibling tests that inspect calls[0]["url"]. Use the existing _run,
_patch_urlopen, and request capture pattern to verify ASC is translated to
order=asc in the actual request.

In `@tests/comfy_cli/test_host_port.py`:
- Around line 102-137: The resolve_host_port tests are still affected by ambient
COMFY_* environment variables because only ConfigManager is patched. Update the
test setup in test_host_port.py so these cases explicitly clear or isolate
COMFY_HOST, COMFY_PORT, COMFY_BACKEND, and COMFY_HOST_PORT before calling
resolve_host_port, especially in the _patch_background helper or a shared
fixture. Keep the assertions against resolve_host_port, DEFAULT_HOST, and
DEFAULT_PORT the same, but ensure the environment cannot override the intended
behavior.

---

Outside diff comments:
In `@comfy_cli/cmdline.py`:
- Around line 914-923: `validate()` is duplicating host/port fallback logic
instead of using the shared resolver, so it can miss `config.background` and the
`validate_host()` checks applied elsewhere. Update `validate()` to call
`resolve_host_port()` and use its returned host/port before invoking
`Graph.load()`, so host resolution stays consistent with `comfy run` and the
rest of the command flow.

In `@comfy_cli/cql/loader.py`:
- Around line 83-90: The URL construction in _load_from_server is not handling
IPv6 localhost hosts correctly, since an unbracketed host like "::1" breaks
urllib.parse.urlsplit and causes the loopback check to reject it. Update the
host formatting in _load_from_server so IPv6 addresses are bracketed before
building the object_info URL, while keeping the existing is_loopback_host
validation in place for the parsed hostname.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1870e95d-ba7c-4a49-bd44-1c070ce3232f

📥 Commits

Reviewing files that changed from the base of the PR and between f94aa73 and 9e168c2.

📒 Files selected for processing (31)
  • comfy_cli/cloud/oauth.py
  • comfy_cli/cmdline.py
  • comfy_cli/comfy_client.py
  • comfy_cli/command/install.py
  • comfy_cli/command/jobs.py
  • comfy_cli/command/launch.py
  • comfy_cli/command/models/search.py
  • comfy_cli/command/nodes.py
  • comfy_cli/command/transfer.py
  • comfy_cli/command/workflow.py
  • comfy_cli/command/workflow_fragments.py
  • comfy_cli/constants.py
  • comfy_cli/cql/_net.py
  • comfy_cli/cql/engine.py
  • comfy_cli/cql/loader.py
  • comfy_cli/error_codes.py
  • comfy_cli/host_port.py
  • comfy_cli/http.py
  • comfy_cli/uv.py
  • comfy_cli/where.py
  • tests/comfy_cli/auth/test_where.py
  • tests/comfy_cli/command/models/test_search.py
  • tests/comfy_cli/command/test_launch_background.py
  • tests/comfy_cli/command/test_workflow_saved.py
  • tests/comfy_cli/cql/test_engine.py
  • tests/comfy_cli/cql/test_loader.py
  • tests/comfy_cli/cql/test_net.py
  • tests/comfy_cli/test_host_port.py
  • tests/comfy_cli/test_http.py
  • tests/comfy_cli/test_install_python_resolution.py
  • tests/uv/test_uv.py

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
comfy_cli/cql/loader.py (1)

83-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Bracket IPv6 hosts before building the local object_info URL

http://{host}:{port}/object_info breaks for host="::1": urlsplit() can't recover a usable hostname from the unbracketed netloc, so the loopback check sees "" and rejects a valid IPv6 localhost target. Bracketing the host here keeps ::1 reachable, not just on paper—tiny fix, big payoff.

🩹 Proposed fix
 def _load_from_server(host: str, port: int, *, timeout: float) -> dict[str, Any]:
-    url = f"http://{host}:{port}/object_info"
+    host_for_url = f"[{host}]" if ":" in host else host
+    url = f"http://{host_for_url}:{port}/object_info"
🤖 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_cli/cql/loader.py` around lines 83 - 90, The URL construction in
_load_from_server is not handling IPv6 localhost hosts correctly, since an
unbracketed host like "::1" breaks urllib.parse.urlsplit and causes the loopback
check to reject it. Update the host formatting in _load_from_server so IPv6
addresses are bracketed before building the object_info URL, while keeping the
existing is_loopback_host validation in place for the parsed hostname.
comfy_cli/cmdline.py (1)

914-923: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Reuse resolve_host_port() here
validate() still hand-rolls env fallback, so it misses config.background and the validate_host() checks that the shared resolver already applies. Graph.load() brackets IPv6 later, so that part is already covered; using the shared helper keeps host resolution consistent.

🤖 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_cli/cmdline.py` around lines 914 - 923, `validate()` is duplicating
host/port fallback logic instead of using the shared resolver, so it can miss
`config.background` and the `validate_host()` checks applied elsewhere. Update
`validate()` to call `resolve_host_port()` and use its returned host/port before
invoking `Graph.load()`, so host resolution stays consistent with `comfy run`
and the rest of the command flow.
🤖 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_cli/host_port.py`:
- Around line 73-80: The _to_port helper currently loses the original ValueError
when int(s) fails, so update the exception handling in _to_port to chain the
caught ValueError into the typer.BadParameter raise. Keep the existing
validation and messages, but preserve the traceback by re-raising with the
original exception attached.

In `@comfy_cli/uv.py`:
- Around line 125-129: The ROCm and CUDA URLs/backends in uv.py are still
hardcoded, which duplicates version strings that already live in constants.
Update the setup in uv.py to derive rocmPytorchUrl, nvidiaPytorchUrl, and
rocmTorchBackend/cpuTorchBackend from constants.ROCmVersion and
constants.CUDAVersion instead of embedding the values directly, and make the
same source-of-truth adjustment anywhere install.py or related helpers reference
these strings so future version bumps only need constants.py.

In `@tests/comfy_cli/command/test_workflow_saved.py`:
- Around line 246-249: The test for order normalization only checks env["ok"],
so it can pass even if --order is ignored; strengthen
test_order_normalized_case_insensitively by asserting the request made through
the patched URL helper contains the normalized lowercase order value, similar to
the sibling tests that inspect calls[0]["url"]. Use the existing _run,
_patch_urlopen, and request capture pattern to verify ASC is translated to
order=asc in the actual request.

In `@tests/comfy_cli/test_host_port.py`:
- Around line 102-137: The resolve_host_port tests are still affected by ambient
COMFY_* environment variables because only ConfigManager is patched. Update the
test setup in test_host_port.py so these cases explicitly clear or isolate
COMFY_HOST, COMFY_PORT, COMFY_BACKEND, and COMFY_HOST_PORT before calling
resolve_host_port, especially in the _patch_background helper or a shared
fixture. Keep the assertions against resolve_host_port, DEFAULT_HOST, and
DEFAULT_PORT the same, but ensure the environment cannot override the intended
behavior.

---

Outside diff comments:
In `@comfy_cli/cmdline.py`:
- Around line 914-923: `validate()` is duplicating host/port fallback logic
instead of using the shared resolver, so it can miss `config.background` and the
`validate_host()` checks applied elsewhere. Update `validate()` to call
`resolve_host_port()` and use its returned host/port before invoking
`Graph.load()`, so host resolution stays consistent with `comfy run` and the
rest of the command flow.

In `@comfy_cli/cql/loader.py`:
- Around line 83-90: The URL construction in _load_from_server is not handling
IPv6 localhost hosts correctly, since an unbracketed host like "::1" breaks
urllib.parse.urlsplit and causes the loopback check to reject it. Update the
host formatting in _load_from_server so IPv6 addresses are bracketed before
building the object_info URL, while keeping the existing is_loopback_host
validation in place for the parsed hostname.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1870e95d-ba7c-4a49-bd44-1c070ce3232f

📥 Commits

Reviewing files that changed from the base of the PR and between f94aa73 and 9e168c2.

📒 Files selected for processing (31)
  • comfy_cli/cloud/oauth.py
  • comfy_cli/cmdline.py
  • comfy_cli/comfy_client.py
  • comfy_cli/command/install.py
  • comfy_cli/command/jobs.py
  • comfy_cli/command/launch.py
  • comfy_cli/command/models/search.py
  • comfy_cli/command/nodes.py
  • comfy_cli/command/transfer.py
  • comfy_cli/command/workflow.py
  • comfy_cli/command/workflow_fragments.py
  • comfy_cli/constants.py
  • comfy_cli/cql/_net.py
  • comfy_cli/cql/engine.py
  • comfy_cli/cql/loader.py
  • comfy_cli/error_codes.py
  • comfy_cli/host_port.py
  • comfy_cli/http.py
  • comfy_cli/uv.py
  • comfy_cli/where.py
  • tests/comfy_cli/auth/test_where.py
  • tests/comfy_cli/command/models/test_search.py
  • tests/comfy_cli/command/test_launch_background.py
  • tests/comfy_cli/command/test_workflow_saved.py
  • tests/comfy_cli/cql/test_engine.py
  • tests/comfy_cli/cql/test_loader.py
  • tests/comfy_cli/cql/test_net.py
  • tests/comfy_cli/test_host_port.py
  • tests/comfy_cli/test_http.py
  • tests/comfy_cli/test_install_python_resolution.py
  • tests/uv/test_uv.py
🛑 Comments failed to post (4)
comfy_cli/host_port.py (1)

73-80: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Chain the exception for a preserved traceback.

🔗 Suggested fix
 def _to_port(s: str, original: str) -> int:
     try:
         port = int(s)
-    except ValueError:
-        raise typer.BadParameter(f"invalid port in {original!r}: {s!r} is not a number")
+    except ValueError as exc:
+        raise typer.BadParameter(f"invalid port in {original!r}: {s!r} is not a number") from exc
     if not (1 <= port <= 65535):
         raise typer.BadParameter(f"invalid port in {original!r}: {port} is out of range (1-65535)")
     return port
📝 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.

def _to_port(s: str, original: str) -> int:
    try:
        port = int(s)
    except ValueError as exc:
        raise typer.BadParameter(f"invalid port in {original!r}: {s!r} is not a number") from exc
    if not (1 <= port <= 65535):
        raise typer.BadParameter(f"invalid port in {original!r}: {port} is out of range (1-65535)")
    return port
🧰 Tools
🪛 Pylint (4.0.6)

[convention] 78-78: Unnecessary parens after 'not' keyword

(C0325)


[warning] 77-77: Consider explicitly re-raising using 'except ValueError as exc' and 'raise typer.BadParameter(f'invalid port in {original!r}: {s!r} is not a number') from exc'

(W0707)

🤖 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_cli/host_port.py` around lines 73 - 80, The _to_port helper currently
loses the original ValueError when int(s) fails, so update the exception
handling in _to_port to chain the caught ValueError into the typer.BadParameter
raise. Keep the existing validation and messages, but preserve the traceback by
re-raising with the original exception attached.

Source: Linters/SAST tools

comfy_cli/uv.py (1)

125-129: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive ROCm/CUDA strings from constants instead of re-hardcoding.

This bump required touching constants.py, uv.py, and install.py in lockstep just to move 6.37.2. That's three places to remember next time — a version-skew imp waiting to sneak in. Consider sourcing these from constants.ROCmVersion/CUDAVersion so there's a single source of truth.

♻️ Suggested fix
+from comfy_cli import constants
+
 class DependencyCompiler:
     cpuPytorchUrl = "https://download.pytorch.org/whl/cpu"
-    rocmPytorchUrl = "https://download.pytorch.org/whl/rocm7.2"
-    nvidiaPytorchUrl = "https://download.pytorch.org/whl/cu126"
+    rocmPytorchUrl = f"https://download.pytorch.org/whl/rocm{constants.ROCmVersion.v7_2.value}"
+    nvidiaPytorchUrl = f"https://download.pytorch.org/whl/{constants.CUDAVersion.v12_6.value.replace('cu', 'cu')}"

     cpuTorchBackend = "cpu"
-    rocmTorchBackend = "rocm7.2"
-    nvidiaTorchBackend = "cu126"
+    rocmTorchBackend = f"rocm{constants.ROCmVersion.v7_2.value}"
+    nvidiaTorchBackend = "cu126"
📝 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.

from comfy_cli import constants

class DependencyCompiler:
    cpuPytorchUrl = "https://download.pytorch.org/whl/cpu"
    rocmPytorchUrl = f"https://download.pytorch.org/whl/rocm{constants.ROCmVersion.v7_2.value}"
    nvidiaPytorchUrl = f"https://download.pytorch.org/whl/{constants.CUDAVersion.v12_6.value.replace('cu', 'cu')}"

    cpuTorchBackend = "cpu"
    rocmTorchBackend = f"rocm{constants.ROCmVersion.v7_2.value}"
    nvidiaTorchBackend = "cu126"
🤖 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_cli/uv.py` around lines 125 - 129, The ROCm and CUDA URLs/backends in
uv.py are still hardcoded, which duplicates version strings that already live in
constants. Update the setup in uv.py to derive rocmPytorchUrl, nvidiaPytorchUrl,
and rocmTorchBackend/cpuTorchBackend from constants.ROCmVersion and
constants.CUDAVersion instead of embedding the values directly, and make the
same source-of-truth adjustment anywhere install.py or related helpers reference
these strings so future version bumps only need constants.py.
tests/comfy_cli/command/test_workflow_saved.py (1)

246-249: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Strengthen case-insensitivity assertion for --order.

Only env["ok"] is True is checked; the test doesn't confirm ASC was actually normalized (e.g., to order=asc in the request URL) the way sibling tests assert on calls[0]["url"]. As-is, a no-op or ignored --order value would still pass.

✏️ Proposed strengthening
     def test_order_normalized_case_insensitively(self, local_target, monkeypatch, capsys):
-        _patch_urlopen(monkeypatch, {"/userdata": _USERDATA_LIST_RESPONSE})
+        calls = _patch_urlopen(monkeypatch, {"/userdata": _USERDATA_LIST_RESPONSE})
         env = _run(["list", "--where", "local", "--order", "ASC"], capsys)
         assert env["ok"] is True
+        assert "order=asc" in calls[0]["url"]
📝 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.

    def test_order_normalized_case_insensitively(self, local_target, monkeypatch, capsys):
        calls = _patch_urlopen(monkeypatch, {"/userdata": _USERDATA_LIST_RESPONSE})
        env = _run(["list", "--where", "local", "--order", "ASC"], capsys)
        assert env["ok"] is True
        assert "order=asc" in calls[0]["url"]
🧰 Tools
🪛 Pylint (4.0.6)

[convention] 246-246: Missing function or method docstring

(C0116)


[warning] 246-246: Redefining name 'local_target' from outer scope (line 78)

(W0621)


[warning] 246-246: Unused argument 'local_target'

(W0613)

🤖 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 `@tests/comfy_cli/command/test_workflow_saved.py` around lines 246 - 249, The
test for order normalization only checks env["ok"], so it can pass even if
--order is ignored; strengthen test_order_normalized_case_insensitively by
asserting the request made through the patched URL helper contains the
normalized lowercase order value, similar to the sibling tests that inspect
calls[0]["url"]. Use the existing _run, _patch_urlopen, and request capture
pattern to verify ASC is translated to order=asc in the actual request.
tests/comfy_cli/test_host_port.py (1)

102-137: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Unit tests aren't isolated from ambient COMFY_* env vars.

resolve_host_port() reads COMFY_HOST/COMFY_PORT/COMFY_BACKEND/COMFY_HOST_PORT before falling back to config.background/defaults, but these tests only patch ConfigManager — they never clear those env vars. Anyone (or any CI runner) with COMFY_HOST set in their shell will get silently wrong/flaky results here, e.g. test_resolve_host_port_applies_defaults would fail if COMFY_HOST leaks in. A little ironic for the very feature that introduces these vars to be the one whose tests aren't insulated from them.

🛡️ Suggested fix: isolate env for these tests
+@pytest.fixture(autouse=True)
+def _isolate_comfy_env(monkeypatch):
+    """Ambient COMFY_* env vars must not leak into host/port resolution tests."""
+    for var in ("COMFY_HOST", "COMFY_PORT", "COMFY_BACKEND", "COMFY_HOST_PORT"):
+        monkeypatch.delenv(var, raising=False)
+
+
 def _patch_background(bg):
     """Patch ConfigManager as seen by resolve_host_port so `.background` == bg."""
     cfg = MagicMock()
     cfg.background = bg
     return patch("comfy_cli.host_port.ConfigManager", return_value=cfg)
📝 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.

`@pytest.fixture`(autouse=True)
def _isolate_comfy_env(monkeypatch):
    """Ambient COMFY_* env vars must not leak into host/port resolution tests."""
    for var in ("COMFY_HOST", "COMFY_PORT", "COMFY_BACKEND", "COMFY_HOST_PORT"):
        monkeypatch.delenv(var, raising=False)


def _patch_background(bg):
    """Patch ConfigManager as seen by resolve_host_port so `.background` == bg."""
    cfg = MagicMock()
    cfg.background = bg
    return patch("comfy_cli.host_port.ConfigManager", return_value=cfg)


def test_resolve_host_port_brackets_ipv6():
    with _patch_background(None):
        assert resolve_host_port("::1", None) == ("[::1]", DEFAULT_PORT)


def test_resolve_host_port_does_not_double_bracket():
    with _patch_background(None):
        assert resolve_host_port("[::1]", 8188) == ("[::1]", 8188)


def test_resolve_host_port_rejects_unsafe_host():
    with _patch_background(None), pytest.raises(typer.BadParameter):
        resolve_host_port("evil.com/@x", None)


def test_resolve_host_port_applies_defaults():
    with _patch_background(None):
        assert resolve_host_port(None, None) == (DEFAULT_HOST, DEFAULT_PORT)


def test_resolve_host_port_falls_back_to_background():
    # config.background is a (host, port, pid) tuple.
    with _patch_background(("10.0.0.5", 9001, 4242)):
        assert resolve_host_port(None, None) == ("10.0.0.5", 9001)


def test_resolve_host_port_explicit_overrides_background():
    with _patch_background(("10.0.0.5", 9001, 4242)):
        assert resolve_host_port("localhost", 7000) == ("localhost", 7000)
🧰 Tools
🪛 Pylint (4.0.6)

[convention] 109-109: Missing function or method docstring

(C0116)


[convention] 114-114: Missing function or method docstring

(C0116)


[convention] 119-119: Missing function or method docstring

(C0116)


[convention] 124-124: Missing function or method docstring

(C0116)


[convention] 129-129: Missing function or method docstring

(C0116)


[convention] 135-135: Missing function or method docstring

(C0116)

🤖 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 `@tests/comfy_cli/test_host_port.py` around lines 102 - 137, The
resolve_host_port tests are still affected by ambient COMFY_* environment
variables because only ConfigManager is patched. Update the test setup in
test_host_port.py so these cases explicitly clear or isolate COMFY_HOST,
COMFY_PORT, COMFY_BACKEND, and COMFY_HOST_PORT before calling resolve_host_port,
especially in the _patch_background helper or a shared fixture. Keep the
assertions against resolve_host_port, DEFAULT_HOST, and DEFAULT_PORT the same,
but ensure the environment cannot override the intended behavior.

@coderabbitai coderabbitai Bot requested a review from bigcat88 July 9, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant