Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Fix copilotStatusFromEnv to require COPILOT_OTEL_ENABLED before reporting enabled

Cursor Agent19705dbbcab9
diff --git a/cli/beacon/internal/endpoint/harness/copilot.go b/cli/beacon/internal/endpoint/harness/copilot.go
index bc84d54e..1340f9b1 100644
--- a/cli/beacon/internal/endpoint/harness/copilot.go
+++ b/cli/beacon/internal/endpoint/harness/copilot.go
@@ -87,11 +87,10 @@ func copilotStatusFromEnv(env copilotEnv, expectedEndpoint string) (TelemetrySta
if env.fileExporter != "" {
return TelemetryMisconfigured, "GitHub Copilot CLI file exporter is configured and will bypass local OTLP"
}
- enabled := truthySetting(env.enabled)
- endpoint := env.endpoint
- if !enabled && endpoint == "" {
+ if !truthySetting(env.enabled) {
return TelemetryDisabled, "GitHub Copilot CLI OTel env is not configured"
}
+ endpoint := env.endpoint
if endpoint == "" {
endpoint = "http://localhost:4318"
}
diff --git a/cli/beacon/internal/endpoint/harness/harness_test.go b/cli/beacon/internal/endpoint/harness/harness_test.go
index a598ba51..afc75204 100644
--- a/cli/beacon/internal/endpoint/harness/harness_test.go
+++ b/cli/beacon/internal/endpoint/harness/harness_test.go
@@ -612,9 +612,12 @@ func TestCopilotStatusVariants(t *testing.T) {
}{
{name: "missing export", body: `export OTHER=1`, status: TelemetryDisabled},
{name: "enabled default endpoint", body: `export COPILOT_OTEL_ENABLED=true`, status: TelemetryEnabled},
- {name: "remote endpoint", body: `export OTEL_EXPORTER_OTLP_ENDPOINT="https://example.com:4318"`, status: TelemetryMisconfigured},
- {name: "copilot endpoint enabled", body: `export COPILOT_OTEL_ENDPOINT="http://localhost:4318"`, status: TelemetryEnabled},
- {name: "standard endpoint enabled", body: `export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318`, status: TelemetryEnabled},
+ {name: "endpoint without enable flag", body: `export OTEL_EXPORTER_OTLP_ENDPOINT="https://example.com:4318"`, status: TelemetryDisabled},
+ {name: "copilot endpoint without enable flag", body: `export COPILOT_OTEL_ENDPOINT="http://localhost:4318"`, status: TelemetryDisabled},
+ {name: "standard endpoint without enable flag", body: `export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318`, status: TelemetryDisabled},
+ {name: "enabled remote endpoint", body: "export COPILOT_OTEL_ENABLED=true\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"https://example.com:4318\"", status: TelemetryMisconfigured},
+ {name: "enabled copilot endpoint", body: "export COPILOT_OTEL_ENABLED=true\nexport COPILOT_OTEL_ENDPOINT=\"http://localhost:4318\"", status: TelemetryEnabled},
+ {name: "enabled standard endpoint", body: "export COPILOT_OTEL_ENABLED=true\nexport OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318", status: TelemetryEnabled},
{name: "file exporter bypass", body: "export COPILOT_OTEL_ENABLED=true\nexport COPILOT_OTEL_FILE_EXPORTER_PATH=/tmp/copilot.jsonl", status: TelemetryMisconfigured},
}