refactor(install): dedupe manager-install fallback and normalize exit conventions (BE-4356)#594
Open
mattmillerai wants to merge 1 commit into
Open
refactor(install): dedupe manager-install fallback and normalize exit conventions (BE-4356)#594mattmillerai wants to merge 1 commit into
mattmillerai wants to merge 1 commit into
Conversation
… conventions (BE-4356) Extract the twice-duplicated manager-install-and-degrade sequence into a single helper _install_manager_with_fallback(repo_dir, python, *, bootstrap_pip: bool), called from both the pip and fast_deps paths of execute(). The only prior difference between the two copies — the fast_deps path bootstrapping pip first — is preserved via the bootstrap_pip flag. Normalize the module's sys.exit(1)/sys.exit(-1) calls to raise typer.Exit(code=1), matching the convention used broadly elsewhere. Note sys.exit(-1) previously yielded shell exit code 255; it now yields 1 (a minor observable change on the invalid-ComfyUI-repo path).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughInstallation failures now consistently raise ChangesInstall reliability
Sequence Diagram(s)sequenceDiagram
participant InstallCommand
participant ManagerFallback
participant Pip
participant ConfigManager
InstallCommand->>ManagerFallback: install ComfyUI-Manager
ManagerFallback->>Pip: bootstrap pip when enabled
ManagerFallback->>Pip: install manager
Pip-->>ManagerFallback: success or failure
ManagerFallback->>ConfigManager: disable manager GUI mode on failure
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
mattmillerai
marked this pull request as ready for review
July 24, 2026 07:02
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
✅ No high-signal findings.
Panel: 6/8 reviewers contributed findings.
Reviewers that did not contribute: kimi-k2.5:adversarial (empty), kimi-k2.5:edge-case (empty)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI-5
When you run
comfy install, the tool installs ComfyUI-Manager and, if thatinstall fails, quietly turns the manager off so a later launch doesn't try to
use something that isn't there. That little "install-or-degrade" dance was
written out twice — once for the normal pip path and once for the
--fast-depspath — and the two copies had already started to drift. This PRfolds them into one shared helper so they can't drift again.
While in the file, it also makes the module exit the way the rest of the
codebase does:
raise typer.Exit(code=1)instead ofsys.exit(...).What changed
Dedupe the manager-install fallback. New module-private helper
_install_manager_with_fallback(repo_dir, python, *, bootstrap_pip: bool)holds the single copy of "install the manager; on failure disable the
manager GUI mode and warn." Both call sites in
execute()(the pip path andthe
fast_depspath) now call it. The only behavioral difference between theold copies — the
fast_depspath callsensure_pip(python)first becauseits uv-managed venv may ship no pip, while the pip path already bootstrapped
pip earlier — is preserved via the
bootstrap_pipflag (Falsefor the pippath,
Trueforfast_deps). Pure code motion; no behavior change.Normalize exit conventions. The module's six
sys.exit(...)calls arenow
raise typer.Exit(code=1), matching the convention used broadlyelsewhere in the codebase. All of these already propagate straight up to
main(), which re-raises bothtyper.ExitandSystemExitidentically, sothe exit code is unchanged (1) for five of them.
sys.exit(-1)on the "path exists but isn't a recognized ComfyUI repo" branchpreviously produced shell exit code 255 (a negative arg wraps to 255); it
now produces 1, like every other failure in the module. This is the only
user-visible change and is a deliberate normalization.
Notes / judgment calls
_install_deps_pip/_install_deps_fasttwo-strategy extraction is intentionally not done here — install is the
highest-blast-radius command and the groom verdict downgraded scope to just
the concrete dedupe + exit normalization. Defer that split until install next
changes for feature reasons.
typer.Exitis not a subclass ofSystemExit, so theone existing test asserting
pytest.raises(SystemExit)oncheckout_stable_comfyuiwas updated topytest.raises(typer.Exit). Iverified none of the six exit sites sit inside a broad
except Exception:intheir call path (which would newly swallow a
typer.ExitwhereSystemExitescaped) — they all propagate to
main()unchanged.TestInstallManagerWithFallbacklocking the helper'sbootstrap-vs-not behavior and the degrade-on-failure config write.
Testing
2670 passed, 13 skipped(uv run pytest tests/comfy_cli).ruff check+ruff format --checkclean on the touched files.