Skip to content

🪢 feat: Langfuse Connection Configuration - #94

Open
dustinhealy wants to merge 21 commits into
mainfrom
langfuse-connection-ui
Open

🪢 feat: Langfuse Connection Configuration#94
dustinhealy wants to merge 21 commits into
mainfrom
langfuse-connection-ui

Conversation

@dustinhealy

@dustinhealy dustinhealy commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Depends on danny-avila/LibreChat#14107

The LibreChat PR provides the dedicated tenant Langfuse connection API and encrypted secret storage. Until a data-provider release defines the langfuse schema group, this PR includes a forward-compatible schema shim that self-disables once the dependency is updated.

Summary

Adds a tenant Langfuse export section to Configuration -> Features, gated by LibreChat's fanout capability.

  • Reads and writes through LibreChat's dedicated Langfuse connection API.
  • Uses deployment-approved destination keys rather than arbitrary URLs.
  • Shows masked public and secret keys without returning the stored secret.
  • Uses Save & enable for new or edited credentials, with implicit verification before persistence.
  • Shows one Enable or Disable action for a saved connection; these actions preserve the stored secret and skip credential verification.
  • Tests saved credentials on load and preserves in-progress edits across shared query refreshes.
  • Supports broad config admins and section-scoped manage:configs:langfuse admins.
  • Includes dedicated connection state in configured counts and Show configured only filtering.

Validation

  • Full suite: 775 tests passing
  • TypeScript, ESLint, and Prettier checks
  • Coordinated correctness reviews with Opus and Cursor across this PR and LibreChat #14108

Change Type

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes work

@upman upman self-assigned this Jul 10, 2026
@upman

upman commented Jul 10, 2026

Copy link
Copy Markdown
Screen.Recording.2026-07-10.at.18.02.00.mov

@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@upman
upman marked this pull request as ready for review July 10, 2026 15:00
@upman

upman commented Jul 10, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6233bffd3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/langfuse.ts Outdated
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/server/langfuse.ts Outdated
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx Outdated
Comment thread src/server/langfuse.ts Outdated
Comment thread src/server/config.ts
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/ConfigPage.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
dustinhealy and others added 14 commits August 4, 2026 04:04
Surface a per-tenant Langfuse connection section (enabled, base URL, public
key, secret key) in the admin config UI. It saves through the existing
/api/admin/config field API.

The pinned librechat-data-provider (0.8.509) predates the langfuse config
group, so a forward-compat shim extends configSchema locally until a
data-provider version defining langfuse is published and pinned, mirroring the
READ_AUDIT_LOG capability shim. The shim no-ops once upstream ships it.
Custom section renderer for the Langfuse config: enable toggle, host, public
key, a masked (PasswordInput) secret that is write-only and only sent on change,
the configured-key fingerprint returned by the backend, and a Test connection
action. Adds an admin-gated testLangfuseConnectionFn that validates credentials
against the Langfuse public projects endpoint.
Inject the langfuse section as a SchemaField instead of extending the pinned
data-provider schema, which mixed zod v4 (app) with v3 (data-provider) and left
the section unintrospected so it fell back to the generic renderer. Read saved
values from parentValue (the base config slice) rather than getValue leaf paths,
which only resolve edited/scope values, so a configured connection repopulates
on reload with the secret redacted and its fingerprint shown.
@dustinhealy
dustinhealy force-pushed the langfuse-connection-ui branch from 447ea6c to dc3d115 Compare August 4, 2026 11:10
Comment thread src/components/configuration/ConfigPage.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx Outdated
The load-time effect called testLangfuseConnectionFn, which requires manage:configs:langfuse, without checking the section's disabled (read-only) prop, so a read-only viewer would trigger a failing verification on every visit. Guard the effect on disabled and add a regression test.

@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 using high effort and found 2 potential issues.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 21ec9ef. Configure here.

Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx
…gured

The read-only guard forced the verification state to idle, which renders as "not configured" and misleads viewers who can still see the stored, masked connection. A configured connection viewed read-only now shows as unverified instead, and the in-flight request marker and tested-connection ref are cleared so switching back to an editable view re-verifies from scratch rather than skipping on a stale marker.
Comment thread src/components/configuration/sections/LangfuseRenderer.tsx Outdated
The connection-load effect and handleCancel blanked the stored destination when the server dropped it from the allowlist, which set destinationChanged, forced edit mode, and left an enabled connection impossible to disable until a replacement was picked. Preserve the stored destination instead, so disable stays available; a de-allowlisted destination simply shows as unselected in the picker.

Also await the read-only "not verified" label in its regression, since that label is set in a follow-up effect and a slower CI run had not painted it yet, and add a regression covering the disable action for an out-of-allowlist stored destination.
@upman

upman commented Aug 10, 2026

Copy link
Copy Markdown

@dustinhealy The secret key field should show the redacted secret key value

Screenshot 2026-08-10 at 23 55 15

Another piece of feedback I got was to mirror langfuse's API key provisioning screen where it shows secret key first and then public key

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.

3 participants