authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-10-06 13:55:06-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-06 13:55:06-07:00
log78c9fcaafcbee9e2b941d8b0129a9f968373c6b2
tree7bd9ab85d18d90afa871dbe5699fc902f72428d2
parent3dfe373fddb966101371805b0b102ae5af75b15b
signature Signed by PGP key B5690EEEBB952194

fix(desktop): honor the telemetry opt-out from the shell profile (#16563)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

5 files changed, 14 insertions(+), 0 deletions(-)

apps/desktop/src/backend/DesktopBackendConfiguration.test.ts+5
......@@ -979,9 +979,11 @@ describe("DesktopBackendConfiguration", () => {
979979
980980 const previousWslEnv = process.env.WSLENV;
981981 const previousDisabled = process.env.OTEL_SDK_DISABLED;
982 const previousTelemetry = process.env.T3CODE_TELEMETRY_ENABLED;
982983 try {
983984 delete process.env.WSLENV;
984985 process.env.OTEL_SDK_DISABLED = "true";
986 process.env.T3CODE_TELEMETRY_ENABLED = "false";
985987
986988 yield* Effect.gen(function* () {
987989 const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
......@@ -989,6 +991,8 @@ describe("DesktopBackendConfiguration", () => {
989991
990992 assert.equal(config.env.OTEL_SDK_DISABLED, "true");
991993 assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED");
994 assert.equal(config.env.T3CODE_TELEMETRY_ENABLED, "false");
995 assert.include((config.env.WSLENV ?? "").split(":"), "T3CODE_TELEMETRY_ENABLED");
992996 }).pipe(
993997 Effect.provide(
994998 DesktopBackendConfiguration.layer.pipe(
......@@ -1009,6 +1013,7 @@ describe("DesktopBackendConfiguration", () => {
10091013 } finally {
10101014 restoreEnv("WSLENV", previousWslEnv);
10111015 restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
1016 restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
10121017 }
10131018 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
10141019 );
apps/desktop/src/backend/DesktopBackendConfiguration.ts+1
......@@ -101,6 +101,7 @@ const DESKTOP_BACKEND_ENV_NAMES = [
101101const WSL_FORWARDED_ENV_NAMES = [
102102 "OPENAI_API_KEY",
103103 "ANTHROPIC_API_KEY",
104 "T3CODE_TELEMETRY_ENABLED",
104105 // Otherwise the WSL server keeps exporting to endpoints from the bootstrap.
105106 "T3CODE_OTEL_SDK_DISABLED",
106107 "OTEL_SDK_DISABLED",
apps/desktop/src/shell/DesktopShellEnvironment.test.ts+2
......@@ -268,11 +268,13 @@ describe("DesktopShellEnvironment", () => {
268268 envOutput({
269269 PATH: "/home/linuxbrew/.linuxbrew/bin:/usr/bin",
270270 SSH_AUTH_SOCK: "/tmp/secretive.sock",
271 T3CODE_TELEMETRY_ENABLED: "false",
271272 }),
272273 });
273274
274275 assert.equal(env.PATH, "/home/linuxbrew/.linuxbrew/bin:/usr/bin");
275276 assert.equal(env.SSH_AUTH_SOCK, "/tmp/secretive.sock");
277 assert.equal(env.T3CODE_TELEMETRY_ENABLED, "false");
276278 }),
277279 );
278280
apps/desktop/src/shell/DesktopShellEnvironment.ts+3
......@@ -85,6 +85,7 @@ const LOGIN_SHELL_ENV_NAMES = [
8585 "XDG_SESSION_DESKTOP",
8686 "XDG_SESSION_TYPE",
8787 "WAYLAND_DISPLAY",
88 "T3CODE_TELEMETRY_ENABLED",
8889] as const;
8990const WINDOWS_PROFILE_ENV_NAMES = ["PATH", "FNM_DIR", "FNM_MULTISHELL_PATH"] as const;
9091const LOCALE_ENV_NAMES = ["LANG", "LC_ALL", "LC_CTYPE"] as const;
......@@ -450,6 +451,8 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix
450451 "XDG_DATA_HOME",
451452 "XDG_RUNTIME_DIR",
452453 "WAYLAND_DISPLAY",
454 // The telemetry opt-out is documented as a shell variable; GUI launches never see it.
455 "T3CODE_TELEMETRY_ENABLED",
453456 ] as const) {
454457 if (!config.env[name] && shellEnvironment[name]) {
455458 config.env[name] = shellEnvironment[name];
docs/user/telemetry.md+3
......@@ -9,3 +9,6 @@ raw provider events, or child-agent output. Child-agent token use is excluded fr
99
1010To disable collection, set `T3CODE_TELEMETRY_ENABLED=false` in the server's environment before
1111starting it. This stops product events from being recorded or sent.
12
13The desktop app reads the variable from your shell profile (for example `~/.zshrc`) on macOS and
14Linux, so export it there and restart the app. On Windows, set it as a user environment variable.