Skip to content

Conversation

@Harshit28j
Copy link
Contributor

Relevant issues

Fixes Prompts UI bugs: "Prompt not found" and broken deletion logic.

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

This PR fixes two critical issues in the Prompts configuration endpoints related to ID handling (Base ID vs Versioned ID mismatch).

1. Fix "Prompt not found" error in UI

  • Issue: get_prompt_info was using the base prompt ID (e.g., my_prompt) to lookup callbacks in the registry, but the registry keys are versioned IDs (e.g., my_prompt.v1).
  • Fix: Updated lookup to use prompt_spec.prompt_id (the resolved versioned ID).

2. Fix Silent Failure on Prompt Deletion (Critical)

  • Issue: delete_prompt was attempting to delete from the database using a versioned ID (e.g., test.v1). However, the Postgres database stores prompts using the base ID (test) + a version column. This caused the DB deletion to fail silently (0 rows deleted).
  • Issue: Memory cleanup was also inconsistent, sometimes leaving versioned keys in IN_MEMORY_PROMPTS.
  • Fix:
    • Extracted base_prompt_id for the database delete_many query.
    • Added InMemoryPromptRegistry.delete_prompts_by_base_id helper method to reliably clean up all versions of a prompt from memory.

Verification

  • Verified locally with Docker.
  • Verified create, get info, and delete flow works as expected.
  • Ran tests/test_litellm/proxy/prompts/test_prompt_endpoints.py and passed all tests.
Tesing.mp4

@vercel
Copy link

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Error Error Jan 20, 2026 3:43am

Request Review

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.

2 participants