[codex] Structure telemetry identity errors - #3306
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR refactors telemetry identity error handling to use structured, typed error classes instead of a generic error. The core fallback logic remains unchanged, and comprehensive tests verify the new error structure. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
One convention finding on the new telemetry identity error classes. Details inline.
Posted via Macroscope — Effect Service Conventions
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate e855c40
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate f7c377b
Summary
catchTags, treating onlyNotFoundas absence and refusing to overwrite the anonymous-id path after other read failuresTests
vp test apps/server/src/telemetry/Identify.test.tsvp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Changes how telemetry user IDs are derived and persisted when auth files are missing or corrupt; mis-handling could affect analytics identity stability but scope is limited to telemetry identification.
Overview
Replaces the single hash error with typed telemetry identity errors (read, decode, generate, persist, hash) that keep the original
causebut use fixed messages that do not echo nested cause text.getTelemetryIdentifierForHomeresolves codex → claude → anonymous: only NotFound counts as “missing”; other read failures are logged with structured annotations (errorTag,source,filePath,causeKind, no rawcauseor secrets) and the flow falls through to the next source.upsertAnonymousIdreuses an existing file when readable and does not write a new anonymous id after a non-NotFound read failure (can returnnullinstead of minting an id).getTelemetryIdentifierdelegates to the new home-directory API.Adds
Identify.test.tsfor anonymous reuse, malformed Codex JSON fallback/logging, and directory-at-anonymous-path behavior.Reviewed by Cursor Bugbot for commit f7c377b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure telemetry identity errors with typed error classes and source-aware logging
TelemetryIdentityReadError,TelemetryIdentityDecodeError,TelemetryAnonymousIdGenerationError,TelemetryAnonymousIdPersistenceError,TelemetryIdentityHashError) that carry source, filePath, and cause fields.logTelemetryIdentityErrorto emit structured warnings with consistent annotations (errorTag, source, causeKind, platformReason, errorStack).Option.nonefor silent fallback; other read failures propagate as typed errors, preventing anonymous id from being silently overwritten on non-NotFound errors.getTelemetryIdentifierForHometo resolve identity across Codex → Claude → anonymous sources deterministically, returningnullwhen all sources fail.upsertAnonymousIdnow propagates non-NotFound read failures instead of silently overwriting, which is a behavioral change for degraded filesystem states.Macroscope summarized f7c377b.