Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,16 +961,20 @@ 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;
const config = yield* configuration.resolveWsl({ port: 5050, distro: null });

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(
Expand All @@ -991,6 +995,7 @@ describe("DesktopBackendConfiguration", () => {
} finally {
restoreEnv("WSLENV", previousWslEnv);
restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
}
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/backend/DesktopBackendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const DESKTOP_BACKEND_ENV_NAMES = [
const WSL_FORWARDED_ENV_NAMES = [
"OPENAI_API_KEY",
"ANTHROPIC_API_KEY",
"T3CODE_TELEMETRY_ENABLED",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// Otherwise the WSL server keeps exporting to endpoints from the bootstrap.
"T3CODE_OTEL_SDK_DISABLED",
"OTEL_SDK_DISABLED",
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/shell/DesktopShellEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}),
);

Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/src/shell/DesktopShellEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
3 changes: 3 additions & 0 deletions docs/user/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Loading