Skip to content

fix(prompt): preserve empty fallback values - #1828

Open
jstar0 wants to merge 1 commit into
langfuse:mainfrom
jstar0:fix/prompt-empty-fallback
Open

fix(prompt): preserve empty fallback values#1828
jstar0 wants to merge 1 commit into
langfuse:mainfrom
jstar0:fix/prompt-empty-fallback

Conversation

@jstar0

@jstar0 jstar0 commented Aug 21, 2026

Copy link
Copy Markdown

What does this PR do?

When a prompt fetch fails, an explicitly supplied empty-string fallback is currently treated as if no fallback was provided because the fallback branch uses a truthiness check. This causes the client to raise instead of returning the caller's intentional empty fallback.

This changes the guard to an explicit fallback is not None check, preserving existing behavior for omitted fallbacks while allowing "" as a valid fallback value.

Type of change

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

Verification

  • tests/unit/test_prompt.py: 27 passed (with proxy variables cleared and non-sensitive test credentials used for client initialization)
  • ruff check langfuse tests/unit/test_prompt.py: passed
  • git diff --check origin/main...HEAD: passed

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.
  • I did not hand-edit generated files; if generated files changed, I used the upstream regeneration path.
  • I did not commit secrets or credentials.

Greptile Summary

This PR preserves explicitly supplied empty prompt fallbacks when remote prompt retrieval fails.

  • Replaces the fallback truthiness check with an explicit None check.
  • Adds unit coverage confirming an empty text fallback produces a fallback prompt client.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or quality issues identified.

The updated guard preserves omitted-fallback behavior while allowing both empty strings and empty chat lists supported by the declared prompt models.

Reviews (1): Last reviewed commit: "fix(prompt): preserve empty fallback val..." | Re-trigger 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

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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