Skip to content

The agent that grows with you

fix(telemetry): an opt-out from the CLI also drops the Desktop onboarding latches (m16)

teknium158530cc7f5aa
diff --git a/hermes_cli/observability/shared_metrics_process.py b/hermes_cli/observability/shared_metrics_process.py
index a0e322b68f6..1d621e9b05f 100644
--- a/hermes_cli/observability/shared_metrics_process.py
+++ b/hermes_cli/observability/shared_metrics_process.py
@@ -76,6 +76,7 @@ def begin_process(kind: str) -> None:
try:
from hermes_constants import get_hermes_home
+ from .shared_metrics_desktop import ONBOARDING_LATCH_DIRNAME
from .shared_metrics_setup import markers_dir as setup_markers_dir
from .shared_metrics_update import _collection_on, purge_pending_updates
@@ -85,7 +86,8 @@ def begin_process(kind: str) -> None:
if not _collection_on():
home = get_hermes_home()
purge_pending_updates(home) # parked while on, never to be counted once off
- for directory in (markers_dir(home), setup_markers_dir(home)): # likewise pending exits/setups
+ latches = home / "telemetry" / "shared_metrics" / ONBOARDING_LATCH_DIRNAME # an opt-out outside Desktop
+ for directory in (markers_dir(home), setup_markers_dir(home), latches): # likewise pending exits/setups
shutil.rmtree(directory, ignore_errors=True)
return
from gateway.status import get_process_start_time
diff --git a/tests/hermes_cli/test_shared_metrics_reliability.py b/tests/hermes_cli/test_shared_metrics_reliability.py
index 39bf3a6fcbf..b16e7b3022b 100644
--- a/tests/hermes_cli/test_shared_metrics_reliability.py
+++ b/tests/hermes_cli/test_shared_metrics_reliability.py
@@ -171,7 +171,8 @@ def test_begin_process_marks_then_stamps_clean_and_crash(marks, monkeypatch):
def test_opted_out_start_purges_markers_left_while_opted_in(marks, monkeypatch):
from hermes_cli.observability import shared_metrics_setup as setup_metrics
- left = [process_metrics.markers_dir(marks.home) / "cli-1.json", setup_metrics.markers_dir(marks.home) / "tui-1-1.json"]
+ left = [process_metrics.markers_dir(marks.home) / "cli-1.json", setup_metrics.markers_dir(marks.home) / "tui-1-1.json",
+ marks.home / "telemetry" / "shared_metrics" / "desktop_onboarding" / "provider.completed"] # CLI opt-out
for marker in left:
marker.parent.mkdir(parents=True)
marker.write_text(json.dumps({"pid": 1, "started_at": 0, "surface": "tui", "provider": "xai", "state": "running"}))