Skip to content

fix(prompts): expire cached prompts at their configured TTL - #2137

Open
DevNeto07 wants to merge 1 commit into
langfuse:mainfrom
DevNeto07:Atualização/langfuse-prompt-cache-ttl

Hidden character warning

The head ref may contain hidden characters: "Atualiza\u00e7\u00e3o/langfuse-prompt-cache-ttl"
Open

DevNeto07 wants to merge 1 commit into
langfuse:mainfrom
DevNeto07:Atualização/langfuse-prompt-cache-ttl

Conversation

@DevNeto07

@DevNeto07 DevNeto07 commented Nov 18, 2026 •

Copy link
Copy Markdown

Summary

The prompt cache truncates wall-clock timestamps to whole seconds and uses a strict greater-than comparison. A cached prompt can stay fresh for up to one second beyond its TTL. Wall-clock changes can also shift its effective lifetime.

Use a monotonic deadline and refresh once the entry reaches its TTL. Stale-while-revalidate behavior remains the same. The regression test checks the same cached prompt just before and exactly at a fractional deadline.

Verification

  • Before the fix, the boundary test failed because no refresh was scheduled at the TTL.
  • The prompt unit test module passed in Docker with dummy SDK credentials and mocked API calls.
  • Ruff lint, formatting check for the touched files, mypy and git diff --check passed.
  • Live-provider and end-to-end tests were skipped because the behavior is covered by the local prompt tests.
  • Claude Code assisted with reviewing the patch.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Prompt cache entries now expire exactly at their configured lifetime, without being affected by wall-clock changes.

  • Prompt cache entries expire exactly when their TTL ends.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "fix(prompts): expire cached prompts at t..." · 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 Nov 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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