: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(engineering-analytics): report conclusive pass rates (#89197)
Raúl Negrón-Otero5aa4d6860cbb
diff --git a/products/engineering_analytics/SPEC.md b/products/engineering_analytics/SPEC.mdindex 3645a3384db6..fa7d007991d7 100644--- a/products/engineering_analytics/SPEC.md+++ b/products/engineering_analytics/SPEC.md@@ -150,7 +150,8 @@ Engineering-specific decisions. Product-level decisions live in README → Locke- Two cost queries stay unfloored on purpose: single-PR cost and the PR-list cost rollup are keyed by PR number, not a window, and no cheap date bound exists for either (see `pr_cost.py`). The per-run job breakdown is unfloored too — it filters `run_id`, the window's leading partition column.- **Warehouse columns are strings + Nullable JSON; the builders parse and `ifNull`-guard.** Timestamps parse via `parseDateTimeBestEffort`; Nullable columns unwrap before any array function (ClickHouse rejects an Array inside a Nullable). `source_schema.py` mirrors the real landed types so seed and tests exercise the real path; violating this 500'd every endpoint on real data while idealized fixtures stayed green.- **The warehouse views are managed data, not code registration.** "No global HogQL views" locks out `Database.create_for` (core importing the product, every team's per-query hot path). A per-team `DataWarehouseSavedQuery`, synced only for qualifying teams, reopens nothing: it exists so cost and CI history are queryable by insights, subscriptions, and `execute-sql`.-- **CI Signals use immutable evidence.** Flaky checks require job rows from `github_workflow_jobs` showing a failed attempt followed by a successful later attempt for the same `(run_id, job)`. The run snapshot alone cannot prove this transition. Broken-default-branch detection reads GitHub's reported default branch from the PR snapshot's `base.repo`, the only full repository object in the tables this product reads (`query_default_branches` documents why the runs snapshot cannot answer it). A repo with no PR rows resolves nothing and is skipped: `repo_overview`'s master/main run-volume guess stays a display approximation, because a P1 needs GitHub's report, not inference. Detection gates on the rate over runs that reached a verdict (cancelled and skipped runs decide nothing). Duration comparisons require enough successful samples because the percentiles exclude failed and cancelled runs. All three conditions carry a week-stable `source_id`, and the coordinator records each emitted key in `SignalEmissionRecord` so an hourly sweep doesn't re-emit the same standing condition within its week. For broken-default-branch that means one signal per week per workflow, accepting that a distinct second breakage of the same workflow inside one week dedupes into the first rather than minting a signal (and a ledger row) per completed run.+- **Workflow pass rate uses verdicts, not every completed run.** `success` is a pass. `failure`, `timed_out`, `startup_failure`, and `stale` are decisive failures. Skipped, cancelled, neutral, action-required, unsettled, and unknown outcomes reached no pass-or-fail verdict, so they stay in run volume but not the rate. The backend query layer owns this classification; frontend summaries over raw run rows mirror it in `lifecycle.ts`.+- **CI Signals use immutable evidence.** Flaky checks require job rows from `github_workflow_jobs` showing a failed attempt followed by a successful later attempt for the same `(run_id, job)`. The run snapshot alone cannot prove this transition. Broken-default-branch detection reads GitHub's reported default branch from the PR snapshot's `base.repo`, the only full repository object in the tables this product reads (`query_default_branches` documents why the runs snapshot cannot answer it). A repo with no PR rows resolves nothing and is skipped: `repo_overview`'s master/main run-volume guess stays a display approximation, because a P1 needs GitHub's report, not inference. Detection gates on the canonical pass rate above. Duration comparisons require enough successful samples because the percentiles exclude failed and cancelled runs. All three conditions carry a week-stable `source_id`, and the coordinator records each emitted key in `SignalEmissionRecord` so an hourly sweep doesn't re-emit the same standing condition within its week. For broken-default-branch that means one signal per week per workflow, accepting that a distinct second breakage of the same workflow inside one week dedupes into the first rather than minting a signal (and a ledger row) per completed run.- **HogQL only for analytics data.** No raw ClickHouse.- **No product Postgres DB.** Analytics data lives in the warehouse / ClickHouse; any product-config model goes on the main DB as a team-scoped model (`TeamScopedRootMixin`), never a separate DB.- **No author leaderboards or per-developer performance rankings; the author page is allowed.** The surveillance risk is ranking people against each other, not an engineer viewing their own PRs and CI cost. The page is reachable only from PR-row author links; `author_workflow_costs` stays a UI-only read (MCP `enabled: false`).diff --git a/products/engineering_analytics/backend/facade/contracts.py b/products/engineering_analytics/backend/facade/contracts.pyindex 8fd0863113ed..0718395b72b3 100644--- a/products/engineering_analytics/backend/facade/contracts.py+++ b/products/engineering_analytics/backend/facade/contracts.py@@ -806,7 +806,7 @@ class PushCISample:started_at: datetime# First run start → last completed run end on this push; None while nothing has completed.wall_seconds: int | None- # Any latest-per-workflow run on this push concluded 'failure' or 'timed_out'.+ # Any latest-per-workflow run on this push reached a decisive failure verdict.failed: bool# Any latest-per-workflow run on this push hasn't completed yet.pending: bool@@ -894,8 +894,8 @@ class CICardSummary:class WorkflowHealthBucket:"""One time bucket of a workflow's run history; empty buckets are zero-filled. Thebucket width (hour / day / week) is set per item in ``WorkflowHealthItem.granularity``- to fit the window. ``failures`` is decisive failures only (failure / timed_out),- matching the CI rollup — skipped, cancelled, and action_required runs are neither+ to fit the window. ``failures`` is decisive failures only, matching the CI rollup —+ skipped, cancelled, neutral, and action_required runs are neithersuccesses nor failures, so they must not be treated as non-passing."""@@ -981,25 +981,24 @@ class QuarantineRequestResult:@dataclass(frozen=True)class WorkflowHealthItem:- """Per-workflow CI health over a window. ``success_rate`` is over completed runs;- ``p50_seconds``/``p95_seconds`` are over successful runs only (cancelled, skipped,- and failed runs end early and would bias a duration percentile low). Each is- ``None`` when the window has no qualifying runs.+ """Per-workflow CI health over a window. ``success_rate`` is over conclusive runs+ (success or a decisive failure); ``p50_seconds``/``p95_seconds`` are over successful+ runs only because cancelled, skipped, and failed runs end early. Each is ``None``+ when the window has no qualifying runs."""repo: RepoRefworkflow_name: strrun_count: intsuccessful_run_count: int- # Completed runs that reached a verdict (success / failure / timed_out). Cancelled and skipped- # runs inflate `success_rate`'s denominator; pair this with `successful_run_count` for a rate- # meaning "of the runs that actually ran".+ # Completed runs that reached a pass or decisive failure verdict. This is the denominator for+ # success_rate and the sample-size gate for verdict-based signals.conclusive_run_count: intsuccess_rate: float | Nonep50_seconds: float | Nonep95_seconds: float | Nonelast_failure_at: datetime | None- # Whether the most recent completed run was a decisive failure (failure / timed_out).+ # Whether the most recent completed run was a decisive failure.# None when nothing has completed in the window. Drives the OK/RED status badge — a# bool, not the raw conclusion, because the data carries conclusions outside# WorkflowConclusion (e.g. action_required) that would fail validation here.@@ -1020,7 +1019,7 @@ class WorkflowHealthItem:estimated_cost_usd: float | None = None# Runs in the window that were a 2nd+ attempt.rerun_cycles: int = 0- # Success rate over the equal-length window before date_from; None when it had no completed runs.+ # Success rate over the equal-length window before date_from; None when it had no conclusive runs.success_rate_prev: float | None = None# Successful runs that did real work; the exact population p50/p95 are computed over (no-op gate# runs excluded). Distinct from `successful_run_count`, which counts those no-op successes too, so@@ -1072,14 +1071,14 @@ class TimeToGreenBucket:@dataclass(frozen=True)class PassRateBucket:- """One time bucket of the repo's CI pass rate: the fraction of completed runs (all branches) started in- this bucket that succeeded. ``success_rate`` is None for a bucket with no completed run (a gap, not a- 0% pass rate); the UI carries the last known value forward rather than dipping the trend to zero.+ """One time bucket of the repo's CI pass rate: successful runs divided by conclusive runs+ (success or a decisive failure) across all branches. ``success_rate`` is None for a bucket+ with no conclusive run, so the trend has a gap instead of a false 0% rate."""# Bucket start, aligned to the granularity (top of hour / midnight / Monday).bucket_start: datetime- # Fraction (0-1) of completed runs started in this bucket that succeeded. None when none completed.+ # Fraction (0-1) of conclusive runs that succeeded. None when no run reached a verdict.success_rate: float | None@@ -1202,8 +1201,8 @@ class RepoOverview:time_to_green_series: list[TimeToGreenBucket]# Bucket width of `time_to_green_series`, chosen to fit the window: 'hour', 'day', or 'week'.time_to_green_series_granularity: str- # Pass-rate trend: fraction of completed runs (all branches) that succeeded per bucket, oldest first,- # bucketed by `success_rate_series_granularity`. Empty buckets carry None (no completed run).+ # Pass-rate trend: fraction of conclusive runs (all branches) that succeeded per bucket, oldest first,+ # bucketed by `success_rate_series_granularity`. Empty buckets carry None (no conclusive run).success_rate_series: list[PassRateBucket]# Bucket width of `success_rate_series`, chosen to fit the window: 'hour', 'day', or 'week'.success_rate_series_granularity: strdiff --git a/products/engineering_analytics/backend/logic/queries/_curated.py b/products/engineering_analytics/backend/logic/queries/_curated.pyindex 7169abb15dd1..5e015bc2fb17 100644--- a/products/engineering_analytics/backend/logic/queries/_curated.py+++ b/products/engineering_analytics/backend/logic/queries/_curated.py@@ -28,6 +28,7 @@ from posthog.clickhouse.workload import Workloadfrom posthog.dataclasses import frozenfrom posthog.models.team import Team+from products.engineering_analytics.backend.logic.queries._workflow_filters import DECISIVE_FAILURE_CONCLUSIONS_SQLfrom products.engineering_analytics.backend.logic.sources import (GitHubTables,TrunkQuarantineSource,@@ -364,13 +365,13 @@ class CuratedGitHubSource:head_sha,count() AS runs,countIf(s = 'completed' AND c = 'success') AS passing,- countIf(s = 'completed' AND c IN ('failure', 'timed_out')) AS failing,+ countIf(s = 'completed' AND c IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})) AS failing,-- s IS NULL: run_started_at parses to NULL on a bad/missing timestamp, and argMax-- over an all-NULL group returns NULL — count those as pending, not vanished.countIf(s IS NULL OR s != 'completed') AS pending,-- The names behind `failing`, sorted for a stable order — the UI shows what is-- failing under the CI tag instead of a bare count.- arraySort(groupArrayIf(workflow_name, s = 'completed' AND c IN ('failure', 'timed_out'))) AS failing_workflows+ arraySort(groupArrayIf(workflow_name, s = 'completed' AND c IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL}))) AS failing_workflowsFROM (SELECThead_sha,diff --git a/products/engineering_analytics/backend/logic/queries/_workflow_filters.py b/products/engineering_analytics/backend/logic/queries/_workflow_filters.pyindex 5102f76a4fb0..376bb8a3b79f 100644--- a/products/engineering_analytics/backend/logic/queries/_workflow_filters.py+++ b/products/engineering_analytics/backend/logic/queries/_workflow_filters.py@@ -22,11 +22,25 @@ def merge_queue_branch_predicate(branch_sql: str) -> str:return f"startsWith({branch_sql}, '{MERGE_QUEUE_BRANCH_PREFIX}')"-# The base duration-percentile population, for runs and jobs alike: successful instances-# only. Cancelled/skipped (superseded) and failed instances end early, so including them-# answers "how long until CI stopped", not "how long does CI take to pass". Jobs use this-# as-is — a seconds-long job (the gate job itself) is a legitimate duration sample.-DURATION_PERCENTILE_CONDITION = "status = 'completed' AND conclusion = 'success'"+# Mirrors DECISIVE_FAILURE_CONCLUSIONS in frontend/lib/lifecycle.ts (keep the two in sync).+DECISIVE_FAILURE_CONCLUSIONS = ("failure", "timed_out", "startup_failure", "stale")+DECISIVE_FAILURE_CONCLUSIONS_SQL = ", ".join(f"'{conclusion}'" for conclusion in DECISIVE_FAILURE_CONCLUSIONS)+SUCCESSFUL_RUN_CONDITION = "status = 'completed' AND conclusion = 'success'"+CONCLUSIVE_RUN_CONDITION = f"status = 'completed' AND conclusion IN ('success', {DECISIVE_FAILURE_CONCLUSIONS_SQL})"++# Duration percentiles use successful instances because cancelled, skipped, and failed instances+# end early. Including them answers "how long until CI stopped", not "how long does CI take to pass".+# Jobs use this as-is because a seconds-long job can be a legitimate duration sample.+DURATION_PERCENTILE_CONDITION = SUCCESSFUL_RUN_CONDITION+++def success_rate_expr(scope: str | None = None) -> str:+ """Bare (unaliased) pass rate per aggregate group: successful runs over conclusive runs.+ Division through nullIf yields NULL when no run reached a verdict, so consumers read a gap,+ never a false 0%. ``scope`` ANDs an extra predicate into both counts (e.g. a window split)."""+ guard = f" AND {scope}" if scope else ""+ return f"countIf({SUCCESSFUL_RUN_CONDITION}{guard}) / nullIf(countIf({CONCLUSIVE_RUN_CONDITION}{guard}), 0)"+# A run that settled in under this many seconds with a benign conclusion did no real CI work — the# common shape is a gate job deciding the rest of the workflow should be skipped (path filters,@@ -68,7 +82,7 @@ def run_duration_percentile_expr(quantile: float) -> str:# later-created run. argMaxIf defaults to 0 (false) over zero matching rows, so consumers must# pair it with a completed-run count to tell "latest run passed" apart from "no completed run yet".LATEST_COMPLETED_RUN_FAILED = (- "argMaxIf(conclusion IN ('failure', 'timed_out'), (run_started_at, id), status = 'completed')"+ f"argMaxIf(conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL}), (run_started_at, id), status = 'completed')")diff --git a/products/engineering_analytics/backend/logic/queries/master_failures.py b/products/engineering_analytics/backend/logic/queries/master_failures.pyindex e5eadd59c32c..4cec51754784 100644--- a/products/engineering_analytics/backend/logic/queries/master_failures.py+++ b/products/engineering_analytics/backend/logic/queries/master_failures.py@@ -19,6 +19,7 @@ from posthog.hogql import astfrom products.engineering_analytics.backend.facade.contracts import MasterFailureGroup, RepoReffrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries._workflow_filters import (+ DECISIVE_FAILURE_CONCLUSIONS_SQL,run_windowed_job_created_floor_constant,)@@ -30,15 +31,15 @@ _FAILED_RUNS_SELECT = f"""FROM __RUNS_SOURCE__ AS rWHERE run_started_at >= {{date_from}} __DATE_TO__AND head_branch = {{branch}}- AND status = 'completed' AND conclusion IN ('failure', 'timed_out')+ AND status = 'completed' AND conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})ORDER BY run_started_at DESCLIMIT {_RUN_CAP}"""-_FAILED_JOBS_SELECT = """+_FAILED_JOBS_SELECT = f"""SELECT run_id, nameFROM __JOBS_SOURCE__ AS j- WHERE run_id IN {run_ids} AND conclusion IN ('failure', 'timed_out')+ WHERE run_id IN {{run_ids}} AND conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})"""# Trailing "(G/N)" shard suffix, incl. nested parens ("Product tests (experiments (1/2))") —diff --git a/products/engineering_analytics/backend/logic/queries/merge_queue_overview.py b/products/engineering_analytics/backend/logic/queries/merge_queue_overview.pyindex 1d3e6289d8eb..430e6b247af6 100644--- a/products/engineering_analytics/backend/logic/queries/merge_queue_overview.py+++ b/products/engineering_analytics/backend/logic/queries/merge_queue_overview.py@@ -19,6 +19,7 @@ from posthog.hogql import astfrom products.engineering_analytics.backend.logic.merge_queue import gate_attempt_exprfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource, opt_floatfrom products.engineering_analytics.backend.logic.queries._workflow_filters import (+ DECISIVE_FAILURE_CONCLUSIONS_SQL,date_to_filter_clause,run_started_floor_constant,window_pair_predicates,@@ -65,7 +66,7 @@ _MERGE_QUEUE_SELECT = """any(pr.merged_at) AS merged_at,min(r.run_started_at) AS first_gate_started_at,count(DISTINCT __GATE_ATTEMPT__) AS attempts,- max(r.status = 'completed' AND r.conclusion IN ('failure', 'timed_out')) AS had_failed_gate+ max(r.status = 'completed' AND r.conclusion IN (__DECISIVE_FAILURES__)) AS had_failed_gateFROM __RUNS_SOURCE__ AS rINNER JOIN __PR_SOURCE__ AS pr ON pr.number = r.pr_numberWHERE r.is_merge_queue@@ -232,6 +233,7 @@ def query_merge_queue_overview(.replace("__PR_SOURCE__", curated.pr_source()).replace("__GATE_ATTEMPT__", gate_attempt_expr("r.head_branch")).replace("__DATE_TO_MERGED__", date_to_merged_clause)+ .replace("__DECISIVE_FAILURES__", DECISIVE_FAILURE_CONCLUSIONS_SQL))response = curated.run(sql, query_type="engineering_analytics.merge_queue_overview", placeholders=placeholders)if not response.results:diff --git a/products/engineering_analytics/backend/logic/queries/pull_request_list.py b/products/engineering_analytics/backend/logic/queries/pull_request_list.pyindex 1403257d983c..0411303f3de1 100644--- a/products/engineering_analytics/backend/logic/queries/pull_request_list.py+++ b/products/engineering_analytics/backend/logic/queries/pull_request_list.py@@ -22,6 +22,7 @@ from products.engineering_analytics.backend.facade.contracts import ()from products.engineering_analytics.backend.logic.cost import PRCostAggregatefrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource+from products.engineering_analytics.backend.logic.queries._workflow_filters import DECISIVE_FAILURE_CONCLUSIONS_SQLfrom products.engineering_analytics.backend.logic.queries.pr_cost import query_pr_list_costs_LIMIT = 1000@@ -86,7 +87,7 @@ _PUSH_HISTORY_SELECT = """repo_owner, repo_name, pr_number, head_sha,min(first_start) AS started_at,if(countIf(last_end IS NOT NULL) = 0, NULL, dateDiff('second', min(first_start), max(last_end))) AS wall_seconds,- countIf(s = 'completed' AND c IN ('failure', 'timed_out')) > 0 AS failed,+ countIf(s = 'completed' AND c IN (__DECISIVE_FAILURES__)) > 0 AS failed,countIf(s IS NULL OR s != 'completed') > 0 AS pendingFROM (SELECT@@ -114,8 +115,10 @@ def query_pr_push_history(the scan tracks the page (same shape as ``query_pr_list_costs``)."""if not pr_numbers:return {}- sql = _PUSH_HISTORY_SELECT.replace("__RUNS_SOURCE__", curated.run_source()).replace(- "__PUSH_HISTORY_LIMIT__", str(_PUSH_HISTORY_LIMIT)+ sql = (+ _PUSH_HISTORY_SELECT.replace("__RUNS_SOURCE__", curated.run_source())+ .replace("__PUSH_HISTORY_LIMIT__", str(_PUSH_HISTORY_LIMIT))+ .replace("__DECISIVE_FAILURES__", DECISIVE_FAILURE_CONCLUSIONS_SQL))response = curated.run(sql,diff --git a/products/engineering_analytics/backend/logic/queries/repo_overview.py b/products/engineering_analytics/backend/logic/queries/repo_overview.pyindex 00a3b9f1affb..20b8f3156a78 100644--- a/products/engineering_analytics/backend/logic/queries/repo_overview.py+++ b/products/engineering_analytics/backend/logic/queries/repo_overview.py@@ -38,6 +38,7 @@ from products.engineering_analytics.backend.logic.queries._buckets import (from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource, opt_floatfrom products.engineering_analytics.backend.logic.queries._workflow_filters import (run_started_floor_constant,+ success_rate_expr,window_pair_predicates,)from products.engineering_analytics.backend.logic.queries.merge_queue_overview import (@@ -54,20 +55,18 @@ from products.engineering_analytics.backend.logic.queries.workflow_health importquery_time_to_green_window,)-_RUNS_SELECT = """+_RUNS_SELECT = f"""SELECTcountIf(__CUR__) AS run_count,countIf(__PREV__) AS run_count_prev,- countIf(status = 'completed' AND conclusion = 'success' AND __CUR__)- / nullIf(countIf(status = 'completed' AND __CUR__), 0) AS success_rate,- countIf(status = 'completed' AND conclusion = 'success' AND __PREV__)- / nullIf(countIf(status = 'completed' AND __PREV__), 0) AS success_rate_prev,+ {success_rate_expr("__CUR__")} AS success_rate,+ {success_rate_expr("__PREV__")} AS success_rate_prev,countIf(run_attempt > 1 AND __CUR__) AS rerun_cycles,countIf(run_attempt > 1 AND __PREV__) AS rerun_cycles_prev,countIf(head_branch = 'master' AND __CUR__) AS master_runs,countIf(head_branch = 'main' AND __CUR__) AS main_runsFROM __RUNS_SOURCE__ AS r- WHERE run_started_at >= {prev_from} __DATE_TO__+ WHERE run_started_at >= {{prev_from}} __DATE_TO__"""# The locked cycle-time recipe: a median over merges is a median over human, never-drafted PRs.@@ -122,14 +121,13 @@ def query_default_branch(return "main" if (main_runs or 0) > (master_runs or 0) else "master"-# Pass rate per bucket over completed runs, all branches — the population the headline pass rate uses.-# Division through nullIf yields NULL for a bucket with no completed run (a gap, not 0%).-_PASS_RATE_SERIES_SELECT = """+# Pass rate per bucket over conclusive runs on all branches, matching the headline population.+_PASS_RATE_SERIES_SELECT = f"""SELECT__BUCKET_FN__ AS bucket_start,- countIf(status = 'completed' AND conclusion = 'success') / nullIf(countIf(status = 'completed'), 0) AS success_rate+ {success_rate_expr()} AS success_rateFROM __RUNS_SOURCE__ AS r- WHERE run_started_at >= {date_from} __DATE_TO__+ WHERE run_started_at >= {{date_from}} __DATE_TO__GROUP BY bucket_startLIMIT 40000"""@@ -194,8 +192,8 @@ def query_success_rate_series(date_to: datetime | None,granularity: Granularity,) -> list[PassRateBucket]:- """Pass rate per bucket across the window, oldest first: completed runs that succeeded, all branches —- the same population as the headline pass rate. Empty buckets carry ``success_rate`` None (a gap)."""+ """Pass rate per bucket across the window, oldest first: successful runs divided by conclusive runs+ on all branches, matching the headline population. Empty buckets carry ``success_rate`` None."""placeholders: dict[str, ast.Expr] = {"date_from": ast.Constant(value=date_from),"run_started_floor": run_started_floor_constant(date_from),diff --git a/products/engineering_analytics/backend/logic/queries/repo_run_activity.py b/products/engineering_analytics/backend/logic/queries/repo_run_activity.pyindex d44121a34188..8a4402bc7b1e 100644--- a/products/engineering_analytics/backend/logic/queries/repo_run_activity.py+++ b/products/engineering_analytics/backend/logic/queries/repo_run_activity.py@@ -10,8 +10,8 @@ go green for this commit, and how long did its CI take":- ``duration_seconds`` = wall-clock from the first workflow start to the last workflow finish, and onlyonce **every** workflow settled — while any is still running the commit's CI isn't done, so duration isnull (the point drops off the scatter and feeds the in-flight band instead), mirroring the per-run chart.-- ``conclusion`` = the commit's overall verdict: red if **any** workflow decisively failed- (``failure`` / ``timed_out``), else '' (still in flight) if any hasn't settled, else ``success`` when at+- ``conclusion`` = the commit's overall verdict: red if **any** workflow decisively failed,+ else '' (still in flight) if any hasn't settled, else ``success`` when atleast one passed, else ``neutral`` (only cancelled/skipped). One decisive failure turns the commit red,matching how a human reads a broken default branch.@@ -31,6 +31,7 @@ from posthog.hogql import astfrom products.engineering_analytics.backend.facade.contracts import WorkflowRunActivity, WorkflowRunActivityPointfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource+from products.engineering_analytics.backend.logic.queries._workflow_filters import DECISIVE_FAILURE_CONCLUSIONS_SQL# One point per commit, so the cap is in commits (not runs) — comfortably above the busiest window's# default-branch commit count while bounding the wire size. Newest commits win when the cap is hit.@@ -40,7 +41,7 @@ _SELECT = f"""SELECTmax(w.id) AS run_id,multiIf(- countIf(w.status = 'completed' AND w.conclusion IN ('failure', 'timed_out')) > 0, 'failure',+ countIf(w.status = 'completed' AND w.conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})) > 0, 'failure',countIf(w.status != 'completed') > 0, '',countIf(w.conclusion = 'success') > 0, 'success','neutral'diff --git a/products/engineering_analytics/backend/logic/queries/workflow_health.py b/products/engineering_analytics/backend/logic/queries/workflow_health.pyindex 152e7573b6c0..45ebba0c3f20 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_health.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_health.py@@ -2,14 +2,14 @@Run counts, success rate, and duration percentiles per ``workflow_name`` for runsstarted within ``[date_from, date_to]`` (``date_to`` optional), optionally scoped to-a single ``head_branch`` and/or attributed pull-request runs. Rates are over completed-runs. Duration percentiles are over successful runs only — cancelled/skipped runs-(common on PR branches, where a new push supersedes in-flight CI) and failed runs-end early and would bias a "how long does CI take" percentile low — so they are-``None`` for a window with no successful runs. No-op gate runs are excluded from the-percentiles too, with an all-successful fallback for legitimately all-fast workflows-(see ``run_duration_percentile_expr``), so the Workflows table agrees with the-activity chart and the detail-page KPIs.+a single ``head_branch`` and/or attributed pull-request runs. Rates are over conclusive+runs (success or a decisive failure), so skipped, cancelled, neutral, and action-required+runs never read as failures. Duration percentiles are over successful runs only because+cancelled, skipped, and failed runs end early and would bias a "how long does CI take"+percentile low. They are ``None`` for a window with no successful runs. No-op gate runs+are excluded from the percentiles too, with an all-successful fallback for legitimately+all-fast workflows (see ``run_duration_percentile_expr``), so the Workflows table agrees+with the activity chart and the detail-page KPIs.The per-bucket history adapts its granularity to the window length (hour / day / week)so the trend sparkline keeps a readable number of points — per-day buckets are useless@@ -39,14 +39,18 @@ from products.engineering_analytics.backend.logic.queries._buckets import ()from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource, opt_floatfrom products.engineering_analytics.backend.logic.queries._workflow_filters import (+ CONCLUSIVE_RUN_CONDITION,+ DECISIVE_FAILURE_CONCLUSIONS_SQL,LATEST_COMPLETED_RUN_FAILED,RUN_DURATION_PERCENTILE_CONDITION,+ SUCCESSFUL_RUN_CONDITION,branch_filter_clause,date_to_filter_clause,non_default_branch_predicate,run_duration_percentile_expr,run_scope_filter_clause,run_started_floor_constant,+ success_rate_expr,window_pair_predicates,)from products.engineering_analytics.backend.logic.queries.pr_cost import query_workflow_window_costs@@ -61,13 +65,13 @@ _SELECT = f"""repo_name,workflow_name,count() AS run_count,- countIf(status = 'completed' AND conclusion = 'success') AS successful_run_count,- countIf(status = 'completed' AND conclusion IN ('success', 'failure', 'timed_out')) AS conclusive_run_count,+ countIf({SUCCESSFUL_RUN_CONDITION}) AS successful_run_count,+ countIf({CONCLUSIVE_RUN_CONDITION}) AS conclusive_run_count,countIf({RUN_DURATION_PERCENTILE_CONDITION}) AS percentile_run_count,- countIf(status = 'completed' AND conclusion = 'success') / nullIf(countIf(status = 'completed'), 0) AS success_rate,+ {success_rate_expr()} AS success_rate,{run_duration_percentile_expr(0.5)} AS p50_seconds,{run_duration_percentile_expr(0.95)} AS p95_seconds,- max(if(conclusion IN ('failure', 'timed_out'), run_started_at, NULL)) AS last_failure_at,+ max(if(conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL}), run_started_at, NULL)) AS last_failure_at,countIf(status = 'completed') AS completed_count,{LATEST_COMPLETED_RUN_FAILED} AS latest_failed,argMaxIf(conclusion, (run_started_at, id), status = 'completed') AS latest_conclusion,@@ -84,14 +88,14 @@ _SELECT = f"""# Success rate over the equal-length window before date_from — the delta baseline the UI renders as# an honest Δpp instead of a server-baked percentage. Kept as its own slim scan so the main query's# window (and its LIMIT semantics) stay untouched.-_PREV_SELECT = """+_PREV_SELECT = f"""SELECTrepo_owner,repo_name,workflow_name,- countIf(status = 'completed' AND conclusion = 'success') / nullIf(countIf(status = 'completed'), 0) AS success_rate+ {success_rate_expr()} AS success_rateFROM __RUNS_SOURCE__ AS r- WHERE run_started_at >= {prev_from} AND run_started_at < {date_from} __BRANCH__ __RUN_SCOPE__+ WHERE run_started_at >= {{prev_from}} AND run_started_at < {{date_from}} __BRANCH__ __RUN_SCOPE__GROUP BY repo_owner, repo_name, workflow_name"""@@ -103,8 +107,8 @@ _BUCKET_SELECT = f"""__BUCKET_FN__ AS bucket_start,count() AS run_count,countIf(status = 'completed') AS completed,- countIf(status = 'completed' AND conclusion = 'success') AS successes,- countIf(status = 'completed' AND conclusion IN ('failure', 'timed_out')) AS failures+ countIf({SUCCESSFUL_RUN_CONDITION}) AS successes,+ countIf(status = 'completed' AND conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})) AS failuresFROM __RUNS_SOURCE__ AS rWHERE run_started_at >= {{date_from}} __DATE_TO__ __BRANCH__ __RUN_SCOPE__GROUP BY repo_owner, repo_name, workflow_name, bucket_start@@ -144,7 +148,7 @@ _TIME_TO_GREEN_CTES = f"""status = 'completed' AND coalesce(conclusion, '') IN ('success', 'skipped', 'neutral'),updated_at, NULL)) AS first_green_end,- countIf(status = 'completed' AND conclusion = 'success') > 0 AS has_success+ countIf({SUCCESSFUL_RUN_CONDITION}) > 0 AS has_successFROM __RUNS_SOURCE__ AS rWHERE run_started_at >= {{scan_from}} __DATE_TO__AND NOT r.is_merge_queuediff --git a/products/engineering_analytics/backend/logic/signals/detectors.py b/products/engineering_analytics/backend/logic/signals/detectors.pyindex 94131ffa539f..1fbd5b43c632 100644--- a/products/engineering_analytics/backend/logic/signals/detectors.py+++ b/products/engineering_analytics/backend/logic/signals/detectors.py@@ -212,10 +212,8 @@ def detect_broken_default_branch(continueif item.conclusive_run_count < min_runs or not item.latest_run_failed:continue- # `success_rate` counts cancelled/skipped in its denominator, which pins any- # heavy-cancel workflow under the floor and makes this guard a no-op.- conclusive_success_rate = item.successful_run_count / item.conclusive_run_count- if conclusive_success_rate > max_success_rate:+ success_rate = item.success_rate+ if success_rate is None or success_rate > max_success_rate:continuerepo = f"{item.repo.owner}/{item.repo.name}"latest_conclusion = item.latest_run_conclusion or "failure"@@ -229,7 +227,7 @@ def detect_broken_default_branch(),description=(f"CI workflow '{item.workflow_name}' is failing on {branch} for {repo}\n"- f"{conclusive_success_rate:.0%} success over the last {window_hours}h "+ f"{success_rate:.0%} success over the last {window_hours}h "f"({item.conclusive_run_count} runs that reached a verdict), latest completed run "f"'{latest_conclusion}'. The default branch is red, so every PR branched from it "f"inherits the failure."@@ -240,7 +238,7 @@ def detect_broken_default_branch(repo_name=item.repo.name,workflow_name=item.workflow_name,branch=branch,- conclusive_success_rate=conclusive_success_rate,+ conclusive_success_rate=success_rate,conclusive_run_count=int(item.conclusive_run_count),latest_conclusion=latest_conclusion,window_hours=window_hours,diff --git a/products/engineering_analytics/backend/presentation/serializers/pull_requests.py b/products/engineering_analytics/backend/presentation/serializers/pull_requests.pyindex 3ad9d457dadb..143e8ef44363 100644--- a/products/engineering_analytics/backend/presentation/serializers/pull_requests.py+++ b/products/engineering_analytics/backend/presentation/serializers/pull_requests.py@@ -200,7 +200,7 @@ class CIStatusRollupSerializer(DataclassSerializer):extra_kwargs = {"runs": {"help_text": "Distinct workflows run on the PR's head SHA."},"passing": {"help_text": "Latest runs that completed with conclusion 'success'."},- "failing": {"help_text": "Latest runs that completed with conclusion 'failure' or 'timed_out'."},+ "failing": {"help_text": "Latest runs that ended in failure, timeout, startup failure, or staleness."},"pending": {"help_text": "Latest runs not yet completed (queued or in progress)."},"failing_workflows": {"help_text": "The workflow names behind `failing`, sorted - names what is failing instead of "@@ -221,7 +221,7 @@ class PushCISampleSerializer(DataclassSerializer):"allow_null": True,},"failed": {- "help_text": "True when any latest-per-workflow run on this push concluded 'failure' or 'timed_out'.",+ "help_text": "True when any latest-per-workflow run on this push ended in a decisive failure.",},"pending": {"help_text": "True when any latest-per-workflow run on this push hasn't completed yet."},}diff --git a/products/engineering_analytics/backend/presentation/serializers/workflows.py b/products/engineering_analytics/backend/presentation/serializers/workflows.pyindex 1cd734db671a..03cf7437464c 100644--- a/products/engineering_analytics/backend/presentation/serializers/workflows.py+++ b/products/engineering_analytics/backend/presentation/serializers/workflows.py@@ -169,8 +169,8 @@ class WorkflowHealthBucketSerializer(DataclassSerializer):"completed": {"help_text": "Runs that completed in this bucket."},"successes": {"help_text": "Completed runs with conclusion 'success' in this bucket."},"failures": {- "help_text": "Completed runs that failed in this bucket (conclusion 'failure' or 'timed_out'); "- "excludes skipped, cancelled, and action_required runs."+ "help_text": "Completed runs with conclusion 'failure', 'timed_out', 'startup_failure', or 'stale'. "+ "Skipped, cancelled, neutral, and action_required runs are excluded."},}@@ -186,8 +186,15 @@ class WorkflowHealthItemSerializer(DataclassSerializer):extra_kwargs = {"workflow_name": {"help_text": "GitHub Actions workflow name."},"run_count": {"help_text": "Total runs started in the window."},+ "successful_run_count": {"help_text": "Completed runs with conclusion 'success'."},+ "conclusive_run_count": {+ "help_text": "Completed runs that succeeded or ended in failure, timeout, startup failure, or staleness. "+ "This is the success_rate denominator."+ },"success_rate": {- "help_text": "Fraction of completed runs that succeeded (0-1). Null if no completed runs.",+ "help_text": "Fraction of conclusive runs that succeeded (0-1). Failures include failure, timed_out, "+ "startup_failure, and stale. Skipped, cancelled, neutral, and action_required runs are excluded. "+ "Null if no run reached a verdict.","allow_null": True,},"p50_seconds": {@@ -202,12 +209,12 @@ class WorkflowHealthItemSerializer(DataclassSerializer):"allow_null": True,},"last_failure_at": {- "help_text": "When the most recent failing run (conclusion 'failure' or 'timed_out') started, or null.",+ "help_text": "When the most recent decisive failure started, or null.","allow_null": True,},"latest_run_failed": {- "help_text": "Whether the most recent completed run was a decisive failure (conclusion 'failure' "- "or 'timed_out'). Null when no run has completed in the window. Powers the OK/RED status badge.",+ "help_text": "Whether the most recent completed run ended in failure, timeout, startup failure, or "+ "staleness. Null when no run has completed in the window. Powers the OK/RED status badge.","allow_null": True,},"latest_run_conclusion": {@@ -232,10 +239,13 @@ class WorkflowHealthItemSerializer(DataclassSerializer):"help_text": "Runs in the window that were a 2nd+ attempt - retry pressure, a flakiness proxy."},"success_rate_prev": {- "help_text": "Success rate over the equal-length window before date_from - the delta baseline. "- "Null when that window had no completed runs.",+ "help_text": "Conclusive-run success rate over the equal-length window before date_from - the "+ "delta baseline. Null when that window had no conclusive runs.","allow_null": True,},+ "percentile_run_count": {+ "help_text": "Successful runs that did real CI work. This is the p50/p95 sample count."+ },}@@ -286,8 +296,9 @@ class PassRateBucketSerializer(DataclassSerializer):"help_text": "Bucket start, aligned to success_rate_series_granularity (top of hour, midnight, or Monday)."},"success_rate": {- "help_text": "Fraction (0-1) of completed runs started in this bucket that succeeded. "- "Null when the bucket had no completed run (a gap, not a 0% pass rate).",+ "help_text": "Fraction (0-1) of conclusive runs started in this bucket that succeeded. "+ "Skipped, cancelled, neutral, and action_required runs are excluded. Null when the bucket had no "+ "conclusive run (a gap, not a 0% pass rate).","allow_null": True,},}@@ -338,9 +349,9 @@ class RepoOverviewSerializer(DataclassSerializer):)success_rate_series = PassRateBucketSerializer(many=True,- help_text="CI pass rate (completed runs that succeeded, all branches) per bucket across the window, "- "oldest first, bucketed by success_rate_series_granularity. Empty buckets carry null; the whole "- "series is empty when include_series=false.",+ help_text="CI pass rate (conclusive runs that succeeded, all branches) per bucket across the window, "+ "oldest first, bucketed by success_rate_series_granularity. Skipped, cancelled, neutral, and action_required "+ "runs are excluded. Empty buckets carry null; the whole series is empty when include_series=false.",)open_to_merge_series = OpenToMergeBucketSerializer(many=True,@@ -364,11 +375,12 @@ class RepoOverviewSerializer(DataclassSerializer):"help_text": "Same count over the equal-length window immediately before date_from — the delta baseline."},"success_rate": {- "help_text": "Fraction of completed runs that succeeded (0-1) in the window. Null if none completed.",+ "help_text": "Fraction of conclusive runs that succeeded (0-1) in the window. Skipped, cancelled, "+ "neutral, and action_required runs are excluded. Null if no run reached a verdict.","allow_null": True,},"success_rate_prev": {- "help_text": "Success rate over the previous window. Null if none completed.",+ "help_text": "Conclusive-run success rate over the previous window. Null if no run reached a verdict.","allow_null": True,},"rerun_cycles": {"help_text": "Runs in the window that were a 2nd+ attempt (attempt > 1)."},diff --git a/products/engineering_analytics/backend/presentation/views/workflows.py b/products/engineering_analytics/backend/presentation/views/workflows.pyindex be1ec4770e5b..fdfb2b8dc1a5 100644--- a/products/engineering_analytics/backend/presentation/views/workflows.py+++ b/products/engineering_analytics/backend/presentation/views/workflows.py@@ -64,8 +64,10 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):description=("Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success ""rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed "- "by hour/day/week to fit the window. p50/p95 are over successful runs only, so cancelled (superseded) "- "and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, "+ "by hour/day/week to fit the window. Success rate covers runs that succeeded or ended in a decisive "+ "failure. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over "+ "successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. "+ "Optionally scope to a single git branch via `branch`, ""or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' ""and 'which workflow is the long pole'; compare two windows to get a trend."),@@ -357,7 +359,7 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):400: OpenApiResponse(description="Invalid date_from, date_to, or source_id, or a window over 366 days."),},description=(- "Repo-level headline aggregates over a window (default -30d): run count, success rate, re-run "+ "Repo-level headline aggregates over a window (default -30d): run count, conclusive-run success rate, re-run ""cycles, merged-PR count (bots included), median PR open-to-merge (bots and drafts excluded; ""coarse — draft and ready time fused), median time-to-green, billable minutes + estimated cost ""(with the merge-queue slice of billable minutes broken out), and merge-queue landing stats "diff --git a/products/engineering_analytics/backend/tests/test_logic_workflows.py b/products/engineering_analytics/backend/tests/test_logic_workflows.pyindex 7e38dc98a7b5..c24456053617 100644--- a/products/engineering_analytics/backend/tests/test_logic_workflows.py+++ b/products/engineering_analytics/backend/tests/test_logic_workflows.py@@ -244,11 +244,18 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):WORKFLOW_RUNS_COLUMNS,[_run_row(9500, "CI", "sha80", "completed", "success", _ago(2), _ago(2), pr_number=80),- _run_row(9501, "CI", "sha81", "completed", "success", _ago(3), _ago(3), pr_number=81, run_attempt=2),+ _run_row(9501, "CI", "sha81", "completed", "success", _ago(2), _ago(2), pr_number=81, run_attempt=2),# A merge-queue batch run: its job funds the queue slice, and only it._run_row(9502, "CI", "sha82q", "completed", "success", _ago(2), _ago(2), head_branch="trunk-merge/gr-1"),+ _run_row(9503, "CI", "failed", "completed", "failure", _ago(2), _ago(2)),+ _run_row(9504, "CI", "skipped", "completed", "skipped", _ago(2), _ago(2)),+ _run_row(9505, "CI", "cancelled", "completed", "cancelled", _ago(2), _ago(2)),+ _run_row(9506, "CI", "action", "completed", "action_required", _ago(2), _ago(2)),+ _run_row(9507, "CI", "startup", "completed", "startup_failure", _ago(2), _ago(2)),+ _run_row(9508, "CI", "stale", "completed", "stale", _ago(2), _ago(2)),+ _run_row(9509, "CI", "neutral", "completed", "neutral", _ago(2), _ago(2)),],)self._create_table(@@ -264,7 +271,8 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):assert overview.merged_pr_count == 2 # 80 and 81; 82 merged long before the windowassert overview.merged_pr_count_prev == 0assert overview.median_open_to_merge_seconds == pytest.approx(8 * 86400) # bot PR 81 excluded- assert overview.run_count == 3+ assert overview.run_count == 10+ assert overview.success_rate == pytest.approx(0.5) # 3 successes of 6 conclusive runsassert overview.rerun_cycles == 1assert overview.billable_minutes == pytest.approx(4.0) # two 120s jobs on a billable tierassert overview.estimated_cost_usd == pytest.approx(0.032) # 4 min x $0.004 x 2 (4-core)@@ -281,7 +289,10 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):with_series = api.get_repo_overview(team=self.team)assert len(with_series.cost_series) > 0 # zero-filled spine across the default -30d window- assert len(with_series.success_rate_series) > 0+ observed_pass_rates = [+ bucket.success_rate for bucket in with_series.success_rate_series if bucket.success_rate is not None+ ]+ assert observed_pass_rates == [pytest.approx(0.5)]def test_time_to_green_measures_push_rounds_not_runs(self) -> None:# A per-run median would read this fixture as ~5 min. The round definition asks a different@@ -605,9 +616,9 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):health = api.list_workflow_health(team=self.team, date_from="-30d")ci = next(item for item in health if item.workflow_name == "CI")- # Counts and rate stay over all/completed runs; only the duration population narrows.+ # Counts keep every run, while the rate excludes the cancelled runs that reached no verdict.assert ci.run_count == 9- assert ci.success_rate == pytest.approx(5 / 9)+ assert ci.success_rate == pytest.approx(5 / 6)assert ci.p50_seconds == pytest.approx(100)assert ci.p95_seconds == pytest.approx(100)@@ -697,8 +708,8 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):assert github_hosted.estimated_cost_usd is None # free tier: minutes/jobs only, no billable costdef test_workflow_health_daily_failures_exclude_non_failures(self) -> None:- # The daily failure count is decisive failures only — skipped / cancelled / action_required- # runs are completed but neither successes nor failures, so they must not inflate the trend.+ # The daily failure count keeps decisive failures while completed non-verdict runs stay out+ # of the pass-rate denominator.self._create_table("github_pull_requests",PULL_REQUESTS_COLUMNS,@@ -714,16 +725,20 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):_run_row(6004, "CI", "sha-d", "completed", "skipped", _ago(1), _ago(1)),_run_row(6005, "CI", "sha-e", "completed", "cancelled", _ago(1), _ago(1)),_run_row(6006, "CI", "sha-f", "completed", "action_required", _ago(1), _ago(1)),+ _run_row(6007, "CI", "sha-g", "completed", "startup_failure", _ago(1), _ago(1)),+ _run_row(6008, "CI", "sha-h", "completed", "stale", _ago(1), _ago(1)),+ _run_row(6009, "CI", "sha-i", "completed", "neutral", _ago(1), _ago(1)),],)ci = next(i for i in api.list_workflow_health(team=self.team, date_from="-30d") if i.workflow_name == "CI")bucket = next(entry for entry in ci.buckets if entry.run_count > 0)- # 6 completed, 1 success, 2 failures (failure + timed_out) — skipped/cancelled/action_required are neither.- assert (bucket.completed, bucket.successes, bucket.failures) == (6, 1, 2)+ # Non-verdict runs remain in volume but not the pass-rate denominator.+ assert (bucket.completed, bucket.successes, bucket.failures) == (9, 1, 4)+ assert ci.success_rate == pytest.approx(1 / 5)- def test_workflow_health_last_failure_includes_timed_out(self) -> None:- # last_failure_at must agree with the failure definition used by the trend: a workflow whose- # only decisive failure is a timeout still has a "last failure".+ @parameterized.expand(["timed_out", "startup_failure", "stale"])+ def test_workflow_health_last_failure_includes_decisive_conclusion(self, conclusion: str) -> None:+ # last_failure_at, rate buckets, and the latest-run badge must share one failure definition.self._create_table("github_pull_requests",PULL_REQUESTS_COLUMNS,@@ -734,15 +749,14 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):WORKFLOW_RUNS_COLUMNS,[_run_row(6101, "CI", "sha-g", "completed", "success", _ago(2), _ago(2)),- _run_row(6102, "CI", "sha-h", "completed", "timed_out", _ago(1), _ago(1)),+ _run_row(6102, "CI", "sha-h", "completed", conclusion, _ago(1), _ago(1)),],)ci = next(i for i in api.list_workflow_health(team=self.team, date_from="-30d") if i.workflow_name == "CI")assert ci.last_failure_at is not None- # The latest completed run (the timeout) was decisive — drives the RED status badge.assert ci.latest_run_failed is True- # And its raw conclusion is carried so the UI can distinguish a real pass from a non-failure.- assert ci.latest_run_conclusion == "timed_out"+ # The raw conclusion lets the UI retain the specific failure label while sharing the verdict.+ assert ci.latest_run_conclusion == conclusiondef test_workflow_run_detail_by_id(self) -> None:# The run detail page fetches one run by id; re-runs share the id, so the latest attempt wins.diff --git a/products/engineering_analytics/frontend/components/WindowComparisonCard.tsx b/products/engineering_analytics/frontend/components/WindowComparisonCard.tsxindex 2c0bcaf6553a..0b838c5a7664 100644--- a/products/engineering_analytics/frontend/components/WindowComparisonCard.tsx+++ b/products/engineering_analytics/frontend/components/WindowComparisonCard.tsx@@ -9,6 +9,7 @@ import { ReactNode } from 'react'import { LemonCard, LemonSkeleton, Tooltip } from '@posthog/lemon-ui'+import { percent } from '../lib/format'import { DeltaBadge, percentChange, pointChange } from './MetricTile'function MagnitudeBar({@@ -41,9 +42,8 @@ function MagnitudeBar({}function SplitBar({ rate }: { rate: number }): JSX.Element {- const passedPercent = Math.round(rate * 100)return (- <Tooltip title={`${passedPercent}% passed, ${100 - passedPercent}% failed`}>+ <Tooltip title={`${percent(rate, 1)} passed, ${percent(1 - rate, 1)} failed`}><div className="flex h-2.5 flex-1 overflow-hidden rounded-sm"><div className="h-full bg-success" style={{ width: `${rate * 100}%` }} /><div className="h-full flex-1 bg-danger" />@@ -98,6 +98,7 @@ export function WindowComparisonCard({goodWhenDown = false,share = false,deltaUnit,+ deltaPrecision,tooltip,marker,markerPrevious,@@ -116,6 +117,8 @@ export function WindowComparisonCard({share?: boolean/** 'pt' renders the delta as percentage points; default is relative percent. */deltaUnit?: 'pt'+ /** Decimal places shown in the delta badge. */+ deltaPrecision?: number/** Definition or methodology, shown on title hover. */tooltip?: ReactNode/** A companion figure (e.g. p90) pinned as a tick on each magnitude bar, on the same scale as@@ -150,6 +153,7 @@ export function WindowComparisonCard({value={delta}unit={deltaUnit ?? '%'}goodWhenDown={goodWhenDown}+ precision={deltaPrecision}vs="vs the previous window"/></div>diff --git a/products/engineering_analytics/frontend/components/WorkflowHealthTable.tsx b/products/engineering_analytics/frontend/components/WorkflowHealthTable.tsxindex 6f5b6096a087..8029f61ec089 100644--- a/products/engineering_analytics/frontend/components/WorkflowHealthTable.tsx+++ b/products/engineering_analytics/frontend/components/WorkflowHealthTable.tsx@@ -28,8 +28,8 @@ function formatRate(rate: number | null): string {return rate == null ? '—' : `${humanFriendlyNumber(rate * 100)}%`}-/** Color only what needs attention — red rare, amber occasional, everything else plain. A low rate- * without any decisive failure (skip/cancel-heavy workflows) stays plain: nothing is broken. */+/** Color only rates backed by a decisive failure in the visible buckets; anything else is plain.+ * Red rare, amber occasional, so color means "needs attention", not "below a number". */function successRateClass(rate: number | null, hasFailures: boolean): string {if (rate == null) {return 'text-secondary'@@ -211,7 +211,7 @@ export function WorkflowHealthTable({key: 'p50Seconds',width: 88,align: 'right',- tooltip: 'Median run duration (wall-clock) over completed runs.',+ tooltip: 'Median run duration (wall-clock) over successful runs.',sorter: (a, b) => (a.p50Seconds ?? -1) - (b.p50Seconds ?? -1),render: (_, row) => (<span className="text-xs tabular-nums whitespace-nowrap">{formatSeconds(row.p50Seconds)}</span>@@ -222,7 +222,7 @@ export function WorkflowHealthTable({key: 'p95Seconds',width: 88,align: 'right',- tooltip: '95th-percentile run duration (wall-clock) over completed runs.',+ tooltip: '95th-percentile run duration (wall-clock) over successful runs.',sorter: (a, b) => (a.p95Seconds ?? -1) - (b.p95Seconds ?? -1),render: (_, row) => (<span className="text-xs tabular-nums whitespace-nowrap text-secondary">diff --git a/products/engineering_analytics/frontend/generated/api.schemas.ts b/products/engineering_analytics/frontend/generated/api.schemas.tsindex 8f24dc7ecb55..abd2609ba18b 100644--- a/products/engineering_analytics/frontend/generated/api.schemas.ts+++ b/products/engineering_analytics/frontend/generated/api.schemas.ts@@ -689,7 +689,7 @@ export interface CIStatusRollupApi {runs: number/** Latest runs that completed with conclusion 'success'. */passing: number- /** Latest runs that completed with conclusion 'failure' or 'timed_out'. */+ /** Latest runs that ended in failure, timeout, startup failure, or staleness. */failing: number/** Latest runs not yet completed (queued or in progress). */pending: number@@ -707,7 +707,7 @@ export interface PushCISampleApi {* @nullable*/wall_seconds: number | null- /** True when any latest-per-workflow run on this push concluded 'failure' or 'timed_out'. */+ /** True when any latest-per-workflow run on this push ended in a decisive failure. */failed: boolean/** True when any latest-per-workflow run on this push hasn't completed yet. */pending: boolean@@ -979,7 +979,7 @@ export interface PassRateBucketApi {/** Bucket start, aligned to success_rate_series_granularity (top of hour, midnight, or Monday). */bucket_start: string/**- * Fraction (0-1) of completed runs started in this bucket that succeeded. Null when the bucket had no completed run (a gap, not a 0% pass rate).+ * Fraction (0-1) of conclusive runs started in this bucket that succeeded. Skipped, cancelled, neutral, and action_required runs are excluded. Null when the bucket had no conclusive run (a gap, not a 0% pass rate).* @nullable*/success_rate: number | null@@ -1010,7 +1010,7 @@ export interface RepoOverviewApi {cost_series: CostPerMergeBucketApi[]/** Median time-to-green (p50 wall clock for a PR push round to settle fully green) per bucket across the window, oldest first, bucketed by time_to_green_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */time_to_green_series: TimeToGreenBucketApi[]- /** CI pass rate (completed runs that succeeded, all branches) per bucket across the window, oldest first, bucketed by success_rate_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */+ /** CI pass rate (conclusive runs that succeeded, all branches) per bucket across the window, oldest first, bucketed by success_rate_series_granularity. Skipped, cancelled, neutral, and action_required runs are excluded. Empty buckets carry null; the whole series is empty when include_series=false. */success_rate_series: PassRateBucketApi[]/** Median time-to-merge (p50 open_to_merge_seconds, bots/drafts excluded) per bucket across the window, oldest first, bucketed by open_to_merge_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */open_to_merge_series: OpenToMergeBucketApi[]@@ -1021,12 +1021,12 @@ export interface RepoOverviewApi {/** Same count over the equal-length window immediately before date_from — the delta baseline. */run_count_prev: number/**- * Fraction of completed runs that succeeded (0-1) in the window. Null if none completed.+ * Fraction of conclusive runs that succeeded (0-1) in the window. Skipped, cancelled, neutral, and action_required runs are excluded. Null if no run reached a verdict.* @nullable*/success_rate: number | null/**- * Success rate over the previous window. Null if none completed.+ * Conclusive-run success rate over the previous window. Null if no run reached a verdict.* @nullable*/success_rate_prev: number | null@@ -1444,7 +1444,7 @@ export interface WorkflowHealthBucketApi {completed: number/** Completed runs with conclusion 'success' in this bucket. */successes: number- /** Completed runs that failed in this bucket (conclusion 'failure' or 'timed_out'); excludes skipped, cancelled, and action_required runs. */+ /** Completed runs with conclusion 'failure', 'timed_out', 'startup_failure', or 'stale'. Skipped, cancelled, neutral, and action_required runs are excluded. */failures: number}@@ -1457,10 +1457,12 @@ export interface WorkflowHealthItemApi {workflow_name: string/** Total runs started in the window. */run_count: number+ /** Completed runs with conclusion 'success'. */successful_run_count: number+ /** Completed runs that succeeded or ended in failure, timeout, startup failure, or staleness. This is the success_rate denominator. */conclusive_run_count: number/**- * Fraction of completed runs that succeeded (0-1). Null if no completed runs.+ * Fraction of conclusive runs that succeeded (0-1). Failures include failure, timed_out, startup_failure, and stale. Skipped, cancelled, neutral, and action_required runs are excluded. Null if no run reached a verdict.* @nullable*/success_rate: number | null@@ -1475,12 +1477,12 @@ export interface WorkflowHealthItemApi {*/p95_seconds: number | null/**- * When the most recent failing run (conclusion 'failure' or 'timed_out') started, or null.+ * When the most recent decisive failure started, or null.* @nullable*/last_failure_at: string | null/**- * Whether the most recent completed run was a decisive failure (conclusion 'failure' or 'timed_out'). Null when no run has completed in the window. Powers the OK/RED status badge.+ * Whether the most recent completed run ended in failure, timeout, startup failure, or staleness. Null when no run has completed in the window. Powers the OK/RED status badge.* @nullable*/latest_run_failed: boolean | null@@ -1508,10 +1510,11 @@ export interface WorkflowHealthItemApi {/** Runs in the window that were a 2nd+ attempt - retry pressure, a flakiness proxy. */rerun_cycles?: number/**- * Success rate over the equal-length window before date_from - the delta baseline. Null when that window had no completed runs.+ * Conclusive-run success rate over the equal-length window before date_from - the delta baseline. Null when that window had no conclusive runs.* @nullable*/success_rate_prev?: number | null+ /** Successful runs that did real CI work. This is the p50/p95 sample count. */percentile_run_count?: number}diff --git a/products/engineering_analytics/frontend/generated/api.ts b/products/engineering_analytics/frontend/generated/api.tsindex e7577212a5b6..f72cf31c2e55 100644--- a/products/engineering_analytics/frontend/generated/api.ts+++ b/products/engineering_analytics/frontend/generated/api.ts@@ -598,7 +598,7 @@ export const getEngineeringAnalyticsRepoOverviewUrl = (}/**- * Repo-level headline aggregates over a window (default -30d): run count, success rate, re-run cycles, merged-PR count (bots included), median PR open-to-merge (bots and drafts excluded; coarse — draft and ready time fused), median time-to-green, billable minutes + estimated cost (with the merge-queue slice of billable minutes broken out), and merge-queue landing stats (queue-landed merges, first-gate-to-merge median and p90, gate attempts, failed-gate share) — each with its equal-length previous-window twin so a caller can render honest deltas. Also carries the detected default branch and its completed-run history series (skippable via include_series=false). Cost figures are null until the job-level source is synced.+ * Repo-level headline aggregates over a window (default -30d): run count, conclusive-run success rate, re-run cycles, merged-PR count (bots included), median PR open-to-merge (bots and drafts excluded; coarse — draft and ready time fused), median time-to-green, billable minutes + estimated cost (with the merge-queue slice of billable minutes broken out), and merge-queue landing stats (queue-landed merges, first-gate-to-merge median and p90, gate attempts, failed-gate share) — each with its equal-length previous-window twin so a caller can render honest deltas. Also carries the detected default branch and its completed-run history series (skippable via include_series=false). Cost figures are null until the job-level source is synced.*/export const engineeringAnalyticsRepoOverview = async (projectId: string,@@ -880,7 +880,7 @@ export const getEngineeringAnalyticsWorkflowHealthUrl = (}/**- * Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.+ * Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. Success rate covers runs that succeeded or ended in a decisive failure. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.*/export const engineeringAnalyticsWorkflowHealth = async (projectId: string,diff --git a/products/engineering_analytics/frontend/lib/lifecycle.ts b/products/engineering_analytics/frontend/lib/lifecycle.tsindex 82668f695066..25ba3984a4ce 100644--- a/products/engineering_analytics/frontend/lib/lifecycle.ts+++ b/products/engineering_analytics/frontend/lib/lifecycle.ts@@ -36,15 +36,17 @@ export interface WorkflowRun {}const PASSING_CONCLUSIONS = new Set(['success', 'skipped', 'neutral', 'completed'])+// Mirrors DECISIVE_FAILURE_CONCLUSIONS in backend/logic/queries/_workflow_filters.py (keep the two in sync).+const DECISIVE_FAILURE_CONCLUSIONS = new Set(['failure', 'timed_out', 'startup_failure', 'stale'])/** For a finished run's conclusion; 'completed' stands in when no conclusion was recorded. */export function isPassingConclusion(conclusion: string): boolean {return PASSING_CONCLUSIONS.has(conclusion)}-/** A decisive failure — the verdict that turns a run red. Cancelled/skipped/neutral are not failures. */+/** A decisive failure that turns a run red. Non-verdict outcomes and unknown values stay neutral. */export function isDecisiveFailure(conclusion: string | null): boolean {- return conclusion === 'failure' || conclusion === 'timed_out'+ return conclusion != null && DECISIVE_FAILURE_CONCLUSIONS.has(conclusion)}/**diff --git a/products/engineering_analytics/frontend/lib/runHealth.test.ts b/products/engineering_analytics/frontend/lib/runHealth.test.tsindex ce449d82b9fe..cd8a464bd9c0 100644--- a/products/engineering_analytics/frontend/lib/runHealth.test.ts+++ b/products/engineering_analytics/frontend/lib/runHealth.test.ts@@ -41,20 +41,34 @@ describe('runHealth', () => {expect(computeHealthSummary(runs).state).toBe(expected)})- it('counts only conclusion=success as a pass, matching the backend success_rate', () => {- // Skipped/neutral are completed but not successes — the header must not inflate pass rate past- // what the Workflows table shows for the same window.+ it('excludes non-verdict conclusions from the pass rate', () => {const summary = computeHealthSummary([{ conclusion: 'success', durationSeconds: 600, startedAt: at(9) },{ conclusion: 'skipped', durationSeconds: 600, startedAt: at(10) },+ { conclusion: 'cancelled', durationSeconds: 600, startedAt: at(11) },+ { conclusion: 'action_required', durationSeconds: 600, startedAt: at(12) },+ { conclusion: 'neutral', durationSeconds: 600, startedAt: at(13) },+ { conclusion: 'future_outcome', durationSeconds: 600, startedAt: at(14) },])- expect(summary.completedRuns).toBe(2)+ expect(summary.completedRuns).toBe(6)+ expect(summary.conclusiveRuns).toBe(1)expect(summary.passedRuns).toBe(1)- expect(summary.passRate).toBe(0.5)+ expect(summary.passRate).toBe(1)expect(summary.failures).toBe(0)expect(summary.state).toBe('healthy')})+ it.each(['failure', 'timed_out', 'startup_failure', 'stale'])('counts %s as a decisive failure', (conclusion) => {+ const summary = computeHealthSummary([+ { conclusion: 'success', durationSeconds: 600, startedAt: at(9) },+ { conclusion, durationSeconds: 600, startedAt: at(10) },+ ])+ expect(summary.conclusiveRuns).toBe(2)+ expect(summary.failures).toBe(1)+ expect(summary.passRate).toBe(0.5)+ expect(summary.state).toBe('failing')+ })+it('excludes still-running runs from rates and durations, and counts re-runs', () => {const summary = computeHealthSummary([{ conclusion: 'success', durationSeconds: 120, startedAt: at(9), runAttempt: 1 },@@ -66,6 +80,8 @@ describe('runHealth', () => {expect(summary.passRate).toBe(0.5)expect(summary.failures).toBe(1)expect(summary.reruns).toBe(1)+ expect(summary.medianSeconds).toBe(120)+ expect(summary.p95Seconds).toBe(120)})it.each([@@ -136,8 +152,7 @@ describe('runHealth', () => {['every settled workflow failing → failing', [fleetRow(true), fleetRow(true)], 'failing'],['some failing, some green → degraded', [fleetRow(true), fleetRow(false)], 'degraded'],['green but flaky (low success + a real failure) → degraded', [fleetRow(false, 0.7, at(9))], 'degraded'],- // Low success driven by skips/cancels, never a decisive failure → healthy, not flaky (matches the- // single-workflow verdict).+ // A low rate with no decisive failure in the window stays healthy, never a false flaky verdict.['green, low success, no failures → healthy', [fleetRow(false, 0.7, null)], 'healthy'],['all green and healthy → healthy', [fleetRow(false, 0.99), fleetRow(false)], 'healthy'],])('classifies fleet state: %s', (_name, rows, expected) => {@@ -164,34 +179,34 @@ describe('runHealth', () => {})it.each([- // Weighted by completed runs — an unweighted mean of per-row rates would say 0.75 here.+ // Weighted by conclusive runs, so skipped and cancelled volume cannot lower the rate.[- 'weights the fleet rate by completed runs, not per-row average',+ 'weights the fleet rate by conclusive runs, not per-row average',[- { runCount: 2, successRate: 1, latestRunFailed: false, buckets: [{ completed: 2, successes: 2 }] },+ { runCount: 2, successRate: 1, latestRunFailed: false, buckets: [{ successes: 2, failures: 0 }] },{- runCount: 6,+ runCount: 10,successRate: 0.5,latestRunFailed: true,buckets: [- { completed: 3, successes: 2 },- { completed: 3, successes: 1 },+ { successes: 2, failures: 1 },+ { successes: 1, failures: 2 },],},],0.625,],- // Nothing settled anywhere → null, never a misleading 0%.+ // Completed runs without a verdict produce null, never a misleading 0%.[- 'null when nothing has completed',- [{ runCount: 3, successRate: null, latestRunFailed: null, buckets: [{ completed: 0, successes: 0 }] }],+ 'null when nothing reached a verdict',+ [{ runCount: 3, successRate: null, latestRunFailed: false, buckets: [{ successes: 0, failures: 0 }] }],null,],// Rows without buckets (per-push rows) contribute nothing rather than crashing or zeroing the rate.['rows without buckets are tolerated',[- { runCount: 4, successRate: 0.5, latestRunFailed: false, buckets: [{ completed: 4, successes: 2 }] },+ { runCount: 4, successRate: 0.5, latestRunFailed: false, buckets: [{ successes: 2, failures: 2 }] },{ runCount: 9, successRate: 1, latestRunFailed: false },],0.5,diff --git a/products/engineering_analytics/frontend/lib/runHealth.ts b/products/engineering_analytics/frontend/lib/runHealth.tsindex 31ff101240b9..04421d05a716 100644--- a/products/engineering_analytics/frontend/lib/runHealth.ts+++ b/products/engineering_analytics/frontend/lib/runHealth.ts@@ -33,12 +33,13 @@ export interface HealthSummary {state: WorkflowStatetotalRuns: numbercompletedRuns: number+ conclusiveRuns: numberpassedRuns: numberfailures: numberrunning: number/** Runs that were a 2nd+ attempt. */reruns: number- /** Passes ÷ completed runs (null when nothing has settled). */+ /** Passes divided by conclusive runs (null when no run reached a verdict). */passRate: number | nullmedianSeconds: number | nullp95Seconds: number | null@@ -60,13 +61,12 @@ export interface FleetRow {workflowName?: string/** Most recent completed run failed; null when nothing has completed for that workflow. */latestRunFailed: boolean | null- /** Last decisive failure in the window, or null if there was none — so a low success rate driven by- * skips/cancels (not failures) isn't mistaken for flakiness. */+ /** Last decisive failure in the window, or null if there was none. */lastFailureAt?: string | nullbillableMinutes?: number | nullestimatedCostUsd?: number | null- /** Per-bucket completed/success counts — the weights behind the fleet-wide pass rate. */- buckets?: { completed: number; successes: number }[]+ /** Per-bucket outcome counts that weight the fleet-wide pass rate. */+ buckets?: { successes: number; failures: number }[]/** Runs in the window that were a 2nd+ attempt. */rerunCycles?: number}@@ -82,7 +82,7 @@ export interface FleetSummary {/** Currently green but below the success-rate floor — flaky. */flakyNow: numbertotalRuns: number- /** Passes ÷ completed runs across every row's buckets; null when nothing has completed. */+ /** Passes divided by conclusive runs across every row's buckets; null when none reached a verdict. */passRate: number | null/** Re-runs (attempt > 1) summed across workflows. */rerunCycles: number@@ -118,24 +118,24 @@ export function percentileSorted(sortedAsc: number[], q: number): number | null}/**- * Verdict + headline stats for one workflow's runs. Durations and rates are over completed runs only —- * an unsettled run is excluded, never counted as a failure.+ * Verdict + headline stats for one workflow's runs. Durations use successful runs. Rates use+ * conclusive runs, so an unsettled or non-verdict run is never counted as a failure.*/export function computeHealthSummary(runs: HealthRun[]): HealthSummary {const completed = runs.filter((run) => run.conclusion !== null)+ const successful = completed.filter((run) => run.conclusion === 'success')const running = runs.length - completed.length- // Strictly 'success' (not skipped/neutral), mirroring the endpoint's success_rate so surfaces agree.- const passed = completed.filter((run) => run.conclusion === 'success').length+ const passed = successful.lengthconst failures = completed.filter((run) => isDecisiveFailure(run.conclusion)).length+ const conclusiveRuns = passed + failuresconst reruns = runs.filter((run) => (run.runAttempt ?? 1) > 1).length- const passRate = completed.length ? passed / completed.length : null+ const passRate = conclusiveRuns > 0 ? passed / conclusiveRuns : null- // No-op runs stay in the counts and pass rate (they are real runs) but not in the duration- // percentiles, so the median/p95 tiles agree with the activity chart, which hides them too. The- // all-duration fallback is reserved for ZERO real samples (an intentionally fast workflow, where- // "—" would be wrong): even a lone real execution is a more honest median than gate-run noise.- const allDurations = completed.map((run) => run.durationSeconds).filter((d): d is number => d != null)- const realDurations = completed+ // No-op successes stay in the counts and pass rate but not in the duration percentiles, so the+ // median and p95 agree with the activity chart. The all-duration fallback is reserved for zero+ // real successes because an intentionally fast workflow still needs a duration.+ const allDurations = successful.map((run) => run.durationSeconds).filter((d): d is number => d != null)+ const realDurations = successful.filter((run) => !isNoOpRun(run)).map((run) => run.durationSeconds).filter((d): d is number => d != null)@@ -156,7 +156,7 @@ export function computeHealthSummary(runs: HealthRun[]): HealthSummary {state = 'unknown'} else if (isDecisiveFailure(latestConclusion)) {state = 'failing'- } else if (failures / completed.length >= DEGRADED_FAILURE_RATE) {+ } else if (conclusiveRuns > 0 && failures / conclusiveRuns >= DEGRADED_FAILURE_RATE) {state = 'degraded'} else {state = 'healthy'@@ -166,6 +166,7 @@ export function computeHealthSummary(runs: HealthRun[]): HealthSummary {state,totalRuns: runs.length,completedRuns: completed.length,+ conclusiveRuns,passedRuns: passed,failures,running,@@ -186,8 +187,7 @@ export function computeFleetSummary(rows: FleetRow[]): FleetSummary {const failingRows = rows.filter((row) => row.latestRunFailed === true)const failingNow = failingRows.lengthconst failingWorkflowNames = failingRows.map((row) => row.workflowName).filter((name): name is string => !!name)- // Flaky = currently green, below the success-rate floor, AND actually failed in the window. The- // lastFailureAt gate keeps a low success rate from skips/cancels (no real failures) reading as flaky.+ // Flaky requires a currently green workflow, a low conclusive-run success rate, and a real failure.const flakyNow = rows.filter((row) =>row.latestRunFailed === false &&@@ -197,16 +197,16 @@ export function computeFleetSummary(rows: FleetRow[]): FleetSummary {).lengthconst totalRuns = rows.reduce((sum, row) => sum + row.runCount, 0)- // Completed-run-weighted, so a 3-run workflow can't move the fleet as much as a 3,000-run one.- let completedRuns = 0+ // Conclusive-run-weighted, so a 3-run workflow cannot move the fleet as much as a 3,000-run one.+ let conclusiveRuns = 0let passedRuns = 0for (const row of rows) {for (const bucket of row.buckets ?? []) {- completedRuns += bucket.completed+ conclusiveRuns += bucket.successes + bucket.failurespassedRuns += bucket.successes}}- const passRate = completedRuns > 0 ? passedRuns / completedRuns : null+ const passRate = conclusiveRuns > 0 ? passedRuns / conclusiveRuns : nullconst rerunCycles = rows.reduce((sum, row) => sum + (row.rerunCycles ?? 0), 0)// Free runners report null — a bare sum would turn "no cost data" into a misleading $0.00.diff --git a/products/engineering_analytics/frontend/lib/runStatus.ts b/products/engineering_analytics/frontend/lib/runStatus.tsindex c02353677932..1634aafc06a0 100644--- a/products/engineering_analytics/frontend/lib/runStatus.ts+++ b/products/engineering_analytics/frontend/lib/runStatus.ts@@ -2,18 +2,18 @@ import { LemonTagType } from '@posthog/lemon-ui'import { capitalizeFirstLetter } from 'lib/utils/strings'-import { isPassingConclusion } from './lifecycle'+import { isDecisiveFailure, isPassingConclusion } from './lifecycle'/*** A workflow run's conclusion as a labeled tag. `null` = still in progress. Decisive failures- * (failure / timed_out) are danger; success green; other passing outcomes muted; else warning.+ * are danger; success green; other passing outcomes muted; else warning.*/export function verdictTag(conclusion: string | null): { label: string; type: LemonTagType } {if (conclusion === null) {return { label: 'Running', type: 'warning' }}const label = capitalizeFirstLetter(conclusion.replace('_', ' '))- if (conclusion === 'failure' || conclusion === 'timed_out') {+ if (isDecisiveFailure(conclusion)) {return { label, type: 'danger' }}if (isPassingConclusion(conclusion)) {diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsxindex 422420f0d14d..748beea53c32 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.tsx@@ -94,8 +94,9 @@ export function EngineeringAnalyticsWorkflows(): JSX.Element {/><div className="text-xs text-tertiary">- Pass rate and durations cover completed runs only. A run that hasn't settled is excluded, never counted- as a failure. Health is workflow-level, not per-job.+ Pass rate compares successful runs with runs that failed, timed out, failed to start, or became stale.+ Skipped, canceled, neutral, and action-required runs are excluded. Durations cover successful runs only.+ Health is workflow-level, not per-job.{fleetTruncated && ` Showing the top ${WORKFLOW_HEALTH_LIMIT} workflows by run count.`}</div></div>diff --git a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsxindex 593a680cae47..034ebe1ff5bf 100644--- a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx+++ b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx@@ -124,15 +124,16 @@ export function RepoOverviewScene(): JSX.Element {<Section id="ci-health" title="CI health" busy={overviewLoading}><div className="grid grid-cols-1 gap-2 md:grid-cols-2"><WindowComparisonCard- title="CI runs that passed"+ title="CI pass rate"value={overview?.success_rate}previousValue={overview?.success_rate_prev}- formatValue={percent}+ formatValue={(value) => percent(value, 1)}sharedeltaUnit="pt"+ deltaPrecision={1}loading={overviewPending}- tooltip="Share of completed CI runs that passed, all branches."- emptyText="Not enough completed CI runs in the window yet."+ tooltip="Share of successful runs among runs that succeeded, failed, timed out, failed to start, or became stale. Skipped, canceled, neutral, and action-required runs are excluded."+ emptyText="No CI runs reached a pass-or-fail result in the window."/><WindowComparisonCarddiff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsxindex f37782e70874..8311d2479deb 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx@@ -315,8 +315,8 @@ export function WorkflowRunsScene(): JSX.Element {<MetricTilelabel="Pass rate"tooltip={`${humanFriendlyNumber(healthSummary.passedRuns)} of ${humanFriendlyNumber(- healthSummary.completedRuns- )} completed runs passed.`}+ healthSummary.conclusiveRuns+ )} runs with a pass-or-fail result passed.`}value={percent(healthSummary.passRate)}loading={runsLoading}/>@@ -333,7 +333,7 @@ export function WorkflowRunsScene(): JSX.Element {/><MetricTilelabel="Duration p50"- tooltip="Wall-clock, over completed runs."+ tooltip="Wall-clock, over successful runs."value={healthSummary.medianSeconds != null ? humanFriendlyDuration(healthSummary.medianSeconds) : '—'}diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.tsindex 18ed599b3fba..5fd5e2eeffd0 100644--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts@@ -100,7 +100,7 @@ export interface WorkflowHealthBucket {runCount: numbercompleted: numbersuccesses: number- /** Decisive failures only (failure / timed_out); excludes skipped, cancelled, action_required. */+ /** Decisive failures only; excludes skipped, cancelled, neutral, and action_required. */failures: number}@@ -109,7 +109,7 @@ export interface WorkflowHealthRow {repoName: stringworkflowName: stringrunCount: number- /** Over completed runs only; null when nothing has settled yet. */+ /** Over conclusive runs only; null when no run reached a pass-or-fail verdict. */successRate: number | nullp50Seconds: number | nullp95Seconds: number | nulldiff --git a/products/engineering_analytics/mcp/tools.yaml b/products/engineering_analytics/mcp/tools.yamlindex 4bf1914a998e..0c80536cdb74 100644--- a/products/engineering_analytics/mcp/tools.yaml+++ b/products/engineering_analytics/mcp/tools.yaml@@ -354,9 +354,11 @@ tools:description: >Per-workflow CI health over a window: run count, success rate, p50/p95 duration, and last failure time. Usethis for "is CI getting faster or slower", "which GitHub Actions workflow is the slow or flaky long pole",- and CI duration trends. p50/p95 are over successful runs only, so superseded cancels and failed runs never- bias the duration percentile. For PR-branch CI health, pass run_scope=pull_request (same-repo PRs only —- fork PRs carry no PR attribution). To get a trend, call this over two adjacent windows and compare.+ and CI duration trends. Success rate covers runs that succeeded or ended in failure, timeout, startup+ failure, or staleness. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over+ successful runs only, so superseded cancels and failed runs never bias the duration percentile. For+ PR-branch CI health, pass run_scope=pull_request (same-repo PRs only — fork PRs carry no PR attribution). To+ get a trend, call this over two adjacent windows and compare.param_overrides:date_from:description: Window start — relative ('-24h', '-7d') or ISO8601. Defaults to -24h.diff --git a/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md b/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.mdindex 3e5bfd700e73..ec9d842461ff 100644--- a/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md+++ b/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md@@ -32,8 +32,10 @@ to take one failing test or red run to a verdict, switch to the `investigating-c- **`workflow-health`** — per-workflow CI health over a window (`date_from` / `date_to`, default last 24 hours):`run_count`, `success_rate`, `p50_seconds`, `p95_seconds`, `last_failure_at`. Answers "is CI getting faster orslower" and "which workflow is the slow or flaky long pole". There is no built-in trend — call it over two- adjacent windows and compare. `success_rate` covers completed runs; `p50_seconds` / `p95_seconds` cover- successful runs only (cancelled and failed runs end early and would bias the duration trend). Each is `null`+ adjacent windows and compare. `success_rate` covers runs that succeeded or ended in a decisive failure+ (`failure`, `timed_out`, `startup_failure`, or `stale`), excluding skipped, cancelled, neutral, and+ action-required runs. `p50_seconds` / `p95_seconds` cover successful runs only because+ cancelled and failed runs end early and would bias the duration trend. Each is `null`when a window has no qualifying runs — guard for null before comparing two windows (a workflow can have runsin one and none in the other). `run_scope=pull_request` scopes to PR-attributed runs, excluding master/main(same-repo PRs only — fork runs carry no PR attribution).diff --git a/products/engineering_analytics/skills/investigating-ci-failures/references/investigation-queries.md b/products/engineering_analytics/skills/investigating-ci-failures/references/investigation-queries.mdindex 05db26338f32..753283d7e559 100644--- a/products/engineering_analytics/skills/investigating-ci-failures/references/investigation-queries.md+++ b/products/engineering_analytics/skills/investigating-ci-failures/references/investigation-queries.md@@ -148,7 +148,7 @@ with an honest denominator.```sqlSELECTcountIf(conclusion = 'success') AS ok,- countIf(conclusion IN ('failure', 'timed_out')) AS fail,+ countIf(conclusion IN ('failure', 'timed_out', 'startup_failure', 'stale')) AS fail,round(100.0 * fail / nullIf(ok + fail, 0), 2) AS fail_pctFROM engineering_analytics_ci_job_historyWHERE repo_name = '<repo>'@@ -162,8 +162,9 @@ Scope by repository and workflow as well as job: the view unions every connectednames repeat across workflows (`Desktop Tests Pass` fails under two), so a job-only filter poolsunrelated attempts into the denominator.-`timed_out` counts as a failure, the same set every other rate in this product uses. `cancelled` and-`skipped` are absent from `ok + fail` on purpose: neither reached a verdict, and both are common+`failure`, `timed_out`, `startup_failure`, and `stale` are decisive failures, the same set every+other workflow-run rate in this product uses. `cancelled`, `skipped`, `neutral`, and `action_required`+are absent from `ok + fail` on purpose: none reached a pass-or-fail verdict, and they are commonenough here (superseded pushes, path filters) to halve the rate if counted.A percentage alone can't tell an old flake from a live outage. Break the same window down by hour:@@ -172,7 +173,7 @@ A percentage alone can't tell an old flake from a live outage. Break the same wiSELECTtoStartOfHour(created_at) AS hour,countIf(conclusion = 'success') AS ok,- countIf(conclusion IN ('failure', 'timed_out')) AS fail+ countIf(conclusion IN ('failure', 'timed_out', 'startup_failure', 'stale')) AS failFROM engineering_analytics_ci_job_historyWHERE repo_name = '<repo>'AND workflow_name = '<failing workflow name>'@@ -200,7 +201,7 @@ FROM engineering_analytics_ci_job_historyWHERE startsWith(head_branch, 'trunk-merge/pr-<n>/')AND created_at >= now() - INTERVAL 7 DAYAND created_at_raw >= '<8 days ago, YYYY-MM-DD>'-ORDER BY conclusion IN ('failure', 'timed_out') DESC, created_at DESC+ORDER BY conclusion IN ('failure', 'timed_out', 'startup_failure', 'stale') DESC, created_at DESC```Each `<uuid>` is one queue attempt; a PR kicked twice has two. The failing `job_name` feeds query 7.diff --git a/products/engineering_analytics/skills/turning-engineering-analytics-into-insights/references/hogql-recipes.md b/products/engineering_analytics/skills/turning-engineering-analytics-into-insights/references/hogql-recipes.mdindex f887cf3e5ca9..fc2f79ce9c0c 100644--- a/products/engineering_analytics/skills/turning-engineering-analytics-into-insights/references/hogql-recipes.md+++ b/products/engineering_analytics/skills/turning-engineering-analytics-into-insights/references/hogql-recipes.md@@ -104,8 +104,10 @@ SELECTtoStartOfWeek(run_started_at) AS week,workflow_name,count() AS runs,- countIf(conclusion = 'success') / count() AS success_rate,- quantile(0.95)(duration_seconds) AS p95_seconds+ countIf(conclusion = 'success')+ / nullIf(countIf(conclusion IN ('success', 'failure', 'timed_out', 'startup_failure', 'stale')), 0)+ AS success_rate,+ quantileIf(0.95)(duration_seconds, conclusion = 'success') AS p95_secondsFROM runsWHERE status = 'completed'AND run_started_at >= now() - INTERVAL 60 DAY@@ -114,7 +116,9 @@ HAVING runs >= 5ORDER BY week, runs DESC```-Completed runs only: in-flight and stale-conclusion rows would poison the rate.+The success rate counts `failure`, `timed_out`, `startup_failure`, and `stale` as failures.+It excludes skipped, cancelled, neutral, and action-required runs because they did not reach a pass-or-fail verdict.+The duration percentile uses successful runs because cancelled and failed runs end early.For a single-workflow tile, add `AND workflow_name = 'CI'` and drop the group.## Recipe: PR throughput per week@@ -143,7 +147,7 @@ runs AS (<workflow-runs base>),ci AS (SELECThead_sha,- countIf(s = 'completed' AND c IN ('failure', 'timed_out')) AS failing+ countIf(s = 'completed' AND c IN ('failure', 'timed_out', 'startup_failure', 'stale')) AS failingFROM (SELECT head_sha, workflow_name,argMax(status, run_started_at) AS s,diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex d626beafefc5..456d93a2c63a 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -11885,7 +11885,7 @@}},"workflow-health": {- "description": "Per-workflow CI health over a window: run count, success rate, p50/p95 duration, and last failure time. Use this for \"is CI getting faster or slower\", \"which GitHub Actions workflow is the slow or flaky long pole\", and CI duration trends. p50/p95 are over successful runs only, so superseded cancels and failed runs never bias the duration percentile. For PR-branch CI health, pass run_scope=pull_request (same-repo PRs only — fork PRs carry no PR attribution). To get a trend, call this over two adjacent windows and compare.",+ "description": "Per-workflow CI health over a window: run count, success rate, p50/p95 duration, and last failure time. Use this for \"is CI getting faster or slower\", \"which GitHub Actions workflow is the slow or flaky long pole\", and CI duration trends. Success rate covers runs that succeeded or ended in failure, timeout, startup failure, or staleness. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over successful runs only, so superseded cancels and failed runs never bias the duration percentile. For PR-branch CI health, pass run_scope=pull_request (same-repo PRs only — fork PRs carry no PR attribution). To get a trend, call this over two adjacent windows and compare.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Per-workflow CI health",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex ab994ae11462..bd403f7e5ae6 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -12513,7 +12513,7 @@}},"workflow-health": {- "description": "Per-workflow CI health over a window: run count, success rate, p50/p95 duration, and last failure time. Use this for \"is CI getting faster or slower\", \"which GitHub Actions workflow is the slow or flaky long pole\", and CI duration trends. p50/p95 are over successful runs only, so superseded cancels and failed runs never bias the duration percentile. For PR-branch CI health, pass run_scope=pull_request (same-repo PRs only — fork PRs carry no PR attribution). To get a trend, call this over two adjacent windows and compare.",+ "description": "Per-workflow CI health over a window: run count, success rate, p50/p95 duration, and last failure time. Use this for \"is CI getting faster or slower\", \"which GitHub Actions workflow is the slow or flaky long pole\", and CI duration trends. Success rate covers runs that succeeded or ended in failure, timeout, startup failure, or staleness. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over successful runs only, so superseded cancels and failed runs never bias the duration percentile. For PR-branch CI health, pass run_scope=pull_request (same-repo PRs only — fork PRs carry no PR attribution). To get a trend, call this over two adjacent windows and compare.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Per-workflow CI health",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 89fd61203160..5197d608c611 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -15062,7 +15062,7 @@ export namespace Schemas {runs: number;/** Latest runs that completed with conclusion 'success'. */passing: number;- /** Latest runs that completed with conclusion 'failure' or 'timed_out'. */+ /** Latest runs that ended in failure, timeout, startup failure, or staleness. */failing: number;/** Latest runs not yet completed (queued or in progress). */pending: number;@@ -59391,7 +59391,7 @@ export namespace Schemas {/** Bucket start, aligned to success_rate_series_granularity (top of hour, midnight, or Monday). */bucket_start: string;/**- * Fraction (0-1) of completed runs started in this bucket that succeeded. Null when the bucket had no completed run (a gap, not a 0% pass rate).+ * Fraction (0-1) of conclusive runs started in this bucket that succeeded. Skipped, cancelled, neutral, and action_required runs are excluded. Null when the bucket had no conclusive run (a gap, not a 0% pass rate).* @nullable*/success_rate: number | null;@@ -70240,7 +70240,7 @@ export namespace Schemas {* @nullable*/wall_seconds: number | null;- /** True when any latest-per-workflow run on this push concluded 'failure' or 'timed_out'. */+ /** True when any latest-per-workflow run on this push ended in a decisive failure. */failed: boolean;/** True when any latest-per-workflow run on this push hasn't completed yet. */pending: boolean;@@ -73647,7 +73647,7 @@ export namespace Schemas {cost_series: CostPerMergeBucket[];/** Median time-to-green (p50 wall clock for a PR push round to settle fully green) per bucket across the window, oldest first, bucketed by time_to_green_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */time_to_green_series: TimeToGreenBucket[];- /** CI pass rate (completed runs that succeeded, all branches) per bucket across the window, oldest first, bucketed by success_rate_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */+ /** CI pass rate (conclusive runs that succeeded, all branches) per bucket across the window, oldest first, bucketed by success_rate_series_granularity. Skipped, cancelled, neutral, and action_required runs are excluded. Empty buckets carry null; the whole series is empty when include_series=false. */success_rate_series: PassRateBucket[];/** Median time-to-merge (p50 open_to_merge_seconds, bots/drafts excluded) per bucket across the window, oldest first, bucketed by open_to_merge_series_granularity. Empty buckets carry null; the whole series is empty when include_series=false. */open_to_merge_series: OpenToMergeBucket[];@@ -73658,12 +73658,12 @@ export namespace Schemas {/** Same count over the equal-length window immediately before date_from — the delta baseline. */run_count_prev: number;/**- * Fraction of completed runs that succeeded (0-1) in the window. Null if none completed.+ * Fraction of conclusive runs that succeeded (0-1) in the window. Skipped, cancelled, neutral, and action_required runs are excluded. Null if no run reached a verdict.* @nullable*/success_rate: number | null;/**- * Success rate over the previous window. Null if none completed.+ * Conclusive-run success rate over the previous window. Null if no run reached a verdict.* @nullable*/success_rate_prev: number | null;@@ -86361,7 +86361,7 @@ export namespace Schemas {completed: number;/** Completed runs with conclusion 'success' in this bucket. */successes: number;- /** Completed runs that failed in this bucket (conclusion 'failure' or 'timed_out'); excludes skipped, cancelled, and action_required runs. */+ /** Completed runs with conclusion 'failure', 'timed_out', 'startup_failure', or 'stale'. Skipped, cancelled, neutral, and action_required runs are excluded. */failures: number;}@@ -86374,10 +86374,12 @@ export namespace Schemas {workflow_name: string;/** Total runs started in the window. */run_count: number;+ /** Completed runs with conclusion 'success'. */successful_run_count: number;+ /** Completed runs that succeeded or ended in failure, timeout, startup failure, or staleness. This is the success_rate denominator. */conclusive_run_count: number;/**- * Fraction of completed runs that succeeded (0-1). Null if no completed runs.+ * Fraction of conclusive runs that succeeded (0-1). Failures include failure, timed_out, startup_failure, and stale. Skipped, cancelled, neutral, and action_required runs are excluded. Null if no run reached a verdict.* @nullable*/success_rate: number | null;@@ -86392,12 +86394,12 @@ export namespace Schemas {*/p95_seconds: number | null;/**- * When the most recent failing run (conclusion 'failure' or 'timed_out') started, or null.+ * When the most recent decisive failure started, or null.* @nullable*/last_failure_at: string | null;/**- * Whether the most recent completed run was a decisive failure (conclusion 'failure' or 'timed_out'). Null when no run has completed in the window. Powers the OK/RED status badge.+ * Whether the most recent completed run ended in failure, timeout, startup failure, or staleness. Null when no run has completed in the window. Powers the OK/RED status badge.* @nullable*/latest_run_failed: boolean | null;@@ -86425,10 +86427,11 @@ export namespace Schemas {/** Runs in the window that were a 2nd+ attempt - retry pressure, a flakiness proxy. */rerun_cycles?: number;/**- * Success rate over the equal-length window before date_from - the delta baseline. Null when that window had no completed runs.+ * Conclusive-run success rate over the equal-length window before date_from - the delta baseline. Null when that window had no conclusive runs.* @nullable*/success_rate_prev?: number | null;+ /** Successful runs that did real CI work. This is the p50/p95 sample count. */percentile_run_count?: number;}diff --git a/services/mcp/src/generated/engineering_analytics/api.ts b/services/mcp/src/generated/engineering_analytics/api.tsindex 7b68f44fea7c..da341775153f 100644--- a/services/mcp/src/generated/engineering_analytics/api.ts+++ b/services/mcp/src/generated/engineering_analytics/api.ts@@ -242,7 +242,7 @@ export const EngineeringAnalyticsTeamCiHealthQueryParams = /* @__PURE__ */ zod.o})/**- * Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.+ * Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. Success rate covers runs that succeeded or ended in a decisive failure. Skipped, cancelled, neutral, and action-required runs are excluded. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.*/export const EngineeringAnalyticsWorkflowHealthParams = /* @__PURE__ */ zod.object({project_id: zod