comfyui-mcp 0.50.63 → 0.50.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -985,6 +985,36 @@ async function probeDeclineRecovery(base, windowMs, intervalMs, probeTimeoutMs,
985
985
  * Origin carries NO path, a boot target mounted under a basePath fails path-aware
986
986
  * identity and is (soundly) fail-closed to dispatched-unconfirmed.
987
987
  */
988
+ /**
989
+ * #851 — what to tell the caller about `restart_comfyui` when the panel's confirmation
990
+ * card timed out.
991
+ *
992
+ * The old text recommended it unconditionally. It targets COMFYUI_URL, not the ComfyUI
993
+ * the panel runs inside, so a reporter who followed that advice aimed a restart at a
994
+ * different server than the one they had been working on — and got "No ComfyUI process
995
+ * found on port 8188" while the panel was working fine on the live canvas.
996
+ *
997
+ * `panelBase` comes from captureRebootHealthBase(), which is a PROOF rather than a
998
+ * comparison: null in remote/cloud mode, and whenever the tab's origin cannot be shown
999
+ * to front the local boot instance. "Unproven" is deliberately NOT folded into
1000
+ * "different" — that would fire the warning on ordinary remote installs where the two
1001
+ * ARE the same server, trading a wrong recommendation for a wrong alarm.
1002
+ *
1003
+ * Pure, so the three-way decision is testable without a live panel.
1004
+ */
1005
+ export function restartTimeoutFallbackAdvice({ headlessBase, panelBase, }) {
1006
+ if (panelBase != null && sameHttpBase(headlessBase, panelBase)) {
1007
+ return "or use restart_comfyui to restart the server directly without a panel card.";
1008
+ }
1009
+ if (panelBase != null) {
1010
+ return (`Do NOT reach for restart_comfyui here without checking: it targets ${headlessBase}, ` +
1011
+ `while this panel is running inside ${panelBase}. Restarting the first would hit a ` +
1012
+ "different server than the one you have been working on — and may find nothing there at all.");
1013
+ }
1014
+ return (`or use restart_comfyui, which restarts ${headlessBase} directly without a panel ` +
1015
+ "card — check that this is the same ComfyUI you have been working on, since I " +
1016
+ "could not confirm which one this panel is running inside.");
1017
+ }
988
1018
  function captureRebootHealthBase(ctx) {
989
1019
  if (isCloudMode() || isRemoteMode())
990
1020
  return null;
@@ -7925,11 +7955,26 @@ export function buildPanelToolDefs() {
7925
7955
  const confirmBudget = Math.max(1, Math.min(RESTART_CONFIRM_TIMEOUT_MS, overallDeadline - Date.now()));
7926
7956
  const decision = await ctx.confirm("Restart ComfyUI now? It (and this agent) will go down briefly, then reconnect and resume automatically.", "Restart ComfyUI", confirmBudget);
7927
7957
  if (decision === "timeout") {
7958
+ // #851 — the fallback used to be recommended unconditionally, and
7959
+ // `restart_comfyui` targets COMFYUI_URL, NOT the ComfyUI the panel is
7960
+ // running inside. A reporter followed this advice against a panel driving a
7961
+ // different server and got `No ComfyUI process found on port 8188` while the
7962
+ // panel was working fine on the live canvas — a restart aimed at the wrong
7963
+ // machine, recommended by a call that never checked which machine that was.
7964
+ //
7965
+ // The information was already here and simply not consulted on this branch:
7966
+ // captureRebootHealthBase() is the origin the PANEL answers on, and the
7967
+ // adjacent decline branch already reads it. Only recommend the headless tool
7968
+ // when it provably points at the same server; otherwise name both and say
7969
+ // plainly that this call did not verify the other one.
7970
+ const fallback = restartTimeoutFallbackAdvice({
7971
+ headlessBase: getComfyUIBaseUrl(),
7972
+ panelBase: captureRebootHealthBase(ctx),
7973
+ });
7928
7974
  return ok(`No confirmation received within ${Math.round(confirmBudget / 1000)}s, so I did NOT ` +
7929
7975
  "restart ComfyUI. The panel tab may be backgrounded or still reconnecting after a " +
7930
7976
  "previous restart, so the confirmation card wasn't answered. Tell me to restart it " +
7931
- "and I'll re-ask, or use restart_comfyui to restart the server directly without a " +
7932
- "panel card.");
7977
+ `and I'll re-ask. ${fallback}`);
7933
7978
  }
7934
7979
  if (decision !== "yes") {
7935
7980
  // #742: NEVER claim "not restarted" while the server is actually DOWN —