From 6e0f6469df93957a310ac4b5e5aa28dd95f47084 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:47:00 +0000 Subject: [PATCH 1/3] chore(web): remove langfuse integration Sourcebot no longer uses Langfuse, so drop the integration entirely: - Remove the `langfuse-vercel` `LangfuseExporter` registration from `instrumentation.ts`. This was the only consumer of `@vercel/otel`'s `registerOTel`, so `@vercel/otel` is dropped as well. - Remove the browser-side `LangfuseWeb` feedback score from `answerCard.tsx`, along with the now-unused `traceId` prop. `metadata.traceId` is still produced and consumed by the PostHog analytics paths. - Drop the `langfuseTraceId` key from the AI SDK `experimental_telemetry` metadata. The telemetry block itself is left in place, gated on `SOURCEBOT_TELEMETRY_PII_COLLECTION_ENABLED` as before. - Remove `LANGFUSE_SECRET_KEY`, `NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY`, and `NEXT_PUBLIC_LANGFUSE_BASE_URL` from the env schemas and the Dockerfile. Co-authored-by: Brendan Kellam <10233483+brendan-kellam@users.noreply.github.com> --- CHANGELOG.md | 3 ++ Dockerfile | 10 ---- packages/shared/src/env.client.ts | 4 -- packages/shared/src/env.server.ts | 2 - packages/web/package.json | 3 -- packages/web/src/ee/features/chat/agent.ts | 3 -- .../chat/components/chatThread/answerCard.tsx | 17 +------ .../chatThread/chatThreadListItem.tsx | 1 - packages/web/src/instrumentation.ts | 17 ------- yarn.lock | 48 ------------------- 10 files changed, 4 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a630e4f..db0e58dc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed +- Removed the Langfuse integration, along with the `langfuse` and `langfuse-vercel` dependencies and the `LANGFUSE_SECRET_KEY`, `NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY`, and `NEXT_PUBLIC_LANGFUSE_BASE_URL` environment variables. + ### Fixed - Upgraded `brace-expansion` to `^1.1.17`/`^2.1.3`/`^5.0.8`. [#1527](https://github.com/sourcebot-dev/sourcebot/pull/1527) - Upgraded `tar` to `^7.5.22`. [#1472](https://github.com/sourcebot-dev/sourcebot/pull/1472) diff --git a/Dockerfile b/Dockerfile index 4a1b016c7..e18965663 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,6 @@ ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN -ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY -ARG NEXT_PUBLIC_LANGFUSE_BASE_URL ARG NEXT_PUBLIC_BUILD_COMMIT_SHA FROM node:24-alpine3.23 AS node-alpine @@ -54,10 +52,6 @@ ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN -ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY -ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY -ARG NEXT_PUBLIC_LANGFUSE_BASE_URL -ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL ARG NEXT_PUBLIC_BUILD_COMMIT_SHA ENV NEXT_PUBLIC_BUILD_COMMIT_SHA=$NEXT_PUBLIC_BUILD_COMMIT_SHA @@ -138,10 +132,6 @@ ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN ENV NEXT_PUBLIC_SENTRY_BACKEND_DSN=$NEXT_PUBLIC_SENTRY_BACKEND_DSN -ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY -ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY -ARG NEXT_PUBLIC_LANGFUSE_BASE_URL -ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL ARG NEXT_PUBLIC_BUILD_COMMIT_SHA ENV NEXT_PUBLIC_BUILD_COMMIT_SHA=$NEXT_PUBLIC_BUILD_COMMIT_SHA # ----------- diff --git a/packages/shared/src/env.client.ts b/packages/shared/src/env.client.ts index ae9eae94d..31096b725 100644 --- a/packages/shared/src/env.client.ts +++ b/packages/shared/src/env.client.ts @@ -6,15 +6,11 @@ export const env = createEnv({ client: { NEXT_PUBLIC_SENTRY_BACKEND_DSN: z.string().optional(), NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().optional(), - NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY: z.string().optional(), - NEXT_PUBLIC_LANGFUSE_BASE_URL: z.string().optional(), NEXT_PUBLIC_BUILD_COMMIT_SHA: z.string().optional(), }, runtimeEnvStrict: { NEXT_PUBLIC_SENTRY_BACKEND_DSN: process.env.NEXT_PUBLIC_SENTRY_BACKEND_DSN, NEXT_PUBLIC_SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, - NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY, - NEXT_PUBLIC_LANGFUSE_BASE_URL: process.env.NEXT_PUBLIC_LANGFUSE_BASE_URL, NEXT_PUBLIC_BUILD_COMMIT_SHA: process.env.NEXT_PUBLIC_BUILD_COMMIT_SHA, }, emptyStringAsUndefined: true, diff --git a/packages/shared/src/env.server.ts b/packages/shared/src/env.server.ts index 8e082fe63..2edd9050c 100644 --- a/packages/shared/src/env.server.ts +++ b/packages/shared/src/env.server.ts @@ -345,8 +345,6 @@ const options = { DEBUG_ENABLE_REACT_SCAN: booleanSchema.default('false'), DEBUG_ENABLE_REACT_GRAB: booleanSchema.default('false'), - LANGFUSE_SECRET_KEY: z.string().optional(), - SOURCEBOT_DEMO_EXAMPLES_PATH: z.string().optional(), DISABLE_API_KEY_USAGE_FOR_NON_OWNER_USERS: booleanSchema.default('false'), diff --git a/packages/web/package.json b/packages/web/package.json index 280de50b2..2b9af958c 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -117,7 +117,6 @@ "@uidotdev/usehooks": "^2.4.1", "@uiw/codemirror-themes": "^4.23.6", "@uiw/react-codemirror": "^4.23.0", - "@vercel/otel": "^1.13.0", "@viz-js/lang-dot": "^1.0.4", "@xiechao/codemirror-lang-handlebars": "^1.0.4", "ai": "^6.0.167", @@ -156,8 +155,6 @@ "graphql": "^16.9.0", "http-status-codes": "^2.3.0", "input-otp": "^1.4.2", - "langfuse": "^3.38.4", - "langfuse-vercel": "^3.38.4", "linguist-languages": "^9.3.1", "lucide-react": "^1.7.0", "mermaid": "^11.16.0", diff --git a/packages/web/src/ee/features/chat/agent.ts b/packages/web/src/ee/features/chat/agent.ts index 27959c746..5a13c6f79 100644 --- a/packages/web/src/ee/features/chat/agent.ts +++ b/packages/web/src/ee/features/chat/agent.ts @@ -789,9 +789,6 @@ const createAgentStream = async ({ }, experimental_telemetry: { isEnabled: env.SOURCEBOT_TELEMETRY_PII_COLLECTION_ENABLED === 'true', - metadata: { - langfuseTraceId: traceId, - }, }, onError: (error) => { logger.error(error); diff --git a/packages/web/src/ee/features/chat/components/chatThread/answerCard.tsx b/packages/web/src/ee/features/chat/components/chatThread/answerCard.tsx index 3ed22370e..545cbf441 100644 --- a/packages/web/src/ee/features/chat/components/chatThread/answerCard.tsx +++ b/packages/web/src/ee/features/chat/components/chatThread/answerCard.tsx @@ -15,8 +15,6 @@ import { convertLLMOutputToPortableMarkdown } from "@/features/chat/utils"; import { submitFeedback } from "@/features/chat/actions"; import { isServiceError } from "@/lib/utils"; import useCaptureEvent from "@/hooks/useCaptureEvent"; -import { LangfuseWeb } from "langfuse"; -import { env } from "@sourcebot/shared/client"; import isEqual from "fast-deep-equal/react"; import { FileSource } from "@/features/chat/types"; @@ -24,20 +22,13 @@ interface AnswerCardProps { answerText: string; messageId: string; chatId: string; - traceId?: string; sources: FileSource[]; } -const langfuseWeb = env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY ? new LangfuseWeb({ - publicKey: env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY, - baseUrl: env.NEXT_PUBLIC_LANGFUSE_BASE_URL, -}) : null; - const AnswerCardComponent = forwardRef(({ answerText, messageId, chatId, - traceId, sources, }, forwardedRef) => { const markdownRendererRef = useRef(null); @@ -89,16 +80,10 @@ const AnswerCardComponent = forwardRef(({ chatId, messageId, }); - - langfuseWeb?.score({ - traceId: traceId, - name: 'user_feedback', - value: feedbackType === 'like' ? 1 : 0, - }) } setIsSubmittingFeedback(false); - }, [chatId, messageId, toast, captureEvent, traceId]); + }, [chatId, messageId, toast, captureEvent]); return (
diff --git a/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx b/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx index d6388443c..8b22eab2a 100644 --- a/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx +++ b/packages/web/src/ee/features/chat/components/chatThread/chatThreadListItem.tsx @@ -473,7 +473,6 @@ const ChatThreadListItemComponent = forwardRef ) : !isTurnInProgress && approvalRequestedParts.length === 0 && ( diff --git a/packages/web/src/instrumentation.ts b/packages/web/src/instrumentation.ts index 238495b4f..7bea4bbf0 100644 --- a/packages/web/src/instrumentation.ts +++ b/packages/web/src/instrumentation.ts @@ -1,23 +1,6 @@ import * as Sentry from '@sentry/nextjs'; -import { registerOTel } from '@vercel/otel'; -import { LangfuseExporter } from 'langfuse-vercel'; export async function register() { - if ( - process.env.LANGFUSE_SECRET_KEY && - process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY - ) { - console.log("Registering Langfuse"); - registerOTel({ - serviceName: 'sourcebot', - traceExporter: new LangfuseExporter({ - secretKey: process.env.LANGFUSE_SECRET_KEY, - publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY, - baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_BASE_URL, - }), - }); - } - if (process.env.NEXT_RUNTIME === 'nodejs') { await import('./sentry.server.config'); } diff --git a/yarn.lock b/yarn.lock index f4369d37d..7ba1fbf52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9228,7 +9228,6 @@ __metadata: "@uidotdev/usehooks": "npm:^2.4.1" "@uiw/codemirror-themes": "npm:^4.23.6" "@uiw/react-codemirror": "npm:^4.23.0" - "@vercel/otel": "npm:^1.13.0" "@viz-js/lang-dot": "npm:^1.0.4" "@xiechao/codemirror-lang-handlebars": "npm:^1.0.4" ai: "npm:^6.0.167" @@ -9273,8 +9272,6 @@ __metadata: http-status-codes: "npm:^2.3.0" input-otp: "npm:^1.4.2" jsdom: "npm:^25.0.1" - langfuse: "npm:^3.38.4" - langfuse-vercel: "npm:^3.38.4" linguist-languages: "npm:^9.3.1" lucide-react: "npm:^1.7.0" mermaid: "npm:^11.16.0" @@ -10843,21 +10840,6 @@ __metadata: languageName: node linkType: hard -"@vercel/otel@npm:^1.13.0": - version: 1.13.0 - resolution: "@vercel/otel@npm:1.13.0" - peerDependencies: - "@opentelemetry/api": ">=1.7.0 <2.0.0" - "@opentelemetry/api-logs": ">=0.46.0 <0.200.0" - "@opentelemetry/instrumentation": ">=0.46.0 <0.200.0" - "@opentelemetry/resources": ">=1.19.0 <2.0.0" - "@opentelemetry/sdk-logs": ">=0.46.0 <0.200.0" - "@opentelemetry/sdk-metrics": ">=1.19.0 <2.0.0" - "@opentelemetry/sdk-trace-base": ">=1.19.0 <2.0.0" - checksum: 10c0/720e1fd7efa3882fc147ec749d78e861d2d0644184838947c5754a8fa4e29d59e201ca54649dac4c4b75f4d932c8b62711e94f8fecd3176a96fc380eb7dd9437 - languageName: node - linkType: hard - "@vitest/expect@npm:4.1.4": version: 4.1.4 resolution: "@vitest/expect@npm:4.1.4" @@ -16904,36 +16886,6 @@ __metadata: languageName: node linkType: hard -"langfuse-core@npm:^3.38.4": - version: 3.38.4 - resolution: "langfuse-core@npm:3.38.4" - dependencies: - mustache: "npm:^4.2.0" - checksum: 10c0/65290416c379d1d628842a372127ad016b360409de07b670a72ff0ff79aa82255166571b532142b871548d562ee326f65e5cfb4e919e58520cdad633ea148bc7 - languageName: node - linkType: hard - -"langfuse-vercel@npm:^3.38.4": - version: 3.38.4 - resolution: "langfuse-vercel@npm:3.38.4" - dependencies: - langfuse: "npm:^3.38.4" - langfuse-core: "npm:^3.38.4" - peerDependencies: - ai: ">=3.2.44" - checksum: 10c0/f1781353e37ccfbf1f452be6fe9aeae548ed735c00e6d2d77c513c36b2dabeda0607bd25635a43f0047e8fa199a726cc1af8fc3f2b88501c956f55cf8d94449b - languageName: node - linkType: hard - -"langfuse@npm:^3.38.4": - version: 3.38.4 - resolution: "langfuse@npm:3.38.4" - dependencies: - langfuse-core: "npm:^3.38.4" - checksum: 10c0/9718701a4c9b0634d6365edb4ad8a06a7334d65b11ec20f209a322f3aaaef859c427ad8adf7ee1e63ffa3c3aaa49edcf8360f29bb95b6ce539ea66a65fde4217 - languageName: node - linkType: hard - "langsmith@npm:>=0.5.0 <1.0.0": version: 0.7.1 resolution: "langsmith@npm:0.7.1" From 0994e4d1c5b0b82753fd75b439cf50a5bfa9a838 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 01:00:19 +0000 Subject: [PATCH 2/3] chore: add PR link to Langfuse removal changelog entry Co-authored-by: Brendan Kellam <10233483+brendan-kellam@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db0e58dc0..ee92e3b6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Removed -- Removed the Langfuse integration, along with the `langfuse` and `langfuse-vercel` dependencies and the `LANGFUSE_SECRET_KEY`, `NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY`, and `NEXT_PUBLIC_LANGFUSE_BASE_URL` environment variables. +- Removed the Langfuse integration, along with the `langfuse` and `langfuse-vercel` dependencies and the `LANGFUSE_SECRET_KEY`, `NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY`, and `NEXT_PUBLIC_LANGFUSE_BASE_URL` environment variables. [#1536](https://github.com/sourcebot-dev/sourcebot/pull/1536) ### Fixed - Upgraded `brace-expansion` to `^1.1.17`/`^2.1.3`/`^5.0.8`. [#1527](https://github.com/sourcebot-dev/sourcebot/pull/1527) From 58f796d2bba46f688b32494abffe84dd8c5f784d Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Tue, 4 Aug 2026 18:02:52 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee92e3b6d..80f76d29f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Removed -- Removed the Langfuse integration, along with the `langfuse` and `langfuse-vercel` dependencies and the `LANGFUSE_SECRET_KEY`, `NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY`, and `NEXT_PUBLIC_LANGFUSE_BASE_URL` environment variables. [#1536](https://github.com/sourcebot-dev/sourcebot/pull/1536) +- Removed the Langfuse integration. [#1536](https://github.com/sourcebot-dev/sourcebot/pull/1536) ### Fixed - Upgraded `brace-expansion` to `^1.1.17`/`^2.1.3`/`^5.0.8`. [#1527](https://github.com/sourcebot-dev/sourcebot/pull/1527)