Skip to content

feat: write .comfy_environment marker for desktop builds#1719

Closed
Kosinkadink wants to merge 1 commit into
mainfrom
add-comfy-environment-marker
Closed

feat: write .comfy_environment marker for desktop builds#1719
Kosinkadink wants to merge 1 commit into
mainfrom
add-comfy-environment-marker

Conversation

@Kosinkadink
Copy link
Copy Markdown
Member

@Kosinkadink Kosinkadink commented May 11, 2026

Summary

ComfyUI recently added a deploy-environment header (commits e7fbb3c2, 06e416bd, 38e5aac7, e35348aa upstream): comfy/deploy_environment.py reads a .comfy_environment file from the ComfyUI install directory (next to main.py) and sends its first line as the X-Comfy-Deploy-Env header on partner-node API calls. Falls back to local-git when missing.

The portable build already writes local-portable. This PR is the equivalent for legacy desktop, writing local-desktop so api.comfy.org can distinguish desktop traffic.

Changes

  • scripts/makeComfy.js: write local-desktop\n to assets/ComfyUI/.comfy_environment immediately after the ComfyUI clone. The file is gitignored upstream so it does not dirty the cloned working tree.
  • scripts/verifyBuild.js: require ComfyUI/.comfy_environment in both Mac and Windows build outputs so a missing/dropped dotfile fails CI loudly instead of silently regressing to local-git.

Why this is safe at runtime

The desktop app runs ComfyUI in place from <resourcesPath>/ComfyUI/main.py. Per upstream commit 38e5aac7, deploy_environment.py reads the marker from the install directory (next to main.py), not from --base-directory -- so the user's chosen base path is irrelevant and no Electron-side code changes are needed.

Verification

  • yarn typecheck -> passes
  • yarn prettier --check on changed files -> passes
  • yarn eslint on changed files -> passes
  • verify:build will assert the file is bundled at the correct path

┆Issue is synchronized with this Notion page by Unito

ComfyUI now reads a .comfy_environment file from its install directory and sends the value as the X-Comfy-Deploy-Env header on partner-node API calls (defaults to 'local-git' when missing). Write 'local-desktop' into assets/ComfyUI/.comfy_environment after the ComfyUI clone in scripts/makeComfy.js so the bundled copy ships with the correct identifier.

Also extend scripts/verifyBuild.js to require the marker in both Mac and Windows build outputs, so a missing/dropped dotfile fails CI loudly instead of silently regressing to the local-git default.

Mirrors the portable build's existing 'local-portable' marker (ComfyUI commit e35348aa).

Amp-Thread-ID: https://ampcode.com/threads/T-019e1852-4349-768a-abb0-b78b78475c8d
Co-authored-by: Amp <amp@ampcode.com>
@Kosinkadink Kosinkadink requested a review from a team as a code owner May 11, 2026 19:03
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels May 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

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

Run ID: 1e89793f-c884-49ba-9c30-6bc6045665a8

📥 Commits

Reviewing files that changed from the base of the PR and between 71fb1e5 and 1733268.

📒 Files selected for processing (2)
  • scripts/makeComfy.js
  • scripts/verifyBuild.js

📝 Walkthrough

Walkthrough

The PR establishes desktop environment marking by creating a .comfy_environment configuration file during ComfyUI setup and updating build verification to enforce its presence across platforms. This ensures ComfyUI can identify and configure API headers for partner-node calls in the desktop deployment context.

Changes

Deploy Environment Configuration

Layer / File(s) Summary
Environment File Generation
scripts/makeComfy.js
After cloning the ComfyUI directory, the script writes a .comfy_environment file with value local-desktop. This marks the install as a desktop deployment so ComfyUI's main.py can configure the X-Comfy-Deploy-Env header for partner-node API calls. The file is gitignored upstream, so creating it won't dirty the working tree.
Build Verification Setup
scripts/verifyBuild.js
Platform-specific required-path lists are updated to include ComfyUI/.comfy_environment as a mandatory path for both macOS and Windows verification checks. The verification logic itself—checking filesystem existence and failing the build if required paths are missing—remains unchanged. No env-ironmental mishaps here!
🚥 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-comfy-environment-marker
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch add-comfy-environment-marker

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@Kosinkadink
Copy link
Copy Markdown
Member Author

Combined into #1718, closing

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:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant