Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 60 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/

## [Unreleased]

### Fixed

- Restarting ComfyUI from the Manager under comfy-cli no longer prints
`ValueError: I/O operation on closed file` on the console. The log file is
closed before the process exits, and what was logged after that was still
written to it.
- In the legacy UI, Update ComfyUI and Update All with ComfyUI no longer end
with status 500 and nothing queued. The batch route called the handler of
the update route without a request.
- With `update_policy = nightly`, the legacy server updates ComfyUI to the
nightly version. Only `nightly-comfyui` was taken as nightly, and `nightly`
as stable.
- The legacy server answers 400 again when the list of ComfyUI versions cannot
be read or a switch to another version fails. The call that logs the cause
was given an argument it does not take, so the answer was 500 with a
`TypeError` in the log.

- Update ComfyUI to the latest stable version again when Manager runs git
through GitPython, which it does whenever the `git` command is available.
The update ended with `Failed to checkout 'master' branch` and ComfyUI
stayed at its version: the branch to check out was passed to git as an
object instead of by its name. An update to the nightly version failed the
same way when the checkout was detached and the remote's default branch was
not known locally.

- On the default server, `POST /v2/manager/queue/update_comfyui` follows
`update_policy` when the request names no version line. Its `stable`
parameter defaulted to true, so the policy was never read and such a request
updated ComfyUI to the stable version also under `nightly-comfyui`.
`nightly` is taken as nightly too.
- On the default server, the same route reads `is_stable`, the name the
ComfyUI frontend sends, when `stable` is not given. It was ignored.
- `openapi.yaml` lists the values the two setting routes accept: `cache` for
`db_mode` and `stable-comfyui` for the update policy were missing.

- Print console messages with paths, URLs and package names as they are.
Manager printed many of its messages through rich, which reads square
brackets as markup: a package name such as `diffusers[torch]` was shown as
`diffusers`, a text such as `:100:` as an emoji, and a line longer than the
console was broken in the middle of a path or a URL. A text with a closing
tag such as `[/b]` raised `MarkupError` instead of being printed, in the
middle of the operation that reported it. Numbers and quoted strings keep
their colors.

- Refuse a `db_mode` or an `update_policy` that Manager does not know in the
legacy server. With `--enable-manager-legacy-ui`, the two setting routes
stored whatever value a request carried and wrote it to `config.ini`. They
answer 400 for a value that is not one of the known ones, as the default
server does.
- Answer 400 from the two setting routes of both servers for a JSON body that
is not an object. It ended with status 500.
- Name the security level `normal-` and the database mode `channel` as the
servers do in `common/enums.py`, which had `normal-minus` and no `channel`.
Nothing read these two members.

- Keep a database mode, update policy or share option that is chosen in the
legacy Manager menu while the menu is still loading the stored value. The
value was saved, but the menu went back to showing the old one when it
arrived.

## [4.4] - 2026-11-16

### Changed
Expand Down Expand Up @@ -210,10 +270,6 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/
always answered that it was not one, so after `colorama.init()` the colors of
every `print()` were removed, and tqdm and rich took a terminal for a pipe
(#3259, #3423).
- Restarting ComfyUI from the Manager under comfy-cli no longer prints
`ValueError: I/O operation on closed file` on the console. The log file is
closed before the process exits, and what was logged after that was still
written to it.

## [4.3] - 2026-09-19

Expand Down
3 changes: 2 additions & 1 deletion comfyui_manager/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ class NetworkMode(enum.Enum):
class SecurityLevel(enum.Enum):
STRONG = "strong"
NORMAL = "normal"
NORMAL_MINUS = "normal-minus"
NORMAL_MINUS = "normal-"
WEAK = "weak"

class DBMode(enum.Enum):
LOCAL = "local"
CACHE = "cache"
CHANNEL = "channel"
REMOTE = "remote"
4 changes: 4 additions & 0 deletions comfyui_manager/common/git_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ def create_backup_branch(self, name):
self._repo.create_head(name)

def checkout(self, ref):
# ref can be a _HeadProxy from get_head_by_name
if isinstance(ref, _HeadProxy):
ref = ref.name

self._repo.git.checkout(ref)

def checkout_new_branch(self, branch_name, start_point):
Expand Down
8 changes: 6 additions & 2 deletions comfyui_manager/data_models/generated_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ class UpdateComfyUIQueryParams(BaseModel):
)
ui_id: str = Field(..., description="UI identifier for task tracking")
stable: Optional[bool] = Field(
True,
description="Whether to update to stable version (true) or nightly (false)",
None,
description="Whether to update to stable version (true) or nightly (false). When neither this nor `is_stable` is given, the update policy decides.",
)
is_stable: Optional[bool] = Field(
None,
description="Another name for `stable`, the one the task parameters use. Read when `stable` is not given.",
)


Expand Down
12 changes: 10 additions & 2 deletions comfyui_manager/glob/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

orig_print = print

from rich import print
import rich
from rich.console import Console
from rich.markup import escape
from packaging import version

import uuid
Expand All @@ -46,6 +48,12 @@
from ..common import context


def print(*objects, sep=" ", end="\n", file=None):
# rich's print with its highlighting only, so that a path, a URL or an error text is written as it is
console = rich.get_console() if file is None else Console(file=file)
console.print(*objects, sep=sep, end=end, markup=False, emoji=False, soft_wrap=True)


try:
from importlib.metadata import version as _pkg_version
_raw_version = _pkg_version("comfyui-manager")
Expand Down Expand Up @@ -699,7 +707,7 @@ async def load_nightly(channel, mode):
channel_url = normalize_channel(channel)
if channel_url:
if mode not in ['remote', 'local', 'cache']:
print(f"[bold red]ERROR: Invalid mode is specified `--mode {mode}`[/bold red]", file=sys.stderr)
rich.print(f"[bold red]ERROR: Invalid mode is specified `--mode {escape(mode)}`[/bold red]", file=sys.stderr)
return {}

# validate channel - only the channel set by the user is allowed.
Expand Down
12 changes: 7 additions & 5 deletions comfyui_manager/glob/manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,10 +1860,12 @@ async def update_comfyui(request):
)

# Check if stable parameter was provided, otherwise use config
if query_params.stable is None:
is_stable = core.get_config()["update_policy"] != "nightly-comfyui"
else:
if query_params.stable is not None:
is_stable = query_params.stable
elif query_params.is_stable is not None:
is_stable = query_params.is_stable
else:
is_stable = core.get_config()["update_policy"] not in ("nightly", "nightly-comfyui")

client_id = query_params.client_id
ui_id = query_params.ui_id
Expand Down Expand Up @@ -1993,7 +1995,7 @@ async def set_db_mode_api(request):
environment_utils.set_db_mode(data["value"])
core.write_config()
return web.Response(status=200)
except (json.JSONDecodeError, KeyError):
except (json.JSONDecodeError, KeyError, TypeError):
return web.Response(status=400, text="Invalid request")
except ValueError as e:
return web.Response(status=400, text=str(e))
Expand All @@ -2015,7 +2017,7 @@ async def set_update_policy_api(request):
environment_utils.set_update_policy(data["value"])
core.write_config()
return web.Response(status=200)
except (json.JSONDecodeError, KeyError):
except (json.JSONDecodeError, KeyError, TypeError):
return web.Response(status=400, text="Invalid request")
except ValueError as e:
return web.Response(status=400, text=str(e))
Expand Down
20 changes: 16 additions & 4 deletions comfyui_manager/js/comfyui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ var switch_comfyui_button = null;
var update_all_button = null;
var restart_stop_button = null;
var update_policy_combo = null;
var update_policy_chosen = false;

let share_option = 'all';
const share_options = [
Expand Down Expand Up @@ -644,10 +645,12 @@ async function switchComfyUI() {

showVersionSelectorDialog(versions, obj.current, async (selected_version) => {
if(selected_version == 'nightly') {
update_policy_chosen = true;
update_policy_combo.value = 'nightly-comfyui';
api.fetchApi('/v2/manager/policy/update', { method: 'POST', body: JSON.stringify({value: 'nightly-comfyui'}) });
}
else {
update_policy_chosen = true;
update_policy_combo.value = 'stable-comfyui';
api.fetchApi('/v2/manager/policy/update', { method: 'POST', body: JSON.stringify({value: 'stable-comfyui'}) });
}
Expand Down Expand Up @@ -978,11 +981,14 @@ class ManagerMenuDialog extends ComfyDialog {
this.datasrc_combo.appendChild($el('option', { value: 'local', text: 'Local' }, []));
this.datasrc_combo.appendChild($el('option', { value: 'remote', text: 'Channel (remote)' }, []));

// a choice made before the stored value arrives is not to be replaced by it
let db_mode_chosen = false;
api.fetchApi('/v2/manager/db_mode')
.then(response => response.text())
.then(data => { this.datasrc_combo.value = data; });
.then(data => { if(!db_mode_chosen) this.datasrc_combo.value = data; });

this.datasrc_combo.addEventListener('change', function (event) {
db_mode_chosen = true;
api.fetchApi('/v2/manager/db_mode', { method: 'POST', body: JSON.stringify({value: event.target.value}) });
});

Expand Down Expand Up @@ -1026,14 +1032,18 @@ class ManagerMenuDialog extends ComfyDialog {
share_combo.appendChild($el('option', { value: option[0], text: `${option[1]}` }, []));
}

let share_option_chosen = false;
api.fetchApi('/v2/manager/share_option')
.then(response => response.text())
.then(data => {
share_option = to_share_option(data);
share_combo.value = share_option;
if(!share_option_chosen) {
share_option = to_share_option(data);
share_combo.value = share_option;
}
});

share_combo.addEventListener('change', function (event) {
share_option_chosen = true;
const value = event.target.value;
share_option = value;
api.fetchApi(`/v2/manager/share_option?value=${value}`);
Expand All @@ -1056,10 +1066,12 @@ class ManagerMenuDialog extends ComfyDialog {
api.fetchApi('/v2/manager/policy/update')
.then(response => response.text())
.then(data => {
update_policy_combo.value = data;
if(!update_policy_chosen)
update_policy_combo.value = data;
});

update_policy_combo.addEventListener('change', function (event) {
update_policy_chosen = true;
api.fetchApi('/v2/manager/policy/update', { method: 'POST', body: JSON.stringify({value: event.target.value}) });
});

Expand Down
12 changes: 10 additions & 2 deletions comfyui_manager/legacy/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

orig_print = print

from rich import print
import rich
from rich.console import Console
from rich.markup import escape
from packaging import version

import uuid
Expand All @@ -44,6 +46,12 @@
from ..common import context


def print(*objects, sep=" ", end="\n", file=None):
# rich's print with its highlighting only, so that a path, a URL or an error text is written as it is
console = rich.get_console() if file is None else Console(file=file)
console.print(*objects, sep=sep, end=end, markup=False, emoji=False, soft_wrap=True)


try:
from importlib.metadata import version as _pkg_version
_raw_version = _pkg_version("comfyui-manager")
Expand Down Expand Up @@ -689,7 +697,7 @@ async def load_nightly(channel, mode):
channel_url = normalize_channel(channel)
if channel_url:
if mode not in ['remote', 'local', 'cache']:
print(f"[bold red]ERROR: Invalid mode is specified `--mode {mode}`[/bold red]", file=sys.stderr)
rich.print(f"[bold red]ERROR: Invalid mode is specified `--mode {escape(mode)}`[/bold red]", file=sys.stderr)
return {}

# validate channel - only the channel set by the user is allowed.
Expand Down
33 changes: 25 additions & 8 deletions comfyui_manager/legacy/manager_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,18 @@ def run_script(self, cmd, cwd='.'):
local_db_extension_node_mappings = os.path.join(manager_util.comfyui_manager_path, "extension-node-map.json")


ALLOWED_UPDATE_POLICIES = ('stable', 'stable-comfyui', 'nightly', 'nightly-comfyui')
ALLOWED_DB_MODES = ('cache', 'channel', 'local', 'remote')


def set_update_policy(mode):
if mode not in ALLOWED_UPDATE_POLICIES:
raise ValueError(f"Invalid update_policy {mode!r}; must be one of {ALLOWED_UPDATE_POLICIES}")
core.get_config()['update_policy'] = mode

def set_db_mode(mode):
if mode not in ALLOWED_DB_MODES:
raise ValueError(f"Invalid db_mode {mode!r}; must be one of {ALLOWED_DB_MODES}")
core.get_config()['db_mode'] = mode

def print_comfyui_version():
Expand Down Expand Up @@ -802,7 +810,8 @@ async def queue_batch(request):
failed.add(x['id'])

elif k == 'update_comfyui':
await update_comfyui(None)
if v:
_update_comfyui()
Comment thread
ltdrdata marked this conversation as resolved.
Resolved

elif k == 'disable':
for x in v:
Expand Down Expand Up @@ -1313,7 +1322,7 @@ def unzip_install(files):

os.remove(temp_filename)
except Exception as e:
logging.error(f"Install(unzip) error: {url} / {e}", file=sys.stderr)
logging.error(f"Install(unzip) error: {url} / {e}")
return False

logging.info("Installation was successful.")
Expand Down Expand Up @@ -1655,18 +1664,22 @@ async def update_comfyui(request):
rejection = manager_security.reject_simple_form_post(request)
if rejection is not None:
return rejection
is_stable = core.get_config()['update_policy'] != 'nightly-comfyui'
temp_queue_batch.append(("update-comfyui", ('comfyui', is_stable)))
_update_comfyui()
return web.Response(status=200)


def _update_comfyui():
is_stable = core.get_config()['update_policy'] not in ('nightly', 'nightly-comfyui')
temp_queue_batch.append(("update-comfyui", ('comfyui', is_stable)))


@routes.get("/v2/comfyui_manager/comfyui_versions")
async def comfyui_versions(request):
try:
res, current, latest = core.get_comfyui_versions()
return web.json_response({'versions': res, 'current': current}, status=200, content_type='application/json')
except Exception as e:
logging.error(f"ComfyUI update fail: {e}", file=sys.stderr)
logging.error(f"ComfyUI update fail: {e}")

return web.Response(status=400)

Expand All @@ -1691,7 +1704,7 @@ async def comfyui_switch_version(request):
except json.JSONDecodeError:
return web.Response(status=400, text="Invalid JSON body")
except Exception as e:
logging.error(f"ComfyUI update fail: {e}", file=sys.stderr)
logging.error(f"ComfyUI update fail: {e}")
return web.Response(status=400)


Expand Down Expand Up @@ -1780,8 +1793,10 @@ async def set_db_mode_api(request):
set_db_mode(data['value'])
core.write_config()
return web.Response(status=200)
except (json.JSONDecodeError, KeyError):
except (json.JSONDecodeError, KeyError, TypeError):
return web.Response(status=400, text='Invalid request')
except ValueError as e:
return web.Response(status=400, text=str(e))


@routes.get("/v2/manager/policy/update")
Expand All @@ -1800,8 +1815,10 @@ async def set_update_policy_api(request):
set_update_policy(data['value'])
core.write_config()
return web.Response(status=200)
except (json.JSONDecodeError, KeyError):
except (json.JSONDecodeError, KeyError, TypeError):
return web.Response(status=400, text='Invalid request')
except ValueError as e:
return web.Response(status=400, text=str(e))


@routes.get("/v2/manager/channel_url_list")
Expand Down
Loading
Loading