: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tasks): add Go spellings to the free-tier model pin (#112723)
Brandona26307881c66
diff --git a/products/tasks/backend/logic/services/gateway_model_pin.py b/products/tasks/backend/logic/services/gateway_model_pin.pyindex 3a343a44026f..790677b05884 100644--- a/products/tasks/backend/logic/services/gateway_model_pin.py+++ b/products/tasks/backend/logic/services/gateway_model_pin.py@@ -28,7 +28,14 @@ DESKTOP_AGENT_MODELS: list[str] = list(MAX_GATEWAY_PIN_LENGTH = 32assert len(DESKTOP_AGENT_MODELS) <= MAX_GATEWAY_PIN_LENGTH, "the desktop model pin outgrew the gateway limit"-FREE_TIER_MODELS: list[str] = ["@cf/zai-org/glm-5.2", "deepseek-ai/deepseek-v4-flash-0731", "moonshotai/kimi-k3"]+# The legacy gateway's free tier. GLM-5.2 is listed twice: older clients send `@cf/`, Go serves the bare id.+FREE_TIER_MODELS: list[str] = [+ "@cf/zai-org/glm-5.2",+ "zai-org/glm-5.2",+ "deepseek-ai/deepseek-v4-flash-0731",+ "moonshotai/kimi-k3",+ "zai-org/glm-5.3-flash",+]# Stamped on a free-plan run in place of its product, so the model-change guard reads the narrower pin.FREE_TIER_PIN_KEY = "posthog_code:free"diff --git a/products/tasks/backend/temporal/process_task/tests/test_ai_gateway_token.py b/products/tasks/backend/temporal/process_task/tests/test_ai_gateway_token.pyindex b569864c0a96..ded71cad464c 100644--- a/products/tasks/backend/temporal/process_task/tests/test_ai_gateway_token.py+++ b/products/tasks/backend/temporal/process_task/tests/test_ai_gateway_token.py@@ -46,6 +46,7 @@ from products.tasks.backend.temporal.process_task.ai_gateway_token import (_team_credit_refusal,mint_refusal,mint_scoped_token,+ model_allowed_by_pin,resolve_sandbox_ai_product,sandbox_product_routed,token_cap_usd,@@ -1429,10 +1430,22 @@ class TestPosthogCodeSandboxMint:assert {"gpt-5.4", "gpt-5.3-codex", "gpt-5.2", "gpt-5-mini"} <= set(pin)assert any("/" in model for model in pin)- def test_free_pin_is_the_three_open_weight_models(self):- assert FREE_TIER_MODELS == ["@cf/zai-org/glm-5.2", "deepseek-ai/deepseek-v4-flash-0731", "moonshotai/kimi-k3"]+ def test_free_pin_is_the_legacy_free_tier_in_both_glm_spellings(self):+ assert FREE_TIER_MODELS == [+ "@cf/zai-org/glm-5.2",+ "zai-org/glm-5.2",+ "deepseek-ai/deepseek-v4-flash-0731",+ "moonshotai/kimi-k3",+ "zai-org/glm-5.3-flash",+ ]assert _PRODUCT_ALLOWED_MODELS[FREE_TIER_PIN_KEY] == FREE_TIER_MODELS+ @pytest.mark.parametrize(+ "model", ["@cf/zai-org/glm-5.2", "zai-org/glm-5.2", "zai-org/glm-5.3-flash", "moonshotai/kimi-k3"]+ )+ def test_free_pin_admits_each_free_tier_spelling(self, model):+ assert model_allowed_by_pin(FREE_TIER_MODELS, model)+def test_ttl_is_the_sandbox_lifetime_plus_an_hour(self, mint_settings):# The sandbox dies at its TTL and a new one mints its own token, so a leaked token# outlives its sandbox by the settle hour at most.