Skip to content

One-click character swap for videos: an open-source, local Higgsfield Genjutsu alternative built on ComfyUI and MiniMax H3, with FLUX.3 Klein relighting.

Fix live progress for other installs

D3voz3db46ab00351
diff --git a/CUSTOM_NODES_REPORT.md b/CUSTOM_NODES_REPORT.md
index bc5237f..bccd74d 100644
--- a/CUSTOM_NODES_REPORT.md
+++ b/CUSTOM_NODES_REPORT.md
@@ -4,7 +4,7 @@ Updated 25 October 2026. The README lists the packs, their links and the model f
## 1. Packs by workflow
-Openjutsu uses ten custom-node packs: the ten in the README's Custom nodes table, `comfyui_controlnet_aux` included. Install them under `ComfyUI/custom_nodes/`.
+Openjutsu uses the custom-node packs in the README's Custom nodes table. Install them under `ComfyUI/custom_nodes/`.
| Feature / shipped workflow | Required custom packs |
| --- | --- |
@@ -21,6 +21,8 @@ Openjutsu uses ten custom-node packs: the ten in the README's Custom nodes table
Fix colours removes the detail or tone node when that step is off, so each of its two packs is needed only for its own step. Turning off hat fix or No lip-sync does not remove any pack from swapping.
+Every workflow also needs [comfyui-websocket-reconnect-fix](https://github.com/D3voz/comfyui-websocket-reconnect-fix). It adds no nodes, so the setup check looks for its `/websocket_reconnect_fix` route instead of `/object_info`. Without it, when comfy-api-proxy reconnects to ComfyUI (a page reload, for example), ComfyUI drops the new connection and the page stops showing progress while the job keeps running.
+
Release notes worth knowing:
- Context Loop must be **0.7.3+**. Its Registry ID keeps the spelling `comfyui-minimaxh3-contex-loop`, and the `Contex` in its node IDs is intentional.
diff --git a/README.md b/README.md
index 32f151b..50bf4d7 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,7 @@ Install these into `ComfyUI/custom_nodes` (ComfyUI Manager finds the first three
| [ComfyUI-Impact-Pack](https://github.com/ltdrdata/ComfyUI-Impact-Pack) | Fix faces: SAM loader |
| [comfyui-image-detail-contrast](https://github.com/D3voz/comfyui-image-detail-contrast) | Fix colours: Image Detail Contrast |
| [Orion4D_FXMax](https://github.com/orion4d/Orion4D_FXMax) | Fix colours: DCTL Tone Mapper and its presets |
+| [comfyui-websocket-reconnect-fix](https://github.com/D3voz/comfyui-websocket-reconnect-fix) | every job: keeps live progress coming after the proxy reconnects to ComfyUI (adds no nodes) |
Restart ComfyUI after installing them.
@@ -60,13 +61,14 @@ Before uploading a job, Openjutsu checks the selected workflow against ComfyUI's
## Run it locally
-On Windows, double-click `start_openjutsu.bat` (ComfyUI must be running, or started while it waits). The first run installs `comfy-api-proxy` 0.1.6 into `.venv-proxy` and the node packages. Each run builds the app, then opens the proxy and the app (`npm start`, the production server) in two windows and the page in your browser. Close those two windows to stop Openjutsu. The manual steps:
+On Windows, double-click `start_openjutsu.bat` (ComfyUI must be running, or started while it waits). The first run installs `comfy-api-proxy` 0.1.6 into `.venv-proxy` and the node packages, and `patch_proxy.py` fixes the proxy's live progress (node changes and mid-job previews). Each run builds the app, then opens the proxy and the app (`npm start`, the production server) in two windows and the page in your browser. Close those two windows to stop Openjutsu. The manual steps:
1. Start ComfyUI on `127.0.0.1:8188`. On Windows, set `AIOHTTP_NOSENDFILE=1` first (PowerShell: `$env:AIOHTTP_NOSENDFILE = "1"`). Without it, the first partial-file request (the video player sends one when you seek) can stall ComfyUI's `/view`, and every later file download hangs until ComfyUI restarts.
-2. Install and start the proxy, which serves the Comfy API v2 on `127.0.0.1:8189`. Raise the upload cap for longer videos (the default is 100 MB):
+2. Install the proxy, fix its live progress with this repo's `patch_proxy.py` (run it with the same Python), and start it. It serves the Comfy API v2 on `127.0.0.1:8189`. Raise the upload cap for longer videos (the default is 100 MB):
```sh
pip install comfy-api-proxy==0.1.6
+ python openjutsu/patch_proxy.py
comfy-api-proxy run --max-upload-mb 500
```
diff --git a/components/openjutsu.tsx b/components/openjutsu.tsx
index 96b99f9..c8ec447 100644
--- a/components/openjutsu.tsx
+++ b/components/openjutsu.tsx
@@ -757,7 +757,7 @@ export function Openjutsu() {
<p className="hint">Use ComfyUI Manager or follow the links below for installation and Python dependency instructions. If ComfyUI itself is listed, update ComfyUI. Then restart ComfyUI and try again.</p>
<ul>{setup.packs.map((pack) => <li key={pack.url}>
<a href={pack.url} target="_blank" rel="noopener noreferrer">{pack.name} ↗</a>
- <small>Missing nodes: {pack.nodes.join(", ")}</small>
+ {pack.nodes.length > 0 && <small>Missing nodes: {pack.nodes.join(", ")}</small>}
</li>)}</ul>
</>}
{setup.models.length > 0 && <>
@@ -767,7 +767,7 @@ export function Openjutsu() {
</li>)}</ul>
</>}
<CopyDetails lines={[tab, "Setup check failed", setup.error ? `Error: ${setup.error}` : "",
- ...setup.packs.map((pack) => `Missing pack: ${pack.name} ${pack.url} (nodes: ${pack.nodes.join(", ")})`),
+ ...setup.packs.map((pack) => `Missing pack: ${pack.name} ${pack.url}${pack.nodes.length ? ` (nodes: ${pack.nodes.join(", ")})` : ""}`),
...setup.models.map((item) => `Missing model: ComfyUI/models/${item.folder}/${item.name}`)]} />
</section>
)}
diff --git a/lib/setup.ts b/lib/setup.ts
index 4e39c50..f178c98 100644
--- a/lib/setup.ts
+++ b/lib/setup.ts
@@ -41,6 +41,8 @@ const PACKS = [
{ name: "Orion4D_FXMax", url: "https://github.com/orion4d/Orion4D_FXMax", nodes: ["Orion4D_FXMax_DCTLToneMapper"] },
];
const CORE = { name: "ComfyUI (update required)", url: "https://github.com/Comfy-Org/ComfyUI", nodes: [] as string[] };
+// Adds no nodes, so it is found by its route instead. Without it, live progress stops when the proxy reconnects.
+const WEBSOCKET_FIX = { name: "comfyui-websocket-reconnect-fix", url: "https://github.com/D3voz/comfyui-websocket-reconnect-fix", nodes: [] as string[] };
const PACK_HINT = "Already installed? ComfyUI may be too old for the pack, or the pack failed to load. Update ComfyUI, restart it and check its console for import errors.";
const MODEL_INPUTS: Record<string, Record<string, string>> = {
UNETLoader: { unet_name: "diffusion_models" },
@@ -97,9 +99,14 @@ export function inspectSetup(graph: ApiGraph, registry: NodeRegistry): SetupResu
export async function checkSetup(graph: ApiGraph): Promise<SetupResult> {
try {
- const registry = await comfyUi("/object_info", 8000);
+ const [registry, websocketFix] = await Promise.all([
+ comfyUi("/object_info", 8000),
+ comfyUi("/websocket_reconnect_fix", 8000).then(() => true, () => false),
+ ]);
if (!registry || typeof registry !== "object" || Array.isArray(registry)) throw new Error("Invalid node list");
- return inspectSetup(graph, registry);
+ const result = inspectSetup(graph, registry);
+ if (!websocketFix) Object.assign(result, { ok: false, error: PACK_HINT, packs: [...result.packs, WEBSOCKET_FIX] });
+ return result;
} catch {
return { ok: false, error: "Could not check ComfyUI. Make sure it is running and COMFYUI_URL points to it, then try again.", packs: [], models: [] };
}
diff --git a/patch_proxy.py b/patch_proxy.py
new file mode 100644
index 0000000..2520fca
--- /dev/null
+++ b/patch_proxy.py
@@ -0,0 +1,118 @@
+"""Fix live progress in comfy-api-proxy 0.1.6. start_openjutsu.bat runs this after installing the proxy.
+
+The proxy throttles progress frames across nodes, so the next node's start is always dropped and the
+page sits on the last node. It also sends a node's files only when the whole job ends, so mask previews
+never arrive mid-run. Drop this once a proxy release fixes both.
+"""
+import importlib.util
+import pathlib
+import sys
+
+FIXES = {
+ "app.py": [
+ (
+ """\
+ bridge = JobEventBridge(
+ self.comfyui, job_id, client_id=client_id, snapshot=snapshot, session=self.session
+ )
+""",
+ """\
+ bridge = JobEventBridge(
+ self.comfyui,
+ job_id,
+ client_id=client_id,
+ snapshot=snapshot,
+ node_outputs=lambda node_id, output: self._outputs(job_id, {"outputs": {node_id: output}}, base),
+ session=self.session,
+ )
+""",
+ ),
+ ],
+ "realtime.py": [
+ (
+ """\
+StatusSnapshotFn = Callable[[], Awaitable[dict[str, Any]]]
+""",
+ """\
+StatusSnapshotFn = Callable[[], Awaitable[dict[str, Any]]]
+NodeOutputsFn = Callable[[str, dict[str, Any]], list[dict[str, Any]]]
+""",
+ ),
+ (
+ """\
+ snapshot: StatusSnapshotFn,
+ session: aiohttp.ClientSession,
+""",
+ """\
+ snapshot: StatusSnapshotFn,
+ node_outputs: NodeOutputsFn,
+ session: aiohttp.ClientSession,
+""",
+ ),
+ (
+ """\
+ self._snapshot = snapshot
+ self._session = session
+ self._last_progress_emit = 0.0
+""",
+ """\
+ self._snapshot = snapshot
+ self._node_outputs = node_outputs
+ self._session = session
+ self._last_progress_emit = 0.0
+ self._last_progress_node: str | None = None
+""",
+ ),
+ (
+ """\
+ if self._is_executed_text(msg.data):
+ for frame in await self._reconcile_outputs(seen_outputs):
+""",
+ """\
+ if self._is_executed_text(msg.data):
+ # /history only lists a prompt's outputs once it has
+ # finished, so surface this node's files from the frame.
+ data = json.loads(msg.data)["data"]
+ live = self._node_outputs(str(data["node"]), data.get("output") or {})
+ for frame in self._final_outputs({"outputs": live}, seen_outputs):
+ yield frame
+ for frame in await self._reconcile_outputs(seen_outputs):
+""",
+ ),
+ (
+ """\
+ now = time.monotonic()
+ if now - self._last_progress_emit < _THROTTLE_SECONDS:
+ return []
+ self._last_progress_emit = now
+ return [sse_frame("progress", self._translate_progress(mtype, data))]
+""",
+ """\
+ progress = self._translate_progress(mtype, data)
+ now = time.monotonic()
+ # Throttle step updates of one node only: ComfyUI sends an empty
+ # progress_state when a node finishes and the next node's start a
+ # few ms later, so throttling across nodes always dropped the start.
+ node = progress["current_node"]
+ if node == self._last_progress_node and now - self._last_progress_emit < _THROTTLE_SECONDS:
+ return []
+ self._last_progress_emit = now
+ self._last_progress_node = node
+ return [sse_frame("progress", progress)]
+""",
+ ),
+ ],
+}
+
+package = pathlib.Path(importlib.util.find_spec("comfy_api_proxy").origin).parent
+for name, fixes in FIXES.items():
+ path = package / name
+ text = path.read_text(encoding="utf-8")
+ if all(new in text for _, new in fixes):
+ continue
+ for old, new in fixes:
+ if text.count(old) != 1:
+ sys.exit(f"Could not fix live progress in {path}. patch_proxy.py is written for comfy-api-proxy 0.1.6.")
+ text = text.replace(old, new)
+ path.write_text(text, encoding="utf-8", newline="\n")
+ print(f"Fixed live progress in {path}")
diff --git a/start_openjutsu.bat b/start_openjutsu.bat
index 19a5945..952f44c 100644
--- a/start_openjutsu.bat
+++ b/start_openjutsu.bat
@@ -11,6 +11,7 @@ if not exist ".venv-proxy\Scripts\python.exe" (
python -m venv .venv-proxy || goto :fail
)
".venv-proxy\Scripts\python.exe" -m pip install -q --disable-pip-version-check comfy-api-proxy==%PROXY_VERSION% || goto :fail
+".venv-proxy\Scripts\python.exe" patch_proxy.py || goto :fail
if not exist "node_modules" (
echo Installing the app...
call npm ci || goto :fail
diff --git a/test/setup.test.ts b/test/setup.test.ts
index 6a48151..f8557c4 100644
--- a/test/setup.test.ts
+++ b/test/setup.test.ts
@@ -125,16 +125,24 @@ test("model checks deduplicate files, normalize path separators, and ignore uplo
assert.deepEqual(inspectSetup(graph, registry).models, [{ name: "missing.safetensors", folder: "text_encoders" }]);
});
-test("setup reads the registry once and never uploads or submits a job", async (t) => {
+test("setup reads the registry and the websocket fix route, and never uploads or submits a job", async (t) => {
const graph = setupGraph(load("simple"), simple);
const urls: string[] = [];
t.mock.method(globalThis, "fetch", async (url: string) => {
urls.push(url);
- return Response.json(registryFor(graph));
+ return Response.json(url.endsWith("/websocket_reconnect_fix") ? {} : registryFor(graph));
});
assert.equal((await checkSetup(graph)).ok, true);
- assert.equal(urls.length, 1);
- assert.ok(urls[0].endsWith("/object_info"));
+ assert.deepEqual(urls.map((url) => new URL(url).pathname).sort(), ["/object_info", "/websocket_reconnect_fix"]);
+});
+
+test("setup lists the websocket fix when ComfyUI does not have it", async (t) => {
+ const graph = setupGraph(load("simple"), simple);
+ t.mock.method(globalThis, "fetch", async (url: string) => url.endsWith("/websocket_reconnect_fix")
+ ? new Response("404: Not Found", { status: 404 }) : Response.json(registryFor(graph)));
+ const result = await checkSetup(graph);
+ assert.equal(result.ok, false);
+ assert.deepEqual(result.packs, [{ name: "comfyui-websocket-reconnect-fix", url: "https://github.com/D3voz/comfyui-websocket-reconnect-fix", nodes: [] }]);
});
test("offline, HTTP failure and invalid registry responses give an actionable error", async (t) => {