feat(cli): thread FERN_RUN_ID through CLI startup and Sentry#14727
Merged
Conversation
Generate a FERN_RUN_ID at CLI startup if one is not already set in the environment (e.g. by fern-api/actions/setup-cli), so all invocations in a workflow run share a single correlation ID. Tag Sentry errors with fern_run_id and github_run_id via dedicated setSentryFernRunIdTag / setSentryGithubRunIdTag helpers in telemetry/sentryRunId.ts, called once after Sentry.init().
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
…i/fern-run-id-sentry-tracking
FedeZara
approved these changes
Apr 9, 2026
Contributor
FedeZara
left a comment
There was a problem hiding this comment.
Thank you! We might want to include this logic also in CLI v2: a correlation ID is already set up, but we are not reading ENV variables for it, so the logic should slightly change.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FERN_RUN_ID(UUIDv4) at CLI startup if one is not already set in the environment — inherits the value when set upstream (e.g. byfern-api/actions/setup-cli) so all steps in a workflow share a single correlation IDfern_run_idandgithub_run_idvia dedicated helpers intelemetry/sentryRunId.ts, called once afterSentry.init()Changes
packages/cli/cli/src/fernRunId.ts—getOrCreateFernRunId()(generate or inherit) andgetFernRunId()(read-only)packages/cli/cli/src/cli.ts— callsgetOrCreateFernRunId()at the top ofrunCli()before any command runspackages/cli/cli/src/telemetry/sentryRunId.ts—setSentryFernRunIdTag(),setSentryGithubRunIdTag(), andsetSentryRunIdTags()(calls both)packages/cli/cli/src/telemetry/SentryClient.ts— callssetSentryRunIdTags()afterSentry.init()Testing
pnpm compile)fernRunId.tsis a thin env-var wrapper; Sentry tag helpers delegate entirely to the Sentry SDK