Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(provisioning): tell rate-limited partners how to raise their limits (#87222)

Matt Brookerbb4cedb7ae89
diff --git a/ee/api/agentic_provisioning/ratelimits.py b/ee/api/agentic_provisioning/ratelimits.py
index a1544dcb6a6f..00abd49f7454 100644
--- a/ee/api/agentic_provisioning/ratelimits.py
+++ b/ee/api/agentic_provisioning/ratelimits.py
@@ -52,7 +52,11 @@ logger = structlog.get_logger(__name__)
BUCKET_KEY_PREFIX = "provisioning_bucket:"
-RATE_LIMITED_MESSAGE = "Rate limit exceeded for this partner. Try again later."
+RATE_LIMITED_MESSAGE = (
+ "Rate limit exceeded for this partner. Wait the number of seconds in the Retry-After header, "
+ "then retry. To raise your limits, publish a JWKS document or verify your organization: "
+ "https://posthog.com/docs/integrate/provisioning#rate-limits"
+)
TIER_BLOCKED_MESSAGE = (
"This endpoint is not available for this partner's tier. "
"Publish a JWKS document or verify your organization to raise your tier."
diff --git a/ee/api/agentic_provisioning/test/test_resources.py b/ee/api/agentic_provisioning/test/test_resources.py
index 4ef3be4cda08..89baaf6e4220 100644
--- a/ee/api/agentic_provisioning/test/test_resources.py
+++ b/ee/api/agentic_provisioning/test/test_resources.py
@@ -7,6 +7,7 @@ from posthog.models.personal_api_key import PersonalAPIKey
from posthog.models.team.team import Team
from ee.api.agentic_provisioning.credentials import maybe_create_provisioned_pat
+from ee.api.agentic_provisioning.ratelimits import RATE_LIMITED_MESSAGE
from ee.api.agentic_provisioning.test.base import ProvisioningTestBase, provisioning_config
@@ -38,7 +39,7 @@ class TestProvisioningResources(ProvisioningTestBase):
assert res.json() == {
"status": "error",
"id": "",
- "error": {"code": "rate_limited", "message": "Rate limit exceeded for this partner. Try again later."},
+ "error": {"code": "rate_limited", "message": RATE_LIMITED_MESSAGE},
}
@patch("ee.api.agentic_provisioning.views.resources.capture_provisioning_event")