Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(host): keep test hosts out of usage analytics

leepokai2436643d8b97
diff --git a/docs/features/analytics.md b/docs/features/analytics.md
index 17de99c7..7d50d03e 100644
--- a/docs/features/analytics.md
+++ b/docs/features/analytics.md
@@ -21,7 +21,8 @@ lives in `web/app/privacy/page.tsx`: keep it true.
- **Location, never the IP.** The project's GeoIP transformation turns the sender's IP into an
approximate location (`$geoip_country_name`, `$geoip_city_name`, …), then the project's
*Discard client IP data* drops the IP before storage.
-- `env` is `main` or `dev`; filter dev out in PostHog.
+- `env` is `main` or `dev`; filter dev out in PostHog. Debug host builds (`cargo test`, `cargo run`)
+ send nothing: every e2e test starts a fresh host that would count as a new user.
## Where events come from
diff --git a/host/src/analytics.rs b/host/src/analytics.rs
index fb542643..edae1c9c 100644
--- a/host/src/analytics.rs
+++ b/host/src/analytics.rs
@@ -336,6 +336,11 @@ pub async fn flush_before_exit(hub: &Hub) {
}
async fn send(batch: &[Value]) -> bool {
+ // Debug builds (`cargo test`, `cargo run`) are throwaway hosts: each e2e test's fresh
+ // home would count as a new user, and one built with `CODYNC_ENV=main` lands in production.
+ if cfg!(debug_assertions) {
+ return true;
+ }
let body = json!({"api_key": TOKEN, "batch": batch});
match crate::http().post(BATCH_URL).json(&body).timeout(Duration::from_secs(15)).send().await {
Ok(r) if r.status().is_success() => true,