Three fixes. The CHANGELOG has an entry for each.
- Use the git executable set as git_exe
- Read the commit of a node pack whose refs are packed, and bring its
submodules to the commit that is checked out
- Fail an update whose pull or submodule update failed, leave the node pack
at its commit, remove what a clone that failed left, and refuse an install
of a node pack that another install is working on
Five fixes. The CHANGELOG has an entry for each.
- Log a failed read of the ComfyUI versions instead of raising
- Print the messages of manager_core as they are
- Answer 400 to an install request whose body is not usable
- Refuse a db_mode, update_policy or component_policy request the server cannot use
- Keep a setting chosen while the Manager menu is loading it
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 manager-v4 is #3465.
The pack serves an operating-system shell and a file manager over
routes of the ComfyUI server, from the moment it is loaded. Its README
documents the terminal, but the list entry did not mention it. Up to
0.5.2 the routes ask for no authentication; 0.6.1 adds a password and
sends it to the pack's telemetry server together with the host's
addresses.
- Remove the entry from custom-node-list.json
- Add it to node_db/dev/custom-node-list.json with a [SECURITY ISSUE]
title and a warning in the description
- Remove its rows from extension-node-map.json,
node_db/new/extension-node-map.json and github-stats.json
The server reports the end of every queue with two dicts,
nodepack_result and model_result, keyed by the id of each task. The
Model Manager read model_result as an array, so result.length was
undefined, the guard for an empty result never held, and the end of
any queue ended its pending install. After a model install request
that the server refused, the end of the next queue, such as a node
pack install, asked to click Refresh and raised the notice that all
model downloads were completed, although no model had been installed.
- Count the keys of model_result in the guard and in the status text
- Hide the Stop button when the install is completed, not at the end
of every queue
- When a queue ends without a model result, ask the server what is
left: while tasks are left the install stays pending, and with none
left the dialog returns to idle without a message. An install that
started while the server was asked is left alone
- Show the Stop button only while the install that was queued is
still pending; a queue can end before its start request is answered
- Add tests that run the shipped handlers in node
- Add a CHANGELOG entry
The change for manager-v4, which tells the batches apart by their id,
is #3536.
When the server refuses to restore or remove a snapshot with status
400, the Snapshot Manager showed "Restore snapshot failed: undefined /
ReferenceError: exception is not defined", for a removal too, and after
a refused restore it still asked for a restart. The handler built its
message from target.title and exception: target is the snapshot's name,
a string, and exception is not defined there, so the line threw and the
catch block reported that error. 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, for every
answer that is not a success. The reason is the text of a text/plain
response, and otherwise the status line
- Show the restart notice only after a restore that was accepted
- Say "Remove snapshot failed" when a removal fails
- Add tests that run the shipped restore and removal against the
server's answers
- Add a CHANGELOG entry
The same change for manager-v4 is #3535.
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.
- Escape the eight values where createNodePreview inserts them; the
line break of a multi-line default is still shown as <br>
- Add tests that run the shipped createNodePreview in node with a
definition that carries markup, and one that carries text between
angle brackets, in every value the preview shows
- Add a CHANGELOG entry
The same change for manager-v4 is #3534.
_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
- Remove the archive whether the extraction worked or not, and ignore
a failure to remove it
- 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, which an uninstall still reports as an error
- Add tests that install from an archive that fails part-way and from
a file that is not a zip, install again afterwards, install while
the cleanup fails, and uninstall a pack whose directory cannot be
removed
- Add a CHANGELOG entry
The same change for manager-v4 is #3533.
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.
- 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. 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 four writes of a cache file: two in manager_util, one
in get_data_by_mode and one in default_cache_update
- 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, and the age
- Add a CHANGELOG entry
The same change for manager-v4 is #3532.
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
- 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
The same change for manager-v4 is #3531.
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
The same change for manager-v4 is #3530.
When an extension asks through cm.try-install-custom-node for a node
pack that is disabled, the user is asked whether to enable it and
restart. On confirmation the handler posted to
/customnode/toggle_active, which the server does not have, did not
look at the answer, and restarted: ComfyUI came back with the pack
still disabled.
- Enable the pack as the Custom Nodes Manager does: find its row in
/customnode/getlist, put it in the queue, start the queue, and wait
for the queue to report the pack
- Restart only when the queue reports success; otherwise show why the
pack was not enabled
- Leave a queue that is already running alone
- End the wait when the started queue reports without the pack, or
does not report within a minute; a listener left waiting would take
a later report for the same row and restart ComfyUI unasked
- Show the reason when a request made while enabling gets no answer
- Show "Rebooting..." when the restart request gets no answer, which
is what happens when ComfyUI restarts
- 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 does not
exist
- Leave the queue listener of the Manager menu when the menu has not
been created; a queue started from here made it raise
- Add browser tests of the handler and of the menu listener
- Add a CHANGELOG entry
The same change for manager-v4 is #3526.
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 manager-v4 is #3523.
Port the pip requirement checks of manager-v4 (#3489) to main, so that
both branches decide with the same code. #3431 had only replaced the
version class in main's own checks, which left ">" and "~=" answered
differently from v4.
- Parse requirements with packaging and share one parser and one
downgrade decision between manager_core and the startup check
- Treat '-', '_' and '.' as one separator in package names, in the
installed-package lookup, both lists, requirements and
pip_auto_fix.list (#3458)
- Read every version clause, so a lower bound written first no longer
hides an upper bound; read spaces, parentheses, markers, '===' and
direct references
- 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, install one older than its '~=' version or at the
version that '>' excludes, and stop reinstalling the '~=' version
itself
- Read downgrade_blacklist from config.ini in cm-cli, which read a
path attribute that does not exist and so protected only the
built-in packages
- Remove the unused is_installed copy from manager_core and the
pip_version helper that #3431 added
- Import packaging where it is used, because prestartup_script imports
manager_util before it installs missing dependencies
- Add the tests of #3489, adapted to main, and tests for the startup
loop, '>', pip_auto_fix.list names and the cm-cli setting; update
README and CHANGELOG
manager-v4 needs no counterpart: it has this code since #3489.
get_data returned {} when a channel answered with something that is
not JSON, such as a block page or "404: Not Found". get_data_by_mode
and the startup cache update wrote that {} to the cache, and the
custom node list and the model list then failed on the missing key
for as long as the cached {} was read, up to a day.
Raise for such a response, as for a failed connection. The callers
already handle that: get_data_by_mode falls back to the bundled file,
and nothing is written to the cache.
- Add tests
- Add a CHANGELOG entry
The manager-v4 port is #3519. 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 main
it read node pack versions and pip versions alike.
- 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
- Compare pip versions with packaging in is_blacklisted and
is_installed of manager_core and in is_installed of
prestartup_script: an installed 2.5.1+cu124 or 4.41.0rc1 no longer
raises, which at the next start skipped the rest of a node pack's
requirements and its install.py
- Ask a packaging Specifier for the entries of pip_auto_fix.list, as
pip does; "~=" becomes a compatible-release clause
- Import packaging where it is used, because prestartup_script imports
manager_util before it installs missing dependencies
- Add tests that run the real scan and the real pip checks
- Add a CHANGELOG entry
The same change for manager-v4 is #3516. Fixes#1755.
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.
- Refuse, with 400 and the error shape the share dialog shows, a path
that is not inside the directory
- 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 against a recording Matrix client
- Add a CHANGELOG entry
The same change for manager-v4 is #3515.
get_node_types_in_workflows opened workflow files with the locale
encoding. On a non-UTF-8 locale, such as a Windows ANSI code page, a
UTF-8 workflow either failed to decode and was skipped with a
warning, or was read with garbled non-ASCII node type names. Read
with utf-8-sig, which takes files with and without a BOM.
A workflow file saved in the ANSI code page is no longer read.
ComfyUI saves workflows as UTF-8.
Fixes#3441
update_all wrote the autosave snapshot before it read the request
body, so a cross-origin <form method=POST>, which needs no CORS
preflight, reached the snapshot write. Reject the simple form
Content-Types first, as the handlers without a body do, and describe
the scope of the gate in the helper docstring.
A client that sends the JSON body with a form Content-Type, such as
curl -d without a Content-Type header, now gets 400.
installNodeWithVersion interpolated the node id into
/customnode/versions/{id} and /customnode/disabled_versions/{id}
unencoded. Only registry ids reach these fetches, since a pack with
an 'unknown' version never opens the version dialog, and for them the
request URL is unchanged. Encode the id so it stays a single path
segment regardless.
"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
- Add a CHANGELOG entry
Follow-up to #3443. The manager-v4 port, #3512, carries the browser
test.
check_whitelist_for_model compared save_path, base and filename with
the model list, but not the url the file is downloaded from, so a
request with a listed name and another url was queued as given.
Compare the url too.
The 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
Fixes#3302
Four of the six share destinations 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 and CHANGELOG, drop the tests of the removed code, and
keep a single-quoted href under test through the update-result links
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.
Any other argument with a space, e.g. --browser-profile "Profile 1", was
split in two and ComfyUI failed to start with 'unrecognized arguments'.
Build the command in one helper, manager_util.build_restart_command, used by
both the reboot endpoint and the prestartup restart. On Windows every entry
is quoted with subprocess.list2cmdline; other platforms are unchanged.
Fixes#3339