chore(llm-gateway): add signals user cost limits#59433
Merged
Merged
Conversation
Add explicit per-user cost limits for the signals product: $500 USD burst over 7 days, $1000 USD sustained over 30 days. Without an entry in DEFAULT_USER_COST_LIMITS, signals was falling back to the default $100/24h burst, which is too low for report-generation runs. Generated-By: PostHog Code Task-Id: 31cea4e3-e0d7-49e7-bd01-d41bcafabe53
sortafreel
approved these changes
May 21, 2026
Contributor
|
Reviews (1): Last reviewed commit: "chore(llm-gateway): add signals user cos..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
We recently split signals/report-generation traffic out of the larger
ai_product = signalscost-tracking bucket, but thesignalsproduct in the LLM gateway has no explicit entry inDEFAULT_USER_COST_LIMITS. It falls back to the global default ($100 USD per 24h burst), which is too low for report-generation runs and risks hitting the per-user burst limit before a single report finishes.Changes
Add an explicit
UserCostLimitfor thesignalsproduct inservices/llm-gateway/src/llm_gateway/config.py:(Mirrors the cadence we use for
background_agents.)No product-wide (
product_cost_limits) entry is added — the existing fallback ($1000/24h) is still applied viaProductCostThrottle._get_limit_and_window.How did you test this code?
I'm an agent. I ran
ruff checkandruff format --checkon the changed file. I did not run the gateway test suite (requires Redis).Publish to changelog?
no
Docs update
n/a — internal config only.
🤖 Agent context
Authored by PostHog Code on behalf of Josh Snyder. Origin: a Slack thread asking how to track signals LLM cost now that session-summary spend was pulled out of
ai_product = signals. We confirmed thatsignalsexists as a product in the gateway (services/llm-gateway/src/llm_gateway/products/config.py) and is OAuth-gated to the PostHog Code apps, but had no user cost limit override, so it was inheriting the conservative $100/24h default. This PR aligns it with the cadence we use for the other internal-task product (background_agents).Paired with posthog/code#TBD which routes internal
signal_reporttasks to thesignalsgateway product.Created with PostHog Code