fix(telemetry): persist alias marker on any HTTP response (TS)

Previously captureIdentify returned true only on response.ok, so a
stable PostHog 4xx (api-key revocation, schema mismatch) or any 5xx
caused every MemoryClient init to re-fire $identify forever. PostHog
person-merge is idempotent, so it is safe to mark aliased on any
response received. Only genuine network failures leave the marker
absent so the next init naturally retries.

Also downgrades the failure log lines to console.debug and stops
echoing the PostHog response body to stderr.
This commit is contained in:
Mgeeeek
2026-05-06 01:54:24 +05:30
parent d97b7e9131
commit 64487cbf31
+7 -6
View File
@@ -99,15 +99,16 @@ class UnifiedTelemetry implements TelemetryClient {
});
if (!response.ok) {
console.error(
"Telemetry identify capture failed:",
await response.text(),
);
return false;
console.debug("Telemetry identify capture failed:", response.status);
}
// Any HTTP response (2xx / 4xx / 5xx) marks the pair aliased.
// PostHog person-merge is idempotent at the person level, so a
// duplicate $identify on a recovered server is harmless. Only a
// genuine network failure (no response) leaves the marker absent
// so the next init can retry.
return true;
} catch (error) {
console.error("Telemetry identify capture failed:", error);
console.debug("Telemetry identify capture failed:", error);
return false;
}
}