fix(desktop): honor the telemetry opt-out from the shell profile (#16563)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
3dfe373fdd
commit
78c9fcaafc
5 files changed
+14
No files matched your search
@@ -979,9 +979,11 @@ describe("DesktopBackendConfiguration", () => {
|
||||
|
||||
const previousWslEnv = process.env.WSLENV;
|
||||
const previousDisabled = process.env.OTEL_SDK_DISABLED;
|
||||
const previousTelemetry = process.env.T3CODE_TELEMETRY_ENABLED;
|
||||
try {
|
||||
delete process.env.WSLENV;
|
||||
process.env.OTEL_SDK_DISABLED = "true";
|
||||
process.env.T3CODE_TELEMETRY_ENABLED = "false";
|
||||
|
||||
yield* Effect.gen(function* () {
|
||||
const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
|
||||
@@ -989,6 +991,8 @@ describe("DesktopBackendConfiguration", () => {
|
||||
|
||||
assert.equal(config.env.OTEL_SDK_DISABLED, "true");
|
||||
assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED");
|
||||
assert.equal(config.env.T3CODE_TELEMETRY_ENABLED, "false");
|
||||
assert.include((config.env.WSLENV ?? "").split(":"), "T3CODE_TELEMETRY_ENABLED");
|
||||
}).pipe(
|
||||
Effect.provide(
|
||||
DesktopBackendConfiguration.layer.pipe(
|
||||
@@ -1009,6 +1013,7 @@ describe("DesktopBackendConfiguration", () => {
|
||||
} finally {
|
||||
restoreEnv("WSLENV", previousWslEnv);
|
||||
restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
|
||||
restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
|
||||
}
|
||||
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
|
||||
);
|
||||
|
||||
@@ -101,6 +101,7 @@ const DESKTOP_BACKEND_ENV_NAMES = [
|
||||
const WSL_FORWARDED_ENV_NAMES = [
|
||||
"OPENAI_API_KEY",
|
||||
"ANTHROPIC_API_KEY",
|
||||
"T3CODE_TELEMETRY_ENABLED",
|
||||
// Otherwise the WSL server keeps exporting to endpoints from the bootstrap.
|
||||
"T3CODE_OTEL_SDK_DISABLED",
|
||||
"OTEL_SDK_DISABLED",
|
||||
|
||||
@@ -268,11 +268,13 @@ describe("DesktopShellEnvironment", () => {
|
||||
envOutput({
|
||||
PATH: "/home/linuxbrew/.linuxbrew/bin:/usr/bin",
|
||||
SSH_AUTH_SOCK: "/tmp/secretive.sock",
|
||||
T3CODE_TELEMETRY_ENABLED: "false",
|
||||
}),
|
||||
});
|
||||
|
||||
assert.equal(env.PATH, "/home/linuxbrew/.linuxbrew/bin:/usr/bin");
|
||||
assert.equal(env.SSH_AUTH_SOCK, "/tmp/secretive.sock");
|
||||
assert.equal(env.T3CODE_TELEMETRY_ENABLED, "false");
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ const LOGIN_SHELL_ENV_NAMES = [
|
||||
"XDG_SESSION_DESKTOP",
|
||||
"XDG_SESSION_TYPE",
|
||||
"WAYLAND_DISPLAY",
|
||||
"T3CODE_TELEMETRY_ENABLED",
|
||||
] as const;
|
||||
const WINDOWS_PROFILE_ENV_NAMES = ["PATH", "FNM_DIR", "FNM_MULTISHELL_PATH"] as const;
|
||||
const LOCALE_ENV_NAMES = ["LANG", "LC_ALL", "LC_CTYPE"] as const;
|
||||
@@ -450,6 +451,8 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix
|
||||
"XDG_DATA_HOME",
|
||||
"XDG_RUNTIME_DIR",
|
||||
"WAYLAND_DISPLAY",
|
||||
// The telemetry opt-out is documented as a shell variable; GUI launches never see it.
|
||||
"T3CODE_TELEMETRY_ENABLED",
|
||||
] as const) {
|
||||
if (!config.env[name] && shellEnvironment[name]) {
|
||||
config.env[name] = shellEnvironment[name];
|
||||
|
||||
@@ -9,3 +9,6 @@ raw provider events, or child-agent output. Child-agent token use is excluded fr
|
||||
|
||||
To disable collection, set `T3CODE_TELEMETRY_ENABLED=false` in the server's environment before
|
||||
starting it. This stops product events from being recorded or sent.
|
||||
|
||||
The desktop app reads the variable from your shell profile (for example `~/.zshrc`) on macOS and
|
||||
Linux, so export it there and restart the app. On Windows, set it as a user environment variable.
|
||||
Reference in new issue
Block a user