Skip to content

feat(telemetry): record a host's country and US state for location breakdowns - #682

Merged
promptclickrun merged 1 commit into
mainfrom
telemetry/host-country-state
Oct 30, 2026
Merged

promptclickrun merged 1 commit into
mainfrom
telemetry/host-country-state

Conversation

@promptclickrun

Copy link
Copy Markdown
Owner

The usage dashboard can't break model choice, host OS or agents per host down by location, because host telemetry records no location at all. This adds the host's country and, for a US host, its state.

What changes

  • Host reports only. After a host batch passes validation, the Worker adds country (the two-letter code Cloudflare's edge assigns to the connection) and usState (one of the 50 states or DC) to each event's properties.
  • Nothing finer. No city, postal code, coordinates or address. ai.location.ip stays 0.0.0.0. Unknown (XX) and Tor (T1) connections get nothing, and a US region outside the state list keeps only the country.
  • Not spoofable. The values come from request.cf, after the allowlist, so a host that sends country or usState in its context has them dropped like any other unknown key.
  • App, notification-extension and relay reports carry no location. The App Store privacy label is unchanged.
  • Docs: docs/TELEMETRY.md gets a Host location section, including that a cloud or VPN host reports its server's location, and docs/SECURITY_AND_PRIVACY.md points to it.

The public privacy policy on bighelp.app needs one matching sentence. That's a separate change in bighelp-site, and the Worker shouldn't be deployed before it ships.

How you tested it

  • New test/geo.test.ts (14 tests): codes for US and other countries, DC, territories, unknown and Tor, non-state US regions, missing cf; forwarded host events carry both values and no city, postal code, coordinates or client address; app batches get none; client-sent values are dropped and can't override. With the feature switched off, 3 of the forwarding tests fail.
  • pnpm test (251 passed), pnpm typecheck and wrangler deploy --dry-run pass.

Created with Claude Opus 5.5 in Hermes Agent.

Host reports now carry where the host connects from: the two-letter
country Cloudflare's edge assigns to the request and, for a US host, the
state (50 states plus DC). The Worker adds both after validation, so a
host can't set or change them, and keeps nothing finer: no city, postal
code, coordinates or address. App, notification-extension and relay
reports stay location-free.

This lets the usage dashboard break models, OS and agents per host down
by location. The docs describe the new values and note that a cloud or
VPN host reports its server's location, not its owner's.
@promptclickrun promptclickrun self-assigned this Oct 30, 2026
@promptclickrun
promptclickrun merged commit b7900ed into main Oct 30, 2026
2 checks passed
@promptclickrun
promptclickrun deleted the telemetry/host-country-state branch October 30, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant