Skip to content

ref(logging): Decouple async log context#970

Open
sentry-junior[bot] wants to merge 4 commits into
mainfrom
refactor/async-log-context
Open

ref(logging): Decouple async log context#970
sentry-junior[bot] wants to merge 4 commits into
mainfrom
refactor/async-log-context

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Bind provider-neutral correlation data to a typed async context domain so nested logs and spans inherit it without Slack-shaped logging contracts.

What changed

  • log-context.ts now owns the typed LogContext, its telemetry projection, and a strictly scoped runWithLogContext() API.
  • removed the public enterWith() mutation path.
  • LogTape and the direct-emission fallback consume the same AsyncLocalStorage.
  • agent runs bind conversation, destination, user, actor, and run correlation once at the execution boundary; downstream spans and errors only add local fields such as model ID.
  • provider-neutral field names preserve existing OpenTelemetry/Sentry attribute names.
  • tests cover nested restoration and concurrent isolation.

Checks

  • pnpm --filter @sentry/junior typecheck
  • pnpm lint
  • direct async-context concurrency check
  • focused Vitest is blocked locally because Postgres is unavailable at 127.0.0.1:54322; CI exercises the suite.

Requested by David Cramer via Junior.

--

View Junior Session

Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Jul 21, 2026 6:03am

Request Review

@dcramer
dcramer marked this pull request as ready for review July 21, 2026 05:23
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 21, 2026
Co-Authored-By: David Cramer <david@sentry.io>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ef4ac1d. Configure here.

Comment thread packages/junior/src/chat/logging.ts Outdated
Comment thread packages/junior/src/chat/log-context.ts
Co-Authored-By: David Cramer <david@sentry.io>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: high PR risk score: high labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants