GeezerVison is showing github.com — fix(desktop): honor the telemetry opt-out from the shell profile · pingdotgg/t3code@7382e92
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/backend/DesktopBackendConfiguration.test.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -961,16 +961,20 @@ describe("DesktopBackendConfiguration", () => { | 961 | 961 |
| 962 | 962 | const previousWslEnv = process.env.WSLENV; | 963 | 963 | const previousDisabled = process.env.OTEL_SDK_DISABLED; | | 964 | + const previousTelemetry = process.env.T3CODE_TELEMETRY_ENABLED; | 964 | 965 | try { | 965 | 966 | delete process.env.WSLENV; | 966 | 967 | process.env.OTEL_SDK_DISABLED = "true"; | | 968 | + process.env.T3CODE_TELEMETRY_ENABLED = "false"; | 967 | 969 |
| 968 | 970 | yield* Effect.gen(function* () { | 969 | 971 | const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration; | 970 | 972 | const config = yield* configuration.resolveWsl({ port: 5050, distro: null }); | 971 | 973 |
| 972 | 974 | assert.equal(config.env.OTEL_SDK_DISABLED, "true"); | 973 | 975 | assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED"); | | 976 | + assert.equal(config.env.T3CODE_TELEMETRY_ENABLED, "false"); | | 977 | + assert.include((config.env.WSLENV ?? "").split(":"), "T3CODE_TELEMETRY_ENABLED"); | 974 | 978 | }).pipe( | 975 | 979 | Effect.provide( | 976 | 980 | DesktopBackendConfiguration.layer.pipe( | @@ -991,6 +995,7 @@ describe("DesktopBackendConfiguration", () => { | 991 | 995 | } finally { | 992 | 996 | restoreEnv("WSLENV", previousWslEnv); | 993 | 997 | restoreEnv("OTEL_SDK_DISABLED", previousDisabled); | | 998 | + restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry); | 994 | 999 | } | 995 | 1000 | }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), | 996 | 1001 | ); | |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/backend/DesktopBackendConfiguration.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -95,6 +95,7 @@ const DESKTOP_BACKEND_ENV_NAMES = [ | 95 | 95 | const WSL_FORWARDED_ENV_NAMES = [ | 96 | 96 | "OPENAI_API_KEY", | 97 | 97 | "ANTHROPIC_API_KEY", | | 98 | + "T3CODE_TELEMETRY_ENABLED", | 98 | 99 | // Otherwise the WSL server keeps exporting to endpoints from the bootstrap. | 99 | 100 | "T3CODE_OTEL_SDK_DISABLED", | 100 | 101 | "OTEL_SDK_DISABLED", | |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/shell/DesktopShellEnvironment.test.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -268,11 +268,13 @@ describe("DesktopShellEnvironment", () => { | 268 | 268 | envOutput({ | 269 | 269 | PATH: "/home/linuxbrew/.linuxbrew/bin:/usr/bin", | 270 | 270 | SSH_AUTH_SOCK: "/tmp/secretive.sock", | | 271 | + T3CODE_TELEMETRY_ENABLED: "false", | 271 | 272 | }), | 272 | 273 | }); | 273 | 274 |
| 274 | 275 | assert.equal(env.PATH, "/home/linuxbrew/.linuxbrew/bin:/usr/bin"); | 275 | 276 | assert.equal(env.SSH_AUTH_SOCK, "/tmp/secretive.sock"); | | 277 | + assert.equal(env.T3CODE_TELEMETRY_ENABLED, "false"); | 276 | 278 | }), | 277 | 279 | ); | 278 | 280 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/shell/DesktopShellEnvironment.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -85,6 +85,7 @@ const LOGIN_SHELL_ENV_NAMES = [ | 85 | 85 | "XDG_SESSION_DESKTOP", | 86 | 86 | "XDG_SESSION_TYPE", | 87 | 87 | "WAYLAND_DISPLAY", | | 88 | + "T3CODE_TELEMETRY_ENABLED", | 88 | 89 | ] as const; | 89 | 90 | const WINDOWS_PROFILE_ENV_NAMES = ["PATH", "FNM_DIR", "FNM_MULTISHELL_PATH"] as const; | 90 | 91 | const LOCALE_ENV_NAMES = ["LANG", "LC_ALL", "LC_CTYPE"] as const; | @@ -450,6 +451,8 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix | 450 | 451 | "XDG_DATA_HOME", | 451 | 452 | "XDG_RUNTIME_DIR", | 452 | 453 | "WAYLAND_DISPLAY", | | 454 | + // The telemetry opt-out is documented as a shell variable; GUI launches never see it. | | 455 | + "T3CODE_TELEMETRY_ENABLED", | 453 | 456 | ] as const) { | 454 | 457 | if (!config.env[name] && shellEnvironment[name]) { | 455 | 458 | config.env[name] = shellEnvironment[name]; | |
Collapse file Copy file name to clipboardExpand all lines: docs/user/telemetry.md +3Lines changed: 3 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,3 +9,6 @@ raw provider events, or child-agent output. Child-agent token use is excluded fr | 9 | 9 |
| 10 | 10 | To disable collection, set `T3CODE_TELEMETRY_ENABLED=false` in the server's environment before | 11 | 11 | starting it. This stops product events from being recorded or sent. | | 12 | + | | 13 | +The desktop app reads the variable from your shell profile (for example `~/.zshrc`) on macOS and | | 14 | +Linux, so export it there and restart the app. On Windows, set it as a user environment variable. |
|