Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(hogli): suppress first-run telemetry notice in CI (#60475)

Raúl Negrón-Oteroc428685f0a78
diff --git a/tools/hogli/src/hogli/telemetry.py b/tools/hogli/src/hogli/telemetry.py
index 54a81174b004..8ac6a98992bb 100644
--- a/tools/hogli/src/hogli/telemetry.py
+++ b/tools/hogli/src/hogli/telemetry.py
@@ -141,6 +141,11 @@ class TelemetryClient:
_save_config(config)
def show_first_run_notice_if_needed(self) -> None:
+ # CI is auto-opted-out via is_ci(); the notice would be noise in build
+ # logs and instructs users to set POSTHOG_TELEMETRY_OPT_OUT=1, which is
+ # redundant when the CI gate already disables tracking.
+ if is_ci():
+ return
config = _load_config()
if config.get("first_run_notice_shown"):
return
diff --git a/tools/hogli/tests/test_telemetry.py b/tools/hogli/tests/test_telemetry.py
index 9c2c1f438338..7008296d430f 100644
--- a/tools/hogli/tests/test_telemetry.py
+++ b/tools/hogli/tests/test_telemetry.py
@@ -149,6 +149,14 @@ class TestFirstRunNotice:
captured_second = capsys.readouterr()
assert captured_second.err == ""
+ @pytest.mark.parametrize("ci_var", telemetry._CI_ENV_VARS)
+ def test_suppressed_in_ci(self, monkeypatch: pytest.MonkeyPatch, telemetry_config: Path, capsys, ci_var: str):
+ monkeypatch.setenv(ci_var, "true")
+ telemetry.show_first_run_notice_if_needed()
+ captured = capsys.readouterr()
+ assert captured.err == ""
+ assert not telemetry_config.exists()
+
class TestTelemetryCommands:
@pytest.fixture