Detect and log terminal/IDE host in telemetry#5315
Conversation
Adds env-based host detection (TERM_PROGRAM, TERMINAL_EMULATOR, CURSOR_TRACE_ID, __CFBundleIdentifier) returning an enum value (vscode, cursor, jetbrains, terminal, etc.). The result is added to the user agent as host/<value> and to the CLI telemetry ExecutionContext as a new Host field. Includes a best-effort vscode-copilot sentinel that lights up when Copilot agent env vars are seen alongside VSCode. The exact env vars Copilot sets in agent-mode terminals are not stable yet; this is a coarse signal to be refined once we see real telemetry. Co-authored-by: Isaac
Approval status: pending
|
Collapse Cursor/Windsurf/code-server into a single 'vscode' label rather than relying on speculative discriminators (ToDesktop IDs aren't stable identifiers; the path-based check is substring-matching a string outside our control). We can split forks back out later if/when we observe a real stable signal. Also drops unverified entries (Hyper, Tabby, Zed) that were guesses. Co-authored-by: Isaac
Host and 'is Copilot/agent active' are two independent dimensions. Mixing them into one enum value (vscode-copilot) makes it awkward to compute populations like "VSCode users WITHOUT the Copilot extension". Drop the sentinel from this PR; agent/extension detection should land as its own dimension once we've verified the actual env signals. Co-authored-by: Isaac
|
Commit: 2744ae9 |
| return HostJetBrains | ||
| } | ||
|
|
||
| return HostUnknown |
There was a problem hiding this comment.
Should we keep the (sanitized) value? Having categorization on the server side makes the logic forward compatible.
Why
Today we have no way to tell whether the CLI is being run from a raw terminal or from inside an IDE (VSCode, Cursor, IntelliJ, etc.). We want that signal so we can answer questions like:
Changes
Adds env-var-based host detection in
libs/cmdio/host.go. Surfaces the result two ways:host/vscode,host/jetbrains,host/iterm,host/unknown, etc.Hostfield on the telemetryExecutionContext.Scope is deliberately narrow. Only detections backed by direct observation or upstream docs are shipped:
vscode: covers vanilla VSCode and any fork (Cursor, Windsurf, code-server). Forks don't expose a stable, trustworthy discriminator in env, so we don't try to split them.jetbrains,apple-terminal,iterm,warp,wezterm,ghosttyunknownfor everything else (raw shells, terminals we don't recognize yet)What's deliberately NOT in this PR
Detecting whether a user has the Copilot extension active, or whether Claude Code / Cursor Agent is driving the CLI, is a separate dimension. We want it to be independent of host so the analyses above stay clean: "VSCode users WITHOUT Copilot" should be a join across two dimensions, not a single enum value. Conflating them (e.g. emitting
vscode-copilotas a single host value) would make that query awkward. Agent/extension detection will land as its own field once we've verified the actual env signals.Privacy: enum-only values, no raw env values, no paths, no versions.
Test plan