πͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
Langfuse Review Checklist
This is the canonical shared review checklist for Langfuse.
Database Migrations
ClickHouse
packages/shared/clickhouse/migrations/canonicalis the single canonical migration-template tree for both deployment modes. Every cluster-aware DDL position must use{CLICKHOUSE_CLUSTER_CLAUSE}instead of a literalON CLUSTERclause.- Use
{CLICKHOUSE_REPLICATION_PREFIX}only for a table engine that should be replicated in clustered mode and plain in unclustered mode. Do not apply it globally: some tables intentionally use a plain engine in both modes. - Every metadata
ALTER(ADD/DROP/MODIFY COLUMN,ADD/DROP INDEX) in a new migration must add{CLICKHOUSE_CLUSTERED_ONLY: SETTINGS alter_sync = 2}, including files that contain only oneALTERβ the race is across migration files, not within one. Mutation-generating statements use{CLICKHOUSE_CLUSTERED_ONLY: SETTINGS mutations_sync = 2}.alter_syncdefaults to1, so without it the statement returns once the initiating replica has bumped the table's metadata version, and the next migration file's firstALTERon that table can hit a replica still on the old version, aborting the run withcode 517because the replica metadata version is behind the common metadata version.mutations_syncdoes not substitute foralter_sync: it governs mutation completion, not metadata propagation. The renderer omits these fragments in unclustered mode. Do not retrofit these settings into already-shipped migrations solely for consistency; preserve historical output unless a forward fix deliberately changes it. - Run
prepareMigrations.test.tswhen migrations or their renderer change. It must render both modes with no unresolved tokens and keep both historical outputs byte-for-byte unchanged. - Migrations must not use
CREATE OR REPLACE VIEW(norCREATE OR REPLACE TABLE/EXCHANGE TABLES): the atomic replace requiresrenameat2, which fails on NFS-backed self-hosted deployments such as ClickHouse-on-EFS (GitHub issue #14906). Plain views are redefined withDROP VIEW IF EXISTS <name>;followed byCREATE VIEW <name> AS ...in the same migration file β the migration runner enablesx-multi-statement=true, and every statement should stay idempotent (IF EXISTS/IF NOT EXISTS) so a dirty migration can be re-run. - Materialized views must never be dropped and recreated while their source table receives inserts β rows written between
DROPandCREATEare silently and permanently missing from the target table. Redefine the SELECT withALTER TABLE <mv> MODIFY QUERY ...instead, altering the target table(s) first when columns change. - For rationale and full patterns, see "Langfuse-Specific Rules" in the
clickhouse-best-practicesskill. - When adding new indexes on ClickHouse, ensure that there is a corresponding
MATERIALIZE INDEXstatement in the same migration. The materialization can useSETTINGS mutations_sync = 2if they operate on smaller tables, but may timeout otherwise. - All ClickHouse queries on project-scoped tables (traces, observations, scores, events, sessions, etc.) must include
WHERE project_id = {projectId: String}filter to ensure proper tenant isolation and that queries only access data from the intended project. - For operations on the
eventstable, you must never use theFINALkeyword as it kills performance.eventsis built so thatFINALis never required.
Postgres
- Most
schema.prismachanges should produce a change inpackages/shared/prisma/migrations. - All Prisma queries on project-scoped tables must include
projectIdin the WHERE clause (e.g.,where: { id: traceId, projectId }) to ensure proper tenant isolation and that queries only access data from the intended project. - Raw SQL that references the
datasetstable, including joins and CTEs, must not useSELECT *ortable.*; use an explicit safe column projection. Aggregate expressions such asCOUNT(*)are fine. Access secret-bearing dataset fields only through the centralized remote experiment delivery helper.
Environment Variables
- Environment variables should be imported from the
env.mjs/tsfile of the respective package and not fromprocess.env.*to ensure validation and typing.
Redis Invocations
- Highlight usage of
redis.callinvocations. Those may have suboptimal redis cluster routing and will raise errors. Instead, use the native call patterns. Example:await redis?.call("SET", key, "1", "NX", "EX", TTLSeconds);should useawait redis?.set(key, "1", "EX", TTLSeconds, "NX");instead.
New Concepts in Shared Code
- When a change adds vocabulary to shared backend code β a field on a shared schema or payload, an option on a shared signature, an enum member, an env toggle, a branch for one caller β or concludes that no change is needed, review it against
new-concepts.mdin thebackend-dev-guidelinesskill.
Langfuse Cloud
- When attempting to confirm if the current environment is Langfuse Cloud in the frontend, use the
useLangfuseCloudRegionhook and never environment variables directly.
Banner Height System
- Use
top-banner-offsetinstead oftop-0for any elements that are positionedsticky,fixed, orabsolutewith a global reference point (e.g.,top-0). This ensures proper spacing when system banners (payment, maintenance, etc.) are displayed. - The banner height is managed through CSS variables (
--banner-heightand--banner-offset) defined inweb/src/styles/globals.css. - Banner components (like PaymentBanner) dynamically update
--banner-heightusing ResizeObserver to track their actual height, ensuring accurate positioning even when banners resize (e.g., on mobile wrapping). - Available Tailwind utilities:
top-banner-offset/pt-banner-offset- For sticky/fixed/absolute positioning and paddingh-screen-with-banner/min-h-screen-with-banner- For full-height containers accounting for banners
Security
- For changes that accept a user-supplied URL, host,
endpoint,baseURL, or webhook target, or that issue a new outbound HTTP request, run the sharedsecurity-reviewskill and treat itsoutbound-url-validation.mddefenses (save-time validation + use-time / connection-time validation + redirect-time validation) as required. Plainfetch(<userUrl>)or SDK init withendpoint: <userUrl>without one of the canonical validators (validateLlmConnectionBaseURL,validateWebhookURL,validateBlobStorageEndpoint, or a new wrapper aroundvalidateOutboundUrlHost) is a finding. - For changes that add a new integration, secret-bearing field, redirect
follower, RBAC scope, product analytics, browser monitoring, or session
replay, run the rest of the
security-review/references/checklist.md. - For changes that shape what a read route returns β a repository or domain
converter, a
Safe*type, a response projection β a catch-all branch that returns the stored value for unhandled types, or anas Safe*assertion standing in place of a sanitizer, is a finding: feature read scopes are held by VIEWER. Seesecurity-review/references/secret-read-paths.md.
Prisma errors
- Do not inline
instanceof Prisma.PrismaClientKnownRequestError && code === "P2025". ReuseisPrismaRecordNotFoundError(packages/shared/src/server/prismaErrors.ts, re-exported from@langfuse/shared/src/server) andisRecordNotFoundErrorinworker(worker/src/features/integrations/prismaErrors.ts). A true result maps toLangfuseNotFoundError(or the domain not-found subclass) so a missing row is a 404, not a 500.
JavaScript / TypeScript Style
- use concat instead of spread to avoid stack overflow with large arrays
Seeder
- make sure that for new features with data model changes, the database seeder is adjusted.
API Documentation
- Whenever a file in
web/src/features/public-api/typeschanges, thefern/apisdefinition probably needs to be adjusted, too. nullishtypes should map tooptional<nullable<T>>in fern.nullabletypes should map tonullable<T>in fern.optionaltypes should map tooptional<T>in fern.