Skip to content

feat(cli): thread FERN_RUN_ID through CLI startup and Sentry#14727

Merged
fern-support merged 6 commits into
mainfrom
niels/cli/fern-run-id-sentry-tracking
Apr 9, 2026
Merged

feat(cli): thread FERN_RUN_ID through CLI startup and Sentry#14727
fern-support merged 6 commits into
mainfrom
niels/cli/fern-run-id-sentry-tracking

Conversation

@Swimburger
Copy link
Copy Markdown
Member

@Swimburger Swimburger commented Apr 7, 2026

Summary

  • Generates a FERN_RUN_ID (UUIDv4) at CLI startup if one is not already set in the environment — inherits the value when set upstream (e.g. by fern-api/actions/setup-cli) so all steps in a workflow share a single correlation ID
  • Tags Sentry errors with fern_run_id and github_run_id via dedicated helpers in telemetry/sentryRunId.ts, called once after Sentry.init()

Changes

  • packages/cli/cli/src/fernRunId.tsgetOrCreateFernRunId() (generate or inherit) and getFernRunId() (read-only)
  • packages/cli/cli/src/cli.ts — calls getOrCreateFernRunId() at the top of runCli() before any command runs
  • packages/cli/cli/src/telemetry/sentryRunId.tssetSentryFernRunIdTag(), setSentryGithubRunIdTag(), and setSentryRunIdTags() (calls both)
  • packages/cli/cli/src/telemetry/SentryClient.ts — calls setSentryRunIdTags() after Sentry.init()

Testing

  • Compiles cleanly (pnpm compile)
  • No new test files needed — fernRunId.ts is a thin env-var wrapper; Sentry tag helpers delegate entirely to the Sentry SDK

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().
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@FedeZara FedeZara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fern-support fern-support enabled auto-merge (squash) April 9, 2026 15:42
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fern-support fern-support merged commit d8366b6 into main Apr 9, 2026
59 checks passed
@fern-support fern-support deleted the niels/cli/fern-run-id-sentry-tracking branch April 9, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants