Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

fix(wrap): show the dashboard URL when the proxy is already running (#1313)

Lucas Santosb0146c4ccd1e
diff --git a/headroom/cli/wrap.py b/headroom/cli/wrap.py
index 5c6f94c7e..21ee3c010 100644
--- a/headroom/cli/wrap.py
+++ b/headroom/cli/wrap.py
@@ -2406,6 +2406,7 @@ def _ensure_proxy(
f"is running stale Headroom {running_version} and could not be restarted."
)
click.echo(f" Proxy already running on port {port}")
+ click.echo(f" Dashboard: http://127.0.0.1:{port}/dashboard")
return None
if helpers._recover_persistent_proxy(port):
return None
@@ -2536,6 +2537,7 @@ def _ensure_proxy(
if not needs_restart:
click.echo(f" Proxy already running on port {port}")
+ click.echo(f" Dashboard: http://127.0.0.1:{port}/dashboard")
return None
# Start (or restart) the proxy with the requested flags
diff --git a/tests/test_cli/test_wrap_helpers.py b/tests/test_cli/test_wrap_helpers.py
index f8d2bc18a..5594a9d6c 100644
--- a/tests/test_cli/test_wrap_helpers.py
+++ b/tests/test_cli/test_wrap_helpers.py
@@ -739,3 +739,29 @@ class TestProxyClientRefCounting:
# Second unregister is a no-op, not an error.
wrap_mod._unregister_proxy_client(self.PORT)
+
+
+# ---------------------------------------------------------------------------
+# _ensure_proxy — dashboard URL is surfaced even when the proxy is already up.
+# ---------------------------------------------------------------------------
+
+
+def test_ensure_proxy_already_running_prints_dashboard_url(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """When a healthy proxy is already running, the dashboard URL is printed.
+
+ Regression: the URL was only echoed on the start/restart path, so repeat
+ wraps (the common case) never told the user where the dashboard lives.
+ """
+ port = 1234
+ monkeypatch.setattr(wrap_mod, "_find_persistent_manifest", lambda _p: None)
+ monkeypatch.setattr(wrap_mod, "_check_proxy", lambda _p: True)
+ monkeypatch.setattr(wrap_mod, "_query_proxy_health", lambda _p: {})
+ monkeypatch.setattr(wrap_mod, "_proxy_needs_version_restart", lambda _h: False)
+ monkeypatch.setattr(wrap_mod, "_proxy_health_config", lambda _h: None)
+ monkeypatch.setattr(wrap_mod, "_query_proxy_config", lambda _p: None)
+
+ output = _run_in_click_context(lambda: wrap_mod._ensure_proxy(port, no_proxy=False))
+
+ assert f"http://127.0.0.1:{port}/dashboard" in output