Skip to content

feat: allow --comfy-api-base target ephemeral testenvs#14569

Open
bigcat88 wants to merge 1 commit into
masterfrom
feat/ephemeral-env-features
Open

feat: allow --comfy-api-base target ephemeral testenvs#14569
bigcat88 wants to merge 1 commit into
masterfrom
feat/ephemeral-env-features

Conversation

@bigcat88

@bigcat88 bigcat88 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Today the frontend only learns which backend to talk to at build time. This PR allows Frontend to read the comfy-api-base at runtime instead.

Supersedes: #14200

When you start ComfyUI with --comfy-api-base pointed at one of our non-production backends (staging, or a per-PR preview environment under *.testenvs.comfy.org), the server now includes that backend's URLs in its /features response.
The frontend reads them from there, so the same prebuilt UI can follow along without anyone rebuilding it.

Preview environments keep their friendly URL separate from the actual API host, so you can pass the friendly one (pr-N.testenvs.comfy.org) and let the server resolve the real host (pr-N-registry.testenvs.comfy.org) for you, both in what it tells the frontend and in where the API nodes send their calls.

Production and ordinary self-hosting are untouched: the server only adds this when you point it somewhere non-production, so everyone else sees exactly what they do today.

API Node PR Checklist

Scope

  • Is API Node Change

Pricing & Billing

  • Need pricing update
  • No pricing update

If Need pricing update:

  • Metronome rate cards updated
  • Auto‑billing tests updated and passing

QA

  • QA done
  • QA not required

Comms

  • Informed Kosinkadink

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b1ac80b-2b59-4a4e-b84e-10a1883da3cc

📥 Commits

Reviewing files that changed from the base of the PR and between 905a70d and e2dd7b4.

📒 Files selected for processing (5)
  • comfy/comfy_api_env.py
  • comfy_api/feature_flags.py
  • comfy_api_nodes/util/_helpers.py
  • server.py
  • tests-unit/feature_flags_test.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • comfy_api_nodes/util/_helpers.py
  • comfy/comfy_api_env.py

📝 Walkthrough

Walkthrough

A new module comfy/comfy_api_env.py adds staging and testenv API host detection, testenv hostname rewriting, and frontend config overrides for staging-tier bases. get_frontend_features() now merges get_frontend_config() output into feature flags, and the /features route now returns those frontend features. default_base_url() now normalizes the configured API base URL. Tests were added for URL normalization, frontend config generation, and conditional feature flag overrides.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% 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 summarizes the main change: allowing --comfy-api-base to target ephemeral testenvs.
Description check ✅ Passed The description is directly related to the changeset and explains the runtime backend URL behavior well.
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.

✏️ 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.

❤️ Share

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

@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: 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 `@comfy/comfy_api_env.py`:
- Around line 23-32: The normalize_comfy_api_base function only preserves the
scheme and hostname when rewriting the URL on line 32, but discards the original
URL's port, path, query parameters, and fragment. This can silently retarget
requests when the input includes a custom port or path prefix. To fix this,
preserve all URL components from the parsed object when reconstructing the URL:
either manually include parsed.port, parsed.path, parsed.query, and
parsed.fragment in the f-string, or use urlunparse to reconstruct the full URL
after modifying the hostname in the parsed URL object.
🪄 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: ea0505eb-c654-45cc-a238-d54ae12d0c0a

📥 Commits

Reviewing files that changed from the base of the PR and between dc3f8f3 and 7ed56ac.

📒 Files selected for processing (4)
  • comfy/comfy_api_env.py
  • comfy_api/feature_flags.py
  • comfy_api_nodes/util/_helpers.py
  • tests-unit/feature_flags_test.py

Comment thread comfy/comfy_api_env.py
@christian-byrne

Copy link
Copy Markdown
Contributor

@bigcat88 bigcat88 force-pushed the feat/ephemeral-env-features branch from 7ed56ac to 905a70d Compare June 25, 2026 14:42
Signed-off-by: bigcat88 <bigcat88@icloud.com>
@bigcat88 bigcat88 force-pushed the feat/ephemeral-env-features branch from 905a70d to e2dd7b4 Compare June 25, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants