Skip to content

fix(prompts): honor empty fallback prompts - #2079

Open
feiiiiii5 wants to merge 1 commit into
langfuse:mainfrom
feiiiiii5:codex/empty-prompt-fallback
Open

feiiiiii5 wants to merge 1 commit into
langfuse:mainfrom
feiiiiii5:codex/empty-prompt-fallback

Conversation

@feiiiiii5

@feiiiiii5 feiiiiii5 commented Oct 30, 2026 •

Copy link
Copy Markdown

What does this PR do?

get_prompt(..., fallback="") and get_prompt(..., type="chat", fallback=[]) currently propagate a fetch error on a cold cache. Both are valid explicit fallbacks, but the truthiness check treats them as omitted. Check for None so an optional prompt can fall back to empty content during an outage.

Related: #2076 normalizes chat-message types; this fixes the separate empty-fallback check.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation update
  • Tooling, CI, or repo maintenance

Verification

The two new cases fail on main with RuntimeError: Server unavailable; the existing no-fallback case still raises. After the one-line fix, both prompt test files pass (60 tests).

uv run --frozen pytest tests/unit/test_prompt.py tests/unit/test_prompt_compilation.py -q
uv run --frozen ruff check .
uv run --frozen ruff format --check langfuse/_client/client.py tests/unit/test_prompt.py
uv run --frozen mypy langfuse --no-error-summary

Checklist

  • I self-reviewed the diff using code_review.md.
  • I added or updated tests for behavior changes.
  • I updated docs, examples, or .env.template if needed. (No changes needed.)
  • I did not hand-edit generated files; if generated files changed, I used the upstream regeneration path.
  • I did not commit secrets or credentials.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

get_prompt now honors explicit empty fallbacks when fetching a prompt fails.

  • Prompt requests can use empty fallbacks when a fetch fails.

Reviews (1) · Last reviewed commit: "fix(prompts): honor empty fallback promp..." · Reviewed by Greptile

@claude claude 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

CLAassistant commented Oct 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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 ⚠️ Failed 2026-10-30T11:13:09.194734Z
We couldn’t complete this review. Comment @codex review to try again.
df04937 PR opened
ℹ️ 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants