Extensions/Route Probe
ComfyUI Extension

Route Probe

Compare a custom HTTP route and a workflow job on ComfyUI.

By jKaarlehto·Created a day ago·Updated a day ago· 0
jKaarlehto/ComfyUI-Route-Probe
Nodes—
On cloudLocal install
Stars0
Updateda day ago
Readme

ComfyUI Route Probe

Tests whether a ComfyUI worker receives an HTTP marker on a workflow submission. One custom node hashes a payload and renders its SHA-256 digest and a header observation into an image. The example uses the built-in SaveImage node, runs on CPU and requires no models.

Run on a Comfy Platform deployment

Include comfyui-route-probe (publisher jKaarlehto) in a custom build, publish the build and deploy it. From PowerShell 7, with your workspace API key in COMFY_API_KEY, run:

./examples/run-probe.ps1 -BaseUrl https://<deployment>.run.comfy.app -Payload hello

Open route-probe.png. The script sends examples/job.json to POST /api/v2/jobs with X-Comfy-Route-Probe: probe, polls for the result, and downloads the report. An image with the expected digest shows the custom node received the workflow input. The digest for hello starts with 2cf24dba and ends with 938b9824.

| Report | Meaning | | --- | --- | | marker received | The native prompt request carried the exact marker. | | no marker | The worker saw a native prompt request without the marker value. | | prompt hook only | The prompt hook ran outside the observed native POST handler. Header forwarding is undetermined. | | hook not observed | The node ran without an observation from the prompt hook. Header forwarding is undetermined. |

The supplied graph also sets operation to echo. For the first marked probe node in the graph, middleware on the worker's native prompt POST sends its payload to the plugin's fixed POST /route-probe/echo route on the worker's loopback interface. The report's third line shows the HTTP result. HTTP 200 with a matching digest proves a round trip through the custom route. No dispatch observed means this middleware path did not run for that node. A connection error can also mean the runtime has no plain HTTP listener on IPv4 loopback.

Leave the observation and echo_result inputs unset. Change the payload between runs. This tests the worker's native middleware and listener; the public v2 response remains a job.

Native controls

On a ComfyUI server with this package loaded, use the same test header on the custom route and the native job endpoint:

$base = 'http://127.0.0.1:8188'
$headers = @{'X-Comfy-Route-Probe' = 'probe'}
Invoke-RestMethod "$base/route-probe/echo" -Method Post -Headers $headers -ContentType application/json -Body '{"payload":"hello"}'
$graph = (Get-Content ./examples/job.json -Raw | ConvertFrom-Json).workflow
Invoke-RestMethod "$base/prompt" -Method Post -Headers $headers -ContentType application/json -Body (@{prompt=$graph} | ConvertTo-Json -Depth 10)

The echo route returns the same digest and header observation as JSON. For the native workflow, inspect the saved image. For local v2, run the probe script against the proxy's base URL (usually http://127.0.0.1:8189). To test public route exposure independently on your deployment, send the echo request to its deployment URL with your bearer token; compare with a successful authenticated v2 job. A JSON echo with the expected digest is positive evidence. An authentication failure or a timeout is inconclusive.

Verified with ComfyUI 0.47.2 and comfy-api-proxy 0.1.6 on Windows: the direct custom route returned HTTP 200 on the native port and 404 on the proxy port. A marked workflow sent to the proxy returned a PNG with no forwarded header and an HTTP 200 echo response from worker-local dispatch.

Native WebSocket check

Run the client-side probe against the same origin the host would use. It connects to /ws?clientId=..., sends the native ComfyUI feature_flags message, and checks for both the matching session status and the server's reply. The script uses Python's websockets package. For a Platform deployment, set COMFY_API_KEY to a workspace key.

uv run --no-project --with websockets python examples/probe-websocket.py http://127.0.0.1:8188
uv run --no-project --with websockets python examples/probe-websocket.py https://dep-<id>.run.comfy.app

On the Route Probe v1 deployment, the public API origin returned HTTP 404 on the WebSocket upgrade with the Cloud editor both enabled and disabled. An authenticated v2 lookup of the same completed job returned HTTP 200 in both configurations. Local native ComfyUI returned HTTP 101 and completed the feature-flags exchange. These checks cover an external client connecting to the deployment API origin. The Comfy Cloud editor has its own deployment selection.

Worker custom event

Operation websocket_event schedules a route_probe.observed event on the worker's native PromptServer. The event carries only a SHA-256 digest. The client generates a fresh nonce, opens the socket before submitting the workflow, and checks for the exact event name and digest through ten seconds after completion. The native control uses the local server socket and prompt API. The deployment test listens on the shared Cloud socket while submitting the job to the deployment's v2 URL. Each deployment test submits one billable job.

uv run --no-project --with requests --with websockets python examples/probe-custom-event.py --local-port 8188
uv run --no-project --with requests --with websockets python examples/probe-custom-event.py --deployment-id dep-<uuid>

Set COMFY_API_KEY for the Cloud test. It uses Comfy's documented v1 WebSocket authentication. This tests worker-to-client delivery of a broadcast custom event. Native targeting by session ID and client-to-worker messages require separate checks.

The native control received the matching custom event. On Comfy Platform release v2 (plugin commit 3f359c1), the job succeeded with the editor enabled. Its output image confirmed the worker queued the custom event with the expected digest. A separately authenticated client connected to wss://cloud.comfy.org/ws before submission and received status and feature_flags. It observed zero matching custom events through ten seconds after completion. This test used the CLI sign-in as a bearer header and did not observe a browser tab with the deployment selected.

Editor and host round trip

Open an editor with this extension loaded. The browser console reports [Route Probe] Editor listener ready. The external client submits a job with a fresh payload and waits for a WebSocket receipt. The worker emits the payload digest. On receipt the editor generates a fresh random receipt ID and sends it over its Comfy socket. The worker forwards the digest and receipt as route_probe.ui_reply_received. Compare the ID in the editor console with the one printed by the external client.

uv run --no-project --with requests --with websockets python examples/probe-custom-event.py --local-port 8188 --ui-reply
uv run --no-project --with requests --with websockets python examples/probe-custom-event.py --deployment-id dep-<id> --ui-reply

To test the return direction independently, run the client with --manual-payload <unique-text> in place of --ui-reply. Set the Route Probe node's payload to that text and click Send WS probe to host. This sends a receipt without running a job. Both tests measure broadcast delivery. Session targeting and replay require their own checks.

On private build release v2, the Comfy Cloud editor selected the deployment and submitted a probe job. The editor reported the custom event type, and on a subsequent editor submission an independent client on the same account received the matching digest on wss://cloud.comfy.org/ws. Cloud added prompt_id and workflow_id to the event data. With the same editor selected, a job submitted through the private deployment's v2 API succeeded, but the external socket received only status and feature_flags during that observation. Release v2 contained no editor listener or reply code.

Reproduce the hosted delivery checks

Select the private deployment in the Cloud editor's Run on menu. Open the two-node probe graph and confirm the browser console shows [Route Probe] Editor listener ready.

| Action | What to compare | | --- | --- | | Host runs --in-flight | A v2 job emits a digest, waits up to 15 seconds, and writes the received WebSocket receipt or timeout into its output image. Compare with the browser console. | | Editor runs await_editor_receipt | Start the external listener with --watch-editor-payload <unique-text>. Set the node payload to that text and run from the editor. Compare worker challenge, browser receipt, host frames, and the worker's final result. | | Editor clicks Send WS probe to host | Run the external listener with --manual-payload <unique-text> and use the same node payload. The editor logs the receipt it sent without queueing a job. | | Editor clicks Test editor HTTP route | Compare the returned HTTP status and SHA-256 with the digest of the random payload printed in the browser console. | | Editor runs await_editor_http_receipt | Start --watch-editor-payload <unique-text>. The editor answers the worker challenge with a POST to the plugin's fixed receipt route. Compare the random per-process IDs printed for the executing worker and the HTTP handler, the handler's waiting flag, and the worker's final receipt. |

Use the same --deployment-id or --local-port arguments shown above. The host can initiate the HTTP-reply variant with --http-reply. Each timed test needs a fresh payload to avoid execution caching.

Results on Comfy Platform private releases v3–v5

| Path exercised | Observed result | | --- | --- | | External host → private v2 job → worker-local HTTP echo | HTTP 200 inside the worker, with the expected digest in the job output. The public custom route returned 404 and the marked v2 request arrived at the worker without its custom header. | | Private deployment's Cloud editor → plugin HTTP route | The editor's api.fetchApi POST returned HTTP 200 and the expected digest without queueing a job. | | Editor-submitted job → worker custom event → editor and external host | Both received the challenge digest. Two independent account WebSocket listeners observed the same editor-originated challenge on release v5. | | Host-submitted private v2 job → editor and account WebSocket | The job succeeded. Neither listener surface observed its custom challenge. The v2 SSE stream returned job status, progress and output events on v4 and v5. | | Editor raw WebSocket → worker → host | The browser logged the receipt it sent. The waiting worker recorded a 15-second timeout and the host received no acknowledgement. The editor's independent send button on v3 also produced no acknowledgement. The private deployment's public native WS upgrade returned 404. | | Editor HTTP callback during an editor-submitted job | The handler returned HTTP 200 with the browser's receipt. Its per-process identifier differed from the worker's, and it reported no matching waiter. The executing worker timed out and neither external listener received the handler's custom acknowledgement. |

Both timed receipt paths passed on native ComfyUI. The standard managed Comfy Cloud catalog had no JKRouteProbe entry and its workflow preflight rejected the graph. The hosted runs above used a Git-pinned private build with the deployment selected in the Cloud editor.

Trace a receipt

The instrumented probe installs an aiohttp class-level receive hook and wraps the Comfy server's outgoing send method. The wrapper broadcasts probe events and preserves the original destination for other events. The worker logs the challenge digest, process ID, socket count at send time, receive callback and final wait result. After sending a raw reply, the browser queries the editor server's trace for that digest and logs which hooks are active there. A completed send records the local method returning. A matching receive record or receipt confirms delivery.

Test a reply carried by a second workflow

  1. Generate independent random 32-character lowercase hex strings for a pairing code and a challenge. Submit the sample workflow from the host with operation=pair_offer, the pairing code in payload, and the challenge in proof.
  2. Select the same deployment in the editor. Run a Route Probe → Save Image workflow with operation=pair_pickup, the same pairing code, and an empty proof. On a matching worker event the browser generates a receipt, changes the node to pair_reply, and fills the proof. Click Run again to return it.
  3. Listen for route_probe.pair_reply on the host. Independently submit pair_check with the pairing code and compare the resulting image's receipt against the one logged by the browser.

This tests an editor-initiated pickup. Offers live for five minutes in the process that accepted them. A different worker or a restart can yield a missing offer. Production use across replicas or reconnects would require shared session state and a delivery policy.

On private release v6, the host submitted the offer via v2, and the Cloud editor picked it up and returned its own receipt in a second editor run. The external host received the receipt on the account WebSocket and verified the same value in an independent v2 check job's downloaded image. All four steps used the same worker instance.

The raw WebSocket control on v6 still timed out. For an editor-submitted job the worker's send wrapper recorded one native socket and returned. Both the browser and the external host received the challenge. The browser sent a reply, then queried the editor plugin's HTTP trace. Both hooks were installed there, with zero native sockets at inspection and no matching receive. The executing worker also recorded no matching receive during its wait. The native local control passed with the same hook implementation.