Skip to content

[codex] Add Codex auth email as Langfuse user id#8

Merged
jannikmaierhoefer merged 1 commit into
mainfrom
codex/add-codex-email-user-id
Jun 4, 2026
Merged

[codex] Add Codex auth email as Langfuse user id#8
jannikmaierhoefer merged 1 commit into
mainfrom
codex/add-codex-email-user-id

Conversation

@jannikmaierhoefer
Copy link
Copy Markdown
Member

Summary

This adds an automatic user_id fallback for Langfuse traces emitted by the Codex tracing plugin. When LANGFUSE_CODEX_USER_ID or config user_id is not set, the plugin reads Codex auth from CODEX_HOME/auth.json or ~/.codex/auth.json, decodes the tokens.id_token JWT payload, and uses the email claim as the Langfuse trace user id when present.

Explicit user id configuration still takes precedence, and missing or malformed auth data is ignored silently so tracing continues to fail open.

Impact

Codex traces in Langfuse can now be grouped by the signed-in Codex user's email address without requiring extra configuration.

Validation

  • pnpm vitest run
  • pnpm run build
  • pnpm run format:check
  • pnpm run lint:tsc

@jannikmaierhoefer jannikmaierhoefer marked this pull request as ready for review June 4, 2026 12:00
@jannikmaierhoefer jannikmaierhoefer merged commit 6882ab7 into main Jun 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant