Skip to content

feat(prompts): sync Langfuse prompts into the catalog - #17095

Open
AtefBellaaj wants to merge 2 commits into
atef/ai-2276-make-external-prompt-groups-read-onlyfrom
atef/ai-2274-sync-langfuse-prompts-into-the-catalog
Open

AtefBellaaj wants to merge 2 commits into
atef/ai-2276-make-external-prompt-groups-read-onlyfrom
atef/ai-2274-sync-langfuse-prompts-into-the-catalog

Conversation

@AtefBellaaj

@AtefBellaaj AtefBellaaj commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Today a Langfuse text prompt is only previewable through the connection's dry run; nothing it returns ever lands in the prompt library, so an admin who wants to actually use one of those prompts has to copy it by hand into a native PromptGroup. This change lets an admin click Sync prompts on Settings > Langfuse, or POST /api/admin/langfuse/prompts/sync directly, to pull every Langfuse text prompt into the catalog as a read-only PromptGroup pointer, each carrying a PUBLIC viewer ACL entry so every user can see it without an explicit grant.

After the change, a sync runs inside the request: it creates one PromptGroup per Langfuse text prompt and attaches the PUBLIC viewer entry; prompts of other types are skipped. The sync is append-only — it creates pointers for new Langfuse text prompts and never deletes, re-grants, or reconciles an existing group, so a prompt later deleted in Langfuse keeps its local pointer, and a second sync against the same tenant changes nothing. Per item, a duplicate-key race against an existing pointer counts as unchanged, a Mongoose validation error counts as skipped and is warned, and any other storage or grant failure aborts the run (a failed grant rolls back the group it just created) and the endpoint returns 500 { code: 'internal' }; a Langfuse transport failure instead surfaces its own upstream code, and a caller without the capability sees "You do not have permission to manage prompts." A sync already running for the tenant returns 409 already_running instead of starting a second pass. If the distributed lock is lost mid-run (lease expired, another node took over), the handler returns 503 lock_lost rather than continuing to write with a stale claim; a failed lock release is only logged, since the lease still expires on its own. The lock lease and the page cap are both configurable on librechat.yaml (langfuse.promptSync.lockLeaseMs, default 300000 ms, range 60000–3600000; langfuse.promptSync.maxPages, default 50 pages of up to 100 prompts each, range 1–1000), not an environment variable or a hard-coded constant. A new non-unique partial index on { sourceDestination, sourceProjectId, sourcePromptName } backs the lookup for a sync running without tenant context, so it still gets an index scan rather than a collection scan. Deleting the admin account that ran the sync does not delete the groups it created — they are owned by a synthetic source author, not the triggering user. The startup migration check and the config/migrate-prompt-permissions.js CLI both exclude already-synced groups from the backfill they look for, since those groups are intentionally external and read-only rather than missing a migration.

How it works

sequenceDiagram
    participant Admin
    participant Route as POST /prompts/sync
    participant Lock
    participant Langfuse
    participant Catalog as PromptGroup store
    Admin->>Route: trigger sync
    Route->>Route: check capabilities + resolve tenant
    Route->>Lock: acquire(tenant key, leaseMs)
    loop each Langfuse page (type=text, up to maxPages)
        Route->>Langfuse: list prompts
        Langfuse->>Route: prompt page
        Route->>Catalog: find or insert PromptGroup
        Route->>Catalog: grant PUBLIC viewer ACL
        opt another page remains and the page cap is not yet reached
            Route->>Lock: extend(token, leaseMs)
        end
    end
    Route->>Lock: release(token)
    Route->>Admin: sync summary
Loading
packages/api/src/langfuse/
├── promptCatalogSync.ts     # paginates Langfuse, finds/creates groups, grants PUBLIC access
├── prompts.ts               # Langfuse prompt listing/typing used by the sync
└── policy.ts                # tenant/capability gate shared with the sync route
packages/api/src/admin/langfuse.ts   # handler factory wired into the Express route
packages/api/src/prompts/migration.ts  # excludes synced groups from the migration check
api/server/routes/admin/langfuse.js    # route wiring: lock, capabilities, Express glue
client/.../Integrations/LangfusePromptsDialog.tsx  # Sync prompts button + result toast

Type of change

  • Feature

Testing

Tested environments/configuration:

  • Database: mongodb-memory-server (data-schemas, migration tests)
  • Feature flags: Langfuse connection configured in librechat.yaml; USE_REDIS unset (in-process lock path) and set (Redis lock path), both covered by tests

Automated tests:

  • packages/api: 464 tests passing across 15 suites (includes the route-dependency test file: 20 tests; the admin handler spec: 119; the Langfuse prompt-sync/catalog/policy suites: 29 + 26; the migration spec: 4), npx tsc --noEmit clean
  • packages/data-schemas: src/methods/prompt.spec.ts, 36 tests passing, npx tsc --noEmit clean
  • api: server/routes/admin/langfuse.test.js, 27 tests passing
  • config: migration CLI specs, 15 tests passing
  • client: src/components/Nav/SettingsTabs/Integrations + src/data-provider/Langfuse, 58 tests passing (4 suites), npx tsc --noEmit clean
  • npx prettier --check, eslint, and npm run sort-imports all clean on touched paths

Manual (not yet run):

  • Click Sync prompts in Settings > Langfuse against a real Langfuse project and confirm the created groups appear in the prompt picker
  • Re-run the sync and confirm no duplicate groups or ACL rows are created
  • Trigger two concurrent syncs for the same tenant and confirm the second gets the already_running toast
  • Delete the admin user who ran the sync and confirm the synced groups and their ACLs remain
  • Run the startup migration check and the CLI migration against a tenant with synced groups and confirm they are skipped

Screenshots / recordings

No screenshots attached. The only visible change is a Sync prompts button in Settings > Langfuse and its result toast; no layout, theming, or motion change.

Risk / compatibility

  • Reverting this PR leaves any already-synced groups in place. If the config/migrate-prompt-permissions.js CLI is later run live without this PR's exclusion, it would grant the synthetic source author an OWNER ACL entry on those groups; this is harmless, and a subsequent re-sync counts the groups unchanged.
  • This PR is stacked on the Langfuse prompt-routing branch stack; its base is atef/ai-2276-make-external-prompt-groups-read-only, which will be retargeted to dev as the stack merges.
  • No schema migration is required; synced PromptGroup documents use the same shape as the source-identity fields already added upstream in the stack.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • User-facing or complex behavior is documented where necessary
  • Required dependency changes have been merged/published
  • Required documentation PR: N/A

🤖 Generated with Claude Code

@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 1e84111

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T13:39:49.038619Z 4e94232 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 1e84111146

ℹ️ 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 packages/api/src/langfuse/promptCatalogSync.ts Outdated
Comment thread packages/api/src/langfuse/promptCatalogSync.ts
Comment thread packages/api/src/langfuse/promptCatalogSync.ts
Comment thread packages/api/src/langfuse/policy.ts Outdated
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 1e84111 to 954182d Compare October 14, 2026 15:16
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 954182d

@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: 954182db00

ℹ️ 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 api/server/routes/admin/langfuse.js
@AtefBellaaj
AtefBellaaj added this pull request to stack #17090 October 14, 2026 15:24
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 954182d to 5a35cfc Compare October 14, 2026 15:31
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 5a35cfc

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 5a35cfcb84

ℹ️ 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".

@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 5a35cfc

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 5a35cfcb84

ℹ️ 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".

@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 5a35cfc to 39abe55 Compare October 14, 2026 20:14
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 39abe55

@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: 39abe556cc

ℹ️ 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 api/server/routes/admin/langfuse.js Outdated
Comment thread packages/api/src/langfuse/prompts.ts
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 39abe55 to dc469c7 Compare October 14, 2026 20:48
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review dc469c7

@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: dc469c75c5

ℹ️ 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 on lines +825 to +827
async function syncPrompts(req: ServerRequest, res: Response): Promise<Response> {
const gate = await gatePromptSyncTenantSwitch(res);
if (gate.response) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Expose env-credential prompt sync in the UI

When a single-tenant deployment uses LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY, isLangfuseConnectionAvailable() makes api/server/routes/config.js publish langfuseConnectionAccess: false, so LangfuseConnection never mounts. This new env-capable sync handler still requires promptSync.enabled from stored base config, while the only UI for setting that flag and starting the sync is in that hidden panel; operators therefore cannot use the supported UI and must manually call the admin API or preseed the database, despite env-mode synchronization being implemented and tested. Advertise a separate prompt-sync capability and surface these controls whenever sync is available.

AGENTS.md reference: AGENTS.md:L50-L53

Useful? React with 👍 / 👎.

@AtefBellaaj AtefBellaaj Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Accurate description, but the gating is inherited rather than introduced here. The prompt-sync enable switch, the preview dialog and the sync button all live in the same promptSync.available block of LangfuseConnection.tsx, and that panel mounts only when langfuseConnectionAccess is true, which isLangfuseConnectionAvailable() sets to false in env-credential mode by design: in that mode Langfuse is operator-configured, not admin-configured. That rule and the enable toggle come from the base branch; this PR adds one button to the existing block. The sync endpoints are gated by LANGFUSE_PROMPT_SYNC_AVAILABLE and the stored promptSync.enabled flag, not by connection availability, so env-mode deployments can enable and run the sync through the admin API today, and langfuse.handler.spec.ts covers env mode end to end. An env-mode UI surface for prompt sync is a panel-level change tracked as a follow-up on the stack, not folded into this PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@codex review the pushback

@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: dc469c75c5

ℹ️ 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 packages/data-provider/src/data-service.ts
Comment thread packages/api/src/admin/langfuse.ts
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch 2 times, most recently from c24ef6c to c0c846c Compare October 15, 2026 10:19
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from c0c846c to 4d27e36 Compare October 15, 2026 11:11
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review

Reviewing head c8b14e1 (refactor commit on top of 4d27e36).

@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: c8b14e1e41

ℹ️ 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 packages/api/src/admin/langfuse.ts Outdated
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from c8b14e1 to d31bc95 Compare October 16, 2026 11:53
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review d31bc95

@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: d31bc95da4

ℹ️ 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".

sourceProjectId: source.projectId,
sourcePromptName: item.name,
};
const outcome = await syncOne(item, identity, author, deps);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Process prompt pages without serial database round trips

When a page contains many new prompts, this await makes every item run serially: syncOne performs a lookup and insert, while the injected grantPermission also reads the role and writes the ACL before the next item begins. Consequently, the supported 60-second lease can expire before it is renewed after the page—for example, 100 new entries with 250 ms database latency require well over a minute—allowing another node to enter while the first continues writing. Fresh evidence beyond the earlier lease-configuration thread is that the extracted runner still performs this additional ACL work per item; use bounded page concurrency or bulk methods and renew the lease independently before it expires.

AGENTS.md reference: AGENTS.md:L187-L190

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keeping the serial loop in this PR. Checked against d31bc95:

  • promptCatalogSync.ts is byte-identical to the feature commit 4d27e36, and that commit already granted the public viewer role per item from the handler (admin/langfuse.ts L905 there). The runner extraction moved the wiring, not the per-item work, so there is no new evidence beyond the earlier lease thread.
  • The default lease is 300 s (DEFAULT_PROMPT_SYNC_LOCK_LEASE_MS in policy.ts), not 60 s. 60 s is the clamp floor; langfuse.promptSync.lockLeaseMs in librechat.yaml accepts up to 3 600 000. A page of 100 new prompts costs at most four round trips each (find, insert, role read, ACL upsert): 400 round trips at the quoted 250 ms is 100 s, inside the default lease. Prompts that already exist cost one round trip.
  • If a lease does lapse, the second node runs the same find-then-insert: its inserts of groups the first node already created fail with duplicate key 11000 and are reported as unchanged, and the first node returns lock_lost at the next page boundary (promptCatalogSync.ts L187-191). The lock deduplicates work; the unique index keeps the catalog consistent.
  • AGENTS.md L187-190 addresses startup and request paths. This is an admin-triggered batch over a paged external API, where bounded fan-out trades predictable Mongo load for bursts and complicates the per-item rollback (deletePromptGroup after a failed grant).

Renewing the lease on an item count inside a page is a reasonable follow-up. It changes lock semantics in the feature commit and stays out of this refactor commit.

@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from d31bc95 to 785c9d0 Compare October 16, 2026 12:35
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review a1fa67301

@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 785c9d0 to 7eb79d8 Compare October 16, 2026 13:13
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 7eb79d8

(The previous request named a1fa67301, which was never pushed: the branch had been rebased in the meantime. 7eb79d8 is the same change on the rebased stack.)

@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: 7eb79d8c2f

ℹ️ 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 on lines +45 to +46
function isDuplicateKeyError(error: unknown): boolean {
return (error as { code?: number } | undefined)?.code === 11000;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move Mongo error classification into data-schemas

This runner directly interprets MongoDB error code 11000 (and the adjacent predicate recognizes Mongoose's ValidationError), so the exported packages/api integration now owns storage-specific failure semantics. A different repository implementation would require changing this API module rather than supplying a plain contract; classify these failures in packages/data-schemas and return or inject stable, storage-neutral outcomes instead.

AGENTS.md reference: AGENTS.md:L74-L76

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keeping these predicates here.

  • They are not new in this PR. At the feature commit (7480cc3) the same isDuplicateKeyError and isValidationError lived in packages/api/src/admin/langfuse.ts and were passed into the sync. The refactor commit relocates them into the composition module; it does not introduce storage semantics into packages/api.
  • promptSyncRunner.ts is the composition point that binds the Mongo-backed prompt-group methods and the ACL grant to the storage-neutral core. syncLangfusePromptCatalog in promptCatalogSync.ts takes both predicates by injection and knows nothing about Mongo. A different repository implementation supplies a different composition function with its own predicates, which is the plain contract the finding asks for.
  • There is no data-schemas helper for this today. Nine other production files under packages/api/src test code === 11000 inline (agents/handlers.ts, agents/triggers/bindings.ts, auth/email.ts, auth/passkey/handlers.ts, code/http.ts, middleware/error.ts, skills/handlers.ts, skills/import.ts). Introducing a shared classifier in packages/data-schemas is a new convention for all of them, not a fix local to this PR, and AGENTS.md asks to stop widening rather than rewrite what exists.

If a shared duplicate-key classifier is wanted, it is a separate change that migrates those call sites together.

@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 7eb79d8 to 4e94232 Compare October 16, 2026 13:35
@AtefBellaaj

Copy link
Copy Markdown
Collaborator Author

@codex review 4e94232

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4e94232635

ℹ️ 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".

@AtefBellaaj
AtefBellaaj marked this pull request as ready for review October 16, 2026 16:54
AtefBellaaj and others added 2 commits October 16, 2026 18:55
…e admin handler

Add createLangfusePromptSyncRunner, which binds the lock, the prompt-group
methods, the ACL grant and the Mongo error predicates once and returns a
runner that takes the per-request source, connection-bound listPrompts,
lock lease and page cap. The admin handler receives that runner as one
dependency instead of forwarding its parts, and its config method
signatures return a LangfuseAdminConfig interface in place of Mongoose
document types.

In api, api/cache/distributedLock.js creates the one DistributedLock for
the process and api/server/services/LangfusePromptSync.js composes the
runner once with it; the admin route imports the composed runner.
@AtefBellaaj
AtefBellaaj force-pushed the atef/ai-2274-sync-langfuse-prompts-into-the-catalog branch from 4e94232 to c73fb10 Compare October 16, 2026 16:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant