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(flags): point remote_config shadow at the definitions fleet (#66081)

Patriciob9cdf5dbb607
diff --git a/posthog/settings/data_stores.py b/posthog/settings/data_stores.py
index 359675c4921f..0d35d49706a2 100644
--- a/posthog/settings/data_stores.py
+++ b/posthog/settings/data_stores.py
@@ -602,6 +602,9 @@ AI_GATEWAY_PUBLIC_URL = os.getenv("AI_GATEWAY_PUBLIC_URL", "http://localhost:808
# This is used to proxy flag evaluation requests to the Rust feature flags service
FEATURE_FLAGS_SERVICE_URL = os.getenv("FEATURE_FLAGS_SERVICE_URL", "http://localhost:3001")
+# Definitions fleet, which serves remote_config (the eval fleet 404s it). Falls back until set per env.
+FEATURE_FLAGS_DEFINITIONS_SERVICE_URL = os.getenv("FEATURE_FLAGS_DEFINITIONS_SERVICE_URL", FEATURE_FLAGS_SERVICE_URL)
+
# Temporary (Rust remote_config port, phase 2): when true, each Django remote_config response is
# shadow-compared against Rust. Off by default; flip per environment to start/stop without a deploy.
# Delete with remote_config_shadow.py at the phase-3 cutover.
diff --git a/products/feature_flags/backend/api/remote_config_shadow.py b/products/feature_flags/backend/api/remote_config_shadow.py
index 2c0125d1ea3f..0b645c2cc179 100644
--- a/products/feature_flags/backend/api/remote_config_shadow.py
+++ b/products/feature_flags/backend/api/remote_config_shadow.py
@@ -66,7 +66,7 @@ def shadow_compare_remote_config(request: Request, django_response: Response, *,
# Rebuild the canonical /api/projects path Rust serves (not request.get_full_path(), which can
# be an /api/environments or legacy alias). Rust resolves the project from ?token= when present,
# else from this segment — both give the same flag.
- url = f"{settings.FEATURE_FLAGS_SERVICE_URL}/api/projects/{project_id}/feature_flags/{key}/remote_config"
+ url = f"{settings.FEATURE_FLAGS_DEFINITIONS_SERVICE_URL}/api/projects/{project_id}/feature_flags/{key}/remote_config"
rust = _SHADOW_SESSION.get(
url,
params=request.query_params.dict(),
diff --git a/products/feature_flags/backend/api/test/test_remote_config_shadow.py b/products/feature_flags/backend/api/test/test_remote_config_shadow.py
index cbbcbc85d3b5..ed55e2089463 100644
--- a/products/feature_flags/backend/api/test/test_remote_config_shadow.py
+++ b/products/feature_flags/backend/api/test/test_remote_config_shadow.py
@@ -86,7 +86,7 @@ def test_non_header_credential_is_skipped(authenticator):
counter.labels.assert_called_once_with(result="skipped")
-@override_settings(FEATURE_FLAGS_SERVICE_URL="http://rust:3001")
+@override_settings(FEATURE_FLAGS_DEFINITIONS_SERVICE_URL="http://rust:3001")
def test_builds_canonical_rust_url():
with patch.object(shadow, "_SHADOW_SESSION") as session, patch.object(shadow, "REMOTE_CONFIG_SHADOW_COMPARISONS"):
session.get.return_value = _rust_response(200, b'"v"', "v")