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.

chore(experiments): stop our own tooling from sending deprecated flag config (#101049)

Anders7423d37ca140
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentModals.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentModals.tsx
index 4fba6573d8be..6c18593c5b0b 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentModals.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentModals.tsx
@@ -251,8 +251,8 @@ export function FinishExperimentModal(): JSX.Element {
})
const aggregationTargetName =
- experiment.filters.aggregation_group_type_index != null
- ? aggregationLabel(experiment.filters.aggregation_group_type_index).plural
+ experiment.feature_flag?.filters?.aggregation_group_type_index != null
+ ? aggregationLabel(experiment.feature_flag.filters.aggregation_group_type_index).plural
: 'users'
const handleClose = (): void => {
diff --git a/frontend/src/scenes/experiments/ExperimentView/ReleaseConditionsTable.tsx b/frontend/src/scenes/experiments/ExperimentView/ReleaseConditionsTable.tsx
index cf15f7c2bc9a..64582a237de4 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ReleaseConditionsTable.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ReleaseConditionsTable.tsx
@@ -96,8 +96,8 @@ export function ReleaseConditionsTable(): JSX.Element {
title: 'Rollout',
render: function Key(_, item): JSX.Element {
const aggregationTargetName =
- experiment.filters.aggregation_group_type_index != null
- ? aggregationLabel(experiment.filters.aggregation_group_type_index).plural
+ experiment.feature_flag?.filters?.aggregation_group_type_index != null
+ ? aggregationLabel(experiment.feature_flag.filters.aggregation_group_type_index).plural
: 'users'
const releaseText = `${item.rollout_percentage ?? 0}% of ${aggregationTargetName}`
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index 344199562fcf..aa23da94d3ab 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -136,6 +136,7 @@ import {
isLegacyExperiment,
toConcurrencyPayload,
toFlagVariantsInput,
+ withoutProjectedFlagConfig,
} from './utils'
export const FORM_MODES = {
@@ -2877,7 +2878,7 @@ export const experimentLogic = kea<experimentLogicType>([
updateExperimentVariantImages: async ({ variantPreviewMediaIds }) => {
try {
const updatedParameters = {
- ...values.experiment.parameters,
+ ...withoutProjectedFlagConfig(values.experiment.parameters),
variant_screenshot_media_ids: variantPreviewMediaIds,
}
const response: Experiment = await api.update(
@@ -2907,7 +2908,7 @@ export const experimentLogic = kea<experimentLogicType>([
updateExperimentVariantNotes: async ({ variantNotes }) => {
try {
const updatedParameters = {
- ...values.experiment.parameters,
+ ...withoutProjectedFlagConfig(values.experiment.parameters),
variant_notes: variantNotes,
}
const response: Experiment = await api.update(
diff --git a/frontend/src/scenes/experiments/utils.test.ts b/frontend/src/scenes/experiments/utils.test.ts
index a734724e43a3..29ae34206f2e 100644
--- a/frontend/src/scenes/experiments/utils.test.ts
+++ b/frontend/src/scenes/experiments/utils.test.ts
@@ -48,6 +48,7 @@ import {
percentageDistribution,
toConcurrencyPayload,
toExperimentWritePayload,
+ withoutProjectedFlagConfig,
} from './utils'
describe('utils', () => {
@@ -1610,3 +1611,22 @@ describe('toConcurrencyPayload', () => {
expect(payload.original_experiment?.exposure_criteria).toBeNull()
})
})
+
+describe('withoutProjectedFlagConfig', () => {
+ it('drops the flag config the read projection adds and keeps the experiment-owned keys', () => {
+ const parameters = {
+ variant_notes: { control: 'baseline copy' },
+ custom_exposure_filter: { events: [] },
+ feature_flag_variants: [{ key: 'control', rollout_percentage: 50 }],
+ rollout_percentage: 100,
+ aggregation_group_type_index: 0,
+ feature_flag_payloads: { control: '{}' },
+ ensure_experience_continuity: true,
+ } as unknown as Experiment['parameters']
+
+ expect(withoutProjectedFlagConfig(parameters)).toEqual({
+ variant_notes: { control: 'baseline copy' },
+ custom_exposure_filter: { events: [] },
+ })
+ })
+})
diff --git a/frontend/src/scenes/experiments/utils.ts b/frontend/src/scenes/experiments/utils.ts
index b11cd0abfc74..1c18f027d56f 100644
--- a/frontend/src/scenes/experiments/utils.ts
+++ b/frontend/src/scenes/experiments/utils.ts
@@ -1165,6 +1165,25 @@ export function conflictPreservedFields(payload: ExperimentUpdatePayload): Parti
return Object.fromEntries(Object.entries(payload).filter(([key]) => !CONFLICT_UNPRESERVABLE_KEYS.has(key)))
}
+/** Flag config the API projects into `parameters` on read. The linked flag owns these keys, so they
+ * are absent from the type but present at runtime on every response. */
+const PROJECTED_FLAG_CONFIG_KEYS = new Set([
+ 'feature_flag_variants',
+ 'rollout_percentage',
+ 'aggregation_group_type_index',
+ 'feature_flag_payloads',
+ 'ensure_experience_continuity',
+])
+
+/** Drops the projected flag config, so updating an experiment-owned key does not echo the
+ * deprecated flag dialect back to the API. The `feature_flag` sibling of this is
+ * {@link toExperimentWritePayload}. */
+export function withoutProjectedFlagConfig(parameters: Experiment['parameters'] | undefined): Experiment['parameters'] {
+ return Object.fromEntries(
+ Object.entries(parameters ?? {}).filter(([key]) => !PROJECTED_FLAG_CONFIG_KEYS.has(key))
+ ) as Experiment['parameters']
+}
+
/** Maps UI variants to the flag's write shape, dropping null names the generated type disallows. */
export function toFlagVariantsInput(
variants: MultivariateFlagVariant[]
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index 48f5b8838a4c..e73e428ce604 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -256,7 +256,7 @@ tools:
- description
- feature_flag_key
- feature_flag
- - parameters
+ - running_time_calculation
- stats_config
- holdout_id
- allow_unknown_events
@@ -281,6 +281,12 @@ tools:
natural-language pair without naming explicit keys, key the baseline `control` and keep their
wording in the variant `name`. When the user asks for specific keys, use them as-is and put the
baseline first.
+ running_time_calculation:
+ description: >
+ Persist a running-time / sample-size plan onto the experiment (the planning target shown in the
+ experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage,
+ e.g. 20 for a 20% lift), recommended_sample_size (total across all variants),
+ recommended_running_time (days), and exposure_estimate_config.
ui_app: experiment
response:
include:
@@ -294,7 +300,7 @@ tools:
- start_date
- end_date
- created_at
- - parameters
+ - running_time_calculation
- metrics
- metrics_secondary
- conclusion
@@ -333,7 +339,6 @@ tools:
- start_date
- end_date
- created_at
- - parameters
- metrics
- metrics_secondary
- conclusion
@@ -528,10 +533,10 @@ tools:
deactivated, "exposure_frozen" when its flag's release groups are narrowed to the already-exposed cohort so
enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with
variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if
- ended, parameters (including feature_flag_variants and recommended_running_time), stats_config, type
- (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event
- is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead
- of hardcoding either name).
+ ended, running_time_calculation (minimum detectable effect, recommended running time and sample size),
+ stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no
+ custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure;
+ use it in SQL instead of hardcoding either name).
param_overrides:
id:
cast: string-int
@@ -1416,7 +1421,6 @@ tools:
- name
- description
- feature_flag
- - parameters
- running_time_calculation
- excluded_variants
- metrics
@@ -1468,8 +1472,8 @@ tools:
- start_date
- end_date
- created_at
- - parameters
- running_time_calculation
+ - excluded_variants
- metrics
- metrics_secondary
- saved_metrics
diff --git a/products/experiments/skills/debugging-experiments/references/pulling-the-data.md b/products/experiments/skills/debugging-experiments/references/pulling-the-data.md
index 4c9592be7122..3b094daad576 100644
--- a/products/experiments/skills/debugging-experiments/references/pulling-the-data.md
+++ b/products/experiments/skills/debugging-experiments/references/pulling-the-data.md
@@ -10,16 +10,18 @@ subset plus the numbers each cause needs.
Pull these fields; they are inputs to almost every cause:
-- `parameters.feature_flag_variants[].rollout_percentage` — the configured **split**.
-- `parameters.rollout_percentage` — the overall **rollout** (% of users entering the test).
- `exposure_criteria.multiple_variant_handling` — `"exclude"` (default) or `"first_seen"`.
- `exposure_criteria.exposure_config.event` — set means a **custom exposure event** (changes
the query below); absent means the default `$feature_flag_called`.
- `exposure_criteria.filterTestAccounts` — defaults to true.
- `feature_flag.filters.groups[]` — per group read `variant`, `properties`,
- `rollout_percentage`. Any non-null `variant` is a forced assignment (not randomized).
-- `feature_flag.filters.multivariate.variants[]` — the variant keys **and their stored order**;
- the offline hash-recomputation test walks them in this order, so read it from the _live_ flag.
+ `rollout_percentage` (that group's **rollout**, % of the matched bucketing units — persons, or
+ groups when `aggregation_group_type_index` is set — that enter the test; each group has its own,
+ so there is no single overall rollout unless the flag has one unconditional group). Any non-null
+ `variant` is a forced assignment (not randomized).
+- `feature_flag.filters.multivariate.variants[]` — the variant keys, their `rollout_percentage`
+ (the configured **split**), **and their stored order**; the offline hash-recomputation test walks
+ them in this order, so read it from the _live_ flag.
- `feature_flag.ensure_experience_continuity` — if `true`, assignment hashes a stored override key,
so the offline hash test is unreliable (see the decisive test below).
- `feature_flag.filters.aggregation_group_type_index` — if set, the experiment is
diff --git a/products/experiments/skills/diagnosing-experiment-results/SKILL.md b/products/experiments/skills/diagnosing-experiment-results/SKILL.md
index 54cc73d80642..8c56d9983793 100644
--- a/products/experiments/skills/diagnosing-experiment-results/SKILL.md
+++ b/products/experiments/skills/diagnosing-experiment-results/SKILL.md
@@ -22,8 +22,7 @@ resolve it to a concrete ID.
Call `experiment-get` and pull these fields. They are inputs for almost every diagnostic:
-- `parameters.feature_flag_variants[].rollout_percentage` — the variant split
-- `parameters.rollout_percentage` — the overall rollout (% of users entering the experiment)
+- `feature_flag.filters.multivariate.variants[].rollout_percentage` — the variant split
- `exposure_criteria.multiple_variant_handling` — defaults to `"exclude"` if absent
- `exposure_criteria.exposure_config.event` — unset means the default exposure event; read which one
from `resolved_exposure_event` (`$feature_flag_called` or `$experiment_exposure` — resolved
@@ -31,7 +30,10 @@ Call `experiment-get` and pull these fields. They are inputs for almost every di
- `exposure_criteria.filterTestAccounts` — defaults to `true`
- `feature_flag.active`, status (`draft` / `running` / `paused` / `exposure_frozen` / `stopped`), `start_date`, `end_date`
- `feature_flag.filters.groups[]` — for each group read `variant`, `properties`, and
- `rollout_percentage`. Any non-null `variant` is a forced-variant override on the matched cohort
+ `rollout_percentage` (that group's rollout, % of the matched bucketing units — persons, or groups
+ when `feature_flag.filters.aggregation_group_type_index` is set — that enter the experiment; each
+ group has its own, so there is no single overall rollout unless the flag has one unconditional
+ group). Any non-null `variant` is a forced-variant override on the matched cohort
(release-condition assignment, not randomized) — surfaces A7. Watch for the severe shape (A7b): a
variant-pinned group with broad/empty `properties` at high rollout, or no group left randomized
(`variant: null`) / no release path to one arm — that starves the other variant (one arm gets ~0
diff --git a/products/experiments/skills/diagnosing-experiment-results/references/bias-and-skew.md b/products/experiments/skills/diagnosing-experiment-results/references/bias-and-skew.md
index 33f1a197c2ff..8758721a28cf 100644
--- a/products/experiments/skills/diagnosing-experiment-results/references/bias-and-skew.md
+++ b/products/experiments/skills/diagnosing-experiment-results/references/bias-and-skew.md
@@ -12,8 +12,8 @@ Pull three signals first:
A red SRM means there is a real assignment or capture problem; proceed below.
2. **`$multiple` share.** If non-zero, identity fragmentation (A3/A4) is on the table.
3. **Configured split.** Read `experiment-get`'s
- `parameters.feature_flag_variants[].rollout_percentage` — uneven splits amplify whichever bias
- source is present.
+ `feature_flag.filters.multivariate.variants[].rollout_percentage` — uneven splits amplify
+ whichever bias source is present.
If the symptom is "metric count is far smaller than exposures" (e.g. 10× or 100× gap), walk this
file before `numbers-vs-sql.md` — that shape of divergence is most often a bucketing / identity
@@ -76,7 +76,7 @@ Open the Exposures tab. PostHog runs a chi-squared test once total exposures ≥
_not_ what triggers SRM — it's that the visible variants don't match the configured rollout).
**Verify directly.** The exposure-shape query from Step 1.5 already gives the counts. Compare observed
-vs expected (using `parameters.feature_flag_variants[].rollout_percentage`) and apply χ². Treat
+vs expected (using `feature_flag.filters.multivariate.variants[].rollout_percentage`) and apply χ². Treat
p < 0.001 as SRM.
**What it means.** The actual variant distribution differs significantly from the configured split —
diff --git a/products/experiments/skills/diagnosing-experiment-results/references/interpretation.md b/products/experiments/skills/diagnosing-experiment-results/references/interpretation.md
index e28d0e55456e..541def838a2d 100644
--- a/products/experiments/skills/diagnosing-experiment-results/references/interpretation.md
+++ b/products/experiments/skills/diagnosing-experiment-results/references/interpretation.md
@@ -13,7 +13,7 @@ How to read PostHog experiment results without falling into common interpretatio
- C7 — Bayesian vs Frequentist confusion (overlapping intervals, p-values)
- C8 — Inconclusive but trending — when is it ok to ship?
- C9 — "Significance reached" notification is not a green light to ship
-- C10 — Ship-variant default does not consider any metric result
+- C10 — Ship-variant choice does not consider any metric result
- C11 — External calculator disagrees with PostHog
## C1 — Peeking / early stopping [HIGH]
@@ -200,16 +200,14 @@ When a previously-significant banner reverts to not-significant, that's not a bu
analysis updated with more exposures. Explain the difference between _signal seen so far_ and
_result confirmed_.
-## C10 — Ship-variant default does not consider any metric result [HIGH]
+## C10 — Ship-variant choice does not consider any metric result [LOW]
-The End-experiment modal pre-fills the "Variant to keep" selector with the **first non-control
-variant** (`feature_flag_variants[1].key`) every time it opens. There is no significance check,
-no primary-metric direction check, and no guardrail check feeding that default. The "End
-experiment" button is gated by **selecting a conclusion** (won / lost / inconclusive / stopped
-early), _not_ by touching the variant selector — so a user who picks a conclusion and clicks
-through without re-examining the variant ships the position-default variant. The only way to end
-without rewriting the flag is to manually clear the variant selector before clicking; the modal
-does not prompt for this.
+The End-experiment modal opens with the "Variant to keep" selector empty, so ending the experiment
+rolls out nothing unless the user picks a variant. Nothing behind that pick reads the results:
+there is no significance check, no primary-metric direction check, and no guardrail check. The
+"End experiment" button is gated by **selecting a conclusion** (won / lost / inconclusive / stopped
+early), _not_ by the variant selector, so a user who picks a conclusion and clicks through ships
+whichever variant they selected earlier in the same session, unexamined.
The modal also asks **how** to release the chosen variant, with two radio options:
@@ -225,7 +223,7 @@ the default. If the user clicks through without re-examining, they get the safer
release mode but still the position-default _variant_ — those are independent risks.
<!-- Source for maintainers: FinishExperimentModal in
-frontend/src/scenes/experiments/ExperimentView/components.tsx. Verify before citing. -->
+frontend/src/scenes/experiments/ExperimentView/ExperimentModals.tsx. Verify before citing. -->
**Recommend:** before clicking "End experiment", do three things:
diff --git a/products/experiments/skills/diagnosing-experiment-results/references/mid-run-changes.md b/products/experiments/skills/diagnosing-experiment-results/references/mid-run-changes.md
index 3db8b559fea3..0ff68a681cbd 100644
--- a/products/experiments/skills/diagnosing-experiment-results/references/mid-run-changes.md
+++ b/products/experiments/skills/diagnosing-experiment-results/references/mid-run-changes.md
@@ -59,7 +59,7 @@ view.
edit history with diffs. Scan `results[].detail.changes[]` for `field == "filters"` entries and
read the last `multivariate.variants[]` `before`/`after` pair _before_ the entry where
`field == "active"` flips `false → true` (the activation event). That value is the split the
-experiment actually launched with. If it doesn't match `parameters.feature_flag_variants` as the
+experiment actually launched with. If it doesn't match `feature_flag.filters.multivariate.variants` as the
user described setting it, the launch state itself is the cause — no mid-run change is needed to
explain the missing-variant data.
diff --git a/products/posthog_ai/skills/auditing-experiments-flags/references/experiment-checks.md b/products/posthog_ai/skills/auditing-experiments-flags/references/experiment-checks.md
index 3831bcec8cab..f0c4bd80d88a 100644
--- a/products/posthog_ai/skills/auditing-experiments-flags/references/experiment-checks.md
+++ b/products/posthog_ai/skills/auditing-experiments-flags/references/experiment-checks.md
@@ -50,16 +50,15 @@ Verifies the experiment's linked feature flag is valid and correctly configured.
- Report: "The linked feature flag has been deleted."
- Action: Create a new flag and re-link it, or archive the experiment.
-- **Uneven variant split**: The linked flag's variant rollout percentages differ from the experiment's expected split by more than 5 percentage points.
- Compare the flag's `filters.multivariate.variants` rollout percentages to the experiment's `parameters.feature_flag_variants`.
+- **Incomplete variant split**: The rollout percentages in the flag's `filters.multivariate.variants` don't add up to 100.
- Severity: WARNING · Category: Correctness
- - Report: "Variant rollout percentages on the flag don't match the experiment's expected split."
- - Action: Adjust the flag's variant percentages to match the experiment configuration.
+ - Report: "The flag's variant rollout percentages don't add up to 100%. Some matched users get no variant."
+ - Action: Adjust the variant percentages on the flag so they total 100%.
-- **Variant mismatch**: The variant keys in the experiment's `parameters.feature_flag_variants` don't match the variant keys in the flag's `filters.multivariate.variants`.
+- **Too few variants**: The flag's `filters.multivariate.variants` holds fewer than two variants.
- Severity: CRITICAL · Category: Correctness
- - Report: "Variant keys differ between the experiment and its linked flag."
- - Action: Align variant keys between the experiment and its flag.
+ - Report: "The linked feature flag has fewer than two variants. There is nothing to compare."
+ - Action: Add a test variant to the flag alongside the baseline.
---
diff --git a/products/posthog_ai/skills/auditing-experiments-flags/references/remediation-actions.md b/products/posthog_ai/skills/auditing-experiments-flags/references/remediation-actions.md
index b021fb9800c3..8a13d83b27d5 100644
--- a/products/posthog_ai/skills/auditing-experiments-flags/references/remediation-actions.md
+++ b/products/posthog_ai/skills/auditing-experiments-flags/references/remediation-actions.md
@@ -12,8 +12,8 @@ Phase 1 is read-only — all actions require the user to make changes manually.
| Missing feature flag | Create and link a feature flag to this experiment. |
| Inactive (paused) flag | Re-enable the linked feature flag, or end the experiment if it's no longer needed. |
| Deleted flag | The experiment's flag was deleted. Create a new flag and re-link, or archive the experiment. |
-| Uneven variant split | Adjust variant rollout percentages on the linked flag to match the experiment's expected split. |
-| Variant mismatch | Align the variants between the experiment and its linked flag — they must use the same variant keys. |
+| Incomplete variant split | Adjust the variant rollout percentages on the linked flag so they total 100%. |
+| Too few variants | Add a test variant to the linked flag, so it has a baseline and at least one variant to compare. |
| Conclusion contradicts shipped variant | Review the experiment conclusion and the flag's current state. Either update the conclusion or change the flag to match. |
| Concluded but still splitting | The experiment has a conclusion but the flag is still splitting traffic. Roll out the winning variant or disable the flag. |
| Stale draft | This experiment has been in draft for over 7 days. Either launch it or delete it. |
diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2
index 25a2d2b31253..6297db8e3365 100644
--- a/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2
+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2
@@ -65,14 +65,13 @@ These are the only columns exposed via HogQL — the full experiment model (e.g.
"minimum_detectable_effect": 5,
"recommended_running_time": 14,
"recommended_sample_size": 1000,
- "feature_flag_variants": [
- {"key": "control", "name": "Control", "rollout_percentage": 50},
- {"key": "test", "name": "Test", "rollout_percentage": 50}
- ],
"custom_exposure_filter": {...}
}
```
+Variant keys and rollout percentages live on the linked flag. Read them from
+`filters.multivariate.variants` in `system.feature_flags`.
+
### Key Relationships
- **Feature Flag**: `feature_flag_id` -> `system.feature_flags.id` (required)
diff --git a/products/signals/skills/signals-scout-experiments/SKILL.md b/products/signals/skills/signals-scout-experiments/SKILL.md
index 4032b6fed9f9..bf33cd0b3669 100644
--- a/products/signals/skills/signals-scout-experiments/SKILL.md
+++ b/products/signals/skills/signals-scout-experiments/SKILL.md
@@ -55,7 +55,7 @@ Three cheap reads cold-start a run:
Then orient on experiments specifically:
1. `experiment-list {"status": "running", "order": "-start_date"}` — cheap: returns id, name, status, dates, `feature_flag_key` per experiment. Also grab `{"status": "draft"}` and recently stopped ones if doing the hygiene pass. **Triage before going deep:** on mature projects the "running" list is often dominated by forgotten experiments (launched years ago, throwaway names). Reserve the per-experiment exposure analysis for the validity-watch set — experiments launched in the last ~90 days or known-active from scratchpad memory (cap ~10 per run; rotate if more). Older running experiments go straight to the zombie bundle without exposure SQL.
-2. `experiment-get {id}` on running candidates only — you need `parameters.feature_flag_variants` (the configured split), `parameters.rollout_percentage`, `exposure_criteria` (custom exposure event? `multiple_variant_handling`?), `parameters.recommended_running_time`, `stats_config.method`, and the linked `feature_flag` (active state, `filters.groups[].variant` forced-variant overrides). The full object is large (metrics arrays, flag filters) — never bulk-fetch every experiment; running experiments only, and lean on scratchpad memory for ones you've profiled before.
+2. `experiment-get {id}` on running candidates only — you need the linked flag's `filters.multivariate.variants` (the configured split) and `filters.groups[].rollout_percentage`, `exposure_criteria` (custom exposure event? `multiple_variant_handling`?), `running_time_calculation.recommended_running_time`, `stats_config.method`, and the linked `feature_flag` (active state, `filters.groups[].variant` forced-variant overrides). The full object is large (metrics arrays, flag filters) — never bulk-fetch every experiment; running experiments only, and lean on scratchpad memory for ones you've profiled before.
3. `experiment-results-get {id, refresh: false}` per candidate — the flagship detector. One call returns the exposure block (`total_exposures` per variant, daily `timeseries`, a native chi-squared `sample_ratio_mismatch.p_value` and `bias_risk.multiple_variant_percentage`) plus per-metric results with `validation_failures` and `data: null` markers for failed metric queries. Read the exposure block and validation fields; **skip the per-metric stats** (movement is not your business) — with many metrics the response is heavy. Legacy experiments (`ExperimentTrendsQuery` / `ExperimentFunnelsQuery` metrics) aren't supported by this tool — fall back to the exposure SQL below.
Drop to `execute-sql` only for diagnosis: dating an onset, per-person fragmentation, custom-exposure drill-downs. **Timezone footgun:** HogQL string timestamp literals parse in the _project_ timezone, not UTC — a UTC `start_date` literal can shift the window by hours and fake a dormant experiment. Use `now() - INTERVAL N DAY` for recency windows.
@@ -119,7 +119,7 @@ Users counted under `$multiple` saw more than one variant — identity fragmenta
- **> 0.5%** sustained — worth surfacing; with `multiple_variant_handling = "exclude"` (the default when `exposure_criteria` doesn't set it) these users are dropped, and on an **uneven** split the drop is asymmetric, biasing results (then even > 0.1% matters).
- **Predictable mechanism check:** a flag with `bucketing_identifier: distinct_id` and `ensure_experience_continuity: false` on an experiment whose audience crosses an identity transition (new-user targeting, signup/login flows) re-buckets every anonymous-to-identified user — `$multiple` grows steadily from day one, and the excluded users are non-randomly the exact population under study. Read both fields off `experiment-get`'s `feature_flag`; when this shape matches, the finding is strong even with clean SRM.
-- A sudden **step-change** in the `$multiple` timeseries dates a rebucketing event — cross-check `feature-flags-activity-retrieve {id: <feature_flag_id>}` for a `filters` diff at that date. A variant zeroed mid-run with `parameters.excluded_variants` set is a deliberate arm-drop (a product feature), but it still rebuckets that arm's users — frame it as a deliberate change with statistical side effects, not a mystery mutation.
+- A sudden **step-change** in the `$multiple` timeseries dates a rebucketing event — cross-check `feature-flags-activity-retrieve {id: <feature_flag_id>}` for a `filters` diff at that date. A variant zeroed mid-run with `excluded_variants` set is a deliberate arm-drop (a product feature), but it still rebuckets that arm's users — frame it as a deliberate change with statistical side effects, not a mystery mutation.
- To dig into fragmentation: per-person variant counts —
```sql
@@ -177,7 +177,7 @@ Also `advanced-activity-logs-list {scopes: ["Experiment"], item_ids: [<id>]}` fo
Cheap hygiene pass over the full list — P3 recommendations, not anomalies; bundle them into one finding rather than one per experiment:
-- **Zombie:** running well past its useful life — exposures far above `parameters.recommended_sample_size` (often the cleaner test; `recommended_running_time` can be 0/absent), or > 60 days with a plateaued exposure curve. The data is as good as it will get; recommend deciding. For high-stakes calls, `experiment-timeseries-results` (needs `metric_uuid` + `fingerprint` from the experiment's `metrics` array) shows whether the primary metric has been stable for weeks — a sustained flat answer strengthens "decide now".
+- **Zombie:** running well past its useful life — exposures far above `running_time_calculation.recommended_sample_size` (often the cleaner test; `recommended_running_time` can be 0/absent), or > 60 days with a plateaued exposure curve. The data is as good as it will get; recommend deciding. For high-stakes calls, `experiment-timeseries-results` (needs `metric_uuid` + `fingerprint` from the experiment's `metrics` array) shows whether the primary metric has been stable for weeks — a sustained flat answer strengthens "decide now".
- **Stopped but contaminating:** `end_date` set weeks ago, linked flag still `active` with a multivariate split (no variant shipped to 100%). Users still see random variants of a concluded test; recommend ship-variant or flag cleanup.
- **Stale drafts:** drafts untouched > 30 days — lowest priority, mention only in a bundle, never alone.
@@ -231,7 +231,7 @@ Direct calls (read-only):
- `experiment-list` — cheap candidate discovery: id, name, status (draft / running / paused / stopped), dates, `feature_flag_key`. Filter by `status`; start here.
- `experiment-results-get` — **the flagship detector**: exposure block (`total_exposures`, daily `timeseries`, native `sample_ratio_mismatch.p_value`, `bias_risk.multiple_variant_percentage`) plus per-metric `validation_failures` / `data: null`. Heavy response with many metrics — read the exposure + validation fields, skip the per-metric stats. New-engine experiments only; pass `refresh: false`.
-- `experiment-get` — full config for a candidate: `parameters.feature_flag_variants` (configured split), `parameters.rollout_percentage`, `recommended_sample_size`, `parameters.excluded_variants`, `exposure_criteria` (custom `exposure_config.event`, `multiple_variant_handling`, `filterTestAccounts`), `resolved_exposure_event` (the default exposure event to query), `stats_config.method`, `holdout_id`, linked `feature_flag` (active, `version`, `bucketing_identifier`, `ensure_experience_continuity`, `filters.groups[].variant` overrides), `metrics` (each with `uuid` + fingerprint). Large response — candidates only.
+- `experiment-get` — full config for a candidate: `running_time_calculation.recommended_sample_size`, `excluded_variants`, `exposure_criteria` (custom `exposure_config.event`, `multiple_variant_handling`, `filterTestAccounts`), `resolved_exposure_event` (the default exposure event to query), `stats_config.method`, `holdout_id`, linked `feature_flag` (active, `version`, `bucketing_identifier`, `ensure_experience_continuity`, `filters.multivariate.variants` for the configured split, `filters.groups[].rollout_percentage`, `filters.groups[].variant` overrides), `metrics` (each with `uuid` + fingerprint). Large response — candidates only.
- `experiment-stats` — project-wide velocity aggregate (launched / completed last 30d, active count). Cheap context for the hygiene pass.
- `experiment-timeseries-results` — day-by-day per-variant results for one metric (`metric_uuid` + `fingerprint` from the metrics array). Use sparingly, for the zombie "decide now" check.
- `feature-flag-get-definition` / `feature-flags-activity-retrieve` — flag state and edit-history diffs; the latter is how you date mid-run mutations.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 6a99ed24f013..0e12f495c30a 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -4442,7 +4442,7 @@
}
},
"experiment-get": {
- "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, parameters (including feature_flag_variants and recommended_running_time), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
+ "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
"category": "Experiments",
"feature": "experiments",
"summary": "Get experiment details",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 878b4bc6907a..d8941bb6da44 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -4513,7 +4513,7 @@
}
},
"experiment-get": {
- "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, parameters (including feature_flag_variants and recommended_running_time), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
+ "description": "Get a single experiment by ID. If you have the experiment's feature flag key instead of its ID, call experiment-get-by-flag-key. If you have neither, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, running_time_calculation (minimum detectable effect, recommended running time and sample size), stats_config, type (web/product), and resolved_exposure_event (the event exposures are counted on when no custom exposure event is configured — resolved server-side to $feature_flag_called or $experiment_exposure; use it in SQL instead of hardcoding either name).",
"category": "Experiments",
"feature": "experiments",
"summary": "Get experiment details",
diff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.ts
index f23c149fd049..63a4c7efe999 100644
--- a/services/mcp/src/tools/generated/experiments.ts
+++ b/services/mcp/src/tools/generated/experiments.ts
@@ -214,7 +214,7 @@ const ExperimentCreateSchema = () => {
return ExperimentsCreateBody.omit({
start_date: true,
end_date: true,
- running_time_calculation: true,
+ parameters: true,
excluded_variants: true,
secondary_metrics: true,
saved_metrics_ids: true,
@@ -239,6 +239,9 @@ const ExperimentCreateSchema = () => {
feature_flag: ExperimentsCreateBody.shape['feature_flag'].describe(
'Variant split, rollout scope, payloads, and experience continuity for the auto-created feature flag, in the flag\'s own filters shape. This is the canonical input for flag config. If the user mentions a specific percentage, load the configuring-experiment-rollout skill and clarify before setting these values. Set filters.multivariate.variants (each with key and rollout_percentage; percentages must sum to 100) to customize the variant split. Set filters.groups to a single group [{"properties": [], "rollout_percentage": N}] (0-100) to control the overall fraction of users entering the experiment. Default: 50/50 control/test, 100% rollout. Omit this parameter entirely when feature_flag_key refers to a pre-existing flag: the experiment links to that flag as-is and explicit config is rejected. No specific variant key is required. The analysis baseline defaults to the variant keyed `control` (lowercase) when present, else the first variant; override with stats_config.baseline_variant_key. Convention: when the user describes variants as "A/B", "old/new", "original/redesign", or any other natural-language pair without naming explicit keys, key the baseline `control` and keep their wording in the variant `name`. When the user asks for specific keys, use them as-is and put the baseline first.'
),
+ running_time_calculation: ExperimentsCreateBody.shape['running_time_calculation'].describe(
+ "Persist a running-time / sample-size plan onto the experiment (the planning target shown in the experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage, e.g. 20 for a 20% lift), recommended_sample_size (total across all variants), recommended_running_time (days), and exposure_estimate_config."
+ ),
})
}
@@ -264,8 +267,8 @@ const experimentCreate = (): ToolBase<ReturnType<typeof ExperimentCreateSchema>,
if (params.holdout_id !== undefined) {
body['holdout_id'] = params.holdout_id
}
- if (params.parameters !== undefined) {
- body['parameters'] = params.parameters
+ if (params.running_time_calculation !== undefined) {
+ body['running_time_calculation'] = params.running_time_calculation
}
if (params.exposure_criteria !== undefined) {
body['exposure_criteria'] = params.exposure_criteria
@@ -295,7 +298,7 @@ const experimentCreate = (): ToolBase<ReturnType<typeof ExperimentCreateSchema>,
'start_date',
'end_date',
'created_at',
- 'parameters',
+ 'running_time_calculation',
'metrics',
'metrics_secondary',
'conclusion',
@@ -355,7 +358,6 @@ const experimentCreateFromPrompt = (): ToolBase<
'start_date',
'end_date',
'created_at',
- 'parameters',
'metrics',
'metrics_secondary',
'conclusion',
@@ -1358,6 +1360,7 @@ const ExperimentUpdateSchema = () => {
start_date: true,
end_date: true,
feature_flag_key: true,
+ parameters: true,
secondary_metrics: true,
filters: true,
deleted: true,
@@ -1404,9 +1407,6 @@ const experimentUpdate = (): ToolBase<ReturnType<typeof ExperimentUpdateSchema>,
if (params.holdout_id !== undefined) {
body['holdout_id'] = params.holdout_id
}
- if (params.parameters !== undefined) {
- body['parameters'] = params.parameters
- }
if (params.running_time_calculation !== undefined) {
body['running_time_calculation'] = params.running_time_calculation
}
@@ -1462,8 +1462,8 @@ const experimentUpdate = (): ToolBase<ReturnType<typeof ExperimentUpdateSchema>,
'start_date',
'end_date',
'created_at',
- 'parameters',
'running_time_calculation',
+ 'excluded_variants',
'metrics',
'metrics_secondary',
'saved_metrics',
diff --git a/services/mcp/tests/tools/experiments.integration.test.ts b/services/mcp/tests/tools/experiments.integration.test.ts
index 1a85038f3802..4e927e20b6ca 100644
--- a/services/mcp/tests/tools/experiments.integration.test.ts
+++ b/services/mcp/tests/tools/experiments.integration.test.ts
@@ -368,7 +368,7 @@ describe('Experiments', { concurrent: false }, () => {
const params = {
name: 'MDE Test Experiment',
feature_flag_key: flagKey,
- parameters: {
+ running_time_calculation: {
minimum_detectable_effect: 15,
},
allow_unknown_events: true,
@@ -379,6 +379,7 @@ describe('Experiments', { concurrent: false }, () => {
trackExperiment(experiment)
expect(experiment.id).toBeTruthy()
+ expect(experiment.running_time_calculation?.minimum_detectable_effect).toBe(15)
})
it('should create an experiment with filter test accounts enabled', async () => {
@@ -609,7 +610,7 @@ describe('Experiments', { concurrent: false }, () => {
},
},
},
- parameters: {
+ running_time_calculation: {
minimum_detectable_effect: 20,
},
exposure_criteria: {
@@ -1198,13 +1199,13 @@ describe('Experiments', { concurrent: false }, () => {
// Update minimum detectable effect
const updateResult = await updateTool.handler(context, {
id: experiment.id,
- parameters: {
+ running_time_calculation: {
minimum_detectable_effect: 25,
},
} as any)
const updatedExperiment = parseToolResponse(updateResult)
- expect(updatedExperiment.parameters?.minimum_detectable_effect).toBe(25)
+ expect(updatedExperiment.running_time_calculation?.minimum_detectable_effect).toBe(25)
})
it('should handle invalid experiment ID', async () => {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
index c8b87a3971c0..2a722800eb00 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-create.json
@@ -5841,10 +5841,63 @@
"maxLength": 400,
"type": "string"
},
- "parameters": {
+ "running_time_calculation": {
"anyOf": [
{
"properties": {
+ "exposure_estimate_config": {
+ "anyOf": [
+ {
+ "properties": {
+ "conversionRateInputType": {
+ "description": "'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data.",
+ "enum": ["manual", "automatic"],
+ "type": "string"
+ },
+ "manualBaselineValue": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode."
+ },
+ "manualExposureRate": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Manually entered estimate of users exposed to the experiment per day. Only used in manual mode."
+ },
+ "manualMetricType": {
+ "anyOf": [
+ {
+ "enum": ["funnel", "mean_count", "mean_sum_or_avg"],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Metric type the manual baseline value refers to. Only used in manual mode."
+ }
+ },
+ "required": ["conversionRateInputType"],
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "How the exposure estimate is configured: manual user-entered values or automatic from live experiment data."
+ },
"minimum_detectable_effect": {
"anyOf": [
{
@@ -5854,24 +5907,29 @@
"type": "null"
}
],
- "description": "Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments."
+ "description": "Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes."
},
- "variant_notes": {
+ "recommended_running_time": {
"anyOf": [
{
- "additionalProperties": {
- "type": "string"
- },
- "propertyNames": {
- "type": "string"
- },
- "type": "object"
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Estimated number of days needed to reach the recommended sample size."
+ },
+ "recommended_sample_size": {
+ "anyOf": [
+ {
+ "type": "number"
},
{
"type": "null"
}
],
- "description": "Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL."
+ "description": "Recommended number of exposed users needed for statistical significance."
}
},
"type": "object"
@@ -5880,7 +5938,7 @@
"type": "null"
}
],
- "description": "Experiment parameters JSON. Supported keys include `custom_exposure_filter` and `variant_notes` (free-text notes per variant, keyed by variant key). Flag config (variants, rollout, aggregation, payloads, experience continuity) belongs on the `feature_flag` object; send it there. For backward compatibility, config still sent through these deprecated keys is copied onto the linked flag rather than rejected, and reads project the flag's current config back into this field. Excluded variants live on the top-level `excluded_variants` field, not here."
+ "description": "Persist a running-time / sample-size plan onto the experiment (the planning target shown in the experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage, e.g. 20 for a 20% lift), recommended_sample_size (total across all variants), recommended_running_time (days), and exposure_estimate_config."
},
"stats_config": {},
"tags": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
index f2fc16cdb99a..28478d015029 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
@@ -9229,47 +9229,6 @@
"maxLength": 400,
"type": "string"
},
- "parameters": {
- "anyOf": [
- {
- "properties": {
- "minimum_detectable_effect": {
- "anyOf": [
- {
- "type": "number"
- },
- {
- "type": "null"
- }
- ],
- "description": "Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments."
- },
- "variant_notes": {
- "anyOf": [
- {
- "additionalProperties": {
- "type": "string"
- },
- "propertyNames": {
- "type": "string"
- },
- "type": "object"
- },
- {
- "type": "null"
- }
- ],
- "description": "Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL."
- }
- },
- "type": "object"
- },
- {
- "type": "null"
- }
- ],
- "description": "Experiment parameters JSON. Supported keys include `custom_exposure_filter` and `variant_notes` (free-text notes per variant, keyed by variant key). Flag config (variants, rollout, aggregation, payloads, experience continuity) belongs on the `feature_flag` object; send it there. For backward compatibility, config still sent through these deprecated keys is copied onto the linked flag rather than rejected, and reads project the flag's current config back into this field. Excluded variants live on the top-level `excluded_variants` field, not here."
- },
"running_time_calculation": {
"anyOf": [
{