Skip to content

fix(email): apply EMAIL_SIGNATURE to budget alert emails - #31712

Merged
michelligabriele merged 1 commit into
litellm_internal_stagingfrom
litellm_fix_email_signature_budget_alerts
Jun 30, 2026
Merged

michelligabriele merged 1 commit into
litellm_internal_stagingfrom
litellm_fix_email_signature_budget_alerts

Conversation

@michelligabriele

Copy link
Copy Markdown
Contributor

Relevant issues

N/A (no public GitHub issue)

Linear ticket

Resolves LIT-3748

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (CircleCI pending on push)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Budget alert emails ignored EMAIL_SIGNATURE. Rendered footer of a soft budget alert with a premium license and EMAIL_SIGNATURE set, before and after the change

Before

If you have any questions, please send an email to support@berri.ai
Best, <br />
The LiteLLM team <br />

After

If you have any questions, please send an email to support@berri.ai
<div>Best,<br/>The Acme Platform Team</div>

All three budget alert types (soft, team soft, max) and both max budget code paths render the configured signature; with no EMAIL_SIGNATURE they fall back to the standard EMAIL_FOOTER, consistent with every other email type. A live end-to-end send needs an enterprise license plus SMTP plus an actual budget crossing, so verification asserts the rendered email body directly through the unit tests and a render harness exercising all four call sites

Type

🐛 Bug Fix

Changes

The three budget alert templates (soft budget, team soft budget, max budget) hardcoded the Best, / The LiteLLM team signature and had no {email_footer} placeholder, and the four budget .format() calls in base_email.py never passed email_footer=email_params.signature. So the EMAIL_SIGNATURE override (and the default EMAIL_FOOTER) reached invitation and key emails but was silently dropped on every budget alert

This adds the {email_footer} placeholder to the three budget templates and passes email_footer=email_params.signature at all four budget call sites; the max budget path has two branches (single recipient and multi-threshold) and both are updated. email_params.signature already resolves to the custom EMAIL_SIGNATURE for premium instances and the default EMAIL_FOOTER otherwise, so budget alerts now match the behavior of the other email types. Five regression tests cover the four paths plus the default-footer fallback; they fail on the pre-fix code and pass with it

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes budget alert emails use the configured email footer. The main changes are:

  • Added {email_footer} to soft budget, team soft budget, and max budget alert templates.
  • Passed the resolved EmailParams.signature into all budget alert render paths.
  • Added tests for custom signatures across budget alert paths and the default footer fallback.

Confidence Score: 5/5

The change is narrowly scoped to budget alert email rendering and is covered by regression tests for the affected render paths.

The implementation consistently threads the existing resolved email signature into the updated templates, matching the behavior of other email types while preserving the default footer fallback.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the budget email signature test suite for base and head commits, confirming the after-run reports an OVERALL PASS.
  • Reviewed the metrics instrumentation across before and after runs, noting changes in metric definitions and the observed error in the after state.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Prometheus guardrail overhead latency metric was removed from the public metrics contract

    • Bug
      • The head commit no longer exposes litellm_overhead_with_guardrails_latency_metric. In base, PrometheusLogger registered it as a Histogram, PrometheusMetricLabels defined labels for it, DEFINED_PROMETHEUS_METRICS included it, and the harness could observe a value. In head, it is absent from DEFINED_PROMETHEUS_METRICS, absent from PrometheusMetricLabels, missing on PrometheusLogger, and no Prometheus series are registered. This is a user-observable instrumentation contract change despite the requested PR scope being described as isolated email work.
    • Cause
      • The changed Prometheus integration/types removed the metric registration and its label/type definitions for litellm_overhead_with_guardrails_latency_metric, dropping a previously exported Prometheus time series from the runtime surface.
    • Fix
      • Restore the metric registration, label definition, helper/observation path, and DEFINED_PROMETHEUS_METRICS entry unless this metric removal is an intentional breaking metrics-contract change that is documented, communicated, and covered by migration/release notes.

    T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(email): apply EMAIL_SIGNATURE to bud..." | Re-trigger Greptile

@michelligabriele
michelligabriele merged commit 88c34a5 into litellm_internal_staging Jun 30, 2026
73 checks passed
@michelligabriele
michelligabriele deleted the litellm_fix_email_signature_budget_alerts branch June 30, 2026 19:11
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