Five fixes. The CHANGELOG has an entry for each.
- Start with a node pack whose .git/config cannot be read
- Use the git executable set as git_exe
- Read the commit of a nodepack whose refs are packed, and bring its
submodules to the commit that is checked out
- Update nested submodules with pygit2, fetch them through the proxy and
over https, and fail when submodules could not be updated
- Do not end a clone or a fetch of pygit2 at a progress message of the
server that is not UTF-8 by itself
- Fail an update whose pull or submodule update failed, leave the nodepack
at its commit, remove what a clone that failed left, and refuse an install
of a nodepack that another install is working on
Backport of #3392 to manager-v4. The dialogs of the legacy UI bring their own styles, where they relied on the PrimeVue styles that the current ComfyUI frontend no longer ships: the Manager menu and the dialogs it opens had no background (#3545).
The Playwright cases of the legacy UI find the dialogs by the new classes, with cases for the background and the close button of the four dialogs. The CHANGELOG records the fix.
setuptools adds `tests/test*.py` to an sdist by default: one built from
this branch held 32 test files. The wheel does not hold them, and is
unchanged.
Six fixes. The CHANGELOG has an entry for each.
- Queue the legacy ComfyUI update and answer failed version requests
- Check out a branch head by its name with GitPython
- Follow the update policy when an update request names no version line
- Print the messages of manager_core as they are
- Refuse a db_mode or update_policy request the servers cannot use
- Keep a setting chosen while the legacy menu is loading it
The E2E cases wait for the Registry list, which a fresh environment has not
cached, and the Playwright cases no longer depend on the timing of the UI.
Restarting through comfy-cli calls close_log() and then exits from the
request handler. asyncio logs the exit, the Manager's logging handler
passes the record to the logger for the log file, and the write to the
closed file raised ValueError: the console showed it twice at every
such restart.
- Write to the log file only while it is open; the console still gets
what is written to it
- Close the log file under the lock of the writes, so that a write
that has found it open is not overtaken by the close
- Add tests for writes to an open and to a closed log file, and for
the lock around the close
- Add a CHANGELOG entry
With file logging on, the logger that captures stdout and stderr
answered isatty() with False for every caller and had no closed
attribute. After colorama.init(), colorama took the console for a pipe
and removed the colors of every print(), and tqdm and rich took a
terminal for a pipe (#3259).
- Answer isatty() from the stream the logger wraps, and False when
that stream cannot answer
- Add closed, which colorama takes as True for a stream without it:
the state of the wrapped stream, False for a stream that has no such
attribute, and True for a detached stream
- Answer closed True once the log file is closed. Restarting through
comfy-cli calls close_log() and then exits, and colorama's exit
handler would write its reset through the logger
- Add tests for both answers on both streams, for streams that cannot
answer, and for what colorama does with the answers
- Add a CHANGELOG entry
The same change for main is #3423.
When the server answers 400 to a restore or a removal, the Snapshot
Manager built its message from target.title and exception. target is
the snapshot's name, a string, and exception is not defined at that
point, so the line threw and the catch block showed "Restore snapshot
failed: undefined / ReferenceError: exception is not defined", for a
removal too. The finally block of the restore then asked for a
restart, although nothing had been scheduled. Any other error status,
such as a 502 from a proxy, was taken as success.
- Show the snapshot's name and the reason, both escaped. The reason is
the text of a plain-text response, which is how the server gives
one, and otherwise the status line: most of the server's refusals
carry no text, and a proxy answers with an HTML page
- Handle every error status this way, where only 400 was looked at
- Return after a failure, and ask for a restart only when the restore
was accepted
- Name the removal in the removal's messages
- Add Playwright cases for a failed restore and removal, answered with
400 with and without a reason and with the 502 page of a proxy, for
a restore refused with 403, and for an accepted restore
- Add a CHANGELOG entry and name the cases in the Playwright README
The same change for main is #3436.
The legacy server reports the end of every batch of tasks with the id
of the batch and two objects keyed by the id of each task. The Model
Manager took the end of any batch for the end of its own install. A
node pack install queued before a model download, or a model install
started earlier, ended the pending install when it finished: the
downloads were shown as done while they were still running, the Stop
button was hidden, and the real completion was then ignored.
- Take progress and completion reports only for a batch the Model
Manager queued, by batch id, and show a failed download without the
request to click Refresh (from #3349)
- Keep the pending installs by batch id, and end each with its own
batch; the Stop button stays while one is pending
- When the queue reports its end, ask the server whether the queue is
running, and if it is not, end the installs that were queued and got
no report of their own: Stop empties the queue, and the dialog stayed
pending with its Stop button. The report can be that of a queue that
ran before the batch was added, so a running queue ends nothing, nor
does a question that gets no answer, and an install whose request is
not answered yet is looked at when the answer arrives
- Take a batch that ended before its request was answered as ended
- Remove the branch for a batch that ends without a model result; the
server writes a result for every task of a batch
- Count the keys of nodepack_result in the status text of the Custom
Nodes Manager, which counted "undefined" node packs, and remove its
guard for an empty result, which never held
- Send the id of the posted batch with the completion in the Model
Manager's XSS case; a completion without it is no longer taken
- Add Playwright cases for the active batch, for two installs in a
row, for a stopped queue, for the end of an earlier queue, for a
question to the queue that is not answered, and for a batch that
ends before its request is answered; extend the case for partly
rejected batches to both managers
- Add a CHANGELOG entry
This takes over #3349, which fixes#3303, and is the v4 counterpart of
#3437.
Co-authored-by: Arian Moeini <arianmoeini11@gmail.com>
The preview that the Custom Nodes Manager shows over a node name is
built from ComfyUI's node definitions (/object_info) and inserted with
innerHTML. The name, the input and output names, the default values
and the description went in as they are, so text between angle
brackets was dropped from the preview and markup in a definition was
rendered. Nothing on the way escapes these values; the server-side
escaping of v4 covers the registry fields, not this route.
- Escape the eight values where createNodePreview inserts them; the
line break of a multi-line default is still shown as <br>
- Add a Playwright case that answers the manager's /object_info
request with a definition carrying markup in every field
- Add a CHANGELOG entry and name the case in the Playwright README
The same change for main is #3434.
_cnr_install creates the directory of the pack and then extracts the
downloaded archive into it. extract_package_as_zip handles a file that
is not a zip; any other error, such as an entry that cannot be written,
left the function through an exception with the new directory and the
archive still in custom_nodes. The next install of the pack found the
directory and stopped with "Install path already exists".
- Catch the error, remove the directory with try_rmtree and return a
failed result that names the error, in the glob and the legacy core
- Remove the archive whether the extraction worked or not
- Use try_rmtree for an archive that is not a zip as well, where
shutil.rmtree was called directly
- Log a cleanup that fails as well and still return the failed result,
at both calls; try_rmtree raises when it can neither remove nor
schedule the directory
- Add tests that install from an archive that fails part-way and from
a file that is not a zip, install again afterwards, and install
while the cleanup fails
- Add a CHANGELOG entry
The same change for main is #3433.
The cache files of the channel lists and of the registry's node list
were written in place. A write that stopped part-way left a truncated
file, which get_data reads as an empty list.
is_file_created_within_one_day read os.path.getctime. On Windows that
is the creation time, which stays the same when the file is rewritten,
so a cache first created more than a day ago counted as expired however
recently it was written. The age decides whether a list is fetched
only when Manager does not run as a pip package; a pip install fetches
at startup and reads the cache afterwards whatever its age.
- Add write_cache_file, which writes a temporary file beside the cache
and replaces the cache with it, keeping the mode of the existing
file. Where the written file cannot be put in place, as on Windows
while another reader has the cache open, the replace is tried three
times, 0.1 s apart. A cache that stays open is left as it is, with a
warning; the caller gets no error and goes on with its data, and
cm-cli update-cache reports that cache as failed. A failure while
writing the temporary file leaves the cache as it is as well. Where
the mode cannot be set, the cache is replaced all the same. A
temporary file that cannot be removed, because a scanner holds it
open, is left behind and does not fail the write
- Use it for the seven writes of a cache file: two in manager_util and
one each in the glob and legacy core, the glob and legacy server, and
cm-cli update-cache
- Read the modification time for the age
- Add tests for a write that fails and one that runs out of space, the
mode, a mode that cannot be set, a replace that is refused for a
moment and one that stays refused, a temporary file that is held
open, the fetch that caches and the age
- Add a CHANGELOG entry
The same change for main is #3432.
Two comparisons in restore_snapshot never matched.
get_commit_hash returned the line of .git/HEAD as it is when HEAD is
detached, with its newline, and the snapshot saved it that way. On
restore the checkout of that text failed, repo_switch_commit returned
None, and the pack was listed as skipped at the commit it had. A pack
is left at a detached HEAD by a restore, so a snapshot taken after one
has this.
For a registry pack, the installed version was compared through v[1],
the path of the pack, where v[0] is the version. Every installed pack
was therefore sent to cnr_switch_version, which asks the registry
before it finds the version unchanged; with the registry out of reach
the request raised and the restore stopped.
- Return the hash without the newline
- Strip the hash read from a snapshot, so the snapshots already saved
restore too
- Compare the version, in the glob and the legacy core
- Add tests for the hash, for a pack at the pinned version and at
another one, and for the checkout of both forms of the hash in a
real repository
- Add a CHANGELOG entry
The same change for main is #3426.
restore_pip_snapshot kept the return value of subprocess.check_output
as the result of each pip run and compared it with 0. check_output
returns pip's output, never an exit status, so the comparison held for
every run that succeeded: after the one run that installs the packages
named by version, pip was run again for each of them with --no-deps,
and every package of the three groups was reported under "Installation
failed for pip packages".
- Run pip with check_call, which returns the exit status and raises
when it is not 0
- Add tests that cover the three groups, the fallback after a failed
run, failures in every group at once, and a group whose option is
not given
- Add a CHANGELOG entry
The same change for main is #3425.
When an extension asks through cm.try-install-custom-node for a node
pack that is disabled, the legacy UI asks whether to enable it and
restart. On confirmation it posted to /v2/customnode/toggle_active,
which neither server has, did not look at the answer, and restarted:
ComfyUI came back with the pack still disabled.
- Enable the pack as the Enable button of the Custom Nodes Manager
does: find its row in /v2/customnode/getlist, post it to
/v2/manager/queue/batch, and wait for the queue to report the batch
- Restart only when the queue reports success; otherwise show why the
pack was not enabled
- Leave a queue that is running alone, and tell the user to try again
- End the wait after a minute, or when the queue finishes without the
batch; left waiting, the handler would restart ComfyUI on a report
that arrives much later
- Do not restart while other work is queued behind the pack; ask the
user to restart after it
- Report a request that gets no answer while the pack is being
enabled; "Enabling..." stayed on screen
- Show "Rebooting..." when the restart request gets no answer, which
is what happens when ComfyUI restarts; the rejected request ended
the handler
- Report a restart that is refused at the current security level:
show_message was not imported, so nothing was shown
- Remove the branch for a pack that is not installed: the server does
not send this request for one, and the route it posted to is gone
- Leave the queue listener of the Manager menu while the menu has not
been created; a queue started from here made it raise
- Add browser tests of the handler and of that listener, and a
CHANGELOG entry
Found while reviewing #3435.
The same change for main is #3525.
The downgrade decision and the startup check read each clause of a pip
requirement on its own, and did not read "!=". Found by CodeRabbit on
#3521, #3523 and #3524 and in review.
- Install a requirement for a protected package that allows the
installed version when another clause sets a minimum above it
("==4.*,>=4.58.0" beside 4.57.0); it was skipped
- Skip one that the installed version does not meet and that allows no
newer version ("[torch]<=4.57.0,!=4.57.0", "<4.58,!=4.57.*"); it was
installed, and pip replaced the package with an older version
- Install one that excludes the installed version with "!=" while a
newer version is allowed ("~=4.57.0,!=4.57.0"); without extras it
was skipped
- At startup, read ">" as pip does: a post-release of its version does
not meet it, and the requirement is installed when a newer version
meets every clause
- At startup, take "==0.21.*" as met by an installed 0.21.0rc1, as pip
does
- At startup, install a requirement that excludes the installed
version with "!=" and allows a newer one; pip chooses the version,
which is an older one when no newer release exists
- Ask packaging whether a newer version meets every clause, about the
versions next to the installed one and next to each clause's version;
a pre-release counts only when "==", ">=", "<=", "~=" or "===" names
one, which is when every pip takes one
- Never replace an installed local build, such as a CUDA build, on
these grounds, and keep a protected one that "!=" excludes unless
the requirement sets a minimum above it: for such a build the
changes only add requirements that are skipped
- Add tests and a CHANGELOG entry
The same change for main is #3524.
When the channel answered a start with something that is not JSON, such
as a block page or "404: Not Found", get_data() returned {} and the
startup cache update wrote that {} to the cache, over a list cached by
an earlier start. As an installed package the Manager reads a channel
file from the cache whenever the cache file exists, so the custom node
list and the model list of the legacy UI ended in HTTP 500 and the map
of nodes to node packs came back empty, until a later start got the
lists from the channel. "cm-cli update-cache" wrote the same {} and
then stopped with KeyError: 'custom_nodes'.
- Re-raise the parse error in get_data() when the text came from an
HTTP response, so such a response is handled like a failed
connection: both startup cache updates and cm-cli skip the file and
leave the cache as it is, and without a cached list the one bundled
with the Manager is used. A local file or cache file that is not
JSON still reads as {}
- Add tests that run the real get_data(), and the real startup cache
update and get_data_by_mode() of both servers, against a local HTTP
server
- Add a CHANGELOG entry
The same change for main is #3518. Refs #3480.
StrictVersion read each of the first three components of a version
with int(), so it raised on a suffix after the third number. On v4 it
reads node pack versions and the pip versions of pip_auto_fix.list.
- Read a node pack version with a pre-release after the third number,
following '.' or '-', and write it with '-' as before: a registry
version such as 1.8.0-beta.1 is recognized, and 0.1.3.post1 no
longer stops the scan of installed node packs, in the glob and the
legacy core
- Ask a packaging Specifier for the entries of pip_auto_fix.list, as
pip does: an installed 2.5.1+cu124 or 4.41.0rc1 no longer skips the
entry with "Failed to restore", and "~=" becomes a compatible-release
clause
- Add tests that run the real scan of both cores and the real PIPFixer
- Add a CHANGELOG entry
The same change for main is #3431, which also moves the pip checks at
install time to packaging; v4 did that in #3489.
The share route joined the file name and subfolder of the selected
output, both taken from the request, onto the output or temp directory
and uploaded that file to the Matrix homeserver named in the same
request. A name such as "../../file" left the directory, so a request
could have any file that ComfyUI can read uploaded. The route runs the
upload only where matrix-nio is installed, which Manager does not
install.
- Refuse, with 400 and the error shape the share dialog shows, a path
that is not inside the directory, in the glob and the legacy copy
- Compare the normalized path without resolving symlinks, as ComfyUI's
/view does, and open that same path, so an image that the dialog
previews through a symlink in the directory can still be shared
- Refuse a path on another Windows drive, for which commonpath raises
ValueError
- Add tests that run the real route of both copies against a recording
Matrix client
- Add a CHANGELOG entry
The same change for main is #3427. The other upload that #3427 first
changed was removed from v4 in #3500.
"Fix node (recreate)" looked a node's links, and the nodes at their
other end, up in app.graph, the root graph. A subgraph keeps its own
links and nodes, so inside a subgraph the lookup found nothing: the
entry threw "Cannot read properties of undefined" and, because the
original is removed only afterwards, left the wired original and an
unwired replacement on the canvas.
- Read links and nodes from the graph the node is in
- Reconnect a link that starts at an input of the subgraph, or ends at
one of its outputs, through that slot; those two are not nodes of
the graph
- For a link from a subgraph input, skip an input the new node does
not have or has with a type that does not fit, as connect() does for
a link from a node; a subgraph input's connect() checks neither
- Extend the Playwright spec to a node inside a subgraph, a node wired
to the inputs and output of a subgraph, an input the new node lacks
and an input whose type changed; compare the slot at the other end
of every link, and the record on the subgraph slot
- Add a CHANGELOG entry
Follow-up to #3507. The same change for main is #3513.
"Fix node (recreate)" rewired the inputs of the new node with
src_node.connect(link.origin_slot, dest.id, input.name).
LGraphNode.connect() looks its target up by id only when the id is a
number, so on a frontend whose node ids are strings the id was taken
for the node itself: the entry threw "findInputSlot is not a function"
and, because the original is removed only afterwards, left the wired
original and an unwired replacement on the canvas.
- Pass the node to connect(), as the output loop below already does
- Add a Playwright spec that clicks the entry in the node context menu
and checks the page errors and what every KSampler is wired to, with
node ids as the frontend issues them and with ids rewritten to
strings
- Add a CHANGELOG entry
Port of #3443 to v4 (#3126).
A model install is limited to the entries of the model list. The legacy
server compared save_path, base and filename with the list, but not the
url the file is downloaded from, so a request with a listed name and
another url was queued as given. The glob server lost the list check,
and the check for formats other than .safetensors, when its routes
moved to data models (0be0a2e6), so it queued and downloaded whatever a
request named.
Compare the url in both servers; for the legacy server this is the port
of #3428. In the glob server, run both checks in the worker, which
queue/install_model and queue/task both reach. A default channel list
without models counts as empty there, so the model is refused and the
worker keeps running.
The legacy notice route fetched the News page from GitHub with
verify_ssl=False, so certificate verification was off for every user:
whoever sat on the connection could present any certificate for
github.com and choose the notice text and links. The sanitizer limits
the markup, but it cannot tell whose content it is.
- Turn verification off for the notice only when bypass_ssl is set, as
manager_util.get_data does
- Answer a certificate or connection failure with "Unable to retrieve
Notice" where it raised and the notice area showed the server's 500
page
- Add tests that run get_notice against a local HTTPS server behind a
local CONNECT proxy: an untrusted certificate and a trusted
certificate for another host are rejected; bypass_ssl accepts the
untrusted certificate; a CA trusted through SSL_CERT_FILE is
accepted; a closed proxy, a proxy answering 502 and a proxy that
never answers end in the unavailable notice, each with one warning
naming the cause
- Add a CHANGELOG entry
Port of #3424 to v4 (#3302).
Four of the six share destinations of the legacy UI are gone: the
comfyworkflows.com domain registration has expired, the Copus API
answers 410 "ComfyUI direct publishing is no longer supported", the
OpenArt workflow API and pages return 404 or redirect to the home page,
and esheep.com no longer resolves. Manager still offered them, and the
ComfyWorkflows flow would hand the share key, the workflow and the
installed snapshot to whoever answers at that domain next.
- Remove ComfyWorkflows, Copus, OpenArt and eSheep from the share
chooser, the Share setting, the Workflow Gallery menu and the share
dialog, with their server routes, the two dialog modules and what the
Copus theme added to the chooser
- Treat a saved Share setting that names a removed site as All, and do
not open a removed site saved as the last visited Workflow Gallery
- Sharing to YouML and to Matrix is unchanged; the share request no
longer carries cw_auth or is_nsfw, which only ComfyWorkflows used
- Update README, CHANGELOG and the Playwright scenario notes
The comfyworkflows share requests in glob/share_3rdparty.py built their
connectors with verify_ssl=False, so certificates were not verified
whatever the bypass_ssl setting said.
Use verify_ssl=not manager_util.bypass_ssl, as manager_util.get_data
does. Verification is on by default, and bypass_ssl = True still turns
it off. The copy under legacy/ is unchanged.
os.execv on Windows joins its arguments with spaces and quotes nothing, so
only the interpreter and script path, quoted by hand, survived a restart.
An argument with a space, such as --output-directory "D:\My Outputs", was
split in two and ComfyUI failed to start with 'unrecognized arguments'.
Build the command in manager_util.build_restart_command and use it at the
three restart sites: the reboot endpoints of the glob and legacy servers
and the prestartup restart. On Windows every entry is quoted with
subprocess.list2cmdline; other platforms get the same list as before. The
endpoints still drop --windows-standalone-build, now every occurrence
rather than only the first, and the prestartup restart still keeps it.
Port of #3488 to v4 (#3339).
get_backup_branch_name() lists branches through list_heads() since
49e205ac. The legacy core passes GitPython's git.Repo, which has no
such method; the error was swallowed and the name was returned without
a collision check, so creating the backup branch failed when one of
the same second existed.
- Read the branches from heads when the repository has no list_heads()
- Repair the tests: the fake repository still exposed heads, so the
collision cases exercised the error fallback and failed
- Run the behaviour tests against both copies of the function, add a
real-repository test as each core opens it, and freeze the clock
The package installed last provides cv2. The repair ranked the
packages with the GUI above the headless ones, so on a Linux without
the graphics libraries it replaced a working headless cv2 with one
that cannot be imported.
- Install a headless package after one with the GUI, and within each
kind the one with the contrib modules last: opencv-python,
opencv-contrib-python, opencv-python-headless,
opencv-contrib-python-headless
- The package that ends up providing cv2 follows from this order alone,
not from which package was the older one
- Update the tests and correct the CHANGELOG sentence
* fix(v4): restore the OpenCV version repair in PIPFixer
PIPFixer looked the four OpenCV packages up by their hyphenated names,
but installed packages have been keyed by normalized names since
e87d616b, so the lookups returned nothing and the repair never ran.
- Look the packages up by normalized name
- Compare versions with packaging, so a fourth component such as
4.11.0.100 is ordered as a number and the newest version is chosen
- Reinstall with --no-deps, so the repair changes only the OpenCV
packages and leaves numpy as it is
- Add regression tests and a CHANGELOG entry
* fix(v4): keep the most complete OpenCV build and defer to pip_auto_fix.list
- Install the most complete package last, reinstalling it when it was
already the newest; raising opencv-python replaced the cv2 binary of
opencv-contrib-python and removed the contrib functions
- Leave the OpenCV packages alone when pip_auto_fix.list lists one;
the repair and that list would otherwise undo each other at every
startup
* Fix pip package name matching in downgrade guards
* Apply the pip blacklists however a requirement is written
Build on the name normalization to close the other ways a listed
requirement escaped the pip_blacklist and downgrade_blacklist checks.
- Parse requirements with packaging and share one parser and one
downgrade decision between both cores, the startup check and the
unified resolver
- Treat '-', '_' and '.' as one separator in package names
- Read every version clause, so a lower bound written first no longer
hides an upper bound; read spaces, parentheses, markers, '===' and
direct references; compare local and four-part versions
- Install a requirement with extras unless it would downgrade the
protected package
- Check the requirement of every pip install command form, including
those with --index-url, on the immediate and reserved paths
- Skip a protected package when the requirement cannot be compared and
log why and how to install it
- At startup, recognize an installed package however its requirement
spells the name, and upgrade one older than its '~=' version
- Remove the unused is_installed copies from both cores
- Add regression tests; update README, CHANGELOG and the resolver design
---------
Co-authored-by: Annika Zhang <287326049+annikazhang77@users.noreply.github.com>
Co-authored-by: Dr.Lt.Data <dr.lt.data@gmail.com>
* feat(security): dedicated install flags decouple git_url/pip from security_level
Install via git URL and pip install are no longer gated by
security_level. Each surface gets a dedicated config.ini flag —
allow_git_url_install / allow_pip_install (both default false, secure
by default) — that fully REPLACES the security-level term for these two
features. The network-position invariant is retained: a non-local
listener stays denied regardless of the flags unless
network_mode = personal_cloud.
- New pure predicate is_dedicated_install_allowed() in
common/manager_security (no config access; callers resolve config)
- Legacy endpoints /v2/customnode/install/git_url and .../pip switch
from is_allowed_security_level('high+') to the flag gate; batch
installs of unknown git URLs likewise (middle+ entry gate unchanged,
unknown-pip 'block' stays unconditional; response shapes preserved)
- Config readers/writers (glob + legacy) parse and persist the flags;
denial logs and frontend 403 messages name the responsible flag and
note the non-local-listener requirement (network_mode=personal_cloud)
- No auto-seed from security_level — users previously on weak/normal-
must opt in explicitly (see CHANGELOG migration notes; README
documents the new contract)
- Update the pre-existing permissive E2E harness
(start_comfyui_permissive.sh + test_e2e_legacy_real_ops.py) to the
new contract: it now also sets allow_git_url_install /
allow_pip_install = true, since security_level = normal- alone no
longer opens the git_url/pip endpoints
Tests: predicate truth table proving security_level independence in
both directions, dual-reader config contract, security-level-matrix
freeze guards, legacy gate regression guards (121 unit), plus 22
real-server E2E tests incl. URL-form pip install with self-clean.
* test(e2e): fix fresh-env failures in customnode_info and git_clone harnesses
Two pre-existing harness defects that fail deterministically on a fresh
E2E environment (unrelated to the dedicated-install-flags change):
- test_e2e_customnode_info: TestInstalledPacks asserted the seed pack
ComfyUI_SigmoidOffsetScheduler is installed, but nothing seeded it —
the installing module (test_e2e_endpoint) runs alphabetically later
and uninstalls it at the end. Add a module-scoped autouse fixture
that installs the pack via cm-cli BEFORE the server starts (the
imported-mode test asserts against the startup-frozen snapshot, so
API-based seeding after boot cannot work) and removes it on teardown
only if the fixture installed it.
- test_e2e_git_clone: _ensure_cache ran cm-cli update-cache with a
120s timeout; the full DB download routinely exceeds that on slow
links, erroring the whole module at setup. Raise to 600s.
Verified from a fresh state (seed pack absent): both modules pass
(13 tests, incl. previously-failing TestInstalledPacks 2 and
TestNightlyInstallCycle 3).
- Route list_remotes() fetch through _fetch_remote so the proxy and
SSH-to-HTTPS rewrite apply to every fetch entry point, and provide
pull on its proxies (parity with get_remote and the GitPython proxy)
via a shared _pull_remote helper
- Rework _to_https_url: handle ssh://git@host:port/... URLs (drop the
custom SSH port instead of mangling it into the path) and collapse
leading slashes so git@host:/abs/path no longer yields a double-slash
URL. Behavior narrowing: colon-less git@host/path (not a valid
scp-form URL), ssh:// URLs with a port but no path, and IPv6 ssh://
URLs are now returned unchanged instead of being wrongly converted
- clone_repo: omit the proxy= kwarg when no proxy is configured, so
proxy-less installs keep working on pygit2 older than 1.18
- Simplify redundant except (KeyError, Exception) clause
- Require pygit2>=1.18 (clone_repository proxy= parameter)
- Add unit tests for _to_https_url (incl. negative cases pinning the
narrowing) and a regression test that list_remotes proxies route
fetch/pull through their own remote (late-binding guard)
* fix(git_compat): ignore global git config in pygit2 backend
Under Desktop 2.0 the launcher sets CM_USE_PYGIT2=1, so the pygit2 backend ran clone_repository/remote.fetch with no credentials callback and honored the user's global git config. An insteadOf rewrite (https->ssh) or credential helper then forced authentication, failing with 'authentication required but no callback set'.
Blank the system/global/XDG config search path at import time so libgit2 operations are hermetic, and normalize SSH-form GitHub URLs to anonymous HTTPS on clone and when opening a repo.
Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>
* fix(git_compat): preserve corporate http.proxy in pygit2 backend
Snapshot http.proxy from the global git config before blanking the config search path, then pass it explicitly (proxy=) to clone_repository and every remote.fetch() in the pygit2 backend, so corporate-lockdown proxy setups keep working after the insteadOf/SSH hardening.
Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>
* fix(git_compat): stop rewriting repo remotes on disk under pygit2 backend
Removing _normalize_remote_urls(): persistently rewriting a repo's SSH origin
to HTTPS mutates on-disk repo state, which is risky if interrupted. The pygit2
backend already neutralizes auth-forcing global config (insteadOf, credential
helpers) by blanking libgit2's config search path, so anonymous HTTPS fetch
works without touching the stored remote.
Manager already prefers the GitPython/system-git backend when a system git is
present (which honors the user's full git config including insteadOf https->ssh
and proxies), and only uses the bundled pygit2 when system git is absent or
CM_USE_PYGIT2=1 is set.
Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>
* fix(git_compat): fetch SSH-origin repos via in-memory anonymous HTTPS
Consolidate the five pygit2 fetch sites into a single _fetch_remote helper.
When a repo's stored origin is SSH-form (git@host:owner/repo), the bundled
pygit2 (no SSH transport) would fail with an auth error; fetch through an
in-memory anonymous remote over HTTPS instead, leaving .git/config untouched.
Also closes a proxy hole where get_remote() exposed remote.fetch without the
preserved http.proxy.
Validated against both backends (pygit2 1.19.2 + GitPython): all 47
git_compat tests pass; verified create_anonymous fetch updates
refs/remotes/origin/* without persisting any remote or rewriting origin.
Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>
---------
Co-authored-by: Amp <amp@ampcode.com>
Lets clients detect CSRF-POST backend support via ComfyUI core's feature_flags
instead of parsing version strings. Absence of the flag indicates a Manager
version < 4.2.1 that is incompatible with POST-only state-mutation endpoints.
Follow-up to #2818; no endpoint or security behavior change.
Defense-in-depth over GET→POST alone: reject the three CORS-safelisted
simple-form Content-Types (x-www-form-urlencoded, multipart/form-data,
text/plain) on 16 no-body POST handlers (glob + legacy) to block
<form method=POST> CSRF that bypasses method-only gating. Move
comfyui_switch_version to a JSON body so the preflight requirement applies.
Split db_mode/policy/update/channel_url_list into GET(read) + POST(write).
Tighten do_fix (high → high+) and gate three previously-ungated config
setters at middle. Resynchronize openapi.yaml (27 paths, 30 operations,
ComfyUISwitchVersionParams as a shared $ref component). Add E2E harness
variants, Playwright config, CSRF/secgate suites, 39-endpoint coverage,
and a CHANGELOG.
Breaking: legacy per-op POST routes (install/uninstall/fix/disable/update/
reinstall/abort_current) are removed; callers already use queue/batch.
Legacy /manager/notice (v1) is removed; /v2/manager/notice is retained.
Reported-by: XlabAI Team of Tencent Xuanwu Lab
CVSS: 8.1 (AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H)
* feat: add pygit2 compatibility wrapper for standalone Desktop 2.0 installs
Add git_compat.py abstraction layer that wraps both GitPython and pygit2
behind a unified GitRepo interface. When CM_USE_PYGIT2=1 is set (by the
Desktop 2.0 Launcher for standalone installs), or when system git is not
available, the pygit2 backend is used automatically.
Key changes:
- New comfyui_manager/common/git_compat.py with abstract GitRepo base class,
_GitPythonRepo (1:1 pass-throughs) and _Pygit2Repo implementations
- All 6 non-legacy files updated to use the wrapper:
- comfyui_manager/glob/manager_core.py (14 git.Repo usages)
- comfyui_manager/common/git_helper.py (7 git.Repo usages)
- comfyui_manager/common/context.py (1 usage)
- comfyui_manager/glob/utils/environment_utils.py (2 usages)
- cm_cli/__main__.py (1 usage)
- comfyui_manager/common/timestamp_utils.py (repo.heads usage)
- get_script_env() propagates CM_USE_PYGIT2 to subprocesses
- git_helper.py uses sys.path.insert to find git_compat as standalone script
- All repo handles wrapped in context managers to prevent resource leaks
- get_head_by_name returns _HeadProxy for interface consistency
- Submodule fallback logs clear message when system git is absent
- 47 tests comparing both backends via subprocess isolation
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d0ec5-cb9f-74df-a1a2-0c8154a330b3
* fix(pygit2): address review findings + bump version to 4.2b1
- C1: add submodule_update() after pygit2 clone for recursive parity
- C2: check subprocess returncode in submodule_update fallback
- C3: move GIT_OPT_SET_OWNER_VALIDATION to module-level (once at import)
- H1: use context manager in git_pull() to prevent resource leaks
- Bump version to 4.2b1, version_code to [4, 2]
- Add pygit2 to dev dependencies and requirements.txt
* style: fix ruff F841 unused variable and F541 unnecessary f-string
---------
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Dr.Lt.Data <dr.lt.data@gmail.com>
Add litellm==1.82.7 and litellm==1.82.8 to pip_blacklist and remediation
guide in security_check.py to detect compromised packages that harvest
credentials and exfiltrate via attacker-controlled server.
Also fixes two pre-existing issues in pip_blacklist scanning:
- Remove `break` that caused only the first blacklist match to be
detected, missing additional threats in multi-infection scenarios
- Replace substring matching with set-based exact matching to prevent
false positives on similar version strings (e.g. 1.82.70 vs 1.82.7)
Bump version to 4.1.
Three fixes for Windows E2E failures:
1. cm_cli reinstall_node(): URL-based node specs used the full URL
as lookup key, but internal dicts are keyed by repo basename or
cnr_id. Use get_cnr_by_repo() for CNR-aware lookup with correct
is_unknown flag.
2. git_helper.py gitclone(): disable tqdm progress when stderr is
piped (sys.stderr.isatty() gate) to prevent pipe buffer deadlock.
Also move stale directories from previous failed clones into
.disabled/.trash/ before cloning (GitPython handle leak on Windows).
3. try_rmtree(): 3-tier deletion strategy for Windows file locks:
retry 3x with delay, rename into .disabled/.trash/, then lazy-delete
via reserve_script as final fallback.
* fix(git_helper): surface git stderr and use portable exit code
- Redirect exception output to stderr for diagnostic visibility
- Surface GitCommandError.stderr when available
- Use sys.exit(1) instead of sys.exit(-1) for portable exit codes
- Remove debug print statements
* fix(e2e): cross-platform E2E tests with file-based stdout capture
- Cross-platform cm-cli path (Scripts/cm-cli.exe vs bin/cm-cli)
- File-based stdout/stderr capture to avoid Windows pipe buffer loss
- Rename uv-compile → uv-sync for standalone command refs
- Update conflict test packs: ansible → python-slugify/text-unidecode
- Add .trash_* cleanup and retry+rename for Windows file locks
- Add test_e2e_git_clone.py for nightly install via ComfyUI server
- Add setup_e2e_env.py cross-platform setup script
* feat(ci): add multiplatform E2E workflow (ubuntu/windows/macos)
Matrix: ubuntu-latest, windows-latest, macos-latest × Python 3.10
Triggers on push to main/feat/*/fix/* and PRs to main.
* bump version to 4.1b7
git_helper.py is spawned as a standalone subprocess on Windows
(manager_core.py:1342). The import of comfyui_manager.common.timestamp_utils
triggered comfyui_manager/__init__.py which imports from comfy.cli_args —
unavailable in the subprocess environment, causing ModuleNotFoundError.
Inline get_backup_branch_name() using only stdlib (time, uuid), preserving
the original collision-detection and UUID-fallback semantics. Add 9 tests
covering standalone subprocess loading, behavioral equivalence, edge cases
(repo.heads exception, 99-suffix exhaustion with UUID fallback).
Add `cm-cli update-cache` command that force-fetches all remote data
and populates local cache in blocking mode. Bypasses pip/offline guards
in get_data_by_mode and get_cnr_data by directly fetching channel JSON
files and calling reload('remote'). Solves permanent cold-start issue
where pip-installed cm-cli could never populate CNR cache without
running the web server first.
Add UnifiedManager.purge_node_state() to both glob and legacy packages
for reinstall categorization mismatch (e.g. unknown→nightly). Includes
path traversal protection via commonpath, root directory guard,
comfyui-manager self-protection, and finally-guarded dictionary cleanup.
Add NodeInstallError exception and batch failure tracking to
for_each_nodes: reinstall propagates install failures via
raise_on_fail, for_each_nodes catches NodeInstallError, tracks
failed nodes, reports aggregate summary, and exits non-zero.
Remove debug print in install_node.
Bump version to 4.1b5.
E2E verified:
- update-cache: empty cache (5 lines) → populated (7815 lines)
- reinstall batch: 2 packs, 1 failure → continues to 2nd → summary + exit 1
The command performs collect→compile→install (full pipeline),
not just compile. uv-sync better reflects the actual behavior.
The --uv-compile flag on other commands (install, reinstall,
update, fix, etc.) is intentionally kept as-is: it reads as
a mechanism descriptor ("use uv pip compile to resolve deps")
rather than a reference to the standalone command name.