: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
feat(eng-analytics): expose ci engine provenance (#109280)
Raúl Negrón-Oteroe6becdc3f09a
diff --git a/.github/scripts/report_test_timings.py b/.github/scripts/report_test_timings.pyindex 18fa1382ca4a..b408b2bc2f40 100644--- a/.github/scripts/report_test_timings.py+++ b/.github/scripts/report_test_timings.py@@ -730,6 +730,9 @@ def get_pull_request_number() -> int | None:def get_run_url() -> str:+ if depot_url := os.environ.get("DEPOT_JOB_URL"):+ match = re.match(r"^(https://depot\.dev/orgs/[^/?]+/workflows/[a-z0-9]+)(?=/|[?#]|$)", depot_url)+ return match[1] if match else ""repo = os.environ.get("GITHUB_REPOSITORY", "")run_id = os.environ.get("GITHUB_RUN_ID", "")if not repo or not run_id:@@ -742,6 +745,13 @@ def workflow_resource_attributes() -> dict[str, str | int]:"""Resource attributes attached to every span — pre-aggregation context for the run."""keys = ("WORKFLOW", "RUN_ID", "RUN_NUMBER", "RUN_ATTEMPT", "REF", "SHA", "ACTOR", "REPOSITORY")attrs: dict[str, str | int] = {f"ci.{k.lower()}": os.environ.get(f"GITHUB_{k}", "") for k in keys}+ run_url = get_run_url()+ attrs["ci.engine"] = "depot_ci" if os.environ.get("DEPOT_JOB_URL") else "github_actions"+ if attrs["ci.engine"] == "depot_ci":+ if run_url:+ attrs["ci.native_workflow_run_id"] = run_url.rsplit("/", 1)[1]+ else:+ attrs["ci.native_workflow_run_id"] = os.environ.get("GITHUB_RUN_ID", "")attrs["ci.event_name"] = os.environ.get("GITHUB_EVENT_NAME", "")attrs["ci.head_ref"] = os.environ.get("GITHUB_HEAD_REF", "")attrs["ci.base_ref"] = os.environ.get("GITHUB_BASE_REF", "")@@ -751,16 +761,17 @@ def workflow_resource_attributes() -> dict[str, str | int]:pr_number = get_pull_request_number()if pr_number is not None:attrs["ci.pr_number"] = pr_number- attrs["ci.run_url"] = get_run_url()+ attrs["ci.run_url"] = run_urlreturn {k: v for k, v in attrs.items() if v != ""}# ---------- OTLP export -----------def deterministic_trace_id(run_id: str, run_attempt: str, job_key: str) -> int:- """One trace ID per (run_id, run_attempt, job). Reruns of the same attempt collide intentionally."""- digest = hashlib.sha256(f"{run_id}:{run_attempt}:{job_key}".encode()).digest()+def deterministic_trace_id(run_id: str, run_attempt: str, job_key: str, *, ci_engine: str = "github_actions") -> int:+ """One trace ID per (engine, run_id, run_attempt, job). Reruns of the same attempt collide intentionally."""+ namespace = "" if ci_engine == "github_actions" else f"{ci_engine}:"+ digest = hashlib.sha256(f"{namespace}{run_id}:{run_attempt}:{job_key}".encode()).digest()return int.from_bytes(digest[:16], "big") # OTLP trace IDs are 128-bit (16 bytes).@@ -858,7 +869,12 @@ def emit_traces(shards: list[Shard], endpoint: str, token: str, runner: Runner =for shard in shards:# Mutate the shared generator before each job so its root span (and the test# children that inherit the active parent's trace ID) form a distinct trace.- id_generator.trace_id = deterministic_trace_id(run_id, run_attempt, job_trace_key(shard.info))+ id_generator.trace_id = deterministic_trace_id(+ str(resource.attributes.get("ci.native_workflow_run_id") or run_id),+ run_attempt,+ job_trace_key(shard.info),+ ci_engine=str(resource.attributes["ci.engine"]),+ )_emit_shard_span(tracer, shard, job_trace_name(workflow, shard.info), owner_of, runner)provider.shutdown()diff --git a/.github/scripts/test_report_test_timings.py b/.github/scripts/test_report_test_timings.pyindex 25d64c8feb3d..751aff01a3dd 100644--- a/.github/scripts/test_report_test_timings.py+++ b/.github/scripts/test_report_test_timings.py@@ -911,6 +911,28 @@ def test_workflow_resource_attributes_includes_query_and_drilldown_fields(assert attrs["ci.pr_number"] == 57216assert attrs["ci.repository"] == "PostHog/posthog"assert attrs["ci.run_url"] == "https://github.com/PostHog/posthog/actions/runs/25218527467"+ assert attrs["ci.engine"] == "github_actions"+ assert attrs["ci.native_workflow_run_id"] == "25218527467"+++ "job_url, workflow_id",+ [+ ("https://depot.dev/orgs/example/workflows/000000001a/jobs/000000001b", "000000001a"),+ ("https://example.com/not-a-workflow", ""),+ ],+)+def test_depot_resource_context_never_links_a_compatible_id_to_github(+ monkeypatch: pytest.MonkeyPatch, job_url: str, workflow_id: str+) -> None:+ monkeypatch.setenv("DEPOT_JOB_URL", job_url)+ monkeypatch.setenv("GITHUB_RUN_ID", "42")+ attrs = report_test_timings.workflow_resource_attributes()+ assert attrs["ci.engine"] == "depot_ci"+ assert attrs.get("ci.native_workflow_run_id", "") == workflow_id+ assert attrs.get("ci.run_url", "") == (+ f"https://depot.dev/orgs/example/workflows/{workflow_id}" if workflow_id else ""+ )def test_workflow_resource_attributes_branch_on_push(monkeypatch: pytest.MonkeyPatch) -> None:@@ -931,6 +953,7 @@ def test_deterministic_trace_id_is_stable_across_processes() -> None:a = report_test_timings.deterministic_trace_id("25218527467", "1", "backend:core:1")b = report_test_timings.deterministic_trace_id("25218527467", "1", "backend:core:1")assert a == b+ assert report_test_timings.deterministic_trace_id("25218527467", "1", "backend:core:1", ci_engine="depot_ci") != a# Different attempt -> different trace id (so reruns of the same workflow run id are isolated).assert report_test_timings.deterministic_trace_id("25218527467", "2", "backend:core:1") != a# Different job -> different trace id (so each job in a run is its own trace).diff --git a/.github/scripts/weekly-slow-tests-report.mjs b/.github/scripts/weekly-slow-tests-report.mjsindex fbea1b26d0e8..dcfb05604cd0 100644--- a/.github/scripts/weekly-slow-tests-report.mjs+++ b/.github/scripts/weekly-slow-tests-report.mjs@@ -49,7 +49,7 @@ const SLOW_TESTS_QUERY = `any(attributes['test.file']) AS file,round(median(toFloat(duration_nano)) / 1000000000, 1) AS p50_seconds,round(max(toFloat(duration_nano)) / 1000000000, 1) AS max_seconds,- uniq(resource_attributes['ci.run_id']) AS builds+ uniq(tuple(resource_attributes['ci.engine'], coalesce(nullIf(resource_attributes['ci.native_workflow_run_id'], ''), resource_attributes['ci.run_id']), resource_attributes['ci.sha'], resource_attributes['ci.run_id'])) AS buildsFROM posthog.trace_spansWHERE service_name IN {service_names}AND attributes['test.outcome'] = 'passed'diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex dbab9d572963..a5667977c5a1 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -9410,6 +9410,10 @@ snapshots:hash: v1.k794b7964.1138e5d885f169ffa0619c3084ed98c52d0e0d9c50495114716a6c51876df00e.WtOFtpae27Ff_bRa4lJQc7WjeR4k90SEi3jx2GRAoXcscenes-app-engineering-analytics-workflow--workflow-detail-section-load-errors--light:hash: v1.k794b7964.84f8223fcaa0e115cd1f9ee5f5198a9af1a51270c7bc10fdc9ebd1b5616708eb.23dbZo3jWrrPpnetF_gpnOvNz3FsB8Z80ovfVXiFsmE+ scenes-app-engineering-analytics-workflow-run--depot-run--dark:+ hash: v1.k794b7964.700c8e576002a8ee86244357b292b70ce82ff204414e001f67ac70908178f246.fCt9_ACi4OPiDvNY1z_1iu04-E4zW42XoVXunMJoDa0+ scenes-app-engineering-analytics-workflow-run--depot-run--light:+ hash: v1.k794b7964.92e946b11c14dd56f65a492866e85a716c4cf44866830ac96c41e236eabf0e3d.ntCPLQEnZ-toghbJD8tLx9kaywEU-NA_OZJncYcu1YMscenes-app-engineering-analytics-workflow-run--failed-run--dark:hash: v1.k794b7964.a00911d6c52b4049f604b641659b6fdcfbda71c715e1bbcb937eb2e5d8f7af25.Cn8V_cwoSpfwEXevukgCHuTVDB8Fpcid4fxJ2GZI7kcscenes-app-engineering-analytics-workflow-run--failed-run--light:diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 774be6165c52..459fde2ada8c 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -1461,8 +1461,13 @@ export const productUrls = {`/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,engineeringAnalyticsPullRequest: (repoOwner: string, repoName: string, number: number | string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}`,- engineeringAnalyticsWorkflowRun: (repoOwner: string, repoName: string, runId: number | string): string =>- `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}`,+ engineeringAnalyticsWorkflowRun: (+ repoOwner: string,+ repoName: string,+ runId: number | string,+ ciEngine?: string | null+ ): string =>+ `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}${ciEngine ? `?ci_engine=${encodeURIComponent(ciEngine)}` : ''}`,engineeringAnalyticsWorkflowRuns: (repoOwner: string, repoName: string, workflowName: string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/workflows/${encodeURIComponent(workflowName)}`,engineeringAnalyticsAuthor: (handle: string): string =>diff --git a/products/engineering_analytics/SPEC.md b/products/engineering_analytics/SPEC.mdindex 1e28975ca6af..8aa41fdfa432 100644--- a/products/engineering_analytics/SPEC.md+++ b/products/engineering_analytics/SPEC.md@@ -107,7 +107,7 @@ The per-PR friction view is the exception, below: it also needs the `pull_reques#### `engineering_analytics_job_costs`- Grain: one row per job attempt (a retry appears once per attempt; correct for cost). Jobs whose run row is missing keep NULL attribution rather than being dropped.-- Joins jobs to runs on `run_id` alone, never `(run_id, run_attempt)` — same key and same reason as `ci_job_history`: the runs snapshot keeps only the newest attempt's row, so attempt equality blanks attribution for every earlier-attempt job, which after a partial re-run is exactly the population that executed. Attribution is attempt-invariant.+- Joins jobs to runs on `(ci_engine, run_id)`, never `(ci_engine, run_id, run_attempt)` — same key and same reason as `ci_job_history`: the runs snapshot keeps only the newest attempt's row, so attempt equality blanks attribution for every earlier-attempt job, which after a partial re-run is exactly the population that executed. Attribution is attempt-invariant.- NULL cost is disambiguated by `provider` (non-billable: github-hosted, non-Linux, unclassifiable), `completed_at` (unsettled), or `is_rerun_copy` (never executed). A queued job is never shown as `$0.00`.- `is_rerun_copy` marks the rows GitHub re-lists but never ran (see §6). They are kept, not dropped — the grain and the row count stay identical to `ci_job_history` — but carry no `billable_seconds` / `estimated_cost_usd`.- Cost runs off Depot's billed clock, not `duration_seconds` (§6). `billable_seconds` is that clock; `duration_seconds` stays the full wall-clock GitHub reports.@@ -121,7 +121,7 @@ The per-PR friction view is the exception, below: it also needs the `pull_reques- Column order is the locked contract (it fixes the UNION ALL order and the saved-query schema): append, never reorder.- `is_rerun_copy` rides here too (§6), so a green/red boundary or duration read can drop the re-listed rows instead of counting one execution twice.- Two PR keys, by design (§6): `pr_number` is the run's `pull_requests` association (0 when absent: master pushes, fork PRs), or the PR a merge-queue gate branch was landing when `is_merge_queue`; `commit_pr_number` resolves the merged PR that produced the head commit, which is how a master push gets PR attribution at all.-- Commit attribution joins the raw runs table on `run_id` alone, never `run_attempt`: the runs snapshot upserts by id so only the newest attempt's row exists, and attribution is attempt-invariant (a re-run is the same commit).+- Commit attribution joins the normalized runs table on `(ci_engine, run_id)`, never `run_attempt`: the runs snapshot upserts by id so only the newest attempt's row exists, and attribution is attempt-invariant (a re-run is the same commit).#### `engineering_analytics_ci_failures`@@ -196,11 +196,16 @@ Warehouse tables (GitHub source):Warehouse table (Depot source):- `depot_job_attempts`: one row per Depot CI job attempt, for the repository the Depot source names. Reads keep only that repository's rows, because a source moved to another repository keeps what it synced before. Depot CI is its own engine, so these runs never reach the GitHub tables. `logic/views/depot_ci.py` reshapes the attempts into rows of the GitHub runs and jobs contracts and unions them onto those tables, so every builder reads both engines. Each Depot workflow is one runs row. A run with one workflow decodes its id to the integer `GITHUB_RUN_ID` Depot CI gives its jobs, which joins them to the CI test spans; a run with several workflows keys each by its own decoded workflow id, so no join fans out. The PR number comes from the run's `refs/pull/<n>/merge` ref, and the run's branch from that PR's snapshot. Job rows carry no branch, because a PR snapshot lookup in the jobs builder would add two full PR scans to every jobs read; a read that joins a job to its run takes the branch through `workflow_jobs.branch`, which falls back to the run's. Depot numbers attempts per job, not per run, so a job's last attempt is listed again under each later attempt of its run, as GitHub lists a job it did not re-run; the jobs builder flags those rows as `is_rerun_copy`. Depot's API reports no `runs-on`, so every attempt is costed as the default `depot-ubuntu-24.04` sandbox. Optional, and reads degrade to GitHub-only CI when unsynced.- - While a workflow moves to Depot CI, GitHub Actions routes each pull request to one engine, and both engines record a run of the commit. The union suppresses a successful Depot workflow whose `wait-for-handoff` job ran alone. A GitHub run is suppressed only when it succeeded, its `Hand off backend tests to Depot CI` job succeeded, its latest `Django Tests Pass` job succeeded, no synced job attempt decisively failed, and a successful Depot workflow took the hand-off for the same PR number and `head_sha`. Missing association or replacement data leaves the GitHub run visible. Failed, cancelled and unsettled GitHub relays and Depot waits stay visible. A relay that recovered retains its earlier failure history. Suppression applies to both runs and jobs; raw source rows remain available for full runner-cost accounting.+ - The shared CI sources assign `ci_engine` from the warehouse source: `github_actions` or `depot_ci`. Runner provider is independent: GitHub Actions can use Depot runners. Managed job-history and job-cost views append `ci_engine`, `native_run_id`, `native_workflow_run_id`, `native_job_id`, and `native_attempt_id`. GitHub's native workflow execution ID is its run ID; Depot's is its workflow ID. These additive string IDs preserve source identity while the existing integer IDs remain compatible with test traces and API consumers. CI job-to-run joins, failure attribution, job run shares, and timeline paging qualify integer IDs with `ci_engine`. The friction view consumes the same normalized sources and resolves a Depot job's default branch through its run. Run and job APIs append engine and source-native IDs; per-run costs and UI caches qualify compatible integers with the engine. Detail, job, and log lookups accept `ci_engine`; an unqualified integer that names both engines fails with a 400. New failure logs and test traces stamp the engine. Recovery evidence groups by engine, native workflow identity, and commit SHA; historical untagged telemetry remains unknown and cannot establish cross-engine identity. Legacy logs are read only for integer IDs unique to one engine in the selected source. Depot workflows without a hand-off job remain visible, including default-branch pushes; their branch and commit come from `ref` and `sha` when no PR head is present.+ - While a workflow moves to Depot CI, GitHub Actions routes each pull request to one engine, and both engines record a run of the commit. The union suppresses a successful Depot workflow whose `wait-for-handoff` job ran alone. A GitHub run is suppressed only when it succeeded, its `Hand off backend tests to Depot CI` job succeeded, its latest `Django Tests Pass` job succeeded, no synced job attempt decisively failed, and a successful Depot workflow took the hand-off for the same PR number and `head_sha`. Missing association or replacement data leaves the GitHub run visible. Failed, cancelled and unsettled GitHub relays and Depot waits stay visible. A relay that recovered retains its earlier failure history. Suppression applies to both runs and jobs; raw source rows remain available for full runner-cost accounting. Curated estimates cover the visible execution jobs; suppressed hand-off and relay overhead is excluded. These figures are not total runner spend or invoice reconciliation.++The Depot source is attempt-grained. A terminal run with no executed job attempts has no row here, so+the normalized run inventory cannot establish total run completeness. Vendor pagination can omit runs+that share a second at a page boundary; replay cannot recover an ID the listing never returns.Other products read as sources:-- Logs: the thinned CI failure lines this product's job-logs pipeline emits (`service.name = github-ci-logs`), keyed by `run_id`, for failed GitHub jobs and failed Depot CI job attempts, whose `run_id` and `job_id` are the decoded integer ids of `depot_ci.py`.+- Logs: the thinned CI failure lines this product's job-logs pipeline emits (`service.name = github-ci-logs`), keyed by `(ci_engine, run_id, job_id)`, for failed GitHub jobs and failed Depot CI job attempts, whose `run_id` and `job_id` are the decoded integer ids of `depot_ci.py`. Historical records without an engine retain unknown provenance.- Traces: per-test CI spans emitted by the main Backend pytest and Frontend Jest suites (`trace_spans`), behind flaky tests and team CI health. Jest covers both legacy `frontend/` tests and isolated product frontends through the shared root config; its quarantine adapter records tolerated failures beside JUnit so the trusted reporter can retain that evidence. Package-specific Jest and Vitest jobs are outside this signal.**Freshness caveat:** a run's `conclusion` settles via the `workflow_run` webhook, which can lag or miss deliveries; the read layer surfaces `status` honestly rather than implying a settled conclusion.diff --git a/products/engineering_analytics/backend/facade/api.py b/products/engineering_analytics/backend/facade/api.pyindex 0157b3115a24..8c0011c565a6 100644--- a/products/engineering_analytics/backend/facade/api.py+++ b/products/engineering_analytics/backend/facade/api.py@@ -30,6 +30,7 @@ from products.engineering_analytics.backend.facade.contracts import (BranchPRMatch,BrokenTestsResult,CICardSummary,+ CIEngine,CIFailureLogs,CISignalsConfig,CITestRunner,@@ -138,12 +139,13 @@ def get_workflow_run(*,team: Team,run_id: int,+ ci_engine: CIEngine | None = None,source_id: str | None = None,repo: str | None = None,user_access_control: "UserAccessControl | None" = None,) -> WorkflowRunDetail | None:return logic.build_workflow_run(- curated=_authorized_source(team, source_id, user_access_control, repo=repo), run_id=run_id+ curated=_authorized_source(team, source_id, user_access_control, repo=repo), run_id=run_id, ci_engine=ci_engine)@@ -406,6 +408,7 @@ def list_workflow_jobs(*,team: Team,run_id: int,+ ci_engine: CIEngine | None = None,run_attempt: int | None = None,source_id: str | None = None,repo: str | None = None,@@ -414,6 +417,7 @@ def list_workflow_jobs(return logic.build_workflow_jobs(curated=_authorized_source(team, source_id, user_access_control, repo=repo),run_id=run_id,+ ci_engine=ci_engine,run_attempt=run_attempt,)@@ -722,12 +726,13 @@ def get_run_failure_logs(*,team: Team,run_id: int,+ ci_engine: CIEngine | None = None,source_id: str | None = None,repo: str | None = None,user_access_control: "UserAccessControl | None" = None,) -> RunFailureLogs:return logic.build_run_failure_logs(- curated=_authorized_source(team, source_id, user_access_control, repo=repo), run_id=run_id+ curated=_authorized_source(team, source_id, user_access_control, repo=repo), run_id=run_id, ci_engine=ci_engine)diff --git a/products/engineering_analytics/backend/facade/contracts.py b/products/engineering_analytics/backend/facade/contracts.pyindex 585b6932afde..e4701056b4cb 100644--- a/products/engineering_analytics/backend/facade/contracts.py+++ b/products/engineering_analytics/backend/facade/contracts.py@@ -29,6 +29,13 @@ from pydantic.dataclasses import dataclassfrom posthog.hogql.database.models import FieldOrTable+from posthog.enums import LabeledStrEnum+++class CIEngine(LabeledStrEnum):+ GITHUB_ACTIONS = "github_actions", "GitHub Actions"+ DEPOT_CI = "depot_ci", "Depot CI"+class QueryWorkLimitExceededError(Exception):"""The complete result needs more warehouse queries than one request allows."""@@ -384,6 +391,9 @@ class WorkflowRunDetail:commit_pr_number: int | None# A merge-queue gate attempt landing `pr_number`. Counts as CI; not as a push the author made.is_merge_queue: bool+ ci_engine: CIEngine | None = None+ native_run_id: str | None = None+ native_workflow_run_id: str | None = None@dataclass(frozen=True)@@ -408,6 +418,7 @@ class WorkflowRunActivityPoint:pr_number: int# Head commit SHA — lets a chart point link to the commit (e.g. the repo-health bar → GitHub commit).head_sha: str+ ci_engine: CIEngine | None = None@dataclass(frozen=True)@@ -447,6 +458,11 @@ class WorkflowJob:# The job's runner tier label, e.g. '16-core' (self-hosted) or 'ubuntu-latest' (GitHub-hosted).runner_label: strestimated_cost_usd: float | None+ ci_engine: CIEngine | None = None+ native_run_id: str | None = None+ native_workflow_run_id: str | None = None+ native_job_id: str | None = None+ native_attempt_id: str | None = None@dataclass(frozen=True)@@ -481,7 +497,7 @@ class WorkflowCost:@dataclass(frozen=True)class RunCost:"""One workflow run's billable CI spend within a PR — the per-run cost shown when a PR's workflow- row is expanded to its runs. Keyed by ``(run_id, run_attempt)`` so a re-run's attempts stay+ row is expanded to its runs. Keyed by ``(ci_engine, run_id, run_attempt)`` so a re-run's attempts staydistinct. Billable runners only; same exclusion rules as ``PRCostSummary``."""@@ -489,6 +505,7 @@ class RunCost:run_attempt: intbillable_minutes: floatestimated_cost_usd: float | None+ ci_engine: CIEngine | None = None@dataclass(frozen=True)@@ -535,7 +552,7 @@ class PRCostSummary:excluded_jobs: int# Same spend broken down per workflow, so the PR's per-workflow table can show a cost column.by_workflow: list[WorkflowCost]- # Same spend broken down per workflow run, keyed by (run_id, run_attempt), so the expanded runs+ # Same spend broken down per workflow run, keyed by (ci_engine, run_id, run_attempt), so the expanded runs# table under a workflow can show a per-run cost column (rolling up to the per-workflow figure).by_run: list[RunCost]# Agent LLM token spend attributed to this PR by git branch ($ai_git_branch), or None when no@@ -549,8 +566,9 @@ class PRLifecycleEvent:kind: PRLifecycleEventKindat: datetimedetail: str | None = None- # GitHub Actions run id for ci_* events — links straight to the run page.+ # Integer run id for ci_* events. It is unique only together with ci_engine.run_id: int | None = None+ ci_engine: CIEngine | None = None@dataclass(frozen=True)@@ -592,6 +610,7 @@ class CIJobFailureLog:line_count: intlines: list[CIFailureLogLine]truncated: bool+ ci_engine: CIEngine | None = None@dataclass(frozen=True)@@ -1125,6 +1144,8 @@ class WorkflowHealthItem:# even when a scope is active.merge_queue_run_count: int = 0+ latest_ci_engine: CIEngine | None = None+@dataclass(frozen=True)class CostPerMergeBucket:@@ -1512,6 +1533,7 @@ class MasterFailureGroup:last_seen: datetime# The most recent failing run in the group — the drill-down anchor.latest_run_id: int+ latest_ci_engine: CIEngine | None = None# The sparkline is a fixed-width hourly histogram; the width is the contract so a caller can render@@ -1553,6 +1575,8 @@ class BrokenTestRow:latest_branch: strtrend_24h: list[int] = field(default_factory=list)+ latest_ci_engine: CIEngine | None = None+@dataclass(frozen=True)class BrokenTestsResult:@@ -1582,6 +1606,7 @@ class RunFailureLogs:logs_available: booljobs: list[CIJobFailureLog]truncated: bool+ ci_engine: CIEngine | None = None@dataclass(frozen=True)diff --git a/products/engineering_analytics/backend/logic/job_logs/activity.py b/products/engineering_analytics/backend/logic/job_logs/activity.pyindex c1e6b1c684ca..496da71f6fbc 100644--- a/products/engineering_analytics/backend/logic/job_logs/activity.py+++ b/products/engineering_analytics/backend/logic/job_logs/activity.py@@ -27,6 +27,7 @@ from posthog.models.team import Teamfrom posthog.sync import database_sync_to_asyncfrom posthog.temporal.common.base import PostHogWorkflow+from products.engineering_analytics.backend.facade.contracts import CIEnginefrom products.engineering_analytics.backend.logic.job_logs.emitter import JobLogsEmitterfrom products.engineering_analytics.backend.logic.job_logs.fetcher import fetch_depot_job_log, fetch_job_logfrom products.engineering_analytics.backend.logic.job_logs.thinning import thin_log_lines@@ -43,6 +44,9 @@ _FETCH_RETRY_POLICY = RetryPolicy(maximum_interval=timedelta(minutes=15),)+# Reserve a trace namespace for Depot without changing GitHub's existing trace IDs.+_DEPOT_TRACE_NAMESPACE = 1 << 127+@dataclasses.dataclass(frozen=True)class FetchJobLogInputs:@@ -74,6 +78,9 @@ class FetchDepotJobLogInputs:job_name: strrun_attempt: inthead_sha: str+ native_run_id: str = ""+ native_workflow_run_id: str = ""+ native_job_id: str = ""@frozen@@ -111,7 +118,7 @@ def _require_logs_endpoint() -> None:def _thin_and_emit(- log_text: str, attributes: dict[str, str | int], *, log_ingest_token: str, run_id: int | None, job_id: int+ log_text: str, attributes: dict[str, str | int], *, log_ingest_token: str, trace_id: int | None, job_id: int) -> int:# CI failure logs are team-level operational data: they ride the owning team's project Logs# (visible to any logs:read holder) by design and intentionally do NOT inherit the GitHub@@ -123,7 +130,7 @@ def _thin_and_emit(thinned,# Total lines in the full log before thinning, which is the denominator for each line's orig_line.attributes={**attributes, "orig_total": len(log_text.splitlines())},- trace_id=run_id,+ trace_id=trace_id,span_id=job_id,)@@ -145,6 +152,11 @@ async def fetch_and_emit_job_log_activity(inputs: FetchJobLogInputs) -> dict[strlog.info("github_job_log_unavailable")return {"status": "log_unavailable", "job_id": inputs.job_id, "lines": 0}attributes: dict[str, str | int] = {+ "ci_engine": CIEngine.GITHUB_ACTIONS.value,+ "native_run_id": str(inputs.run_id or 0),+ "native_workflow_run_id": str(inputs.run_id or 0),+ "native_job_id": str(inputs.job_id),+ "native_attempt_id": str(inputs.job_id),"job_id": inputs.job_id,"run_id": inputs.run_id or 0,"repo": inputs.repo,@@ -163,7 +175,7 @@ async def fetch_and_emit_job_log_activity(inputs: FetchJobLogInputs) -> dict[strarchive,attributes,log_ingest_token=log_ingest_token,- run_id=inputs.run_id,+ trace_id=inputs.run_id,job_id=inputs.job_id,)log.info("github_job_log_emitted", lines=lines)@@ -182,6 +194,11 @@ async def fetch_and_emit_depot_job_log_activity(inputs: FetchDepotJobLogInputs)log.info("depot_job_log_unavailable")return {"status": "log_unavailable", "job_id": inputs.job_id, "lines": 0}attributes: dict[str, str | int] = {+ "ci_engine": CIEngine.DEPOT_CI.value,+ "native_attempt_id": inputs.attempt_id,+ "native_run_id": inputs.native_run_id,+ "native_workflow_run_id": inputs.native_workflow_run_id,+ "native_job_id": inputs.native_job_id,"job_id": inputs.job_id,"run_id": inputs.run_id,"repo": inputs.repo,@@ -198,7 +215,7 @@ async def fetch_and_emit_depot_job_log_activity(inputs: FetchDepotJobLogInputs)log_text,attributes,log_ingest_token=credentials.log_ingest_token,- run_id=inputs.run_id,+ trace_id=inputs.run_id | _DEPOT_TRACE_NAMESPACE,job_id=inputs.job_id,)log.info("depot_job_log_emitted", lines=lines)diff --git a/products/engineering_analytics/backend/logic/job_logs/coordinator.py b/products/engineering_analytics/backend/logic/job_logs/coordinator.pyindex 2fedb36e5ff4..d42e8d14b73c 100644--- a/products/engineering_analytics/backend/logic/job_logs/coordinator.py+++ b/products/engineering_analytics/backend/logic/job_logs/coordinator.py@@ -243,7 +243,7 @@ def _query_failed_depot_attempts(# against the cutoff is chronological. The table name comes from the source's synced schema.after = after or DepotAttemptCursor(finished_at=cutoff_iso, attempt_id="")sql = f"""- SELECT run_id, run_workflow_count, workflow_id, attempt_id, attempt, repo, head_sha, workflow_name,+ SELECT run_id, run_workflow_count, workflow_id, attempt_id, attempt, repo, head_sha, workflow_name, job_id,job_display_name, job_key, attempt_finished_atFROM {table}WHERE attempt_status = 'failed' AND attempt_finished_at > {{cutoff}} AND (@@ -286,6 +286,9 @@ def _depot_attempt_inputs(source: ExternalDataSource, row: dict[str, Any]) -> Fejob_name=row["job_display_name"] or row["job_key"] or "",run_attempt=row["attempt"] or 0,head_sha=row["head_sha"] or "",+ native_run_id=row["run_id"] or "",+ native_workflow_run_id=row["workflow_id"] or "",+ native_job_id=row["job_id"] or "",)diff --git a/products/engineering_analytics/backend/logic/job_logs/test/test_activity.py b/products/engineering_analytics/backend/logic/job_logs/test/test_activity.pyindex 25aac64a8777..2f7742712f50 100644--- a/products/engineering_analytics/backend/logic/job_logs/test/test_activity.py+++ b/products/engineering_analytics/backend/logic/job_logs/test/test_activity.py@@ -121,10 +121,15 @@ async def test_depot_attempt_fetches_by_attempt_id_and_emits_decoded_ids(monkeypassert result == {"status": "emitted", "job_id": 579485267642625, "lines": 1}assert fetched == {"attempt_id": "zf6sbbn2wh", "token": "depot-tok"}assert (_FakeEmitter.last_kwargs["trace_id"], _FakeEmitter.last_kwargs["span_id"]) == (- 80213453736890,+ 80213453736890 | (1 << 127),579485267642625,)assert _FakeEmitter.last_kwargs["attributes"] == {+ "ci_engine": "depot_ci",+ "native_attempt_id": _DEPOT_INPUTS.attempt_id,+ "native_run_id": "",+ "native_workflow_run_id": "",+ "native_job_id": "","job_id": 579485267642625,"run_id": 80213453736890,"repo": "PostHog/posthog",diff --git a/products/engineering_analytics/backend/logic/job_logs/test/test_coordinator.py b/products/engineering_analytics/backend/logic/job_logs/test/test_coordinator.pyindex 8623d6e32bb0..5a3d5a4851a9 100644--- a/products/engineering_analytics/backend/logic/job_logs/test/test_coordinator.py+++ b/products/engineering_analytics/backend/logic/job_logs/test/test_coordinator.py@@ -132,6 +132,8 @@ class TestDiscoverFailedDepotAttempts(ClickhouseTestMixin, BaseTest):job_name="ci-backend.yml:turbo-tests:matrix-38",run_attempt=1,head_sha="abc1234",+ native_run_id="bbbbbbbbbb" if run_id == 223978965517241 else "427q556wmn",+ native_workflow_run_id="cccccccccc",)two_workflow_run = fetch_inputs("h8qn5x801q", run_id=223978965517241, job_id=300989664396052)diff --git a/products/engineering_analytics/backend/logic/queries/_curated.py b/products/engineering_analytics/backend/logic/queries/_curated.pyindex 1de608f94b39..84ab5f4bf2a9 100644--- a/products/engineering_analytics/backend/logic/queries/_curated.py+++ b/products/engineering_analytics/backend/logic/queries/_curated.py@@ -244,7 +244,9 @@ class CuratedGitHubSource:adds the raw-string scan floor — callers must register {run_started_floor} (seerun_started_floor_constant)."""query = workflow_runs.build_query(- self._runs_table(), pull_requests_table=self._tables.pull_requests, started_floor=started_floor+ self._runs_table(),+ pull_requests_table=self._tables.pull_requests,+ started_floor=started_floor,)return f"({query})"diff --git a/products/engineering_analytics/backend/logic/queries/_run_detail.py b/products/engineering_analytics/backend/logic/queries/_run_detail.pyindex 4f18eabdba22..f3133220357d 100644--- a/products/engineering_analytics/backend/logic/queries/_run_detail.py+++ b/products/engineering_analytics/backend/logic/queries/_run_detail.py@@ -7,13 +7,13 @@ applied to two of the three call sites and silently mis-mapping a column.from typing import Any-from products.engineering_analytics.backend.facade.contracts import RepoRef, WorkflowRunDetail+from products.engineering_analytics.backend.facade.contracts import CIEngine, RepoRef, WorkflowRunDetail# The run columns every run-detail query selects, in order — kept in lockstep with the unpacking below.RUN_DETAIL_COLUMNS = """id, workflow_name, head_sha, head_branch, status, conclusion,run_started_at, updated_at, duration_seconds, run_attempt, pr_number, commit_pr_number,- repo_owner, repo_name, is_merge_queue+ repo_owner, repo_name, is_merge_queue, ci_engine, native_run_id, native_workflow_run_id"""@@ -34,6 +34,9 @@ def to_run_detail(row: tuple[Any, ...]) -> WorkflowRunDetail:repo_owner,repo_name,is_merge_queue,+ ci_engine,+ native_run_id,+ native_workflow_run_id,) = rowreturn WorkflowRunDetail(repo=RepoRef(provider="github", owner=repo_owner, name=repo_name),@@ -52,4 +55,7 @@ def to_run_detail(row: tuple[Any, ...]) -> WorkflowRunDetail:pr_number=int(pr_number) if pr_number is not None else 0,commit_pr_number=int(commit_pr_number) if commit_pr_number is not None else None,is_merge_queue=bool(is_merge_queue),+ ci_engine=CIEngine(ci_engine),+ native_run_id=native_run_id,+ native_workflow_run_id=native_workflow_run_id,)diff --git a/products/engineering_analytics/backend/logic/queries/_test_spans.py b/products/engineering_analytics/backend/logic/queries/_test_spans.pyindex 5818fb24dd6c..e786b31bb9b3 100644--- a/products/engineering_analytics/backend/logic/queries/_test_spans.py+++ b/products/engineering_analytics/backend/logic/queries/_test_spans.py@@ -62,6 +62,9 @@ _RUN_EVIDENCE = """runner,nodeid,run_id,+ ci_engine,+ workflow_run_key,+ head_sha,argMax(owner_team, job_at) AS owner_team,anyIf(selector, selector != '') AS selector,anyIf(pr_number, pr_number != '') AS pr_number,@@ -79,6 +82,9 @@ _RUN_EVIDENCE = """runner,nodeid,run_id,+ ci_engine,+ workflow_run_key,+ head_sha,argMax(owner_team, trial_at) AS owner_team,anyIf(selector, selector != '') AS selector,anyIf(pr_number, pr_number != '') AS pr_number,@@ -98,6 +104,9 @@ _RUN_EVIDENCE = """runner,nodeid,run_id,+ ci_engine,+ workflow_run_key,+ head_sha,job_key,argMax(owner_team, span_timestamp) AS owner_team,anyIf(selector, selector != '') AS selector,@@ -110,14 +119,14 @@ _RUN_EVIDENCE = """max(outcome = 'passed') AND NOT trial_failed AS trial_passed,max(span_timestamp) AS trial_atFROM (__SPAN_SCAN__)- WHERE NOT has({setup_break_run_attempts}, (run_id, toString(attempt)))- AND NOT has({setup_break_job_attempts}, (run_id, toString(attempt), job_key))- GROUP BY runner, nodeid, run_id, job_key, attempt+ WHERE NOT has({setup_break_run_attempts}, (ci_engine, workflow_run_key, toString(attempt)))+ AND NOT has({setup_break_job_attempts}, (ci_engine, workflow_run_key, toString(attempt), job_key))+ GROUP BY runner, nodeid, ci_engine, workflow_run_key, head_sha, run_id, job_key, attempt)- GROUP BY runner, nodeid, run_id, job_key+ GROUP BY runner, nodeid, ci_engine, workflow_run_key, head_sha, run_id, job_keyHAVING job_failed OR job_recovered OR job_quarantined)- GROUP BY runner, nodeid, run_id+ GROUP BY runner, nodeid, ci_engine, workflow_run_key, head_sha, run_id-- The scan admits re-run passes so they can pair with a failure above; unpaired they are not-- evidence, and a pass-only row would surface as an all-zero test everywhere downstream.HAVING failed_in_run OR recovered_in_run OR quarantined_in_run@@ -138,30 +147,32 @@ _LEGACY_JOB_KEY = "legacy"# CI stamps every attribute the rules below read, and the warehouse is the side of the pair the# emitter cannot write, so both must agree before any evidence is dropped._SETUP_BREAK_CANDIDATES = """- SELECT run_id, attempt+ SELECT ci_engine, workflow_run_key, attemptFROM (__SPAN_SCAN__)WHERE outcome = 'error'- GROUP BY run_id, attempt+ GROUP BY ci_engine, workflow_run_key, attemptHAVING uniq(job_key) >= {setup_break_min_jobs}OR uniqIf(owner_team, owner_team != {unowned_team}) >= {setup_break_min_teams}"""_SETUP_BREAK_JOB_CANDIDATES = """- SELECT run_id, attempt, job_key+ SELECT ci_engine, workflow_run_key, attempt, job_keyFROM (__SPAN_SCAN__)WHERE outcome IN ('failed', 'error')AND job_key != {legacy_job_key}- GROUP BY run_id, attempt, job_key+ GROUP BY ci_engine, workflow_run_key, attempt, job_keyHAVING uniq(nodeid) >= {setup_break_min_job_failures}"""# One failed job is enough for a job attempt: the jobs a run fans out over fail one at a time, and a# shard that broke is one of them. A run attempt claims many jobs broke, so GitHub has to show as many._FAILED_JOB_COUNTS = """- SELECT toString(run_id) AS run_id, run_attempt, uniqIf(name, conclusion = 'failure') AS failed_jobs+ SELECT ci_engine,+ if(native_workflow_run_id IN {candidate_workflow_keys}, native_workflow_run_id, toString(run_id)) AS workflow_run_key,+ run_attempt, uniqIf(name, conclusion = 'failure') AS failed_jobsFROM __JOBS_SOURCE__- WHERE run_id IN {candidate_run_ids}- GROUP BY run_id, run_attempt+ WHERE run_id IN {candidate_run_ids} OR native_workflow_run_id IN {candidate_workflow_keys}+ GROUP BY ci_engine, workflow_run_key, run_attempt"""@@ -210,6 +221,10 @@ _SCAN_TEMPLATE = """-- The emitter always stamps ci.run_id; the trace_id fallback (one trace per job) keeps an-- unstamped span from merging every execution of its test into one phantom run.coalesce(nullIf(resource_attributes['ci.run_id'], ''), trace_id) AS run_id,+ coalesce(resource_attributes['ci.engine'], '') AS ci_engine,+ coalesce(resource_attributes['ci.sha'], '') AS head_sha,+ -- A Depot parent can contain several workflows; without their native IDs do not pair retries.+ coalesce(nullIf(resource_attributes['ci.native_workflow_run_id'], ''), if(ci_engine = 'depot_ci', trace_id, run_id)) AS workflow_run_key,ifNull(accurateCastOrNull(resource_attributes['ci.run_attempt'], 'Int64'), 1) AS attempt,coalesce(nullIf(attributes['test.job_key'], ''), {legacy_job_key}) AS job_key,timestamp AS span_timestamp,@@ -263,8 +278,8 @@ def scan_placeholders(class SetupBreaks:"""The CI setup breaks a window holds, keyed the way ``run_evidence()`` excludes them."""- run_attempts: tuple[tuple[str, int], ...]- job_attempts: tuple[tuple[str, int, str], ...]+ run_attempts: tuple[tuple[str, str, int], ...]+ job_attempts: tuple[tuple[str, str, int, str], ...]def _attempt_array(attempts: Sequence[tuple[str | int, ...]]) -> ast.Array:@@ -298,8 +313,8 @@ def query_setup_breaks()span_scan = _scan(bounded=date_to is not None)run_candidates = [- (str(run_id), int(attempt))- for run_id, attempt in _rows(+ (str(ci_engine), str(workflow_key), int(attempt))+ for ci_engine, workflow_key, attempt in _rows(curated,_SETUP_BREAK_CANDIDATES.replace("__SPAN_SCAN__", span_scan),query_type="engineering_analytics.setup_break_run_candidates",@@ -308,8 +323,8 @@ def query_setup_breaks()]job_candidates = [- (str(run_id), int(attempt), str(job_key))- for run_id, attempt, job_key in _rows(+ (str(ci_engine), str(workflow_key), int(attempt), str(job_key))+ for ci_engine, workflow_key, attempt, job_key in _rows(curated,_SETUP_BREAK_JOB_CANDIDATES.replace("__SPAN_SCAN__", span_scan),query_type="engineering_analytics.setup_break_job_candidates",@@ -319,24 +334,33 @@ def query_setup_breaks(]# An unstamped span falls back to its trace ID, which names no GitHub run.candidate_run_ids = sorted(- {int(run_id) for run_id, _attempt in run_candidates if run_id.isdigit()}- | {int(run_id) for run_id, _attempt, _job in job_candidates if run_id.isdigit()}+ {int(workflow_key) for _engine, workflow_key, _attempt in run_candidates if workflow_key.isdigit()}+ | {int(workflow_key) for _engine, workflow_key, _attempt, _job in job_candidates if workflow_key.isdigit()})- if not candidate_run_ids:+ candidate_workflow_keys = sorted({candidate[1] for candidate in (*run_candidates, *job_candidates)})+ if not candidate_workflow_keys:return SetupBreaks(run_attempts=(), job_attempts=())failed_jobs_by_attempt = {- (str(run_id), int(attempt)): int(failed_jobs)- for run_id, attempt, failed_jobs in _rows(+ (str(ci_engine), str(workflow_key), int(attempt)): int(failed_jobs)+ for ci_engine, workflow_key, attempt, failed_jobs in _rows(curated,_FAILED_JOB_COUNTS.replace("__JOBS_SOURCE__", jobs_source),query_type="engineering_analytics.setup_break_failed_jobs",placeholders={"candidate_run_ids": ast.Constant(value=candidate_run_ids),+ "candidate_workflow_keys": ast.Constant(value=candidate_workflow_keys),"job_created_floor": job_created_floor_constant(scan_from if scan_from is not None else date_from),},)}+ # Untagged history can use warehouse proof only where the workflow key names one engine.+ engines_by_workflow: dict[str, set[str]] = {}+ for engine, workflow_key, _attempt in failed_jobs_by_attempt:+ engines_by_workflow.setdefault(workflow_key, set()).add(engine)+ for (_engine, workflow_key, attempt), failures in list(failed_jobs_by_attempt.items()):+ if len(engines_by_workflow[workflow_key]) == 1:+ failed_jobs_by_attempt[("", workflow_key, attempt)] = failuresreturn SetupBreaks(run_attempts=tuple(sorted(@@ -344,11 +368,7 @@ def query_setup_breaks()),job_attempts=tuple(- sorted(- candidate- for candidate in job_candidates- if failed_jobs_by_attempt.get((candidate[0], candidate[1]), 0) >= 1- )+ sorted(candidate for candidate in job_candidates if failed_jobs_by_attempt.get(candidate[:3], 0) >= 1)),)@@ -378,6 +398,7 @@ def rerun_recovered_job_attempts(*, scan_from: str) -> str:AND lower(resource_attributes['ci.repository']) = lower({{repository}})AND timestamp >= ({scan_from})AND attributes['test.outcome'] = 'rerun_passed'+ AND coalesce(resource_attributes['ci.engine'], 'github_actions') = 'github_actions'AND notEmpty(coalesce(attributes['test.runner_name'], ''))"""diff --git a/products/engineering_analytics/backend/logic/queries/_workflow_filters.py b/products/engineering_analytics/backend/logic/queries/_workflow_filters.pyindex 0ff773343e29..e7c7ac0a20e5 100644--- a/products/engineering_analytics/backend/logic/queries/_workflow_filters.py+++ b/products/engineering_analytics/backend/logic/queries/_workflow_filters.py@@ -79,12 +79,14 @@ def run_duration_percentile_expr(quantile: float) -> str:)+# The engine and the id make a same-second tie resolve deterministically.+LATEST_RUN_ORDER = "(run_started_at, ci_engine, id)"+# The one "failing right now" signal, per workflow: did the latest completed run fail?-# Ordered by (run_started_at, id) so a same-second tie resolves deterministically to the-# 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".+# 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 = (- f"argMaxIf(conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL}), (run_started_at, id), status = 'completed')"+ f"argMaxIf(conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL}), {LATEST_RUN_ORDER}, status = 'completed')")diff --git a/products/engineering_analytics/backend/logic/queries/broken_tests.py b/products/engineering_analytics/backend/logic/queries/broken_tests.pyindex 48fe180c9767..606506462805 100644--- a/products/engineering_analytics/backend/logic/queries/broken_tests.py+++ b/products/engineering_analytics/backend/logic/queries/broken_tests.py@@ -41,6 +41,7 @@ from products.engineering_analytics.backend.facade.contracts import (BrokenTestRow,BrokenTestsResult,BrokenTestState,+ CIEngine,)from products.engineering_analytics.backend.logic.merge_queue import looks_like_merge_queue_branch_exprfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource@@ -102,7 +103,8 @@ _FINGERPRINTS_SELECT = """argMax(run_id, timestamp) AS latest_run_id,argMax(branch, timestamp) AS latest_branch,argMax(workflow_name, timestamp) AS workflow_name,- dateDiff('second', maxIf(timestamp, branch IN {default_branches}), now()) AS last_master_hit_age+ dateDiff('second', maxIf(timestamp, branch IN {default_branches}), now()) AS last_master_hit_age,+ argMax(tuple(ci_engine), timestamp).1 AS latest_ci_engineFROM __FAILURES_SOURCE__WHERE timestamp >= {date_from} AND lower(repo) = lower({repository})GROUP BY fingerprint@@ -139,11 +141,12 @@ _MASTER_JOBS_SELECT = f"""workflow_name,name AS job_name,argMaxIf(conclusion, completed_at, status = 'completed') AS latest_conclusion,- dateDiff('second', maxIf(completed_at, status = 'completed'), now()) AS latest_completed_age+ dateDiff('second', maxIf(completed_at, status = 'completed'), now()) AS latest_completed_age,+ ci_engineFROM __JOBS_SOURCE__WHERE head_branch IN {{default_branches}}AND created_at >= {{date_from}}- GROUP BY workflow_name, name+ GROUP BY ci_engine, workflow_name, nameLIMIT {UNPAGED_SCAN_LIMIT}"""@@ -271,7 +274,7 @@ def query_broken_tests(# Latest default-branch status per (workflow, job) — empty when the job-level source isn't synced,# in which case breaking_master / potentially_resolved can't be distinguished and those rows fall# through. Keyed on (workflow_name, job_name) so a job name shared across workflows doesn't collapse.- master_by_key: dict[tuple[str, str], tuple[str | None, int | None]] = {}+ master_by_key: dict[tuple[str | None, str, str], tuple[str | None, int | None]] = {}breaking_master_jobs: set[str] = set()jobs_source = curated.jobs_source(created_floor=True)if jobs_source is not None:@@ -287,11 +290,18 @@ def query_broken_tests().resultsor [])- for workflow_name, job_name, latest_conclusion, latest_completed_age in master_rows:- master_by_key[(workflow_name, job_name)] = (latest_conclusion, latest_completed_age)+ for workflow_name, job_name, latest_conclusion, latest_completed_age, ci_engine in master_rows:+ master_by_key[(ci_engine, workflow_name, job_name)] = (latest_conclusion, latest_completed_age)if latest_conclusion in _RED_MASTER_SET:breaking_master_jobs.add(job_name)+ # A legacy log has no engine: use status only when the workflow/job names identify one engine.+ by_job: dict[tuple[str, str], list[tuple[str | None, int | None]]] = {}+ for (_engine, workflow, job), status in master_by_key.items():+ by_job.setdefault((workflow, job), []).append(status)+ for (workflow, job), statuses in by_job.items():+ if len(statuses) == 1:+ master_by_key[(None, workflow, job)] = statuses[0]sparklines = _sparklines_by_fingerprint(hourly_rows)rows: list[BrokenTestRow] = []@@ -314,8 +324,11 @@ def query_broken_tests(latest_branch,workflow_name,last_master_hit_age,+ latest_ci_engine,) in fingerprint_rows:- latest_conclusion, latest_completed_age = master_by_key.get((workflow_name, job_name), (None, None))+ latest_conclusion, latest_completed_age = master_by_key.get(+ (latest_ci_engine, workflow_name, job_name), (None, None)+ )state = _classify(master_hits=master_hits,merge_queue_hits=merge_queue_hits,@@ -341,6 +354,7 @@ def query_broken_tests(branches=branches,master_hits=master_hits,latest_run_id=latest_run_id or 0,+ latest_ci_engine=CIEngine(latest_ci_engine) if latest_ci_engine else None,latest_branch=latest_branch or "",trend_24h=sparklines.get(fingerprint, [0] * BROKEN_TEST_SPARKLINE_HOURS),)diff --git a/products/engineering_analytics/backend/logic/queries/ci_failure_logs.py b/products/engineering_analytics/backend/logic/queries/ci_failure_logs.pyindex 45b3ef0e2c41..417a92f3b4fd 100644--- a/products/engineering_analytics/backend/logic/queries/ci_failure_logs.py+++ b/products/engineering_analytics/backend/logic/queries/ci_failure_logs.py@@ -1,9 +1,9 @@"""HogQL assembly of a pull request's CI failure logs from the Logs product.-The CI job-logs worker emits one Logs record per failure-line, tagged with the GitHub ``run_id`` /+The CI job-logs worker emits one Logs record per failure-line, tagged with ``ci_engine`` / ``run_id`` /``job_id`` (service ``github-ci-logs``). This resolves a PR to its workflow runs via the same``pull_requests`` attribution as ``pr_runs`` (SPEC §6 — never a head-SHA join, so every push is-captured), then reads the Logs product joined on ``run_id`` and groups the lines per failed job.+captured), then reads the Logs product joined on engine-qualified run identity and groups the lines per failed job.Two caps bound the response: ``_PER_JOB_CAP`` lines per job, and ``_LINE_CAP`` lines overall. Rowscome back newest-run-first, so when the overall cap bites it drops the *oldest* runs (the newest push@@ -20,6 +20,7 @@ from posthog.hogql import astfrom posthog.clickhouse.workload import Workloadfrom products.engineering_analytics.backend.facade.contracts import (+ CIEngine,CIFailureLogLine,CIFailureLogs,CIJobFailureLog,@@ -29,6 +30,7 @@ from products.engineering_analytics.backend.facade.contracts import (from products.engineering_analytics.backend.logic.job_logs.constants import CI_LOGS_SERVICE_NAME as _SERVICE_NAMEfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries.pr_runs import query_pr_runs+from products.engineering_analytics.backend.logic.queries.workflow_run import query_workflow_run# Overall safety bound on lines pulled per call (one Logs record == one line) — an incident across# many runs mustn't return an unbounded body.@@ -47,10 +49,15 @@ _SELECT = """attributes['branch'] AS branch,attributes['orig_total'] AS orig_total,attributes['orig_line'] AS orig_line,- body+ body,+ attributes['ci_engine'] AS ci_engineFROM logs- WHERE service_name = {service_name} AND attributes['run_id'] IN {run_ids}- ORDER BY toInt(attributes['run_id']) DESC, toInt(attributes['job_id']), toInt(attributes['seq'])+ WHERE service_name = {service_name} AND lower(attributes['repo']) = lower({repository})+ AND (+ (attributes['ci_engine'], attributes['run_id']) IN {run_keys}+ OR (attributes['ci_engine'] = '' AND attributes['run_id'] IN {legacy_run_ids})+ )+ ORDER BY toInt(attributes['run_id']) DESC, attributes['ci_engine'], toInt(attributes['job_id']), toInt(attributes['seq'])LIMIT {line_cap}"""@@ -63,11 +70,11 @@ def _to_int(value: str | None) -> int:def _group_jobs(rows: list[tuple]) -> list[CIJobFailureLog]:- # Rows arrive grouped by (run_id, job_id) and ordered by seq within a job, so consecutive rows of a+ # Rows arrive grouped by (ci_engine, run_id, job_id) and ordered by seq within a job, so consecutive rows of a# job are contiguous and in order — group them, cap the lines, and carry the per-job conclusion /# branch / orig_total (same on every line of a job) from the first row.jobs: list[CIJobFailureLog] = []- for (run_id, job_id), group in groupby(rows, key=lambda row: (row[0], row[1])):+ for (ci_engine, run_id, job_id), group in groupby(rows, key=lambda row: (row[7], row[0], row[1])):group_rows = list(group)first = group_rows[0]# orig_line is absent ('' from the map) on omission markers, and a real line is 1-based, so@@ -78,6 +85,7 @@ def _group_jobs(rows: list[tuple]) -> list[CIJobFailureLog]:CIJobFailureLog(job_id=_to_int(job_id),run_id=_to_int(run_id),+ ci_engine=CIEngine(ci_engine) if ci_engine else None,conclusion=first[2] or "",branch=first[3] or "",original_total_lines=_to_int(first[4]),@@ -89,6 +97,17 @@ def _group_jobs(rows: list[tuple]) -> list[CIJobFailureLog]:return jobs+def _legacy_run_ids(*, curated: CuratedGitHubSource, run_ids: list[int]) -> list[str]:+ # Old records did not stamp an engine. Keep them only for IDs with one engine in the source.+ response = curated.run(+ f"SELECT id FROM {curated.run_source()} AS r WHERE id IN {{run_ids}} "+ "GROUP BY id HAVING uniq(ci_engine) = 1 LIMIT 1000000",+ query_type="engineering_analytics.failure_logs_legacy_identity",+ placeholders={"run_ids": ast.Constant(value=run_ids)},+ )+ return [str(row[0]) for row in response.results or []]++def query_ci_failure_logs(*,curated: CuratedGitHubSource,@@ -110,7 +129,11 @@ def query_ci_failure_logs(query_type="engineering_analytics.ci_failure_logs",placeholders={"service_name": ast.Constant(value=_SERVICE_NAME),- "run_ids": ast.Constant(value=[str(run_id) for run_id in run_ids]),+ "repository": ast.Constant(value=f"{repo_owner}/{repo_name}"),+ "run_keys": ast.Constant(+ value=[(run.ci_engine.value if run.ci_engine is not None else None, str(run.id)) for run in runs]+ ),+ "legacy_run_ids": ast.Constant(value=_legacy_run_ids(curated=curated, run_ids=run_ids)),# +1 so a full page tells us the overall cap was hit (more lines exist than returned)."line_cap": ast.Constant(value=_LINE_CAP + 1),},@@ -135,26 +158,15 @@ def query_ci_failure_logs()-# Existence probe for the source-authorization check below.-_RUN_IN_SOURCE = """- SELECT 1- FROM __RUNS_SOURCE__ AS r- WHERE id = {run_id}- LIMIT 1-"""---def query_run_failure_logs(*, curated: CuratedGitHubSource, run_id: int) -> RunFailureLogs:+def query_run_failure_logs(+ *, curated: CuratedGitHubSource, run_id: int, ci_engine: CIEngine | None = None+) -> RunFailureLogs:"""Same log substrate as ``query_ci_failure_logs``, keyed directly by one run id — for surfacesthat aren't PR-scoped (the default-branch failures feed and the run page)."""# The Logs table is team-scoped, not source-scoped — prove the run exists in the caller's# authorized source before reading its logs, or a known run id would leak another source's logs.- in_source = curated.run(- _RUN_IN_SOURCE.replace("__RUNS_SOURCE__", curated.run_source()),- query_type="engineering_analytics.run_failure_logs_source_check",- placeholders={"run_id": ast.Constant(value=run_id)},- )- if not in_source.results:+ run = query_workflow_run(curated=curated, run_id=run_id, ci_engine=ci_engine)+ if run is None:return RunFailureLogs(run_id=run_id, logs_available=False, jobs=[], truncated=False)response = curated.run(@@ -162,7 +174,9 @@ def query_run_failure_logs(*, curated: CuratedGitHubSource, run_id: int) -> RunFquery_type="engineering_analytics.run_failure_logs",placeholders={"service_name": ast.Constant(value=_SERVICE_NAME),- "run_ids": ast.Constant(value=[str(run_id)]),+ "repository": ast.Constant(value=f"{run.repo.owner}/{run.repo.name}"),+ "run_keys": ast.Constant(value=[(run.ci_engine.value if run.ci_engine is not None else None, str(run_id))]),+ "legacy_run_ids": ast.Constant(value=_legacy_run_ids(curated=curated, run_ids=[run_id])),"line_cap": ast.Constant(value=_LINE_CAP + 1),},workload=Workload.LOGS,@@ -172,4 +186,6 @@ def query_run_failure_logs(*, curated: CuratedGitHubSource, run_id: int) -> RunFjobs = _group_jobs(rows[:_LINE_CAP])if overall_truncated and jobs:jobs[-1] = dataclasses.replace(jobs[-1], truncated=True)- return RunFailureLogs(run_id=run_id, logs_available=bool(rows), jobs=jobs, truncated=overall_truncated)+ return RunFailureLogs(+ run_id=run_id, ci_engine=run.ci_engine, logs_available=bool(rows), jobs=jobs, truncated=overall_truncated+ )diff --git a/products/engineering_analytics/backend/logic/queries/job_aggregates.py b/products/engineering_analytics/backend/logic/queries/job_aggregates.pyindex 0fb8668f76ca..eda1d8213c31 100644--- a/products/engineering_analytics/backend/logic/queries/job_aggregates.py+++ b/products/engineering_analytics/backend/logic/queries/job_aggregates.py@@ -56,7 +56,7 @@ _AGGREGATE_SELECT = f"""{_job_name_expr("job_name")} AS job_group,count() AS job_count,uniq(job_name) AS shard_count,- uniq(run_id) AS runs_in,+ uniq(tuple(ci_engine, run_id)) AS runs_in,quantileIf(0.5)(queue_seconds, {_QUEUED_JOB_CONDITION}) AS queue_p50_seconds,quantileIf(0.5)(duration_seconds, {DURATION_PERCENTILE_CONDITION}) AS p50_seconds,quantileIf(0.95)(duration_seconds, {DURATION_PERCENTILE_CONDITION}) AS p95_seconds,diff --git a/products/engineering_analytics/backend/logic/queries/master_failures.py b/products/engineering_analytics/backend/logic/queries/master_failures.pyindex 23d1e14f14b1..81ca76705cc4 100644--- a/products/engineering_analytics/backend/logic/queries/master_failures.py+++ b/products/engineering_analytics/backend/logic/queries/master_failures.py@@ -16,7 +16,7 @@ from datetime import datetimefrom posthog.hogql import ast-from products.engineering_analytics.backend.facade.contracts import MasterFailureGroup, RepoRef+from products.engineering_analytics.backend.facade.contracts import CIEngine, MasterFailureGroup, RepoReffrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries._workflow_filters import (DECISIVE_FAILURE_CONCLUSIONS_SQL,@@ -28,7 +28,7 @@ from products.engineering_analytics.backend.logic.queries._workflow_filters impo_RUN_CAP = 500_FAILED_RUNS_SELECT = f"""- SELECT id, repo_owner, repo_name, workflow_name, run_started_at+ SELECT id, repo_owner, repo_name, workflow_name, run_started_at, ci_engineFROM __RUNS_SOURCE__ AS rWHERE run_started_at >= {{date_from}} __DATE_TO__AND head_branch = {{branch}}@@ -38,7 +38,7 @@ _FAILED_RUNS_SELECT = f""""""_FAILED_JOBS_SELECT = f"""- SELECT run_id, name+ SELECT run_id, name, ci_engineFROM __JOBS_SOURCE__ AS jWHERE run_id IN {{run_ids}} AND conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})LIMIT {UNPAGED_SCAN_LIMIT}@@ -79,7 +79,7 @@ def query_master_failures(# Failed job names per run — empty when the jobs source isn't synced, in which case# groups degrade to workflow-level (failed_job = '').- jobs_by_run: dict[int, list[str]] = {}+ jobs_by_run: dict[tuple[str, int], list[str]] = {}# run_id IN (...) scopes the result but not the scan, and the builder's is_rerun_copy window would# otherwise sort the whole jobs history. The run ids come from a run_started_at-windowed scan, so# the floor takes the wider re-run slack.@@ -93,12 +93,12 @@ def query_master_failures("job_created_floor": run_windowed_job_created_floor_constant(date_from),},)- for run_id, job_name in jobs_response.results or []:- jobs_by_run.setdefault(run_id, []).append(job_name)+ for run_id, job_name, ci_engine in jobs_response.results or []:+ jobs_by_run.setdefault((ci_engine, run_id), []).append(job_name)groups: dict[tuple[str, str, str, str], dict] = {}- for run_id, repo_owner, repo_name, workflow_name, run_started_at in runs:- failed_jobs = {strip_shard_suffix(name) for name in jobs_by_run.get(run_id, [])} or {""}+ for run_id, repo_owner, repo_name, workflow_name, run_started_at, ci_engine in runs:+ failed_jobs = {strip_shard_suffix(name) for name in jobs_by_run.get((ci_engine, run_id), [])} or {""}for failed_job in failed_jobs:key = (repo_owner, repo_name, workflow_name, failed_job)group = groups.setdefault(@@ -108,14 +108,16 @@ def query_master_failures("first_seen": run_started_at,"last_seen": run_started_at,"latest_run_id": run_id,+ "latest_ci_engine": ci_engine,},)- group["run_ids"].add(run_id)+ group["run_ids"].add((ci_engine, run_id))if run_started_at < group["first_seen"]:group["first_seen"] = run_started_atif run_started_at > group["last_seen"]:group["last_seen"] = run_started_atgroup["latest_run_id"] = run_id+ group["latest_ci_engine"] = ci_enginereturn sorted((@@ -127,6 +129,7 @@ def query_master_failures(first_seen=group["first_seen"],last_seen=group["last_seen"],latest_run_id=group["latest_run_id"],+ latest_ci_engine=CIEngine(group["latest_ci_engine"]),)for (repo_owner, repo_name, workflow_name, failed_job), group in groups.items()),diff --git a/products/engineering_analytics/backend/logic/queries/pr_cost.py b/products/engineering_analytics/backend/logic/queries/pr_cost.pyindex ffe118a308b5..dd3991a8c68f 100644--- a/products/engineering_analytics/backend/logic/queries/pr_cost.py+++ b/products/engineering_analytics/backend/logic/queries/pr_cost.py@@ -27,6 +27,7 @@ from posthog.hogql import astfrom posthog.clickhouse.workload import Workloadfrom products.engineering_analytics.backend.facade.contracts import (+ CIEngine,CostPerMergeBucket,PRCostSummary,RunCost,@@ -143,10 +144,11 @@ _PR_COST_SELECT = """c.workflow_name AS workflow_name,c.run_id AS run_id,c.run_attempt AS run_attempt,+ c.ci_engine AS ci_engine,__COST_AGGREGATES__FROM __COST_SOURCE__ AS cWHERE c.pr_number = {pr_number} AND c.repo_owner = {repo_owner} AND c.repo_name = {repo_name}- GROUP BY c.workflow_name, c.run_id, c.run_attempt+ GROUP BY c.workflow_name, c.run_id, c.run_attempt, c.ci_engineLIMIT 1000000"""@@ -173,19 +175,19 @@ def query_pr_cost(},)rows = response.results or []- overall = _sum_aggregates(row[3:] for row in rows)+ overall = _sum_aggregates(row[4:] for row in rows)by_workflow_rows: dict[str, list[tuple]] = defaultdict(list)- by_run_rows: dict[tuple[int, int], list[tuple]] = defaultdict(list)- for workflow, run_id, run_attempt, *agg in rows:+ by_run_rows: dict[tuple[CIEngine, int, int], list[tuple]] = defaultdict(list)+ for workflow, run_id, run_attempt, ci_engine, *agg in rows:by_workflow_rows[workflow or ""].append(tuple(agg))- by_run_rows[(int(run_id), int(run_attempt))].append(tuple(agg))+ by_run_rows[(CIEngine(ci_engine), int(run_id), int(run_attempt))].append(tuple(agg))by_workflow = [_to_workflow_cost(workflow, _sum_aggregates(agg_rows))for workflow, agg_rows in sorted(by_workflow_rows.items())]by_run = [- _to_run_cost(run_id, run_attempt, _sum_aggregates(agg_rows))- for (run_id, run_attempt), agg_rows in sorted(by_run_rows.items())+ _to_run_cost(run_id, run_attempt, _sum_aggregates(agg_rows), ci_engine=ci_engine)+ for (ci_engine, run_id, run_attempt), agg_rows in sorted(by_run_rows.items())]return PRCostSummary(@@ -659,10 +661,11 @@ def _has_jobs(aggregate: PRCostAggregate) -> bool:return bool(aggregate.costed_jobs + aggregate.unsettled_jobs + aggregate.excluded_jobs)-def _to_run_cost(run_id: int, run_attempt: int, aggregate: PRCostAggregate) -> RunCost:+def _to_run_cost(run_id: int, run_attempt: int, aggregate: PRCostAggregate, *, ci_engine: CIEngine) -> RunCost:return RunCost(run_id=run_id,run_attempt=run_attempt,+ ci_engine=ci_engine,billable_minutes=aggregate.billable_seconds / 60,estimated_cost_usd=aggregate.estimated_cost_usd,)diff --git a/products/engineering_analytics/backend/logic/queries/pr_lifecycle.py b/products/engineering_analytics/backend/logic/queries/pr_lifecycle.pyindex fd43c945dfa6..66b83725d002 100644--- a/products/engineering_analytics/backend/logic/queries/pr_lifecycle.py+++ b/products/engineering_analytics/backend/logic/queries/pr_lifecycle.py@@ -14,6 +14,7 @@ from posthog.hogql import astfrom products.engineering_analytics.backend.facade.contracts import (Author,+ CIEngine,PRLifecycle,PRLifecycleEvent,PRLifecycleEventKind,@@ -39,7 +40,7 @@ _HEADER = pr_header_query(# Newest first, so a PR past the cap loses its oldest rows; the caller restores chronological order._RUNS = f"""- SELECT id, workflow_name, status, conclusion, run_started_at, updated_at+ SELECT id, workflow_name, status, conclusion, run_started_at, updated_at, ci_engineFROM __RUNS_SOURCE__ AS rWHERE head_sha = {{head_sha}}ORDER BY run_started_at DESC@@ -117,7 +118,12 @@ def query_pr_lifecycle(events: list[PRLifecycleEvent] = []def add(- kind: PRLifecycleEventKind, at: datetime | None, *, detail: str | None = None, run_id: int | None = None+ kind: PRLifecycleEventKind,+ at: datetime | None,+ *,+ detail: str | None = None,+ run_id: int | None = None,+ ci_engine: CIEngine | None = None,) -> None:# Timestamps come from parseDateTimeBestEffort, which yields NULL on a malformed/missing# value, so `at` can be None. Skip those events — a timeline can't place an event with no@@ -125,7 +131,7 @@ def query_pr_lifecycle(# here keeps a single bad run timestamp from failing the whole PR's lifecycle (and the# sort below never sees a None key).if at is not None:- events.append(PRLifecycleEvent(kind=kind, at=at, detail=detail, run_id=run_id))+ events.append(PRLifecycleEvent(kind=kind, at=at, detail=detail, run_id=run_id, ci_engine=ci_engine))add(PRLifecycleEventKind.OPENED, created_at)@@ -151,12 +157,24 @@ def query_pr_lifecycle(else None)if runs is not None:- for run_id, workflow_name, status, conclusion, run_started_at, updated_at in reversed(runs.results):+ for run_id, workflow_name, status, conclusion, run_started_at, updated_at, ci_engine in reversed(runs.results):run_id = int(run_id) if run_id is not None else None- add(PRLifecycleEventKind.CI_STARTED, run_started_at, detail=workflow_name, run_id=run_id)+ add(+ PRLifecycleEventKind.CI_STARTED,+ run_started_at,+ detail=workflow_name,+ run_id=run_id,+ ci_engine=CIEngine(ci_engine),+ )if status == "completed":detail = f"{workflow_name}: {conclusion}" if conclusion else workflow_name- add(PRLifecycleEventKind.CI_FINISHED, updated_at, detail=detail, run_id=run_id)+ add(+ PRLifecycleEventKind.CI_FINISHED,+ updated_at,+ detail=detail,+ run_id=run_id,+ ci_engine=CIEngine(ci_engine),+ )if merged_at is not None:add(PRLifecycleEventKind.MERGED, merged_at)diff --git a/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py b/products/engineering_analytics/backend/logic/queries/pull_request_timelines.pyindex f5c6be9d563e..8b6030473826 100644--- a/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py+++ b/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py@@ -96,7 +96,7 @@ _REVIEWS_SELECT = f"""_RUNS_SELECT = f"""SELECTid, pr_number, workflow_name, head_sha, status, conclusion, run_started_at, updated_at, run_attempt, created_at,- stopped_reporting+ stopped_reporting, ci_engineFROM __RUNS_SOURCE__ AS rWHERE pr_number IN {{pr_numbers}} AND run_started_at >= {{run_from}}AND NOT is_merge_queue AND ifNull(conclusion, '') != 'skipped'@@ -112,16 +112,17 @@ _JOB_ATTEMPTS_SELECT = f"""max(completed_at) AS completed_at,countIf(status != 'completed') AS unfinished,groupArrayIf(name, conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})) AS failed_jobs,- countIf(conclusion NOT IN ('success', 'skipped')) AS unsuccessful+ countIf(conclusion NOT IN ('success', 'skipped')) AS unsuccessful,+ ci_engineFROM __JOBS_SOURCE__ AS jWHERE run_id IN {{run_ids}} AND NOT is_rerun_copy- GROUP BY run_id, attempt_number+ GROUP BY ci_engine, run_id, attempt_number"""_MASTER_FAILURES_SELECT = f"""- SELECT j.workflow_name, j.name, j.completed_at, j.id AS job_id+ SELECT j.workflow_name, j.name, j.completed_at, j.id AS job_id, j.ci_engine AS ci_engineFROM __JOBS_SOURCE__ AS j- INNER JOIN __RUNS_SOURCE__ AS r ON r.id = j.run_id+ INNER JOIN __RUNS_SOURCE__ AS r ON r.id = j.run_id AND r.ci_engine = j.ci_engineWHERE r.head_branch = {{default_branch}}AND NOT r.is_merge_queueAND r.run_started_at >= {{run_from}}@@ -392,7 +393,7 @@ class PullRequestTimelinesQuery:def _query_run_attempts(self, pr_numbers: list[int], run_from: datetime) -> dict[int, list[RunAttempt]]:rows = self._curated.run_paged(_RUNS_SELECT.replace("__RUNS_SOURCE__", self._curated.run_source(started_floor=True)),- page_key=(("id", 0),),+ page_key=(("id", 0), ("ci_engine", 11)),query_type="engineering_analytics.pull_request_timelines_runs",placeholders=self._runs_placeholders(pr_numbers, run_from),)@@ -418,8 +419,9 @@ class PullRequestTimelinesQuery:attempt,created_at,stopped_reporting,+ ci_engine,) in runs:- run_attempts = job_attempts.get(int(run_id), [])+ run_attempts = job_attempts.get((ci_engine, int(run_id)), [])queued_at = created_at or started_at# A run that stopped reporting ends at its last update, but its conclusion is not settled, so only# a failed job row can mark it failed. The friction view applies the same split.@@ -519,24 +521,24 @@ class PullRequestTimelinesQuery:)return gates- def _query_job_attempts(self, run_ids: list[int], run_from: datetime) -> dict[int, list[_JobAttempt]]:+ def _query_job_attempts(self, run_ids: list[int], run_from: datetime) -> dict[tuple[str, int], list[_JobAttempt]]:source = self._curated.jobs_source(created_floor=True)if source is None or not run_ids:return {}rows = self._curated.run_paged(_JOB_ATTEMPTS_SELECT.replace("__JOBS_SOURCE__", source),- page_key=(("run_id", 0), ("attempt_number", 1)),+ page_key=(("run_id", 0), ("attempt_number", 1), ("ci_engine", 7)),query_type="engineering_analytics.pull_request_timelines_job_attempts",placeholders={"run_ids": ast.Constant(value=run_ids),"job_created_floor": run_windowed_job_created_floor_constant(run_from),},)- by_run: dict[int, list[_JobAttempt]] = defaultdict(list)- for run_id, run_attempt, started_at, completed_at, unfinished, failed_jobs, unsuccessful in rows:+ by_run: dict[tuple[str, int], list[_JobAttempt]] = defaultdict(list)+ for run_id, run_attempt, started_at, completed_at, unfinished, failed_jobs, unsuccessful, ci_engine in rows:if started_at is None:continue- by_run[int(run_id)].append(+ by_run[(ci_engine, int(run_id))].append(_JobAttempt(attempt=int(run_attempt or 1),started_at=started_at,@@ -567,7 +569,7 @@ class PullRequestTimelinesQuery:_MASTER_FAILURES_SELECT.replace("__JOBS_SOURCE__", jobs_source).replace("__RUNS_SOURCE__", self._curated.run_source(started_floor=True)),- page_key=(("job_id", 3),),+ page_key=(("job_id", 3), ("ci_engine", 4)),query_type="engineering_analytics.pull_request_timelines_master_failures",placeholders={"default_branch": ast.Constant(value=default_branch),@@ -578,7 +580,7 @@ class PullRequestTimelinesQuery:},)return MasterFailureIndex(- [(workflow or "", name or "", completed_at) for workflow, name, completed_at, _job_id in rows]+ [(workflow or "", name or "", completed_at) for workflow, name, completed_at, _job_id, _ci_engine in rows])def _query_out_of_queue(self, pr_numbers: list[int]) -> set[int]:diff --git a/products/engineering_analytics/backend/logic/queries/team_ci_health.py b/products/engineering_analytics/backend/logic/queries/team_ci_health.pyindex 75d916527a57..1d2ecd7b55fc 100644--- a/products/engineering_analytics/backend/logic/queries/team_ci_health.py+++ b/products/engineering_analytics/backend/logic/queries/team_ci_health.py@@ -44,6 +44,8 @@ from products.engineering_analytics.backend.logic.queries._test_spans import (# splits the current window from its equal-length prior twin._RUN_EVIDENCE = run_evidence(bounded=True)+_RUN_IDENTITY = "(ci_engine, workflow_run_key, head_sha, run_id)"+# A test lands under one team, resolved by its latest ownership stamp, so a re-stamped test is# never counted for two teams at once._ROSTER_SELECT = f"""@@ -67,12 +69,12 @@ _ROSTER_SELECT = f"""runner,nodeid,argMax(owner_team, run_signal_at) AS owner_team,- groupUniqArrayIf(run_id, recovered_in_run AND is_current) AS recovery_runs_current,- groupUniqArrayIf(run_id, recovered_in_run AND NOT is_current) AS recovery_runs_prior,- groupUniqArrayIf(run_id, failed_in_run AND is_current) AS failed_runs_current,- groupUniqArrayIf(run_id, failed_in_run AND NOT is_current) AS failed_runs_prior,- groupUniqArrayIf(run_id, quarantined_in_run AND is_current) AS xfail_runs_current,- groupUniqArrayIf(run_id, quarantined_in_run AND NOT is_current) AS xfail_runs_prior,+ groupUniqArrayIf({_RUN_IDENTITY},recovered_in_run AND is_current) AS recovery_runs_current,+ groupUniqArrayIf({_RUN_IDENTITY},recovered_in_run AND NOT is_current) AS recovery_runs_prior,+ groupUniqArrayIf({_RUN_IDENTITY},failed_in_run AND is_current) AS failed_runs_current,+ groupUniqArrayIf({_RUN_IDENTITY},failed_in_run AND NOT is_current) AS failed_runs_prior,+ groupUniqArrayIf({_RUN_IDENTITY},quarantined_in_run AND is_current) AS xfail_runs_current,+ groupUniqArrayIf({_RUN_IDENTITY},quarantined_in_run AND NOT is_current) AS xfail_runs_prior,countIf(failed_in_run AND branch IN ('master', 'main') AND is_current) > 0OR uniqIf(pr_number, failed_in_run AND pr_number != '' AND is_current) >= {{min_failed_prs}}AS blast_radius_current,diff --git a/products/engineering_analytics/backend/logic/queries/workflow_flakiness.py b/products/engineering_analytics/backend/logic/queries/workflow_flakiness.pyindex 7dcf06442f95..d8f76f6229bc 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_flakiness.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_flakiness.py@@ -41,7 +41,7 @@ _SELECT = """maxIf(j.run_attempt, j.conclusion = 'success') AS passed_attempt,maxIf(j.duration_seconds, j.conclusion IN ('failure', 'timed_out')) AS failed_duration_secondsFROM __JOBS_SOURCE__ AS j- INNER JOIN __RUNS_SOURCE__ AS r ON r.id = j.run_id+ INNER JOIN __RUNS_SOURCE__ AS r ON r.id = j.run_id AND r.ci_engine = j.ci_engine-- Both sources carry a raw-string floor inside their builder (job_created_floor /-- run_started_floor); the parsed j.created_at filter alone can't push down, so those floors-- keep the sweep off a full jobs+runs scan each hour.@@ -49,7 +49,7 @@ _SELECT = """-- concat yields NULL when j.name is NULL, which a bare NOT IN would drop.AND ifNull(concat(lower(r.repo_owner), '/', lower(r.repo_name), '/', j.name), '')NOT IN {by_design_failures}- GROUP BY r.repo_owner, r.repo_name, j.workflow_name, j.name, j.run_id, j.head_sha+ GROUP BY r.repo_owner, r.repo_name, j.workflow_name, j.name, j.ci_engine, j.run_id, j.head_shaHAVING failed_attempt > 0AND passed_attempt > failed_attemptAND failed_duration_seconds >= {min_failed_duration_seconds}diff --git a/products/engineering_analytics/backend/logic/queries/workflow_health.py b/products/engineering_analytics/backend/logic/queries/workflow_health.pyindex f0cd25708076..fb3c05fd8176 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_health.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_health.py@@ -24,6 +24,7 @@ from posthog.hogql import astfrom posthog.clickhouse.workload import Workloadfrom products.engineering_analytics.backend.facade.contracts import (+ CIEngine,RepoRef,TimeToGreenBucket,WorkflowHealthBucket,@@ -42,6 +43,7 @@ from products.engineering_analytics.backend.logic.queries._workflow_filters impoCONCLUSIVE_RUN_CONDITION,DECISIVE_FAILURE_CONCLUSIONS_SQL,LATEST_COMPLETED_RUN_FAILED,+ LATEST_RUN_ORDER,RUN_DURATION_PERCENTILE_CONDITION,SUCCESSFUL_RUN_CONDITION,UNPAGED_SCAN_LIMIT,@@ -76,11 +78,12 @@ _SELECT = f"""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,- argMaxIf(id, (run_started_at, id), status = 'completed') AS latest_run_id,- argMaxIf(run_attempt, (run_started_at, id), status = 'completed') AS latest_run_attempt,+ argMaxIf(conclusion, {LATEST_RUN_ORDER}, status = 'completed') AS latest_conclusion,+ argMaxIf(id, {LATEST_RUN_ORDER}, status = 'completed') AS latest_run_id,+ argMaxIf(run_attempt, {LATEST_RUN_ORDER}, status = 'completed') AS latest_run_attempt,countIf(run_attempt > 1) AS rerun_cycles,- countIf(is_merge_queue) AS merge_queue_run_count+ countIf(is_merge_queue) AS merge_queue_run_count,+ argMaxIf(ci_engine, {LATEST_RUN_ORDER}, status = 'completed') AS latest_ci_engineFROM __RUNS_SOURCE__ AS rWHERE run_started_at >= {{date_from}} __DATE_TO__ __BRANCH__ __RUN_SCOPE__ __WORKFLOW__GROUP BY repo_owner, repo_name, workflow_name@@ -412,6 +415,7 @@ def query_workflow_health(# cancelled/skipped run (both have latest_run_failed false). None when nothing completed.latest_run_conclusion=(latest_conclusion or None) if completed_count else None,latest_run_id=int(latest_run_id) if completed_count else None,+ latest_ci_engine=CIEngine(latest_ci_engine) if completed_count else None,latest_run_attempt=int(latest_run_attempt) if completed_count else None,granularity=granularity,buckets=[@@ -434,5 +438,5 @@ def query_workflow_health(else int(merge_queue_run_count or 0)),)- for repo_owner, repo_name, workflow_name, run_count, successful_run_count, conclusive_run_count, percentile_run_count, success_rate, p50_seconds, p95_seconds, last_failure_at, completed_count, latest_failed, latest_conclusion, latest_run_id, latest_run_attempt, rerun_cycles, merge_queue_run_count in response.results+ for repo_owner, repo_name, workflow_name, run_count, successful_run_count, conclusive_run_count, percentile_run_count, success_rate, p50_seconds, p95_seconds, last_failure_at, completed_count, latest_failed, latest_conclusion, latest_run_id, latest_run_attempt, rerun_cycles, merge_queue_run_count, latest_ci_engine in response.results]diff --git a/products/engineering_analytics/backend/logic/queries/workflow_jobs.py b/products/engineering_analytics/backend/logic/queries/workflow_jobs.pyindex dd6f86bb3e4d..ce42fe68e683 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_jobs.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_jobs.py@@ -20,7 +20,7 @@ from typing import Anyfrom posthog.hogql import ast-from products.engineering_analytics.backend.facade.contracts import WorkflowJob+from products.engineering_analytics.backend.facade.contracts import CIEngine, WorkflowJobfrom products.engineering_analytics.backend.logic.cost import (billed_elapsed_seconds,estimate_job_cost_usd,@@ -37,38 +37,51 @@ from products.engineering_analytics.backend.logic.queries._curated import Curate# entry point isn't given (it takes a run id and nothing else), so bounding it would cost a round trip# to buy a bound the run filter already provides._SELECT = """- SELECT id, run_id, run_attempt, name, status, conclusion, labels, runner_name, started_at, completed_at, duration_seconds, provisioning_seconds, is_rerun_copy+ SELECT id, run_id, run_attempt, name, status, conclusion, labels, runner_name, started_at, completed_at, duration_seconds, provisioning_seconds, is_rerun_copy,+ ci_engine, native_run_id, native_workflow_run_id, native_job_id, native_attempt_idFROM __JOBS_SOURCE__ AS j- WHERE run_id = {run_id}+ WHERE run_id = {run_id} AND ({ci_engine} IS NULL OR ci_engine = {ci_engine})ORDER BY started_at ASC, id ASCLIMIT 1000000"""_LATEST_ATTEMPT_SELECT = """- SELECT max(run_attempt)+ SELECT ci_engine, max(run_attempt)FROM __RUNS_SOURCE__ AS rWHERE id = {run_id}+ GROUP BY ci_engine"""def query_workflow_jobs(- *, curated: CuratedGitHubSource, run_id: int, run_attempt: int | None = None+ *, curated: CuratedGitHubSource, run_id: int, run_attempt: int | None = None, ci_engine: CIEngine | None = None) -> list[WorkflowJob]:jobs_source = curated.jobs_source()if jobs_source is None:# The optional job-level source isn't synced for this team yet.return []+ # Without an engine, the runs read is also what rejects a run id that two engines share.+ latest_attempt = (+ _latest_run_attempt(curated=curated, run_id=run_id, ci_engine=ci_engine)+ if run_attempt is None or ci_engine is None+ else None+ )response = curated.run(_SELECT.replace("__JOBS_SOURCE__", jobs_source),query_type="engineering_analytics.workflow_jobs",- placeholders={"run_id": ast.Constant(value=run_id)},+ placeholders={+ "run_id": ast.Constant(value=run_id),+ "ci_engine": ast.Constant(value=ci_engine.value if ci_engine is not None else None),+ },)rows = list(response.results or [])+ if len({row[13] for row in rows}) > 1:+ raise ValueError("Ambiguous run_id; specify ci_engine.")target_attempt = run_attemptif target_attempt is None:# Default to the run's latest attempt per the runs source, not the synced job rows — those can# trail the run table during sync lag and silently serve an older attempt's jobs as current.- target_attempt = _latest_run_attempt(curated=curated, run_id=run_id)+ target_attempt = latest_attemptif target_attempt is None:# Run isn't in the runs source (shouldn't normally happen); fall back to the jobs rows.attempts = [int(row[2]) for row in rows if row[2] is not None]@@ -78,16 +91,20 @@ def query_workflow_jobs(return [_to_job(row) for row in rows]-def _latest_run_attempt(*, curated: CuratedGitHubSource, run_id: int) -> int | None:+def _latest_run_attempt(*, curated: CuratedGitHubSource, run_id: int, ci_engine: CIEngine | None) -> int | None:response = curated.run(_LATEST_ATTEMPT_SELECT.replace("__RUNS_SOURCE__", curated.run_source()),query_type="engineering_analytics.workflow_jobs_latest_attempt",placeholders={"run_id": ast.Constant(value=run_id)},)rows = response.results or []- if not rows or rows[0][0] is None:+ if ci_engine is not None:+ rows = [row for row in rows if row[0] == ci_engine]+ if len(rows) > 1:+ raise ValueError("Ambiguous run_id; specify ci_engine.")+ if not rows or rows[0][1] is None:return None- return int(rows[0][0])+ return int(rows[0][1])def _to_job(row: tuple[Any, ...]) -> WorkflowJob:@@ -105,6 +122,11 @@ def _to_job(row: tuple[Any, ...]) -> WorkflowJob:duration,provisioning,is_rerun_copy,+ ci_engine,+ native_run_id,+ native_workflow_run_id,+ native_job_id,+ native_attempt_id,) = rowlabels = _parse_labels(labels_raw)duration_seconds = int(duration) if duration is not None else None@@ -120,6 +142,11 @@ def _to_job(row: tuple[Any, ...]) -> WorkflowJob:duration_seconds=duration_seconds,runner_provider=provider,runner_label=runner_label or (runner_name or ""),+ ci_engine=CIEngine(ci_engine),+ native_run_id=native_run_id,+ native_workflow_run_id=native_workflow_run_id,+ native_job_id=native_job_id,+ native_attempt_id=native_attempt_id,# Cost runs off the billed clock (wall-clock minus runner boot), not duration_seconds, which# stays what the row displays. A row GitHub re-listed under this attempt without re-running it# costs nothing — the attempt that actually ran carries the minutes (see the jobs builder).diff --git a/products/engineering_analytics/backend/logic/queries/workflow_run.py b/products/engineering_analytics/backend/logic/queries/workflow_run.pyindex 5ba15be6711c..8d8c1a9c7499 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_run.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_run.py@@ -7,7 +7,7 @@ can have multiple attempts (re-runs) sharing the same id; the latest attempt isfrom posthog.hogql import ast-from products.engineering_analytics.backend.facade.contracts import WorkflowRunDetail+from products.engineering_analytics.backend.facade.contracts import CIEngine, WorkflowRunDetailfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries._run_detail import RUN_DETAIL_COLUMNS, to_run_detail@@ -15,18 +15,27 @@ _SELECT = f"""SELECT{RUN_DETAIL_COLUMNS}FROM __RUNS_SOURCE__ AS r- WHERE id = {{run_id}}+ WHERE id = {{run_id}} AND ({{ci_engine}} IS NULL OR ci_engine = {{ci_engine}})ORDER BY run_attempt DESC- LIMIT 1+ LIMIT 1 BY ci_engine, native_workflow_run_id+ LIMIT 2"""-def query_workflow_run(*, curated: CuratedGitHubSource, run_id: int) -> WorkflowRunDetail | None:+def query_workflow_run(+ *, curated: CuratedGitHubSource, run_id: int, ci_engine: CIEngine | None = None+) -> WorkflowRunDetail | None:response = curated.run(_SELECT.replace("__RUNS_SOURCE__", curated.run_source()),query_type="engineering_analytics.workflow_run",- placeholders={"run_id": ast.Constant(value=run_id)},+ placeholders={+ "run_id": ast.Constant(value=run_id),+ "ci_engine": ast.Constant(value=ci_engine.value if ci_engine is not None else None),+ },)if not response.results:return None+ identities = {(row[15], row[17]) for row in response.results}+ if len(identities) > 1:+ raise ValueError("Ambiguous run_id; specify ci_engine.")return to_run_detail(response.results[0])diff --git a/products/engineering_analytics/backend/logic/queries/workflow_run_activity.py b/products/engineering_analytics/backend/logic/queries/workflow_run_activity.pyindex a149b402df60..afb0ff4e1522 100644--- a/products/engineering_analytics/backend/logic/queries/workflow_run_activity.py+++ b/products/engineering_analytics/backend/logic/queries/workflow_run_activity.py@@ -26,6 +26,7 @@ from datetime import datetimefrom posthog.hogql import astfrom products.engineering_analytics.backend.facade.contracts import (+ CIEngine,WorkflowHealthRunScope,WorkflowRunActivity,WorkflowRunActivityPoint,@@ -51,7 +52,7 @@ _MIN_REAL_RUNS = 2_SELECT = f"""SELECTid, conclusion, run_started_at, duration_seconds, head_branch, pr_number, head_sha,- {NO_OP_RUN_FLAG} AS is_noop+ {NO_OP_RUN_FLAG} AS is_noop, ci_engineFROM __RUNS_SOURCE__ AS rWHERE repo_owner = {{repo_owner}} AND repo_name = {{repo_name}} AND workflow_name = {{workflow_name}}AND run_started_at >= {{date_from}} __DATE_TO__ __BRANCH__ __RUN_SCOPE__@@ -103,7 +104,7 @@ def query_workflow_run_activity(def _to_point(row: tuple) -> WorkflowRunActivityPoint:- run_id, conclusion, run_started_at, duration_seconds, head_branch, pr_number, head_sha, _is_noop = row+ run_id, conclusion, run_started_at, duration_seconds, head_branch, pr_number, head_sha, _is_noop, ci_engine = rowreturn WorkflowRunActivityPoint(run_id=int(run_id),# Empty string means "no conclusion yet" (still running) — normalize to None for the contract.@@ -113,4 +114,5 @@ def _to_point(row: tuple) -> WorkflowRunActivityPoint:head_branch=head_branch or "",pr_number=int(pr_number) if pr_number is not None else 0,head_sha=head_sha or "",+ ci_engine=CIEngine(ci_engine),)diff --git a/products/engineering_analytics/backend/logic/views/ci_failures.py b/products/engineering_analytics/backend/logic/views/ci_failures.pyindex 9f4c9accd32a..a1bb4acdf1e3 100644--- a/products/engineering_analytics/backend/logic/views/ci_failures.py+++ b/products/engineering_analytics/backend/logic/views/ci_failures.py@@ -53,6 +53,7 @@ FIELDS: dict[str, FieldOrTable] = {"job_id": IntegerDatabaseField(name="job_id"),"run_attempt": IntegerDatabaseField(name="run_attempt", nullable=True),"conclusion": StringDatabaseField(name="conclusion", nullable=True),+ "ci_engine": StringDatabaseField(name="ci_engine", nullable=True),}# ``__SERVICE_NAME__`` is substituted with the constant below (a plain identifier, not user input) —@@ -75,7 +76,8 @@ _SELECT = """run_id,job_id,run_attempt,- conclusion+ conclusion,+ ci_engineFROM (SELECT`timestamp`,@@ -96,7 +98,8 @@ _SELECT = """accurateCastOrNull(attributes['run_id'], 'Int64') AS run_id,accurateCastOrNull(attributes['job_id'], 'Int64') AS job_id,accurateCastOrNull(attributes['run_attempt'], 'Int64') AS run_attempt,- nullIf(attributes['conclusion'], '') AS conclusion+ nullIf(attributes['conclusion'], '') AS conclusion,+ nullIf(attributes['ci_engine'], '') AS ci_engineFROM logsWHERE service_name = '__SERVICE_NAME__' AND regexpExtract(body, 'FAILED ([^[:space:]]+::[^[:space:]]+)') != '')diff --git a/products/engineering_analytics/backend/logic/views/ci_job_history.py b/products/engineering_analytics/backend/logic/views/ci_job_history.pyindex 50ed7cc6f265..f5feafa1dbec 100644--- a/products/engineering_analytics/backend/logic/views/ci_job_history.py+++ b/products/engineering_analytics/backend/logic/views/ci_job_history.py@@ -92,6 +92,11 @@ FIELDS: dict[str, FieldOrTable] = {# builder). Its timestamps and conclusion are the earlier attempt's, so a boundary or duration# read that counts it counts one execution twice."is_rerun_copy": BooleanDatabaseField(name="is_rerun_copy"),+ "ci_engine": StringDatabaseField(name="ci_engine", nullable=True),+ "native_run_id": StringDatabaseField(name="native_run_id", nullable=True),+ "native_workflow_run_id": StringDatabaseField(name="native_workflow_run_id", nullable=True),+ "native_job_id": StringDatabaseField(name="native_job_id", nullable=True),+ "native_attempt_id": StringDatabaseField(name="native_attempt_id", nullable=True),}@@ -165,10 +170,15 @@ def build_query(-- The run ran on a merge-queue gate branch, so pr_number above is the PR it was landing-- rather than an association. Without this the two populations are indistinguishable.r.is_merge_queue AS is_merge_queue,- j.is_rerun_copy AS is_rerun_copy+ j.is_rerun_copy AS is_rerun_copy,+ j.ci_engine AS ci_engine,+ j.native_run_id AS native_run_id,+ j.native_workflow_run_id AS native_workflow_run_id,+ j.native_job_id AS native_job_id,+ j.native_attempt_id AS native_attempt_idFROM ({jobs}) AS j- LEFT JOIN ({runs}) AS r ON j.run_id = r.id- LEFT JOIN ({head_commits}) AS hc ON j.run_id = hc.run_id+ LEFT JOIN ({runs}) AS r ON j.run_id = r.id AND j.ci_engine = r.ci_engine+ LEFT JOIN ({head_commits}) AS hc ON j.run_id = hc.run_id AND j.ci_engine = 'github_actions'"""diff --git a/products/engineering_analytics/backend/logic/views/depot_ci.py b/products/engineering_analytics/backend/logic/views/depot_ci.pyindex 1c9cd84b1ea7..c1569e9d73c1 100644--- a/products/engineering_analytics/backend/logic/views/depot_ci.py+++ b/products/engineering_analytics/backend/logic/views/depot_ci.py@@ -130,9 +130,13 @@ def _attempts(depot: DepotJobAttempts, pull_requests_table: str | None) -> str:{_id_to_int("if(a.run_workflow_count = 1, a.run_id, a.workflow_id)")} AS github_run_id,{_id_to_int("a.attempt_id")} AS github_job_id,{pr_number} AS pr_number,- {head_branch} AS head_branch,+ coalesce(nullIf(extract(ifNull(a.ref, ''), '^refs/heads/(.+)$'), ''), {head_branch}) AS head_branch,a.repo AS repo,- a.head_sha AS head_sha,+ coalesce(nullIf(a.head_sha, ''), a.sha) AS head_sha,+ a.run_id AS native_run_id,+ a.workflow_id AS native_workflow_run_id,+ a.job_id AS native_job_id,+ a.attempt_id AS native_attempt_id,a.workflow_name AS workflow_name,a.workflow_status AS workflow_status,a.workflow_created_at AS workflow_created_at,@@ -173,7 +177,10 @@ def _runs(attempts: str) -> str:) AS pull_requests,concat('{{"id":{_REPOSITORY_ID},"full_name":"', any(repo), '"}}') AS repository,NULL AS head_commit,- NULL AS actor+ NULL AS actor,+ 'depot_ci' AS ci_engine,+ any(native_run_id) AS native_run_id,+ any(native_workflow_run_id) AS native_workflow_run_idFROM {attempts}GROUP BY github_run_id"""@@ -201,7 +208,12 @@ def _jobs(attempts: str) -> str:a.attempt_started_at AS created_at,a.attempt_started_at AS started_at,a.attempt_finished_at AS completed_at,- NULL AS steps+ NULL AS steps,+ 'depot_ci' AS ci_engine,+ a.native_run_id AS native_run_id,+ a.native_workflow_run_id AS native_workflow_run_id,+ a.native_job_id AS native_job_id,+ a.native_attempt_id AS native_attempt_idFROM {attempts} AS aINNER JOIN (SELECT jobs.depot_job_id AS depot_job_id, jobs.job_attempt AS job_attempt, runs.run_attempt AS run_attempt@@ -254,7 +266,7 @@ def _github_shells(jobs_table: str, runs_table: str, handoffs: str) -> str:HAVING countIf(name = '{_GITHUB_HANDOFF_JOB}' AND conclusion = 'success') > 0AND argMaxIf(ifNull(conclusion, ''), tuple(run_attempt, id), name = '{_GITHUB_RELAY_JOB}') = 'success') AS j- INNER JOIN ({workflow_runs.build_query(runs_table)}) AS r ON j.run_id = r.id+ INNER JOIN ({workflow_runs.build_query(f"({_github_runs(runs_table)})")}) AS r ON j.run_id = r.idWHERE r.status = 'completed' AND r.conclusion = 'success'-- A run can recover weeks after its failed attempt, so the failure check has no date floor.AND j.run_id NOT IN (@@ -267,10 +279,19 @@ def _github_shells(jobs_table: str, runs_table: str, handoffs: str) -> str:"""-def _union(github_table: str, columns: dict[str, dict[str, str]], depot_select: str, where: str) -> str:- # UNION ALL matches columns by position, so the GitHub side names them in the contract order the- # Depot side follows.- return f"(SELECT {', '.join(columns)} FROM {github_table} WHERE {where} UNION ALL {depot_select})"+# UNION ALL matches columns by position, so the GitHub selects name them in the contract order the+# Depot side follows.+def _github_runs(table: str, where: str = "1") -> str:+ return f"""SELECT {", ".join(WORKFLOW_RUNS_COLUMNS)}, 'github_actions' AS ci_engine,+ toString(id) AS native_run_id, toString(id) AS native_workflow_run_id+ FROM {table} WHERE {where}"""+++def _github_jobs(table: str, where: str = "1") -> str:+ return f"""SELECT {", ".join(WORKFLOW_JOBS_COLUMNS)}, 'github_actions' AS ci_engine,+ toString(run_id) AS native_run_id, toString(run_id) AS native_workflow_run_id,+ toString(id) AS native_job_id, toString(id) AS native_attempt_id+ FROM {table} WHERE {where}"""def with_depot_runs(@@ -281,12 +302,11 @@ def with_depot_runs(Successful hand-off shells are left out. Without ``jobs_table`` the GitHub shells stay."""if depot is None:- return runs_table+ return f"({_github_runs(runs_table)})"handoffs = _handoff_workflows(depot)where = f"id NOT IN ({_github_shells(jobs_table, runs_table, handoffs)})" if jobs_table else "1"- return _union(- runs_table, WORKFLOW_RUNS_COLUMNS, _runs(_executed_attempts(depot, handoffs, pull_requests_table)), where- )+ depot_runs = _runs(_executed_attempts(depot, handoffs, pull_requests_table))+ return f"({_github_runs(runs_table, where)} UNION ALL {depot_runs})"def with_depot_jobs(jobs_table: str, depot: DepotJobAttempts | None, runs_table: str) -> str:@@ -297,11 +317,8 @@ def with_depot_jobs(jobs_table: str, depot: DepotJobAttempts | None, runs_table:joins a job to its run reads the branch through ``workflow_jobs.branch``, which falls back to the run's."""if depot is None:- return jobs_table+ return f"({_github_jobs(jobs_table)})"handoffs = _handoff_workflows(depot)- return _union(- jobs_table,- WORKFLOW_JOBS_COLUMNS,- _jobs(_executed_attempts(depot, handoffs, pull_requests_table=None)),- f"run_id NOT IN ({_github_shells(jobs_table, runs_table, handoffs)})",- )+ where = f"run_id NOT IN ({_github_shells(jobs_table, runs_table, handoffs)})"+ depot_jobs = _jobs(_executed_attempts(depot, handoffs, pull_requests_table=None))+ return f"({_github_jobs(jobs_table, where)} UNION ALL {depot_jobs})"diff --git a/products/engineering_analytics/backend/logic/views/job_costs.py b/products/engineering_analytics/backend/logic/views/job_costs.pyindex beb6f190d289..635d735a670e 100644--- a/products/engineering_analytics/backend/logic/views/job_costs.py+++ b/products/engineering_analytics/backend/logic/views/job_costs.py@@ -115,6 +115,11 @@ FIELDS: dict[str, FieldOrTable] = {# ci_job_history's consumers already do. Appended, because the column order is the saved-query# schema contract."created_at_raw": StringDatabaseField(name="created_at_raw", nullable=True),+ "ci_engine": StringDatabaseField(name="ci_engine", nullable=True),+ "native_run_id": StringDatabaseField(name="native_run_id", nullable=True),+ "native_workflow_run_id": StringDatabaseField(name="native_workflow_run_id", nullable=True),+ "native_job_id": StringDatabaseField(name="native_job_id", nullable=True),+ "native_attempt_id": StringDatabaseField(name="native_attempt_id", nullable=True),}@@ -142,7 +147,11 @@ def _run_passthrough_aliases() -> str:def build_query(- *, jobs_table: str, runs_table: str, include_run_columns: bool = False, created_floor: bool = False+ *,+ jobs_table: str,+ runs_table: str,+ include_run_columns: bool = False,+ created_floor: bool = False,) -> str:"""The per-job cost SELECT for one GitHub source: curated jobs LEFT JOIN curated runs.@@ -207,7 +216,8 @@ def build_query({render_estimated_cost_usd("provider", "os", "vcpu", "is_rerun_copy", "billed_seconds")} AS estimated_cost_usd,is_merge_queue,is_rerun_copy,- created_at_raw{run_columns}+ created_at_raw,+ ci_engine, native_run_id, native_workflow_run_id, native_job_id, native_attempt_id{run_columns}FROM (SELECTrepo_owner,@@ -230,6 +240,7 @@ def build_query(is_merge_queue,is_rerun_copy,created_at_raw,+ ci_engine, native_run_id, native_workflow_run_id, native_job_id, native_attempt_id,{render_provider("depot_label", "hosted_label")} AS provider,{render_os("depot_label", "hosted_label")} AS os,{render_vcpu("depot_label", "hosted_label")} AS vcpu{run_columns}@@ -255,6 +266,7 @@ def build_query(is_merge_queue,is_rerun_copy,created_at_raw,+ ci_engine, native_run_id, native_workflow_run_id, native_job_id, native_attempt_id,{render_depot_label("labels_arr")} AS depot_label,{render_hosted_label("labels_arr")} AS hosted_label{run_columns}FROM (@@ -283,9 +295,14 @@ def build_query(r.is_merge_queue AS is_merge_queue,j.is_rerun_copy AS is_rerun_copy,j.created_at_raw AS created_at_raw,+ j.ci_engine AS ci_engine,+ j.native_run_id AS native_run_id,+ j.native_workflow_run_id AS native_workflow_run_id,+ j.native_job_id AS native_job_id,+ j.native_attempt_id AS native_attempt_id,{labels_array} AS labels_arr{inner_run_columns}FROM ({jobs}) AS j- LEFT JOIN ({runs}) AS r ON j.run_id = r.id+ LEFT JOIN ({runs}) AS r ON j.run_id = r.id AND j.ci_engine = r.ci_engine)))diff --git a/products/engineering_analytics/backend/logic/views/pr_friction.py b/products/engineering_analytics/backend/logic/views/pr_friction.pyindex e8a2672ed459..2c9ad8ef7b54 100644--- a/products/engineering_analytics/backend/logic/views/pr_friction.py+++ b/products/engineering_analytics/backend/logic/views/pr_friction.py@@ -189,9 +189,9 @@ bounds AS (FROM pr AS p{ready_join}{approvals_join}),job_attempts AS (- SELECT run_id, groupArray(tuple(attempt_number, started_at, completed_at, unfinished, failed_jobs, unsuccessful)) AS jas+ SELECT ci_engine, run_id, groupArray(tuple(attempt_number, started_at, completed_at, unfinished, failed_jobs, unsuccessful)) AS jasFROM (- SELECT run_id, ifNull(run_attempt, 1) AS attempt_number,+ SELECT ci_engine, run_id, ifNull(run_attempt, 1) AS attempt_number,min(started_at) AS started_at,max(completed_at) AS completed_at,countIf(status != 'completed') AS unfinished,@@ -199,24 +199,25 @@ job_attempts AS (countIf(conclusion NOT IN ('success', 'skipped')) AS unsuccessfulFROM ({jobs}) AS jWHERE NOT is_rerun_copy- GROUP BY run_id, attempt_number+ GROUP BY ci_engine, run_id, attempt_numberHAVING started_at IS NOT NULL)- GROUP BY run_id+ GROUP BY ci_engine, run_id),master AS (SELECT workflow_name, groupArray(tuple(job, completed_at)) AS failsFROM (- SELECT ifNull(workflow_name, '') AS workflow_name,- {_strip_shard("name")} AS job,- parseDateTimeBestEffort(completed_at) AS completed_at- FROM {workflow_jobs_table}- WHERE created_at >= {_raw_floor(run_days)}- AND head_branch IN (SELECT default_branch FROM pr WHERE default_branch != '')+ SELECT ifNull(j.workflow_name, '') AS workflow_name,+ {_strip_shard("j.name")} AS job,+ parseDateTimeBestEffort(j.completed_at) AS completed_at+ FROM {workflow_jobs_table} AS j+ INNER JOIN ({runs}) AS mr ON j.run_id = mr.id AND j.ci_engine = mr.ci_engine+ WHERE j.created_at >= {_raw_floor(run_days)}+ AND {workflow_jobs.branch("j", "mr")} IN (SELECT default_branch FROM pr WHERE default_branch != '')-- The timeline counts failures of default-branch runs that started in its window, gate runs excluded.- AND run_id IN (SELECT id FROM ({runs}) AS mr WHERE NOT mr.is_merge_queue AND mr.run_started_at >= {run_from})- AND conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})- AND completed_at IS NOT NULL+ AND NOT mr.is_merge_queue AND mr.run_started_at >= {run_from}+ AND j.conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})+ AND j.completed_at IS NOT NULL)WHERE completed_at IS NOT NULLGROUP BY workflow_name@@ -241,7 +242,7 @@ run_rows AS (m.fails AS master_failsFROM ({runs}) AS rINNER JOIN bounds AS b ON b.number = r.pr_number- LEFT JOIN job_attempts AS ja ON ja.run_id = r.id+ LEFT JOIN job_attempts AS ja ON ja.run_id = r.id AND ja.ci_engine = r.ci_engineLEFT JOIN master AS m ON m.workflow_name = r.workflow_nameWHERE r.run_started_at >= {run_from} AND r.pr_number > 0),diff --git a/products/engineering_analytics/backend/logic/views/source_schema.py b/products/engineering_analytics/backend/logic/views/source_schema.pyindex b15f5a00fce2..52ff270cc9af 100644--- a/products/engineering_analytics/backend/logic/views/source_schema.py+++ b/products/engineering_analytics/backend/logic/views/source_schema.py@@ -97,6 +97,7 @@ DEPOT_JOB_ATTEMPTS_COLUMNS: dict[str, dict[str, str]] = {"repo","ref","head_sha",+ "sha","workflow_id","workflow_name","workflow_status",diff --git a/products/engineering_analytics/backend/logic/views/workflow_jobs.py b/products/engineering_analytics/backend/logic/views/workflow_jobs.pyindex 5adee9ae8de2..9ac8bf53325b 100644--- a/products/engineering_analytics/backend/logic/views/workflow_jobs.py+++ b/products/engineering_analytics/backend/logic/views/workflow_jobs.py@@ -110,10 +110,16 @@ def build_query(table_name: str, *, created_floor: bool = False) -> str:-- timestamps, which never match the join keys) reads first_attempt as NULL, so the-- comparison yields 0. min(run_attempt) stays Nullable, which makes the LEFT JOIN-- non-match default NULL rather than 0 (a 0 default would flag every unmatched row).- ifNull(job.run_attempt > dupes.first_attempt, 0) AS is_rerun_copy+ ifNull(job.run_attempt > dupes.first_attempt, 0) AS is_rerun_copy,+ job.ci_engine AS ci_engine,+ job.native_run_id AS native_run_id,+ job.native_workflow_run_id AS native_workflow_run_id,+ job.native_job_id AS native_job_id,+ job.native_attempt_id AS native_attempt_idFROM (SELECTid,+ ci_engine, native_run_id, native_workflow_run_id, native_job_id, native_attempt_id,run_id,run_attempt,name,@@ -140,16 +146,17 @@ def build_query(table_name: str, *, created_floor: bool = False) -> str:-- GROUP BY unambiguously names the parsed values.LEFT JOIN (SELECT+ ci_engine,run_id,name,parseDateTimeBestEffort(started_at) AS started_key,parseDateTimeBestEffort(completed_at) AS completed_key,min(run_attempt) AS first_attemptFROM {table_source}- GROUP BY run_id, name, started_key, completed_key+ GROUP BY ci_engine, run_id, name, started_key, completed_keyHAVING count() > 1 AND started_key IS NOT NULL AND completed_key IS NOT NULL) AS dupes- ON job.run_id = dupes.run_id+ ON job.run_id = dupes.run_id AND job.ci_engine = dupes.ci_engineAND job.name = dupes.nameAND job.started_at = dupes.started_keyAND job.completed_at = dupes.completed_keydiff --git a/products/engineering_analytics/backend/logic/views/workflow_runs.py b/products/engineering_analytics/backend/logic/views/workflow_runs.pyindex ebfe5f56d90b..d1505e04ed4a 100644--- a/products/engineering_analytics/backend/logic/views/workflow_runs.py+++ b/products/engineering_analytics/backend/logic/views/workflow_runs.py@@ -169,11 +169,13 @@ def build_query(table_name: str, *, pull_requests_table: str | None = None, starif(status = 'completed', dateDiff('second', run_started_at, updated_at), NULL) AS duration_seconds,{STOPPED_REPORTING_SQL} AS stopped_reporting,arrayElement(repo_parts, 1) AS repo_owner,- arrayElement(repo_parts, 2) AS repo_name+ arrayElement(repo_parts, 2) AS repo_name,+ ci_engine, native_run_id, native_workflow_run_idFROM (SELECTid,name AS workflow_name,+ ci_engine, native_run_id, native_workflow_run_id,head_sha,head_branch,status,diff --git a/products/engineering_analytics/backend/logic/workflows.py b/products/engineering_analytics/backend/logic/workflows.pyindex 8ba505b358e5..5cb7c2ec6077 100644--- a/products/engineering_analytics/backend/logic/workflows.py+++ b/products/engineering_analytics/backend/logic/workflows.py@@ -1,6 +1,7 @@"""Workflow/run/job-scoped orchestration: health, activity, jobs, costs, and repo-level state."""from products.engineering_analytics.backend.facade.contracts import (+ CIEngine,CurrentBranchHealth,MasterFailureGroup,RepoOverview,@@ -38,14 +39,16 @@ from products.engineering_analytics.backend.logic.queries.workflow_run_list impo_DEFAULT_WORKFLOW_WINDOW = "-24h"-def build_workflow_run(*, curated: CuratedGitHubSource, run_id: int) -> WorkflowRunDetail | None:- return query_workflow_run(curated=curated, run_id=run_id)+def build_workflow_run(+ *, curated: CuratedGitHubSource, ci_engine: CIEngine | None = None, run_id: int+) -> WorkflowRunDetail | None:+ return query_workflow_run(curated=curated, run_id=run_id, ci_engine=ci_engine)def build_workflow_jobs(- *, curated: CuratedGitHubSource, run_id: int, run_attempt: int | None = None+ *, curated: CuratedGitHubSource, ci_engine: CIEngine | None = None, run_id: int, run_attempt: int | None = None) -> list[WorkflowJob]:- return query_workflow_jobs(curated=curated, run_id=run_id, run_attempt=run_attempt)+ return query_workflow_jobs(curated=curated, run_id=run_id, ci_engine=ci_engine, run_attempt=run_attempt)def _parse_run_scope(value: str | None) -> WorkflowHealthRunScope:@@ -207,8 +210,10 @@ def build_master_failures(return query_master_failures(curated=curated, date_from=parsed_from, date_to=parsed_to, branch=resolved_branch)-def build_run_failure_logs(*, curated: CuratedGitHubSource, run_id: int) -> RunFailureLogs:- return query_run_failure_logs(curated=curated, run_id=run_id)+def build_run_failure_logs(+ *, curated: CuratedGitHubSource, ci_engine: CIEngine | None = None, run_id: int+) -> RunFailureLogs:+ return query_run_failure_logs(curated=curated, run_id=run_id, ci_engine=ci_engine)def build_job_aggregates(diff --git a/products/engineering_analytics/backend/presentation/serializers/_shared.py b/products/engineering_analytics/backend/presentation/serializers/_shared.pyindex f93f3a8d096e..3d03e1373fbe 100644--- a/products/engineering_analytics/backend/presentation/serializers/_shared.py+++ b/products/engineering_analytics/backend/presentation/serializers/_shared.py@@ -1,8 +1,15 @@"""Serializers shared across domain modules, and their own leaves."""+from rest_framework.fields import ChoiceFieldfrom rest_framework_dataclasses.serializers import DataclassSerializer-from products.engineering_analytics.backend.facade.contracts import CIFailureLogLine, CIJobFailureLog, RepoRef+from products.engineering_analytics.backend.facade.contracts import CIEngine, CIFailureLogLine, CIJobFailureLog, RepoRef+++def ci_engine_field() -> ChoiceField:+ return ChoiceField(+ choices=CIEngine.choices, required=False, allow_null=True, help_text="CI execution engine; null when unknown."+ )class RepoRefSerializer(DataclassSerializer):@@ -29,6 +36,7 @@ class CIFailureLogLineSerializer(DataclassSerializer):class CIJobFailureLogSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()lines = CIFailureLogLineSerializer(many=True, help_text="The thinned failure-log lines in original order, with omission markers.")@@ -36,7 +44,7 @@ class CIJobFailureLogSerializer(DataclassSerializer):class Meta:dataclass = CIJobFailureLogextra_kwargs = {- "job_id": {"help_text": "GitHub Actions job id of the failed job."},+ "job_id": {"help_text": "Integer job id of the failed job; unique only together with ci_engine."},"run_id": {"help_text": "Workflow run id the job belongs to."},"conclusion": {"help_text": "Job conclusion ('failure', 'timed_out', ...). Only failed jobs have logs.",diff --git a/products/engineering_analytics/backend/presentation/serializers/pull_requests.py b/products/engineering_analytics/backend/presentation/serializers/pull_requests.pyindex 9dfa5abcd454..fece39fac0c0 100644--- a/products/engineering_analytics/backend/presentation/serializers/pull_requests.py+++ b/products/engineering_analytics/backend/presentation/serializers/pull_requests.py@@ -23,6 +23,7 @@ from products.engineering_analytics.backend.facade.contracts import (from products.engineering_analytics.backend.presentation.serializers._shared import (CIJobFailureLogSerializer,RepoRefSerializer,+ ci_engine_field,)@@ -56,6 +57,8 @@ class PullRequestSerializer(DataclassSerializer):class PRLifecycleEventSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()+class Meta:dataclass = PRLifecycleEventextra_kwargs = {@@ -127,10 +130,12 @@ class WorkflowCostSerializer(DataclassSerializer):class RunCostSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()+class Meta:dataclass = RunCostextra_kwargs = {- "run_id": {"help_text": "GitHub Actions run id this cost is for."},+ "run_id": {"help_text": "Integer run id this cost is for; unique only together with ci_engine."},"run_attempt": {"help_text": "Re-run attempt number; 1 for the first attempt."},"billable_minutes": {"help_text": "Billable (self-hosted) minutes for this run attempt."},"estimated_cost_usd": {diff --git a/products/engineering_analytics/backend/presentation/serializers/suite_health.py b/products/engineering_analytics/backend/presentation/serializers/suite_health.pyindex ab9f257a873b..7bf1537b9e34 100644--- a/products/engineering_analytics/backend/presentation/serializers/suite_health.py+++ b/products/engineering_analytics/backend/presentation/serializers/suite_health.py@@ -15,7 +15,7 @@ from products.engineering_analytics.backend.facade.contracts import (TrunkQuarantinedTest,TrunkQuarantineTeamDebt,)-from products.engineering_analytics.backend.presentation.serializers._shared import RepoRefSerializer+from products.engineering_analytics.backend.presentation.serializers._shared import RepoRefSerializer, ci_engine_fieldclass FlakyTestItemSerializer(DataclassSerializer):@@ -162,6 +162,8 @@ class FlakyTestListSerializer(DataclassSerializer):class BrokenTestRowSerializer(DataclassSerializer):+ latest_ci_engine = ci_engine_field()+class Meta:dataclass = BrokenTestRowextra_kwargs = {diff --git a/products/engineering_analytics/backend/presentation/serializers/workflows.py b/products/engineering_analytics/backend/presentation/serializers/workflows.pyindex 793e560e9eff..29957ed5ac72 100644--- a/products/engineering_analytics/backend/presentation/serializers/workflows.py+++ b/products/engineering_analytics/backend/presentation/serializers/workflows.py@@ -26,17 +26,21 @@ from products.engineering_analytics.backend.facade.contracts import (from products.engineering_analytics.backend.presentation.serializers._shared import (CIJobFailureLogSerializer,RepoRefSerializer,+ ci_engine_field,)class WorkflowRunDetailSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()repo = RepoRefSerializer(help_text="Repository the run belongs to.")class Meta:dataclass = WorkflowRunDetailextra_kwargs = {- "id": {"help_text": "GitHub Actions run id."},- "workflow_name": {"help_text": "GitHub Actions workflow name."},+ "native_workflow_run_id": {"help_text": "Source-native workflow run id; use with ci_engine for identity."},+ "native_run_id": {"help_text": "Source-native run id; use with ci_engine for identity."},+ "id": {"help_text": "Integer run id; unique only together with ci_engine."},+ "workflow_name": {"help_text": "CI workflow name."},"head_sha": {"help_text": "Commit SHA the run was triggered on."},"head_branch": {"help_text": "Git branch the run was triggered on."},"status": {"help_text": "Raw run status: 'queued', 'in_progress', 'completed', etc."},@@ -77,10 +81,12 @@ class WorkflowRunDetailSerializer(DataclassSerializer):class WorkflowRunActivityPointSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()+class Meta:dataclass = WorkflowRunActivityPointextra_kwargs = {- "run_id": {"help_text": "GitHub Actions run id."},+ "run_id": {"help_text": "Integer run id; unique only together with ci_engine."},"conclusion": {"help_text": "Run conclusion ('success', 'failure', 'timed_out', 'cancelled', 'skipped', ...), ""or null while still in progress.",@@ -117,10 +123,16 @@ class WorkflowRunActivitySerializer(DataclassSerializer):class WorkflowJobSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()+class Meta:dataclass = WorkflowJobextra_kwargs = {- "id": {"help_text": "GitHub Actions job id."},+ "native_attempt_id": {"help_text": "Source-native attempt id; use with ci_engine for identity."},+ "native_job_id": {"help_text": "Source-native job id; use with ci_engine for identity."},+ "native_workflow_run_id": {"help_text": "Source-native workflow run id; use with ci_engine for identity."},+ "native_run_id": {"help_text": "Source-native run id; use with ci_engine for identity."},+ "id": {"help_text": "Integer job id; unique only together with ci_engine."},"run_id": {"help_text": "The workflow run id this job belongs to."},"name": {"help_text": "Job name."},"status": {"help_text": "Raw job status: 'queued', 'in_progress', 'completed', etc."},@@ -182,6 +194,7 @@ class WorkflowHealthBucketSerializer(DataclassSerializer):class WorkflowHealthItemSerializer(DataclassSerializer):+ latest_ci_engine = ci_engine_field()repo = RepoRefSerializer(help_text="Repository the workflow runs in.")buckets = WorkflowHealthBucketSerializer(many=True, help_text="Run history across the whole window, oldest first, zero-filled, bucketed by granularity."@@ -655,6 +668,7 @@ class CurrentBranchHealthSerializer(DataclassSerializer):class MasterFailureGroupSerializer(DataclassSerializer):+ latest_ci_engine = ci_engine_field()repo = RepoRefSerializer(help_text="Repository the failures occurred in.")class Meta:@@ -674,6 +688,7 @@ class MasterFailureGroupSerializer(DataclassSerializer):class RunFailureLogsSerializer(DataclassSerializer):+ ci_engine = ci_engine_field()jobs = CIJobFailureLogSerializer(many=True, help_text="Failed CI jobs of this run with their thinned failure logs, grouped by job.")diff --git a/products/engineering_analytics/backend/presentation/views/workflows.py b/products/engineering_analytics/backend/presentation/views/workflows.pyindex fb99179202e6..0f068088f2f6 100644--- a/products/engineering_analytics/backend/presentation/views/workflows.py+++ b/products/engineering_analytics/backend/presentation/views/workflows.py@@ -8,6 +8,7 @@ from rest_framework.request import Requestfrom rest_framework.response import Responsefrom products.engineering_analytics.backend.facade import api+from products.engineering_analytics.backend.facade.contracts import CIEnginefrom products.engineering_analytics.backend.presentation.serializers.workflows import (CurrentBranchHealthSerializer,MasterFailureGroupSerializer,@@ -32,10 +33,19 @@ from products.engineering_analytics.backend.presentation.views._base import (EngineeringAnalyticsViewSetBase,_bad_request,_bool_param,+ _optional_enum_param,_optional_int_param,_require_int_param,)+_CI_ENGINE = OpenApiParameter(+ name="ci_engine",+ type=OpenApiTypes.STR,+ location=OpenApiParameter.QUERY,+ enum=CIEngine.values,+ description="CI engine. Required when run_id exists in both engines.",+)+class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):READ_ACTIONS = [@@ -102,14 +112,17 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):type=OpenApiTypes.INT,location=OpenApiParameter.QUERY,required=True,- description="GitHub Actions run id to inspect.",+ description="Integer run id to inspect; unique only together with ci_engine.",),+ _CI_ENGINE,_SOURCE_ID,_REPO,],responses={200: WorkflowRunDetailSerializer,- 400: OpenApiResponse(description="Missing or non-integer run_id, or invalid source_id."),+ 400: OpenApiResponse(+ description="Missing or non-integer run_id, ambiguous run identity, or invalid ci_engine/source_id."+ ),404: OpenApiResponse(description="No workflow run with that id in the warehouse."),},description=(@@ -123,6 +136,7 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):result = api.get_workflow_run(team=self.team,run_id=_require_int_param(request, "run_id"),+ ci_engine=_optional_enum_param(request, "ci_engine", CIEngine),source_id=request.query_params.get("source_id") or None,repo=request.query_params.get("repo") or None,user_access_control=self.user_access_control,@@ -321,12 +335,15 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):description="Which re-run attempt to scope jobs to. Omit to use the run's latest attempt; pass an ""explicit attempt to avoid mixing jobs across a re-run's attempts.",),+ _CI_ENGINE,_SOURCE_ID,_REPO,],responses={200: WorkflowJobSerializer(many=True),- 400: OpenApiResponse(description="Missing or non-integer run_id/run_attempt, or invalid source_id."),+ 400: OpenApiResponse(+ description="Missing or non-integer run_id/run_attempt, ambiguous run identity, or invalid ci_engine/source_id."+ ),},description=("Jobs of a single workflow run attempt, with per-job duration, runner tier, and estimated cost. "@@ -340,6 +357,7 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):jobs = api.list_workflow_jobs(team=self.team,run_id=_require_int_param(request, "run_id"),+ ci_engine=_optional_enum_param(request, "ci_engine", CIEngine),run_attempt=_optional_int_param(request, "run_attempt"),source_id=request.query_params.get("source_id") or None,repo=request.query_params.get("repo") or None,@@ -513,12 +531,15 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):required=True,description="Workflow run id whose failure logs to fetch.",),+ _CI_ENGINE,_SOURCE_ID,_REPO,],responses={200: RunFailureLogsSerializer,- 400: OpenApiResponse(description="Missing or non-integer run_id, or invalid source_id."),+ 400: OpenApiResponse(+ description="Missing or non-integer run_id, ambiguous run identity, or invalid ci_engine/source_id."+ ),},description=("The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of "@@ -532,6 +553,7 @@ class WorkflowActionsMixin(EngineeringAnalyticsViewSetBase):result = api.get_run_failure_logs(team=self.team,run_id=_require_int_param(request, "run_id"),+ ci_engine=_optional_enum_param(request, "ci_engine", CIEngine),source_id=request.query_params.get("source_id") or None,repo=request.query_params.get("repo") or None,user_access_control=self.user_access_control,diff --git a/products/engineering_analytics/backend/tests/test_broken_tests.py b/products/engineering_analytics/backend/tests/test_broken_tests.pyindex 19933aa1b9fe..a32780aa4f02 100644--- a/products/engineering_analytics/backend/tests/test_broken_tests.py+++ b/products/engineering_analytics/backend/tests/test_broken_tests.py@@ -142,6 +142,7 @@ def _fp_row("some-branch",workflow_name,last_master_hit_age,+ None,)@@ -155,7 +156,7 @@ def _run_query(*, fingerprint_rows, hourly_rows, master_rows, jobs_synced=True,return SimpleNamespace(results=fingerprint_rows)if "hourly" in query_type:return SimpleNamespace(results=hourly_rows)- return SimpleNamespace(results=master_rows)+ return SimpleNamespace(results=[(*row, "github_actions") for row in master_rows])curated.run.side_effect = run_side_effectreturn query_broken_tests(diff --git a/products/engineering_analytics/backend/tests/test_ci_failure_logs.py b/products/engineering_analytics/backend/tests/test_ci_failure_logs.pyindex e3d03e9197cf..bf554906c8a0 100644--- a/products/engineering_analytics/backend/tests/test_ci_failure_logs.py+++ b/products/engineering_analytics/backend/tests/test_ci_failure_logs.py@@ -2,7 +2,7 @@ from types import SimpleNamespacefrom unittest import mock-from products.engineering_analytics.backend.facade.contracts import RepoRef, WorkflowRunDetail+from products.engineering_analytics.backend.facade.contracts import CIEngine, RepoRef, WorkflowRunDetailfrom products.engineering_analytics.backend.logic.queries import ci_failure_logs as module@@ -10,6 +10,7 @@ def _run(run_id: int) -> WorkflowRunDetail:return WorkflowRunDetail(repo=RepoRef(provider="github", owner="o", name="r"),id=run_id,+ ci_engine=CIEngine.GITHUB_ACTIONS,workflow_name="CI",head_sha="sha",head_branch="main",@@ -29,7 +30,7 @@ def _run(run_id: int) -> WorkflowRunDetail:# (run_id, job_id, conclusion, branch, orig_total, orig_line, body)def _query(rows, runs):curated = mock.Mock()- curated.run.return_value = SimpleNamespace(results=rows)+ curated.run.return_value = SimpleNamespace(results=[(*row, "") if len(row) == 7 else row for row in rows])with mock.patch.object(module, "query_pr_runs", return_value=runs):return module.query_ci_failure_logs(curated=curated, pr_number=5, repo_owner="o", repo_name="r"), curated@@ -68,6 +69,18 @@ def test_no_attributed_runs_short_circuits_without_querying_logs():curated.run.assert_not_called()+def test_colliding_engine_job_ids_keep_failure_lines_separate():+ rows = [+ ("100", "9", "failure", "main", "20", "1", "Depot failure", "depot_ci"),+ ("100", "9", "failure", "main", "30", "2", "GitHub failure", "github_actions"),+ ]+ result, _ = _query(rows, [_run(100)])+ assert [(job.ci_engine, [line.text for line in job.lines]) for job in result.jobs] == [+ (CIEngine.DEPOT_CI, ["Depot failure"]),+ (CIEngine.GITHUB_ACTIONS, ["GitHub failure"]),+ ]++def test_per_job_lines_are_capped(monkeypatch):# One noisy job must not blow the per-job cap; the excess is dropped and truncated flags it.monkeypatch.setattr(module, "_PER_JOB_CAP", 2)diff --git a/products/engineering_analytics/backend/tests/test_ci_views.py b/products/engineering_analytics/backend/tests/test_ci_views.pyindex 66b783301d35..cbb23af4c2bc 100644--- a/products/engineering_analytics/backend/tests/test_ci_views.py+++ b/products/engineering_analytics/backend/tests/test_ci_views.py@@ -21,7 +21,13 @@ from products.engineering_analytics.backend.logic.sources import (WORKFLOW_JOBS_SCHEMA,WORKFLOW_RUNS_SCHEMA,)-from products.engineering_analytics.backend.logic.views import ci_failures, ci_job_history, job_costs, pr_friction+from products.engineering_analytics.backend.logic.views import (+ ci_failures,+ ci_job_history,+ depot_ci,+ job_costs,+ pr_friction,+)from products.engineering_analytics.backend.logic.views.source_schema import (WORKFLOW_JOBS_COLUMNS,WORKFLOW_RUNS_COLUMNS,@@ -177,7 +183,10 @@ class TestCIJobHistoryView(ClickhouseTestMixin, BaseTest):],)- query = ci_job_history.build_query(jobs_table=jobs_table, runs_table=runs_table)+ query = ci_job_history.build_query(+ jobs_table=depot_ci.with_depot_jobs(jobs_table, None, runs_table),+ runs_table=depot_ci.with_depot_runs(runs_table, None, None, None),+ )columns = execute_hogql_query(query=f"SELECT * FROM ({query})", team=self.team, query_type="engineering_analytics.test"@@ -245,7 +254,10 @@ class TestCIJobHistoryView(ClickhouseTestMixin, BaseTest):WORKFLOW_RUNS_COLUMNS,[_run_row(100, head_sha="s", pr_numbers=[1], head_commit={"message": "m"})],)- query = ci_job_history.build_query(jobs_table=jobs_table, runs_table=runs_table)+ query = ci_job_history.build_query(+ jobs_table=depot_ci.with_depot_jobs(jobs_table, None, runs_table),+ runs_table=depot_ci.with_depot_runs(runs_table, None, None, None),+ )unioned = "\nUNION ALL\n".join([query, query])rows = execute_hogql_query(query=f"SELECT count() FROM ({unioned})", team=self.team, query_type="engineering_analytics.test"diff --git a/products/engineering_analytics/backend/tests/test_flaky_tests.py b/products/engineering_analytics/backend/tests/test_flaky_tests.pyindex 10e9d8417a33..3ed578f341ee 100644--- a/products/engineering_analytics/backend/tests/test_flaky_tests.py+++ b/products/engineering_analytics/backend/tests/test_flaky_tests.py@@ -326,6 +326,9 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):repo: str = "PostHog/posthog",job: str = "",runner_name: str = "",+ ci_engine: str = "",+ head_sha: str = "",+ native_workflow_run_id: str = "",) -> str:# Physical attributes carry a type suffix ('test.outcome__str'); the `attributes` ALIAS# column strips it. Resource attributes are stored as-is; attempt="" drops the@@ -346,6 +349,9 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):("ci.pr_number", pr),("ci.branch", branch),("ci.repository", repo),+ ("ci.engine", ci_engine),+ ("ci.sha", head_sha),+ ("ci.native_workflow_run_id", native_workflow_run_id),)if value]@@ -443,6 +449,58 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):def test_classification_needs_proof_to_call_a_test_flaky(self, _name: str, nodeid: str, expected: str) -> None:assert self._rows()[nodeid]["classification"] == expected+ @parameterized.expand(+ [+ ("same_identity", ("github_actions", "workflow-a"), ("github_actions", "sha-a", "workflow-a"), 1),+ ("different_engine", ("github_actions", "workflow-a"), ("depot_ci", "sha-a", "workflow-a"), 0),+ ("different_commit", ("github_actions", "workflow-a"), ("github_actions", "sha-b", "workflow-a"), 0),+ ("different_workflow", ("github_actions", "workflow-a"), ("github_actions", "sha-a", "workflow-b"), 0),+ ("missing_depot_workflow", ("depot_ci", ""), ("depot_ci", "sha-a", ""), 0),+ ]+ )+ def test_retry_recovery_requires_engine_workflow_and_commit_identity(+ self, _name: str, failed: tuple[str, str], passed: tuple[str, str, str], recovered: int+ ) -> None:+ failed_engine, failed_workflow = failed+ engine, sha, workflow = passed+ nodeid = "posthog/api/test/test_identity/TestIdentity::test_retry"+ stamp = datetime.now(UTC) - timedelta(hours=1)+ rows = [+ self._span(+ 9001,+ nodeid,+ "failed",+ ts=stamp,+ run="9900",+ branch="master",+ ci_engine=failed_engine,+ head_sha="sha-a",+ native_workflow_run_id=failed_workflow,+ ),+ self._span(+ 9002,+ nodeid,+ "passed",+ ts=stamp,+ run="9900",+ attempt="2",+ branch="master",+ ci_engine=engine,+ head_sha=sha,+ native_workflow_run_id=workflow,+ ),+ ]+ sync_execute(+ "INSERT INTO trace_spans (uuid, team_id, trace_id, span_id, parent_span_id, name, kind, timestamp, end_time, observed_timestamp, status_code, service_name, attributes_map_str, resource_attributes) VALUES "+ + ",".join(rows)+ )+ try:+ assert self._rows()[nodeid]["same_commit_recovery_run_count"] == recovered+ finally:+ sync_execute(+ "ALTER TABLE trace_spans DELETE WHERE uuid IN ('uuid-9001', 'uuid-9002') SETTINGS mutations_sync = 2"+ )+def test_evidence_is_counted_once_per_run(self) -> None:rows = self._rows()diff --git a/products/engineering_analytics/backend/tests/test_job_costs.py b/products/engineering_analytics/backend/tests/test_job_costs.pyindex f69c7edcbe6c..2cf41d39815d 100644--- a/products/engineering_analytics/backend/tests/test_job_costs.py+++ b/products/engineering_analytics/backend/tests/test_job_costs.py@@ -18,7 +18,7 @@ from products.engineering_analytics.backend.logic.cost import (classify_runner,estimate_job_cost_usd,)-from products.engineering_analytics.backend.logic.views import job_costs+from products.engineering_analytics.backend.logic.views import depot_ci, job_costsfrom products.engineering_analytics.backend.logic.views.source_schema import (WORKFLOW_JOBS_COLUMNS,WORKFLOW_RUNS_COLUMNS,@@ -132,6 +132,13 @@ def _run_row(run_id: int, *, run_attempt: int, pr_number: int) -> dict[str, Any]}+def _cost_query(jobs_table: str, runs_table: str) -> str:+ return job_costs.build_query(+ jobs_table=depot_ci.with_depot_jobs(jobs_table, None, runs_table),+ runs_table=depot_ci.with_depot_runs(runs_table, None, None, None),+ )++class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):# The drift guard for the single-source-of-truth contract: the view is rendered from the same# constants as logic.cost, so any change to one side that isn't matched on the other shows up@@ -163,7 +170,7 @@ class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):runs_table = self._create_table("github_workflow_runs", WORKFLOW_RUNS_COLUMNS, [dict.fromkeys(WORKFLOW_RUNS_COLUMNS)])- query = job_costs.build_query(jobs_table=jobs_table, runs_table=runs_table)+ query = _cost_query(jobs_table, runs_table)columns = execute_hogql_query(query=f"SELECT * FROM ({query})", team=self.team, query_type="engineering_analytics.test").columns@@ -188,7 +195,7 @@ class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):sql = ("SELECT job_name, provider, os, vcpu, multiplier, billable_seconds, estimated_cost_usd "- f"FROM ({job_costs.build_query(jobs_table=jobs_table, runs_table=runs_table)}) ORDER BY job_name"+ f"FROM ({_cost_query(jobs_table, runs_table)}) ORDER BY job_name")rows = execute_hogql_query(query=sql, team=self.team, query_type="engineering_analytics.test").resultsby_job = {row[0]: row for row in rows}@@ -238,7 +245,7 @@ class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):sql = ("SELECT job_name, duration_seconds, billable_seconds, estimated_cost_usd "- f"FROM ({job_costs.build_query(jobs_table=jobs_table, runs_table=runs_table)}) ORDER BY job_name"+ f"FROM ({_cost_query(jobs_table, runs_table)}) ORDER BY job_name")rows = execute_hogql_query(query=sql, team=self.team, query_type="engineering_analytics.test").resultsby_job = {row[0]: row for row in rows}@@ -280,7 +287,7 @@ class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):sql = ("SELECT job_name, run_attempt, repo_owner, repo_name, pr_number, is_rerun_copy, estimated_cost_usd "- f"FROM ({job_costs.build_query(jobs_table=jobs_table, runs_table=runs_table)}) "+ f"FROM ({_cost_query(jobs_table, runs_table)}) ""ORDER BY job_name, run_attempt")rows = execute_hogql_query(query=sql, team=self.team, query_type="engineering_analytics.test").results@@ -335,7 +342,7 @@ class TestJobCostsViewParity(ClickhouseTestMixin, BaseTest):sql = ("SELECT job_name, run_attempt, is_rerun_copy, duration_seconds, billable_seconds, estimated_cost_usd "- f"FROM ({job_costs.build_query(jobs_table=jobs_table, runs_table=runs_table)}) "+ f"FROM ({_cost_query(jobs_table, runs_table)}) ""ORDER BY job_name, run_attempt")rows = execute_hogql_query(query=sql, team=self.team, query_type="engineering_analytics.test").resultsdiff --git a/products/engineering_analytics/backend/tests/test_logic_pull_requests.py b/products/engineering_analytics/backend/tests/test_logic_pull_requests.pyindex 1881de221bbf..02381a14d785 100644--- a/products/engineering_analytics/backend/tests/test_logic_pull_requests.py+++ b/products/engineering_analytics/backend/tests/test_logic_pull_requests.py@@ -59,7 +59,7 @@ class TestPRLifecycleMapping(BaseTest):def test_assembles_ordered_events_and_marks_partial(self) -> None:header = _header("merged", merged_at=_dt("2026-01-12T15:00:00"))runs = [(2001, "CI", "completed", "success", _dt("2026-01-11T09:00:00"), _dt("2026-01-11T12:00:00"))]- with mock.patch(_RUN_QUERY, side_effect=[_resp([header]), _resp(runs)]):+ with mock.patch(_RUN_QUERY, side_effect=[_resp([header]), _resp([(*row, "github_actions") for row in runs])]):lifecycle = api.get_pr_lifecycle(team=self.team, pr_number=10, repo="PostHog/posthog")assert lifecycle is not None@@ -88,7 +88,7 @@ class TestPRLifecycleMapping(BaseTest):# both timestamps null -> both events dropped(2002, "Deploy", "completed", "success", None, None),]- with mock.patch(_RUN_QUERY, side_effect=[_resp([header]), _resp(runs)]):+ with mock.patch(_RUN_QUERY, side_effect=[_resp([header]), _resp([(*row, "github_actions") for row in runs])]):lifecycle = api.get_pr_lifecycle(team=self.team, pr_number=10, repo="PostHog/posthog")assert lifecycle is not None@@ -137,7 +137,10 @@ class TestPRLifecycleTransitionsMapping(BaseTest):("ready_for_review", _dt("2026-01-11T08:00:00"), "bob"),]runs = [(2001, "CI", "completed", "success", _dt("2026-01-11T09:00:00"), _dt("2026-01-11T12:00:00"))]- with mock.patch(_RUN_QUERY, side_effect=[_resp([header]), _resp(transitions), _resp(runs)]):+ with mock.patch(+ _RUN_QUERY,+ side_effect=[_resp([header]), _resp(transitions), _resp([(*row, "github_actions") for row in runs])],+ ):lifecycle = api.get_pr_lifecycle(team=self.team, pr_number=10, repo="PostHog/posthog")assert lifecycle is not Nonediff --git a/products/engineering_analytics/backend/tests/test_logic_workflows.py b/products/engineering_analytics/backend/tests/test_logic_workflows.pyindex 490b1f46e681..cc387e00e5b5 100644--- a/products/engineering_analytics/backend/tests/test_logic_workflows.py+++ b/products/engineering_analytics/backend/tests/test_logic_workflows.py@@ -12,11 +12,12 @@ from parameterized import parameterizedfrom posthog.hogql.database.database import Databasefrom products.engineering_analytics.backend.facade import api-from products.engineering_analytics.backend.facade.contracts import DeliveryStage+from products.engineering_analytics.backend.facade.contracts import CIEngine, DeliveryStagefrom products.engineering_analytics.backend.logic import build_workflow_healthfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries._workflow_filters import UNPAGED_SCAN_LIMIT-from products.engineering_analytics.backend.logic.queries.pr_cost import query_cost_per_merge_series+from products.engineering_analytics.backend.logic.queries.pr_cost import query_cost_per_merge_series, query_pr_cost+from products.engineering_analytics.backend.logic.queries.workflow_flakiness import query_workflow_flakinessfrom products.engineering_analytics.backend.logic.sources import GitHubTablesfrom products.engineering_analytics.backend.logic.views.source_schema import (ISSUE_EVENTS_COLUMNS,@@ -112,7 +113,10 @@ class TestWorkflowEndpointMapping(BaseTest):bucket_rows = [("PostHog", "posthog", "CI", _seed_now() - timedelta(days=1), 10, 8, 7, 1)]# Third response: the previous-window success rate (the Δ baseline); Deploy had no prior runs.prev_rows = [("PostHog", "posthog", "CI", 0.95)]- with mock.patch(_RUN_QUERY, side_effect=[_resp(rows), _resp(bucket_rows), _resp(prev_rows)]):+ with mock.patch(+ _RUN_QUERY,+ side_effect=[_resp([(*row, "github_actions") for row in rows]), _resp(bucket_rows), _resp(prev_rows)],+ ):items = api.list_workflow_health(team=self.team, date_from="-30d", date_to=None)assert items[0].workflow_name == "CI" and items[0].success_rate == 0.9@@ -146,6 +150,22 @@ class TestCostPerMergeSeries(BaseTest):warehouse. Cost is aggregated in SQL over the shared cost source, so only the per-bucket dollarfigure crosses the mock boundary."""+ def test_pr_cost_keeps_colliding_engine_run_ids_separate(self) -> None:+ curated = mock.Mock()+ curated.job_cost_source.return_value = "(cost_source)"+ curated.run.return_value = _resp(+ [+ ("CI", 42, 1, "github_actions", 120.0, 0.016, 1, 0, 0),+ ("CI", 42, 1, "depot_ci", 60.0, 0.008, 1, 0, 0),+ ]+ )+ cost = query_pr_cost(curated=curated, pr_number=5, repo_owner="o", repo_name="r")+ assert {(run.ci_engine, run.run_id, run.run_attempt): run.billable_minutes for run in cost.by_run} == {+ (CIEngine.GITHUB_ACTIONS, 42, 1): 2.0,+ (CIEngine.DEPOT_CI, 42, 1): 1.0,+ }+ assert sum(run.billable_minutes for run in cost.by_run) == cost.billable_minutes == 3.0+@staticmethoddef _curated(cost_rows: list[tuple], merges_rows: list[tuple], *, jobs_synced: bool = True) -> mock.Mock:curated = mock.Mock()@@ -1186,6 +1206,7 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):self._create_depot_table([_depot_attempt_row(+ run_id="0000000020",ref="refs/pull/65/merge",head_sha="sha65",workflow_name="CI",@@ -1208,14 +1229,96 @@ class TestWorkflowEndpointsWarehouse(_EndpointsWarehouseMixin, BaseTest):self._create_table("github_workflow_runs",WORKFLOW_RUNS_COLUMNS,- [_run_row(9800, "CI", "sha-main", "completed", "success", _ago(1), _ago(1), head_branch="main")],+ [_run_row(60, "CI", "sha-main", "completed", "success", _ago(1), _ago(1), head_branch="main")],)- self._create_table("github_workflow_jobs", WORKFLOW_JOBS_COLUMNS, [_job_row(98000, 9800, "build", "success")])+ self._create_table("github_workflow_jobs", WORKFLOW_JOBS_COLUMNS, [_job_row(98000, 60, "build", "success")])aggregates = api.list_job_aggregates(team=self.team, workflow_name="CI", branch="feature/depot")assert [aggregate.job_name for aggregate in aggregates] == ["ci.yml:lint"]+ @parameterized.expand(+ [("recovery", "finished", 1, 1), ("failure", "failed", 1, 2), ("duplicate_rows", "failed", 3, None)]+ )+ def test_colliding_engine_ids_do_not_pair_recovery_or_reduce_run_counts(+ self, _name: str, depot_status: str, copies: int, master_failure_runs: int | None+ ) -> None:+ started, completed = _ago_with_duration(1, 120)+ self._create_depot_table(+ [+ _depot_attempt_row(+ run_id="0000000020",+ ref="refs/heads/master",+ head_sha="same-sha",+ workflow_name="CI",+ workflow_status=depot_status,+ workflow_created_at=started,+ workflow_started_at=started,+ workflow_finished_at=completed,+ job_key="ci.yml:build",+ job_display_name="build",+ attempt=2,+ attempt_status=depot_status,+ attempt_started_at=started,+ attempt_finished_at=completed,+ )+ ]+ )+ self._create_table("github_pull_requests", PULL_REQUESTS_COLUMNS, [_pr_row(65, "alice", "open", 0, _ago(1))])+ self._create_table(+ "github_workflow_runs",+ WORKFLOW_RUNS_COLUMNS,+ [+ _run_row(+ 60,+ "CI",+ "same-sha",+ "completed",+ "failure",+ started,+ completed,+ head_branch="master",+ run_attempt=3,+ )+ for _ in range(copies)+ ],+ )+ self._create_table(+ "github_workflow_jobs",+ WORKFLOW_JOBS_COLUMNS,+ [+ _job_row(+ 600,+ 60,+ "build",+ "failure",+ started=started,+ completed=completed,+ head_branch="master",+ head_sha="same-sha",+ run_attempt=3,+ )+ ],+ )++ if master_failure_runs is not None:+ assert (+ query_workflow_flakiness(curated=CuratedGitHubSource.for_team(self.team), date_from=_dt(_ago(2))) == []+ )+ [build] = api.list_job_aggregates(team=self.team, workflow_name="CI")+ assert (build.job_count, build.runs_in, build.run_share) == (2, 2, 1.0)+ [failure] = api.list_master_failures(team=self.team, branch="master", date_from="-2d")+ assert failure.run_count == master_failure_runs+ for read in (api.get_workflow_run, api.list_workflow_jobs, api.get_run_failure_logs):+ with pytest.raises(ValueError, match="Ambiguous run_id"):+ read(team=self.team, run_id=60)+ for engine in CIEngine:+ run = api.get_workflow_run(team=self.team, run_id=60, ci_engine=engine)+ assert run is not None and run.ci_engine == engine+ jobs = api.list_workflow_jobs(team=self.team, run_id=60, ci_engine=engine)+ assert jobs and {job.ci_engine for job in jobs} == {engine}+ assert all(job.native_attempt_id and job.native_workflow_run_id for job in jobs)+def test_job_aggregates_rate_and_queue_time_use_verdicts(self) -> None:self._create_table("github_pull_requests",diff --git a/products/engineering_analytics/backend/tests/test_pr_friction.py b/products/engineering_analytics/backend/tests/test_pr_friction.pyindex f81ead42194a..fd4370deae5d 100644--- a/products/engineering_analytics/backend/tests/test_pr_friction.py+++ b/products/engineering_analytics/backend/tests/test_pr_friction.py@@ -224,6 +224,7 @@ class TestPRFrictionView(_WarehouseMixin):self._create_depot_table([_depot_attempt_row(+ run_id="00000003fc",ref="refs/pull/36/merge",head_sha="sha36",workflow_name="Backend CI on Depot",@@ -281,6 +282,8 @@ class TestPRFrictionView(_WarehouseMixin):assert set(timeline_figures) == {31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44}assert view_figures == timeline_figures+ assert view_figures[31]["flake_red_count"] == 1+ assert view_figures[31]["ci_running"] == 20 * 60if with_depot_ci:assert view_figures[36]["ci_running"] > 0diff --git a/products/engineering_analytics/backend/tests/test_presentation.py b/products/engineering_analytics/backend/tests/test_presentation.pyindex 11b3243f68cd..19a042ff2bf2 100644--- a/products/engineering_analytics/backend/tests/test_presentation.py+++ b/products/engineering_analytics/backend/tests/test_presentation.py@@ -598,6 +598,9 @@ class TestEngineeringAnalyticsAPI(APIBaseTest):("pr_lifecycle_repo_malformed", "pr_lifecycle", {"pr_number": "10", "repo": "PostHog"}),("resolve_branch_branch_missing", "resolve_branch", {}),("workflow_run_run_id_invalid", "workflow_run", {"run_id": "not-a-number"}),+ ("workflow_run_engine_invalid", "workflow_run", {"run_id": "7777", "ci_engine": "unknown"}),+ ("workflow_jobs_engine_invalid", "workflow_jobs", {"run_id": "7777", "ci_engine": "unknown"}),+ ("run_failure_logs_engine_invalid", "run_failure_logs", {"run_id": "7777", "ci_engine": "unknown"}),("workflow_runs_repo_missing", "workflow_runs", {"workflow_name": "CI"}),("pr_runs_repo_missing", "pr_runs", {"pr_number": "10"}),("pr_cost_repo_missing", "pr_cost", {"pr_number": "10"}),diff --git a/products/engineering_analytics/backend/tests/test_views.py b/products/engineering_analytics/backend/tests/test_views.pyindex bdc2ac407ff2..af922989d28f 100644--- a/products/engineering_analytics/backend/tests/test_views.py+++ b/products/engineering_analytics/backend/tests/test_views.py@@ -46,6 +46,10 @@ from products.engineering_analytics.backend.tests._github_fixtures import (from products.engineering_analytics.backend.tests._logic_helpers import _job_row+def _github_runs(runs_table: str) -> str:+ return depot_ci.with_depot_runs(runs_table, None, None, None)++class TestListGithubSourcesAccessControl(BaseTest):def setUp(self) -> None:super().setUp()@@ -229,7 +233,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):rows = self._select("SELECT workflow_name, status, conclusion, duration_seconds, repo_owner, repo_name, ""pr_number, is_merge_queue "- f"FROM ({workflow_runs.build_query(table_name)}) AS r ORDER BY id"+ f"FROM ({workflow_runs.build_query(_github_runs(table_name))}) AS r ORDER BY id")# completed runs carry a duration; in-progress run has null duration and null conclusion@@ -327,6 +331,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):repo: str = "PostHog/posthog",job_key: str = "ci-backend.yml:turbo-tests:matrix-38",head_sha: str = "abc123",+ sha: str = "",) -> dict[str, str | int]:return {"run_id": run_id,@@ -334,6 +339,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):"repo": repo,"ref": ref,"head_sha": head_sha,+ "sha": sha,"workflow_id": workflow_id,"workflow_name": workflow_name,"workflow_status": workflow_status,@@ -356,7 +362,8 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):"run_id": "bbbbbbbbbb","run_workflow_count": 2,"ref": "refs/heads/master",- "head_sha": "def456",+ "head_sha": "",+ "sha": "def456",}depot_table = self._create_table("depot_job_attempts",@@ -465,8 +472,8 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):(908, "Backend CI", "success", 101991, "main", 900, "PostHog", 2),(80213453736890, "Backend CI on Depot", "success", 101991, "feature/depot", 600, "PostHog", 2),(101808620689656, "Backend CI on Depot", "failure", 101991, "feature/depot", 600, "PostHog", 1),- (223978965517241, "Monitor", "success", 0, None, 600, "PostHog", 1),- (244340689655172, "Timing", "failure", 0, None, 600, "PostHog", 1),+ (223978965517241, "Monitor", "success", 0, "master", 600, "PostHog", 1),+ (244340689655172, "Timing", "failure", 0, "master", 600, "PostHog", 1),]assert self._select(f"SELECT DISTINCT run_id FROM ({workflow_jobs.build_query(jobs)}) AS j ORDER BY run_id"@@ -505,6 +512,22 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):f"FROM ({ci_job_history.build_query(jobs_table=jobs, runs_table=runs)}) AS h WHERE run_id = 80213453736890") == [("feature/depot",)]+ assert self._select(+ "SELECT DISTINCT ci_engine, native_run_id, native_workflow_run_id "+ f"FROM ({workflow_runs.build_query(runs)}) AS r "+ "WHERE id IN (902, 80213453736890, 223978965517241) ORDER BY id"+ ) == [+ ("github_actions", "902", "902"),+ ("depot_ci", "427q556wmn", "6n4tghls33"),+ ("depot_ci", "bbbbbbbbbb", "cccccccccc"),+ ]+ for view in (job_costs, ci_job_history):+ assert self._select(+ "SELECT DISTINCT ci_engine, native_run_id, native_workflow_run_id, native_attempt_id "+ f"FROM ({view.build_query(jobs_table=jobs, runs_table=runs)}) AS j "+ "WHERE native_attempt_id = '3v4pbsqvfc'"+ ) == [("depot_ci", "427q556wmn", "6n4tghls33", "3v4pbsqvfc")]+def test_pull_requests_view_handles_null_user(self) -> None:# The real source lands user as Nullable(String), NULL for a PR by a deleted GitHub account.# JSONExtractString over a NULL Nullable returns NULL, so the builder must ifNull-guard it to@@ -542,7 +565,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):"'2026-01-20 10:00:00' AS created_at)")rows = self._select(- f"SELECT pr_number, repo_owner, repo_name, is_merge_queue FROM ({workflow_runs.build_query(raw)}) AS r"+ f"SELECT pr_number, repo_owner, repo_name, is_merge_queue FROM ({workflow_runs.build_query(_github_runs(raw))}) AS r")assert rows[0] == (0, "PostHog", "posthog", 0)@@ -589,7 +612,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):table_name = self._create_table("github_workflow_runs", WORKFLOW_RUNS_COLUMNS, rows)results = self._select(- f"SELECT id, pr_number, commit_pr_number FROM ({workflow_runs.build_query(table_name)}) AS r ORDER BY id"+ f"SELECT id, pr_number, commit_pr_number FROM ({workflow_runs.build_query(_github_runs(table_name))}) AS r ORDER BY id")assert results == [(5000 + index, pr, commit_pr) for index, (_, _, _, pr, commit_pr) in enumerate(cases)]@@ -661,7 +684,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):prs_table = self._create_table("github_pull_requests", PULL_REQUESTS_COLUMNS, prs)runs_table = self._create_table("github_workflow_runs", WORKFLOW_RUNS_COLUMNS, runs)- query = workflow_runs.build_query(runs_table, pull_requests_table=prs_table)+ query = workflow_runs.build_query(_github_runs(runs_table), pull_requests_table=prs_table)results = self._select(f"SELECT id, commit_pr_number FROM ({query}) AS r ORDER BY id")assert results == [(6000 + index, expected) for index, (_, _, expected) in enumerate(cases)]@@ -687,7 +710,7 @@ class TestEngineeringAnalyticsViews(ClickhouseTestMixin, BaseTest):table_name = self._create_table("github_workflow_runs", WORKFLOW_RUNS_COLUMNS, [sparse_run])rows = self._select("SELECT status, conclusion, duration_seconds, repo_owner, repo_name, pr_number, run_attempt "- f"FROM ({workflow_runs.build_query(table_name)}) AS r"+ f"FROM ({workflow_runs.build_query(_github_runs(table_name))}) AS r")assert rows[0] == ("completed", None, None, "", "", 0, None)diff --git a/products/engineering_analytics/frontend/components/RunActivityChart.tsx b/products/engineering_analytics/frontend/components/RunActivityChart.tsxindex bb2009ccfd79..6c175d9f2f08 100644--- a/products/engineering_analytics/frontend/components/RunActivityChart.tsx+++ b/products/engineering_analytics/frontend/components/RunActivityChart.tsx@@ -7,6 +7,7 @@ import { LemonCard } from 'lib/lemon-ui/LemonCard'import { cn } from 'lib/utils/css-classes'import { humanFriendlyDuration } from 'lib/utils/durations'+import type { WorkflowRunActivityPointApi } from '../generated/api.schemas'import { TimeRange, clampFocus, defaultFocus, panFocus, pxToTime, resizeFocus, timeToFrac } from '../lib/brush'import { isDecisiveFailure } from '../lib/lifecycle'import { percentileSorted } from '../lib/runHealth'@@ -15,6 +16,7 @@ import { VERDICT_COLOR, verdictTag } from '../lib/runStatus'// A run reduced to what the chart needs. Both WorkflowRunRow and PrRunRow satisfy this, so either page// can drop the chart in over its own run list; the optional branch/PR fields enrich the hover card.export interface ActivityRun {+ ciEngine?: WorkflowRunActivityPointApi['ci_engine']runId: number | nullconclusion: string | nullstartedAt: string | null@@ -307,7 +309,7 @@ export function RunActivityChart({const tag = verdictTag(run.conclusion)presentTypeSet.add(tag.type)return {- key: `${run.runId ?? 'run'}-${i}`,+ key: `${run.ciEngine ?? ''}:${run.runId ?? 'run'}-${i}`,leftPct: xPct(dayjs(run.startedAt).valueOf()),topPx: Math.max(3, Math.min(SCATTER_HEIGHT - 3, yPx(run.durationSeconds / 60))),color: DOT_COLOR[tag.type] ?? DOT_COLOR.muted,diff --git a/products/engineering_analytics/frontend/components/runTables.test.tsx b/products/engineering_analytics/frontend/components/runTables.test.tsxindex 43f380a04a80..886445bf3395 100644--- a/products/engineering_analytics/frontend/components/runTables.test.tsx+++ b/products/engineering_analytics/frontend/components/runTables.test.tsx@@ -1,6 +1,11 @@+import { jobCacheKey } from '../lib/jobs'import { formatCost, runPrNumber } from './runTables'describe('runTables', () => {+ it('separates colliding engine IDs in the expanded job cache', () => {+ expect(jobCacheKey(42, 1, 'depot_ci')).not.toEqual(jobCacheKey(42, 1, 'github_actions'))+ expect(jobCacheKey(42, 1)).toEqual('42:1')+ })describe('formatCost', () => {it.each([[null, '—'],diff --git a/products/engineering_analytics/frontend/generated/api.schemas.ts b/products/engineering_analytics/frontend/generated/api.schemas.tsindex c91e53841473..54989aad40fb 100644--- a/products/engineering_analytics/frontend/generated/api.schemas.ts+++ b/products/engineering_analytics/frontend/generated/api.schemas.ts@@ -266,6 +266,17 @@ export interface WorkflowCostApi {excluded_jobs: number}+/**+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI+ */+export type CIEngineEnumApi = (typeof CIEngineEnumApi)[keyof typeof CIEngineEnumApi]++export const CIEngineEnumApi = {+ GithubActions: 'github_actions',+ DepotCi: 'depot_ci',+} as const+/*** * `breaking_master` - BREAKING_MASTER* * `blocking_merge_queue` - BLOCKING_MERGE_QUEUE@@ -286,6 +297,11 @@ export const BrokenTestRowStateEnumApi = {} as constexport interface BrokenTestRowApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnumApi | null/** Stable identity of this distinct failure: the failing test's node id plus a normalized error signature, so the same failure across runs groups into one row. */fingerprint: string/** The pytest node id from the CI 'FAILED <id>' line: the failing test. */@@ -389,9 +405,14 @@ export interface CIFailureLogLineApi {}export interface CIJobFailureLogApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null/** The thinned failure-log lines in original order, with omission markers. */lines: CIFailureLogLineApi[]- /** GitHub Actions job id of the failed job. */+ /** Integer job id of the failed job; unique only together with ci_engine. */job_id: number/** Workflow run id the job belongs to. */run_id: number@@ -963,6 +984,11 @@ export interface WorkflowJobAggregateApi {}export interface MasterFailureGroupApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnumApi | null/** Repository the failures occurred in. */repo: RepoRefApi/** GitHub Actions workflow name the failing runs belong to. */@@ -980,7 +1006,12 @@ export interface MasterFailureGroupApi {}export interface RunCostApi {- /** GitHub Actions run id this cost is for. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null+ /** Integer run id this cost is for; unique only together with ci_engine. */run_id: number/** Re-run attempt number; 1 for the first attempt. */run_attempt: number@@ -1083,6 +1114,11 @@ export const PRLifecycleEventKindEnumApi = {} as constexport interface PRLifecycleEventApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null/** Event kind: opened, ready_for_review, converted_to_draft, ci_started, ci_finished, merged, or closed.** * `opened` - OPENED@@ -1134,11 +1170,16 @@ export interface PRLifecycleApi {}export interface WorkflowRunDetailApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null/** Repository the run belongs to. */repo: RepoRefApi- /** GitHub Actions run id. */+ /** Integer run id; unique only together with ci_engine. */id: number- /** GitHub Actions workflow name. */+ /** CI workflow name. */workflow_name: string/** Commit SHA the run was triggered on. */head_sha: string@@ -1177,6 +1218,16 @@ export interface WorkflowRunDetailApi {commit_pr_number: number | null/** True when a merge queue pushed this run to gate pr_number, rather than the author pushing it. Count it when measuring CI; drop it when counting what the author did. */is_merge_queue: boolean+ /**+ * Source-native run id; use with ci_engine for identity.+ * @nullable+ */+ native_run_id?: string | null+ /**+ * Source-native workflow run id; use with ci_engine for identity.+ * @nullable+ */+ native_workflow_run_id?: string | null}export interface PullRequestFrictionBreakdownApi {@@ -1877,7 +1928,12 @@ export interface RepoOverviewApi {}export interface WorkflowRunActivityPointApi {- /** GitHub Actions run id. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null+ /** Integer run id; unique only together with ci_engine. */run_id: number/*** Run conclusion ('success', 'failure', 'timed_out', 'cancelled', 'skipped', ...), or null while still in progress.@@ -1926,6 +1982,11 @@ export interface BranchPRMatchApi {}export interface RunFailureLogsApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null/** Failed CI jobs of this run with their thinned failure logs, grouped by job. */jobs: CIJobFailureLogApi[]/** Workflow run id the failure logs are for. */@@ -2134,6 +2195,11 @@ export interface WorkflowHealthBucketApi {}export interface WorkflowHealthItemApi {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnumApi | null/** Repository the workflow runs in. */repo: RepoRefApi/** Run history across the whole window, oldest first, zero-filled, bucketed by granularity. */@@ -2206,7 +2272,12 @@ export interface WorkflowHealthItemApi {}export interface WorkflowJobApi {- /** GitHub Actions job id. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnumApi | null+ /** Integer job id; unique only together with ci_engine. */id: number/** The workflow run id this job belongs to. */run_id: number@@ -2243,6 +2314,26 @@ export interface WorkflowJobApi {* @nullable*/estimated_cost_usd: number | null+ /**+ * Source-native run id; use with ci_engine for identity.+ * @nullable+ */+ native_run_id?: string | null+ /**+ * Source-native workflow run id; use with ci_engine for identity.+ * @nullable+ */+ native_workflow_run_id?: string | null+ /**+ * Source-native job id; use with ci_engine for identity.+ * @nullable+ */+ native_job_id?: string | null+ /**+ * Source-native attempt id; use with ci_engine for identity.+ * @nullable+ */+ native_attempt_id?: string | null}export interface WorkflowRunnerCostApi {@@ -2757,6 +2848,10 @@ export type EngineeringAnalyticsResolveBranchParams = {}export type EngineeringAnalyticsRunFailureLogsParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsRunFailureLogsCiEngine/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/@@ -2771,6 +2866,14 @@ export type EngineeringAnalyticsRunFailureLogsParams = {source_id?: string}+export type EngineeringAnalyticsRunFailureLogsCiEngine =+ (typeof EngineeringAnalyticsRunFailureLogsCiEngine)[keyof typeof EngineeringAnalyticsRunFailureLogsCiEngine]++export const EngineeringAnalyticsRunFailureLogsCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+} as const+export type EngineeringAnalyticsTeamCiActivityParams = {/*** Window start: relative ('-14d', '-7d') or ISO8601. Defaults to -14d; the window may span at most 30 days. An equal-length prior window feeds the *_prior twins; near the 30-day ceiling that prior window can reach past Traces retention, deflating *_prior counts.@@ -2893,6 +2996,10 @@ export const EngineeringAnalyticsWorkflowHealthRunScope = {} as constexport type EngineeringAnalyticsWorkflowJobsParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsWorkflowJobsCiEngine/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/@@ -2911,13 +3018,25 @@ export type EngineeringAnalyticsWorkflowJobsParams = {source_id?: string}+export type EngineeringAnalyticsWorkflowJobsCiEngine =+ (typeof EngineeringAnalyticsWorkflowJobsCiEngine)[keyof typeof EngineeringAnalyticsWorkflowJobsCiEngine]++export const EngineeringAnalyticsWorkflowJobsCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+} as const+export type EngineeringAnalyticsWorkflowRunParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsWorkflowRunCiEngine/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/repo?: string/**- * GitHub Actions run id to inspect.+ * Integer run id to inspect; unique only together with ci_engine.*/run_id: number/**@@ -2926,6 +3045,14 @@ export type EngineeringAnalyticsWorkflowRunParams = {source_id?: string}+export type EngineeringAnalyticsWorkflowRunCiEngine =+ (typeof EngineeringAnalyticsWorkflowRunCiEngine)[keyof typeof EngineeringAnalyticsWorkflowRunCiEngine]++export const EngineeringAnalyticsWorkflowRunCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+} as const+export type EngineeringAnalyticsWorkflowRunActivityParams = {/*** Optional exact git branch (head_branch) to scope results to, e.g. 'main'. Omit or leave blank to aggregate across all branches.diff --git a/products/engineering_analytics/frontend/lib/jobs.ts b/products/engineering_analytics/frontend/lib/jobs.tsindex 7e993f7c1a52..096f53d33041 100644--- a/products/engineering_analytics/frontend/lib/jobs.ts+++ b/products/engineering_analytics/frontend/lib/jobs.ts@@ -1,4 +1,10 @@-/** Cache key for a run's jobs, keyed by attempt so a re-run's attempts don't overwrite each other. */-export function jobCacheKey(runId: number, runAttempt: number | null): string {- return `${runId}:${runAttempt ?? 'latest'}`+import type { WorkflowRunDetailApi } from '../generated/api.schemas'++/** Keep engine and attempt distinct when runs share a compatible integer ID. */+export function jobCacheKey(+ runId: number,+ runAttempt: number | null,+ ciEngine?: WorkflowRunDetailApi['ci_engine']+): string {+ return `${ciEngine ? `${ciEngine}:` : ''}${runId}:${runAttempt ?? 'latest'}`}diff --git a/products/engineering_analytics/frontend/lib/lifecycle.ts b/products/engineering_analytics/frontend/lib/lifecycle.tsindex d0205f73d9e0..6b3d189af753 100644--- a/products/engineering_analytics/frontend/lib/lifecycle.ts+++ b/products/engineering_analytics/frontend/lib/lifecycle.ts@@ -1,6 +1,7 @@-import type { PRLifecycleEventApi } from '../generated/api.schemas'+import type { PRLifecycleEventApi, WorkflowRunDetailApi } from '../generated/api.schemas'export interface WorkflowRun {+ ciEngine?: WorkflowRunDetailApi['ci_engine']workflow: string/** Null while the run hasn't reported a finish — queued or in progress. */conclusion: string | null@@ -43,6 +44,10 @@ function parseFinishedDetail(detail: string | null | undefined): { workflow: strreturn { workflow: detail.slice(0, splitAt), conclusion: detail.slice(splitAt + 2) }}+function unfinishedKey(event: PRLifecycleEventApi, workflow: string): string {+ return `${event.ci_engine ?? ''}:${event.run_id ?? ''}:${workflow}`+}+/*** Pairs ci_started / ci_finished events into per-workflow runs with durations, FIFO by workflow name.* A finish without a matching start (events outside the window) still yields a row.@@ -61,15 +66,17 @@ export function workflowRuns(events: PRLifecycleEventApi[]): WorkflowRun[] {finishedAt: null,durationSeconds: null,runId: event.run_id ?? null,+ ciEngine: event.ci_engine,runAttempt: null,}runs.push(run)- const queue = unfinishedByWorkflow.get(workflow) ?? []+ const key = unfinishedKey(event, workflow)+ const queue = unfinishedByWorkflow.get(key) ?? []queue.push(run)- unfinishedByWorkflow.set(workflow, queue)+ unfinishedByWorkflow.set(key, queue)} else if (event.kind === 'ci_finished') {const { workflow, conclusion } = parseFinishedDetail(event.detail)- const started = unfinishedByWorkflow.get(workflow)?.shift()+ const started = unfinishedByWorkflow.get(unfinishedKey(event, workflow))?.shift()if (started) {started.conclusion = conclusion ?? 'completed'started.finishedAt = event.at@@ -85,6 +92,7 @@ export function workflowRuns(events: PRLifecycleEventApi[]): WorkflowRun[] {finishedAt: event.at,durationSeconds: null,runId: event.run_id ?? null,+ ciEngine: event.ci_engine,runAttempt: null,})}diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsxindex eaf3e5f23cd1..8c9c3e18a7f1 100644--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx@@ -63,7 +63,7 @@ export const scene: SceneExport<PullRequestDetailLogicProps> = {// Stable per-row key: re-runs share a runId, so start time disambiguates attempts. Used for rowKey and// the expand-state set, so expanding one attempt doesn't open the others.function runRowKey(run: WorkflowRun): string {- return `${run.workflow}@${run.startedAt ?? run.finishedAt ?? run.runId ?? ''}`+ return `${run.ciEngine ?? ''}:${run.workflow}@${run.startedAt ?? run.finishedAt ?? run.runId ?? ''}`}/** The runs of one workflow on this PR, one row per push × attempt. Jobs live on the run page. */@@ -88,7 +88,13 @@ function PerPushRunsTable({runJobs: Record<string, WorkflowJobApi[]>runJobsLoading: booleanexpandedRunKeys: string[]- setRunExpanded: (rowKey: string, expanded: boolean, runId: number | null, runAttempt: number | null) => void+ setRunExpanded: (+ rowKey: string,+ expanded: boolean,+ runId: number | null,+ runAttempt: number | null,+ ciEngine?: PrRunRow['ciEngine']+ ) => void}): JSX.Element {// Oldest push first so rows read in the same order as the timeline strip.const ordered = [...runs].sort((a, b) => (a.startedAt ?? '').localeCompare(b.startedAt ?? ''))@@ -116,7 +122,7 @@ function PerPushRunsTable({run.runId != null ? (<Linkto={withCurrentScope(- urls.engineeringAnalyticsWorkflowRun(repoOwner, repoName, run.runId),+ urls.engineeringAnalyticsWorkflowRun(repoOwner, repoName, run.runId, run.ciEngine),sourceId)}className="font-mono text-xs"@@ -160,7 +166,10 @@ function PerPushRunsTable({key: 'cost',align: 'right',render: (_: unknown, run: PrRunRow) => {- const cost = run.runId != null ? runCostByKey[jobCacheKey(run.runId, run.runAttempt)] : null+ const cost =+ run.runId != null+ ? runCostByKey[jobCacheKey(run.runId, run.runAttempt, run.ciEngine)]+ : nullreturn (<span className="text-xs tabular-nums whitespace-nowrap">{cost?.cost != null ? compactUsd(cost.cost) : '—'}@@ -201,7 +210,8 @@ function PerPushRunsTable({runRowKey(run),!expandedRunKeys.includes(runRowKey(run)),run.runId,- run.runAttempt+ run.runAttempt,+ run.ciEngine),}: {}@@ -212,7 +222,11 @@ function PerPushRunsTable({isRowExpanded: (run) => expandedRunKeys.includes(runRowKey(run)),expandedRowRender: (run) => (<GroupedJobsTable- jobs={run.runId != null ? runJobs[jobCacheKey(run.runId, run.runAttempt)] : undefined}+ jobs={+ run.runId != null+ ? runJobs[jobCacheKey(run.runId, run.runAttempt, run.ciEngine)]+ : undefined+ }loading={runJobsLoading}embedded/>@@ -252,7 +266,13 @@ function PrWorkflowsTable({runJobs: Record<string, WorkflowJobApi[]>runJobsLoading: booleanexpandedRunKeys: string[]- setRunExpanded: (rowKey: string, expanded: boolean, runId: number | null, runAttempt: number | null) => void+ setRunExpanded: (+ rowKey: string,+ expanded: boolean,+ runId: number | null,+ runAttempt: number | null,+ ciEngine?: PrRunRow['ciEngine']+ ) => void}): JSX.Element {const latestByWorkflow = latestRunPerWorkflow(filteredRuns)const isWorkflowFailing = (workflowName: string): boolean => {diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.stories.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.stories.tsxindex 11a4667fe938..ba6c476e9a9a 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.stories.tsx@@ -15,6 +15,7 @@ const STARTED_AT = '2026-07-01T11:12:00Z'const RUN: WorkflowRunDetailApi = {repo: REPO,id: RUN_ID,+ ci_engine: 'github_actions',workflow_name: 'Backend CI',head_sha: 'c0ffee880163',head_branch: 'feat/run-scope-groups',@@ -117,3 +118,22 @@ export const JobsAndLogsLoadErrors: Story = {}),],}++export const DepotRun: Story = {+ render: () => <App />,+ parameters: {+ pageUrl: urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', RUN_ID, 'depot_ci'),+ testOptions: { waitForSelector: '#ea-section-jobs' },+ },+ decorators: [+ mswDecorator({+ get: {+ 'api/projects/:team_id/engineering_analytics/workflow_run/': { ...RUN, ci_engine: 'depot_ci' },+ 'api/projects/:team_id/engineering_analytics/workflow_jobs/': JOBS.map((job) => ({+ ...job,+ ci_engine: 'depot_ci',+ })),+ },+ }),+ ],+}diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsxindex 1e676c7e00ff..ec9f1f08cb09 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx@@ -31,10 +31,11 @@ import { WorkflowRunDetailLogicProps, workflowRunDetailLogic } from './workflowRexport const scene: SceneExport<WorkflowRunDetailLogicProps> = {component: WorkflowRunDetailScene,logic: workflowRunDetailLogic,- paramsToProps: ({ params: { repoOwner, repoName, runId }, searchParams: { source } }) => ({+ paramsToProps: ({ params: { repoOwner, repoName, runId }, searchParams: { source, ci_engine } }) => ({repoOwner: decodeURIComponent(repoOwner),repoName: decodeURIComponent(repoName),runId: parseInt(runId, 10),+ ciEngine: ci_engine as WorkflowRunDetailLogicProps['ciEngine'],sourceId: source ?? null,}),}@@ -65,7 +66,7 @@ export function WorkflowRunDetailScene(): JSX.Element {)}- const githubUrl = run ? githubRunUrl(run.repo.owner, run.repo.name, run.id) : null+ const githubUrl = run?.ci_engine === 'github_actions' ? githubRunUrl(run.repo.owner, run.repo.name, run.id) : nullconst verdict = run ? verdictTag(run.conclusion) : nullconst prNumber = run ? runPrNumber(run.pr_number, run.commit_pr_number) : nullconst prUrl =diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsxindex 80952000fd3b..b61e7d72e803 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx@@ -91,6 +91,10 @@ export const scene: SceneExport<WorkflowRunsLogicProps> = {const refreshing = (loading: boolean, rows: unknown[]): boolean => loading && rows.length > 0+function runRowKey(run: WorkflowRunRow): string {+ return `${run.ciEngine ?? ''}:${run.id}-${run.runAttempt}`+}+export function WorkflowRunsScene(): JSX.Element {const {runRows,@@ -160,7 +164,7 @@ export function WorkflowRunsScene(): JSX.Element {render: (_, run) => (<Linkto={withScope(- urls.engineeringAnalyticsWorkflowRun(run.repoOwner, run.repoName, run.id),+ urls.engineeringAnalyticsWorkflowRun(run.repoOwner, run.repoName, run.id, run.ciEngine),searchParams,sourceId)}@@ -461,7 +465,7 @@ export function WorkflowRunsScene(): JSX.Element {size="small"embeddedloading={runsLoading}- rowKey={(run) => `${run.id}-${run.runAttempt}`}+ rowKey={runRowKey}useURLForSorting={false}defaultSorting={{ columnKey: 'started', order: -1 }}pagination={{ pageSize: 25 }}@@ -469,18 +473,19 @@ export function WorkflowRunsScene(): JSX.Element {className: 'cursor-pointer',onClick: () =>setRunExpanded(- `${run.id}-${run.runAttempt}`,- !expandedRunKeys.includes(`${run.id}-${run.runAttempt}`),+ runRowKey(run),+ !expandedRunKeys.includes(runRowKey(run)),run.runId,- run.runAttempt+ run.runAttempt,+ run.ciEngine),})}expandable={{noIndent: true,- isRowExpanded: (run) => expandedRunKeys.includes(`${run.id}-${run.runAttempt}`),+ isRowExpanded: (run) => expandedRunKeys.includes(runRowKey(run)),expandedRowRender: (run) => (<GroupedJobsTable- jobs={runJobs[jobCacheKey(run.id, run.runAttempt)]}+ jobs={runJobs[jobCacheKey(run.id, run.runAttempt, run.ciEngine)]}loading={runJobsLoading}embedded/>diff --git a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.test.tsnew file mode 100644index 000000000000..4a80cb059667--- /dev/null+++ b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.test.ts@@ -0,0 +1,86 @@+import { expectLogic } from 'kea-test-utils'++import { ApiConfig } from 'lib/api'++import { initKeaTests } from '~/test/init'++import { engineeringAnalyticsPrRuns, engineeringAnalyticsWorkflowJobs } from '../generated/api'+import type { CIEngineEnumApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'+import { pullRequestDetailLogic } from './pullRequestDetailLogic'++jest.mock('../generated/api', () => ({+ engineeringAnalyticsPrLifecycle: jest.fn().mockResolvedValue(null),+ engineeringAnalyticsPrRuns: jest.fn(),+ engineeringAnalyticsPullRequestTimelines: jest.fn().mockResolvedValue(null),+ engineeringAnalyticsPrCost: jest.fn().mockResolvedValue(null),+ engineeringAnalyticsCiFailureLogs: jest.fn().mockResolvedValue(null),+ engineeringAnalyticsWorkflowJobs: jest.fn(),+}))++const mockRuns = engineeringAnalyticsPrRuns as jest.MockedFunction<typeof engineeringAnalyticsPrRuns>+const mockJobs = engineeringAnalyticsWorkflowJobs as jest.MockedFunction<typeof engineeringAnalyticsWorkflowJobs>++describe('pullRequestDetailLogic', () => {+ let logic: ReturnType<typeof pullRequestDetailLogic.build>++ beforeEach(() => {+ initKeaTests()+ ApiConfig.setCurrentProjectId(1)+ jest.clearAllMocks()+ })++ afterEach(() => logic?.unmount())++ it.each<CIEngineEnumApi>(['github_actions', 'depot_ci'])(+ 'shows cached failure labels and avoids duplicate job reads for %s',+ async (ciEngine) => {+ const run: WorkflowRunDetailApi = {+ repo: { provider: 'github', owner: 'PostHog', name: 'posthog' },+ id: 42,+ ci_engine: ciEngine,+ workflow_name: 'CI',+ head_sha: 'abc123',+ head_branch: 'main',+ status: 'completed',+ conclusion: 'failure',+ run_started_at: '2026-06-01T00:00:00Z',+ updated_at: '2026-06-01T00:05:00Z',+ duration_seconds: 300,+ run_attempt: 1,+ pr_number: 10,+ commit_pr_number: null,+ is_merge_queue: false,+ }+ const job: WorkflowJobApi = {+ id: 7,+ run_id: 42,+ ci_engine: ciEngine,+ name: 'Python tests',+ status: 'completed',+ conclusion: 'failure',+ started_at: run.run_started_at,+ completed_at: run.updated_at,+ duration_seconds: 300,+ runner_provider: 'self_hosted',+ runner_label: '16-core',+ estimated_cost_usd: 1,+ }+ mockRuns.mockResolvedValue([run])+ mockJobs.mockResolvedValue([job])+ logic = pullRequestDetailLogic({+ repoOwner: 'PostHog',+ repoName: 'posthog',+ number: 10,+ sourceId: null,+ })+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadJobsSuccess']).toFinishAllListeners()++ expect(logic.values.failingJobLabelByWorkflow).toEqual({ CI: 'Python tests' })+ expect(mockJobs).toHaveBeenCalledWith('1', expect.objectContaining({ run_id: 42, ci_engine: ciEngine }))++ await expectLogic(logic, () => logic.actions.loadPrRuns()).toFinishAllListeners()+ expect(mockJobs).toHaveBeenCalledTimes(1)+ }+ )+})diff --git a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.tsindex 255f22d6337e..b7e2982f1f21 100644--- a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts+++ b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts@@ -17,6 +17,7 @@ import {engineeringAnalyticsWorkflowJobs,} from '../generated/api'import type {+ CIEngineEnumApi,CIFailureLogsApi,PRCostSummaryApi,PRLifecycleApi,@@ -136,6 +137,7 @@ function toWorkflowRun(run: WorkflowRunDetailApi): WorkflowRun {finishedAt: run.status === 'completed' ? run.updated_at : null,durationSeconds: run.duration_seconds,runId: run.id,+ ciEngine: run.ci_engine,runAttempt: run.run_attempt,}}@@ -243,7 +245,16 @@ export interface pullRequestDetailLogicActions {friction: PullRequestFrictionDetailApipayload?: any}- loadJobs: ({ runId, runAttempt }: { runAttempt: number | null; runId: number }) => {+ loadJobs: ({+ ciEngine,+ runId,+ runAttempt,+ }: {+ ciEngine?: CIEngineEnumApi | null+ runAttempt: number | null+ runId: number+ }) => {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}@@ -257,12 +268,14 @@ export interface pullRequestDetailLogicActions {loadJobsSuccess: (runJobs: Record<string, WorkflowJobApi[]>,payload?: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}) => {runJobs: Record<string, WorkflowJobApi[]>payload?: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}@@ -331,8 +344,10 @@ export interface pullRequestDetailLogicActions {rowKey: string,expanded: boolean,runId: number | null,- runAttempt: number | null+ runAttempt: number | null,+ ciEngine?: CIEngineEnumApi | null) => {+ ciEngine: CIEngineEnumApi | null | undefinedexpanded: booleanrowKey: stringrunAttempt: number | null@@ -397,7 +412,14 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([actions({// Row expansion is keyed by a per-row key (re-runs share a run_id); jobs are fetched per run+attempt.- setRunExpanded: (rowKey: string, expanded: boolean, runId: number | null, runAttempt: number | null) => ({+ setRunExpanded: (+ rowKey: string,+ expanded: boolean,+ runId: number | null,+ runAttempt: number | null,+ ciEngine?: CIEngineEnumApi | null+ ) => ({+ ciEngine,rowKey,expanded,runId,@@ -485,19 +507,22 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([// The post-await read of values.runJobs (not a pre-await snapshot) keeps two// near-simultaneous first-expands from clobbering each other.loadJobs: async ({+ ciEngine,runId,runAttempt,}: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}): Promise<Record<string, WorkflowJobApi[]>> => {const jobs = await engineeringAnalyticsWorkflowJobs(projectId(), {run_id: runId,+ ci_engine: ciEngine ?? undefined,run_attempt: runAttempt ?? undefined,source_id: props.sourceId ?? undefined,repo: `${props.repoOwner}/${props.repoName}`,})- return { ...values.runJobs, [jobCacheKey(runId, runAttempt)]: jobs }+ return { ...values.runJobs, [jobCacheKey(runId, runAttempt, ciEngine)]: jobs }},},],@@ -542,9 +567,9 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([}),listeners(({ actions, values }) => ({- setRunExpanded: ({ expanded, runId, runAttempt }) => {- if (expanded && runId != null && !(jobCacheKey(runId, runAttempt) in values.runJobs)) {- actions.loadJobs({ runId, runAttempt })+ setRunExpanded: ({ expanded, runId, runAttempt, ciEngine }) => {+ if (expanded && runId != null && !(jobCacheKey(runId, runAttempt, ciEngine) in values.runJobs)) {+ actions.loadJobs({ runId, runAttempt, ciEngine })}},// Only a merged pull request has friction, so an open one skips the read.@@ -563,8 +588,11 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([.filter((run) => run.conclusion != null && !isPassingConclusion(run.conclusion)).slice(0, MAX_FAILING_JOB_FETCHES).forEach((run) => {- if (run.runId != null && !(jobCacheKey(run.runId, run.runAttempt) in values.runJobs)) {- actions.loadJobs({ runId: run.runId, runAttempt: run.runAttempt })+ if (+ run.runId != null &&+ !(jobCacheKey(run.runId, run.runAttempt, run.ciEngine) in values.runJobs)+ ) {+ actions.loadJobs({ runId: run.runId, runAttempt: run.runAttempt, ciEngine: run.ciEngine })}})},@@ -648,7 +676,7 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([(prCost: PRCostSummaryApi | null): Record<string, { minutes: number | null; cost: number | null }> => {const map: Record<string, { minutes: number | null; cost: number | null }> = {}for (const rc of prCost?.by_run ?? []) {- map[jobCacheKey(rc.run_id, rc.run_attempt)] = {+ map[jobCacheKey(rc.run_id, rc.run_attempt, rc.ci_engine)] = {minutes: rc.billable_minutes,cost: rc.estimated_cost_usd,}@@ -676,7 +704,7 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([if (run.conclusion == null || isPassingConclusion(run.conclusion) || run.runId == null) {continue}- const jobs = runJobs[jobCacheKey(run.runId, run.runAttempt)]+ const jobs = runJobs[jobCacheKey(run.runId, run.runAttempt, run.ciEngine)]if (!jobs) {continue}diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.tsindex 9ba9317e2c75..e26dc81091f8 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts@@ -6,7 +6,11 @@ import { urls } from 'scenes/urls'import { initKeaTests } from '~/test/init'-import { engineeringAnalyticsWorkflowJobs, engineeringAnalyticsWorkflowRun } from '../generated/api'+import {+ engineeringAnalyticsRunFailureLogs,+ engineeringAnalyticsWorkflowJobs,+ engineeringAnalyticsWorkflowRun,+} from '../generated/api'import type { WorkflowRunDetailApi } from '../generated/api.schemas'import { workflowRunDetailLogic } from './workflowRunDetailLogic'@@ -18,6 +22,7 @@ jest.mock('../generated/api', () => ({const mockRun = engineeringAnalyticsWorkflowRun as jest.MockedFunction<typeof engineeringAnalyticsWorkflowRun>const mockJobs = engineeringAnalyticsWorkflowJobs as jest.MockedFunction<typeof engineeringAnalyticsWorkflowJobs>+const mockLogs = engineeringAnalyticsRunFailureLogs as jest.MockedFunction<typeof engineeringAnalyticsRunFailureLogs>const RUN: WorkflowRunDetailApi = {repo: { provider: 'github', owner: 'PostHog', name: 'posthog' },@@ -49,6 +54,41 @@ describe('workflowRunDetailLogic', () => {afterEach(() => logic?.unmount())+ it('keeps colliding engine runs in separate logic instances and scopes all reads', async () => {+ const github = workflowRunDetailLogic({+ repoOwner: 'PostHog',+ repoName: 'posthog',+ runId: 42,+ ciEngine: 'github_actions',+ sourceId: null,+ })+ logic = workflowRunDetailLogic({+ repoOwner: 'PostHog',+ repoName: 'posthog',+ runId: 42,+ ciEngine: 'depot_ci',+ sourceId: null,+ })+ expect(logic).not.toBe(github)+ mockRun.mockResolvedValue({ ...RUN, conclusion: 'failure', ci_engine: 'depot_ci' })+ mockLogs.mockResolvedValue({+ run_id: 42,+ ci_engine: 'depot_ci',+ logs_available: false,+ jobs: [],+ truncated: false,+ })+ logic.mount()+ await expectLogic(logic).toDispatchActionsInAnyOrder([+ 'loadRunSuccess',+ 'loadJobsSuccess',+ 'loadFailureLogsSuccess',+ ])+ for (const read of [mockRun, mockJobs, mockLogs]) {+ expect(read).toHaveBeenCalledWith('1', expect.objectContaining({ run_id: 42, ci_engine: 'depot_ci' }))+ }+ })+it('links the loaded workflow breadcrumb back with the current scope', async () => {router.actions.push(urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', 42), {source: 'source-1',diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.tsindex eb1a7644cf1a..057d4d89d7bb 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts@@ -12,7 +12,7 @@ import {engineeringAnalyticsWorkflowJobs,engineeringAnalyticsWorkflowRun,} from '../generated/api'-import type { RunFailureLogsApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'+import type { CIEngineEnumApi, RunFailureLogsApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'import { isDecisiveFailure } from '../lib/lifecycle'import { RunCostSummary, summarizeRunCost } from '../lib/runHealth'import { withScope } from '../lib/scope'@@ -23,6 +23,7 @@ export interface WorkflowRunDetailLogicProps {repoOwner: stringrepoName: stringrunId: number+ ciEngine?: CIEngineEnumApi | null// Which GitHub source the list was scoped to, threaded from `?source=` via paramsToProps.sourceId: string | null}@@ -121,7 +122,10 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'workflowRunDetailLogic']),props({} as WorkflowRunDetailLogicProps),// sourceId is part of the identity: the same run id only exists within one source.- key((props) => `${props.repoOwner}/${props.repoName}/runs/${props.runId}@${props.sourceId ?? ''}`),+ key(+ (props) =>+ `${props.repoOwner}/${props.repoName}/runs/${props.ciEngine ?? ''}/${props.runId}@${props.sourceId ?? ''}`+ ),loaders(({ props, values }) => ({run: [@@ -130,6 +134,7 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([loadRun: async (): Promise<WorkflowRunDetailApi | null> =>await engineeringAnalyticsWorkflowRun(projectId(), {run_id: props.runId,+ ci_engine: props.ciEngine ?? undefined,source_id: props.sourceId ?? undefined,repo: `${props.repoOwner}/${props.repoName}`,}),@@ -143,6 +148,7 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([loadJobs: async (): Promise<WorkflowJobApi[]> =>await engineeringAnalyticsWorkflowJobs(projectId(), {run_id: props.runId,+ ci_engine: props.ciEngine ?? undefined,run_attempt: values.run?.run_attempt ?? undefined,source_id: props.sourceId ?? undefined,repo: `${props.repoOwner}/${props.repoName}`,@@ -157,6 +163,7 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([try {return await engineeringAnalyticsRunFailureLogs(projectId(), {run_id: props.runId,+ ci_engine: props.ciEngine ?? undefined,source_id: props.sourceId ?? undefined,repo: `${props.repoOwner}/${props.repoName}`,})diff --git a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.tsindex 37bb99e37f12..caa98eb0a140 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts@@ -25,6 +25,7 @@ import type {WorkflowRunDetailApi,WorkflowRunnerCostApi,} from '../generated/api.schemas'+import type { CIEngineEnumApi } from '../generated/api.schemas'import { jobCacheKey } from '../lib/jobs'import { type CostSummary, type HealthSummary, computeHealthSummary, workflowHealthSummary } from '../lib/runHealth'import { withScope } from '../lib/scope'@@ -38,6 +39,7 @@ const RUN_LIST_LIMIT = 200/** RunRowBase fields plus this page's lead-column data (run id, branch, attributed PR). */export interface WorkflowRunRow {+ ciEngine?: CIEngineEnumApi | nullrunId: number | nullrunAttempt: number | nullconclusion: string | null@@ -115,7 +117,16 @@ export interface workflowRunsLogicActions {jobAggregates: WorkflowJobAggregateApi[]payload?: any}- loadJobs: ({ runId, runAttempt }: { runAttempt: number | null; runId: number }) => {+ loadJobs: ({+ ciEngine,+ runId,+ runAttempt,+ }: {+ ciEngine?: CIEngineEnumApi | null+ runAttempt: number | null+ runId: number+ }) => {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}@@ -129,12 +140,14 @@ export interface workflowRunsLogicActions {loadJobsSuccess: (runJobs: Record<string, WorkflowJobApi[]>,payload?: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}) => {runJobs: Record<string, WorkflowJobApi[]>payload?: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}@@ -203,8 +216,10 @@ export interface workflowRunsLogicActions {rowKey: string,expanded: boolean,runId: number | null,- runAttempt: number | null+ runAttempt: number | null,+ ciEngine?: CIEngineEnumApi | null) => {+ ciEngine: CIEngineEnumApi | null | undefinedexpanded: booleanrowKey: stringrunAttempt: number | null@@ -258,7 +273,14 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([actions({// Row expansion is keyed by a per-row key (re-runs share a run_id); jobs are fetched per run+attempt.- setRunExpanded: (rowKey: string, expanded: boolean, runId: number | null, runAttempt: number | null) => ({+ setRunExpanded: (+ rowKey: string,+ expanded: boolean,+ runId: number | null,+ runAttempt: number | null,+ ciEngine?: CIEngineEnumApi | null+ ) => ({+ ciEngine,rowKey,expanded,runId,@@ -349,19 +371,22 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([{// Reads the post-await values.runJobs so near-simultaneous first-expands don't clobber.loadJobs: async ({+ ciEngine,runId,runAttempt,}: {+ ciEngine?: CIEngineEnumApi | nullrunId: numberrunAttempt: number | null}): Promise<Record<string, WorkflowJobApi[]>> => {const jobs = await engineeringAnalyticsWorkflowJobs(projectId(), {run_id: runId,+ ci_engine: ciEngine ?? undefined,run_attempt: runAttempt ?? undefined,source_id: props.sourceId ?? undefined,repo: `${props.repoOwner}/${props.repoName}`,})- return { ...values.runJobs, [jobCacheKey(runId, runAttempt)]: jobs }+ return { ...values.runJobs, [jobCacheKey(runId, runAttempt, ciEngine)]: jobs }},},],@@ -446,6 +471,7 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([(runs: WorkflowRunDetailApi[]): WorkflowRunRow[] =>runs.map((run) => ({runId: run.id,+ ciEngine: run.ci_engine,runAttempt: run.run_attempt,conclusion: run.conclusion,durationSeconds: run.duration_seconds,@@ -463,6 +489,7 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([(runActivity: WorkflowRunActivityApi): ActivityRun[] =>runActivity.points.map((point) => ({runId: point.run_id,+ ciEngine: point.ci_engine,conclusion: point.conclusion,startedAt: point.run_started_at,durationSeconds: point.duration_seconds,@@ -569,9 +596,9 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([}),listeners(({ actions, values }) => ({- setRunExpanded: ({ expanded, runId, runAttempt }) => {- if (expanded && runId != null && !(jobCacheKey(runId, runAttempt) in values.runJobs)) {- actions.loadJobs({ runId, runAttempt })+ setRunExpanded: ({ expanded, runId, runAttempt, ciEngine }) => {+ if (expanded && runId != null && !(jobCacheKey(runId, runAttempt, ciEngine) in values.runJobs)) {+ actions.loadJobs({ runId, runAttempt, ciEngine })}},[engineeringAnalyticsFiltersLogic.actionTypes.setDateRange]: () => {diff --git a/products/engineering_analytics/manifest.tsx b/products/engineering_analytics/manifest.tsxindex 9a92827914b6..751e645386c5 100644--- a/products/engineering_analytics/manifest.tsx+++ b/products/engineering_analytics/manifest.tsx@@ -108,8 +108,13 @@ export const manifest: ProductManifest = {`/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,engineeringAnalyticsPullRequest: (repoOwner: string, repoName: string, number: number | string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}`,- engineeringAnalyticsWorkflowRun: (repoOwner: string, repoName: string, runId: number | string): string =>- `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}`,+ engineeringAnalyticsWorkflowRun: (+ repoOwner: string,+ repoName: string,+ runId: number | string,+ ciEngine?: string | null+ ): string =>+ `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}${ciEngine ? `?ci_engine=${encodeURIComponent(ciEngine)}` : ''}`,engineeringAnalyticsWorkflowRuns: (repoOwner: string, repoName: string, workflowName: string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/workflows/${encodeURIComponent(workflowName)}`,engineeringAnalyticsAuthor: (handle: string): string =>diff --git a/products/engineering_analytics/mcp/tools.yaml b/products/engineering_analytics/mcp/tools.yamlindex c1d41f104772..935dbf5a83e9 100644--- a/products/engineering_analytics/mcp/tools.yaml+++ b/products/engineering_analytics/mcp/tools.yaml@@ -42,8 +42,8 @@ tools:and already spreading across branches, not on trunk yet), potentially_resolved (hit trunk but that job isgreen again), flaky (sporadic across two or more branches over more than a day), or pr_only (confined to onebranch: one PR's own problem). Also returns breaking_master_jobs, the default-branch jobs whose latest run- is red. Pass a row's latest_run_id to run-failure-logs to read the actual failing lines. Caveats:- fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and the+ is red. Pass a row's latest_run_id and latest_ci_engine to run-failure-logs to read the failing lines.+ Caveats: fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and thebreaking/resolved distinction needs the job-level source synced: without it those failures fall through toflaky/pr_only rather than being misreported. Counts are absolute, never rates (passing runs aren't in thisdata).@@ -69,7 +69,7 @@ tools:its workflow runs across every push (via the pull_requests association, not the latest commit), so earlierpushes' failures are included too. logs_available is false when CI hasn't failed, the logs aged out of theshort Logs retention, or a fork PR has no run association to resolve. Use pr-runs or workflow-jobs for the- run/job metadata behind these logs.+ run/job metadata behind these logs. Jobs carry ci_engine; null means unknown historical provenance.feature_flag: engineering-analyticsengineering-analytics-ci-signals-config-retrieve:operation: engineering_analytics_ci_signals_config_retrieve@@ -169,7 +169,8 @@ tools:per-vCPU price ladder, and excludes non-Linux and provider-hosted jobs. jobs_available is false when thejob-level source isn't synced yet: every figure is then zero/null, so check it before trusting a $0.00.estimated_cost_usd is null (not zero) when nothing was costable, and unsettled_jobs counts billable jobs- still running that are left out of the estimate.+ still running that are left out of the estimate. Key by_run by (ci_engine, run_id, run_attempt). This covers+ curated work and excludes suppressed relay/wait overhead; it is not an invoice total.feature_flag: engineering-analyticsengineering-analytics-pr-runs:operation: engineering_analytics_pr_runs@@ -212,7 +213,8 @@ tools:surrounding context, with "... N lines omitted ..." markers) as ordered lines, every line carrying itsoriginal 1-based line number in the full pre-thinning log. logs_available is false when the run didn't failor its logs aged out of the short Logs retention. Use ci-failure-logs instead when you have a PR number and- want all its runs' failures.+ want all its runs' failures. Pass ci_engine with run_id (latest_ci_engine for a triage row). Ambiguous+ integer IDs return 400. Null engine means unknown historical provenance.feature_flag: engineering-analyticsengineering-analytics-sources:operation: engineering_analytics_sources@@ -298,7 +300,7 @@ tools:time and money job-by-job, or to find the slow or expensive job in a run. Scoped to one run_attempt (thelatest unless you pass run_attempt) so a re-run's attempts don't merge. estimated_cost_usd is null for freeGitHub-hosted, non-Linux, or unfinished jobs. Returns an empty list when the job-level source isn't synced- yet.+ yet. Pass ci_engine with run_id when following an engine-qualified run; ambiguous integer IDs return 400.feature_flag: engineering-analyticsengineering-analytics-workflow-run:operation: engineering_analytics_workflow_run@@ -322,7 +324,8 @@ tools:spend first. Each row is a tier (provider + runner_label) with its job_count, billable_minutes, andestimated_cost_usd. Use this for "which runner tier drives this workflow's CI bill" and to spot oversizedrunners. Billable self-hosted Linux tiers carry a cost; github-hosted and non-Linux rows are null. Returns- an empty list when the job-level source isn't synced yet.+ an empty list when the job-level source isn't synced yet. Suppressed relay and wait overhead is excluded;+ these curated estimates are not invoice totals.feature_flag: engineering-analyticsengineering-analytics-workflow-runs:operation: engineering_analytics_workflow_runsdiff --git a/products/engineering_analytics/skills/investigating-ci-failures/SKILL.md b/products/engineering_analytics/skills/investigating-ci-failures/SKILL.mdindex 394b3c3cb0db..906d9022c8db 100644--- a/products/engineering_analytics/skills/investigating-ci-failures/SKILL.md+++ b/products/engineering_analytics/skills/investigating-ci-failures/SKILL.md@@ -107,6 +107,8 @@ threshold aren't recorded, so there is no honest denominator.failure logs but are not in `ci_failures`. For those, fall back to the raw failure logs via the`engineering-analytics-ci-failure-logs` (PR-scoped) / `engineering-analytics-run-failure-logs`(run-scoped) MCP tools.+ Carry `ci_engine` with `run_id`, or `latest_ci_engine` with `latest_run_id`, when fetching a run.+ A null engine means unknown historical provenance; do not join it to a known engine by integer ID.- **A job that failed before its tests ran is invisible to every test-level surface.** No `FAILED`line means no fingerprint, no span, nothing for the flaky-tests tool to read — the failure is realbut the test-level answer is silence, not "fine". Setup, docker, and runner failures are onlydiff --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 753283d7e559..ef8484ca16f3 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@@ -64,7 +64,7 @@ The actual error lines behind a fingerprint, newest first — for reading the trconfirming two occurrences really are the same failure.```sql-SELECT timestamp, branch, substring(head_sha, 1, 11) AS sha, run_id, job_name, error_signature+SELECT timestamp, branch, substring(head_sha, 1, 11) AS sha, ci_engine, run_id, job_name, error_signatureFROM engineering_analytics_ci_failuresWHERE timestamp >= now() - INTERVAL 14 DAYAND fingerprint = '<fingerprint from query 1>'@@ -72,8 +72,9 @@ ORDER BY timestamp DESCLIMIT 50```-`run_id` links each row to `ci_job_history` (and to the GitHub UI:-`https://github.com/<owner>/<repo>/actions/runs/<run_id>`).+Join runs on `(ci_engine, run_id)`. Only `github_actions` IDs link to+`https://github.com/<owner>/<repo>/actions/runs/<run_id>`. Historical logs with a null engine+have unknown provenance; do not infer their engine or use them to prove retry recovery.## 4. What's new on master (novelty scan)@@ -110,24 +111,25 @@ fingerprint ever appeared are considered.```sqlSELECT+ h.ci_engine,h.run_id,h.run_attempt,h.conclusion AS job_conclusion,f.run_id != 0 AS fingerprint_presentFROM engineering_analytics_ci_job_history AS hLEFT JOIN (- SELECT DISTINCT run_id, run_attempt+ SELECT DISTINCT ci_engine, run_id, run_attemptFROM engineering_analytics_ci_failuresWHERE timestamp >= now() - INTERVAL 7 DAY AND fingerprint = '<fingerprint from query 1>'-) AS f ON h.run_id = f.run_id AND h.run_attempt = f.run_attempt+) AS f ON h.ci_engine = f.ci_engine AND h.run_id = f.run_id AND h.run_attempt = f.run_attemptWHERE h.job_name = '<failing job name>'AND h.created_at >= now() - INTERVAL 7 DAYAND h.created_at_raw >= '<8 days ago, YYYY-MM-DD>'- AND h.run_id IN (- SELECT DISTINCT run_id FROM engineering_analytics_ci_failures+ AND (h.ci_engine, h.run_id) IN (+ SELECT DISTINCT ci_engine, run_id FROM engineering_analytics_ci_failuresWHERE timestamp >= now() - INTERVAL 7 DAY AND fingerprint = '<fingerprint from query 1>')-ORDER BY h.run_id, h.run_attempt+ORDER BY h.ci_engine, h.run_id, h.run_attempt```Reading: `fingerprint_present` dropping on a later attempt while the job goes green = retry-passed@@ -196,7 +198,7 @@ The `trunk-merge/pr-<n>/<uuid>` branch is ephemeral, but the jobs it ran stay inunder that `head_branch`. One row per job attempt, failures first:```sql-SELECT head_branch, run_id, workflow_name, job_name, conclusion, created_at+SELECT head_branch, ci_engine, run_id, workflow_name, job_name, conclusion, created_atFROM engineering_analytics_ci_job_historyWHERE startsWith(head_branch, 'trunk-merge/pr-<n>/')AND created_at >= now() - INTERVAL 7 DAYdiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 83ffaf2dec58..29eaefecacf7 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -4235,7 +4235,7 @@}},"engineering-analytics-broken-tests": {- "description": "Live CI failures over the last 2 days, grouped into distinct failures (by failing test id + a normalized error signature) and classified by how each is behaving right now, most urgent first. Reach for this to answer \"what CI failures should I care about right now\": it is the triage counterpart to the test-health queue (which ranks week-long unreliability). Each row's state is the verdict: breaking_master (failing on the default branch and that job's latest run is still red, so trunk is broken now), blocking_merge_queue (failing only on merge-queue gate branches, so it stopped a merge on a commit that had already passed the PR's own CI: the conflict-with-trunk class the queue exists to catch), novel_burst (first seen within a day and already spreading across branches, not on trunk yet), potentially_resolved (hit trunk but that job is green again), flaky (sporadic across two or more branches over more than a day), or pr_only (confined to one branch: one PR's own problem). Also returns breaking_master_jobs, the default-branch jobs whose latest run is red. Pass a row's latest_run_id to run-failure-logs to read the actual failing lines. Caveats: fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and the breaking/resolved distinction needs the job-level source synced: without it those failures fall through to flaky/pr_only rather than being misreported. Counts are absolute, never rates (passing runs aren't in this data).",+ "description": "Live CI failures over the last 2 days, grouped into distinct failures (by failing test id + a normalized error signature) and classified by how each is behaving right now, most urgent first. Reach for this to answer \"what CI failures should I care about right now\": it is the triage counterpart to the test-health queue (which ranks week-long unreliability). Each row's state is the verdict: breaking_master (failing on the default branch and that job's latest run is still red, so trunk is broken now), blocking_merge_queue (failing only on merge-queue gate branches, so it stopped a merge on a commit that had already passed the PR's own CI: the conflict-with-trunk class the queue exists to catch), novel_burst (first seen within a day and already spreading across branches, not on trunk yet), potentially_resolved (hit trunk but that job is green again), flaky (sporadic across two or more branches over more than a day), or pr_only (confined to one branch: one PR's own problem). Also returns breaking_master_jobs, the default-branch jobs whose latest run is red. Pass a row's latest_run_id and latest_ci_engine to run-failure-logs to read the failing lines. Caveats: fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and the breaking/resolved distinction needs the job-level source synced: without it those failures fall through to flaky/pr_only rather than being misreported. Counts are absolute, never rates (passing runs aren't in this data).","category": "Engineering analytics","feature": "engineering_analytics","summary": "Broken tests triage",@@ -4250,7 +4250,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-ci-failure-logs": {- "description": "The thinned CI failure logs for a pull request, grouped by failed job: reach for this to answer \"why did this PR's CI fail\". Each failed job returns its failure region (the error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, and every line carries its original 1-based line number in the full pre-thinning log so you can locate it in the raw GitHub log. The PR is resolved to ALL its workflow runs across every push (via the pull_requests association, not the latest commit), so earlier pushes' failures are included too. logs_available is false when CI hasn't failed, the logs aged out of the short Logs retention, or a fork PR has no run association to resolve. Use pr-runs or workflow-jobs for the run/job metadata behind these logs.",+ "description": "The thinned CI failure logs for a pull request, grouped by failed job: reach for this to answer \"why did this PR's CI fail\". Each failed job returns its failure region (the error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, and every line carries its original 1-based line number in the full pre-thinning log so you can locate it in the raw GitHub log. The PR is resolved to ALL its workflow runs across every push (via the pull_requests association, not the latest commit), so earlier pushes' failures are included too. logs_available is false when CI hasn't failed, the logs aged out of the short Logs retention, or a fork PR has no run association to resolve. Use pr-runs or workflow-jobs for the run/job metadata behind these logs. Jobs carry ci_engine; null means unknown historical provenance.","category": "Engineering analytics","feature": "engineering_analytics","summary": "CI failure logs for a PR",@@ -4280,7 +4280,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-pr-cost": {- "description": "Estimated CI dollar cost of one pull request, summed over the jobs of all its workflow runs, with breakdowns per workflow (by_workflow) and per run (by_run). Reach for this instead of summing runner minutes by hand: the estimate already classifies runners (billable self-hosted Linux vs free GitHub-hosted), applies the per-vCPU price ladder, and excludes non-Linux and provider-hosted jobs. jobs_available is false when the job-level source isn't synced yet: every figure is then zero/null, so check it before trusting a $0.00. estimated_cost_usd is null (not zero) when nothing was costable, and unsettled_jobs counts billable jobs still running that are left out of the estimate.",+ "description": "Estimated CI dollar cost of one pull request, summed over the jobs of all its workflow runs, with breakdowns per workflow (by_workflow) and per run (by_run). Reach for this instead of summing runner minutes by hand: the estimate already classifies runners (billable self-hosted Linux vs free GitHub-hosted), applies the per-vCPU price ladder, and excludes non-Linux and provider-hosted jobs. jobs_available is false when the job-level source isn't synced yet: every figure is then zero/null, so check it before trusting a $0.00. estimated_cost_usd is null (not zero) when nothing was costable, and unsettled_jobs counts billable jobs still running that are left out of the estimate. Key by_run by (ci_engine, run_id, run_attempt). This covers curated work and excludes suppressed relay/wait overhead; it is not an invoice total.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Estimated CI cost of a PR",@@ -4295,7 +4295,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-run-failure-logs": {- "description": "The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci-failure-logs, for when you have a run id rather than a PR (default-branch failures, the broken-tests panel's latest_run_id, the run page). Each failed job returns its failure region (error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, every line carrying its original 1-based line number in the full pre-thinning log. logs_available is false when the run didn't fail or its logs aged out of the short Logs retention. Use ci-failure-logs instead when you have a PR number and want all its runs' failures.",+ "description": "The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci-failure-logs, for when you have a run id rather than a PR (default-branch failures, the broken-tests panel's latest_run_id, the run page). Each failed job returns its failure region (error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, every line carrying its original 1-based line number in the full pre-thinning log. logs_available is false when the run didn't fail or its logs aged out of the short Logs retention. Use ci-failure-logs instead when you have a PR number and want all its runs' failures. Pass ci_engine with run_id (latest_ci_engine for a triage row). Ambiguous integer IDs return 400. Null engine means unknown historical provenance.","category": "Engineering analytics","feature": "engineering_analytics","summary": "CI failure logs for a run",@@ -4340,7 +4340,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-workflow-jobs": {- "description": "The jobs of a single workflow run attempt, each with its status, conclusion, wall-clock duration_seconds, runner tier (runner_provider / runner_label), and estimated_cost_usd. Use this to see where a run spent its time and money job-by-job, or to find the slow or expensive job in a run. Scoped to one run_attempt (the latest unless you pass run_attempt) so a re-run's attempts don't merge. estimated_cost_usd is null for free GitHub-hosted, non-Linux, or unfinished jobs. Returns an empty list when the job-level source isn't synced yet.",+ "description": "The jobs of a single workflow run attempt, each with its status, conclusion, wall-clock duration_seconds, runner tier (runner_provider / runner_label), and estimated_cost_usd. Use this to see where a run spent its time and money job-by-job, or to find the slow or expensive job in a run. Scoped to one run_attempt (the latest unless you pass run_attempt) so a re-run's attempts don't merge. estimated_cost_usd is null for free GitHub-hosted, non-Linux, or unfinished jobs. Returns an empty list when the job-level source isn't synced yet. Pass ci_engine with run_id when following an engine-qualified run; ambiguous integer IDs return 400.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Jobs of a workflow run",@@ -4355,7 +4355,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-workflow-runner-costs": {- "description": "One workflow's estimated CI cost broken down by runner tier over a window (date_from default -30d), highest spend first. Each row is a tier (provider + runner_label) with its job_count, billable_minutes, and estimated_cost_usd. Use this for \"which runner tier drives this workflow's CI bill\" and to spot oversized runners. Billable self-hosted Linux tiers carry a cost; github-hosted and non-Linux rows are null. Returns an empty list when the job-level source isn't synced yet.",+ "description": "One workflow's estimated CI cost broken down by runner tier over a window (date_from default -30d), highest spend first. Each row is a tier (provider + runner_label) with its job_count, billable_minutes, and estimated_cost_usd. Use this for \"which runner tier drives this workflow's CI bill\" and to spot oversized runners. Billable self-hosted Linux tiers carry a cost; github-hosted and non-Linux rows are null. Returns an empty list when the job-level source isn't synced yet. Suppressed relay and wait overhead is excluded; these curated estimates are not invoice totals.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Workflow cost by runner tier",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 15bea546b625..52e984ea91a5 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -4264,7 +4264,7 @@}},"engineering-analytics-broken-tests": {- "description": "Live CI failures over the last 2 days, grouped into distinct failures (by failing test id + a normalized error signature) and classified by how each is behaving right now, most urgent first. Reach for this to answer \"what CI failures should I care about right now\": it is the triage counterpart to the test-health queue (which ranks week-long unreliability). Each row's state is the verdict: breaking_master (failing on the default branch and that job's latest run is still red, so trunk is broken now), blocking_merge_queue (failing only on merge-queue gate branches, so it stopped a merge on a commit that had already passed the PR's own CI: the conflict-with-trunk class the queue exists to catch), novel_burst (first seen within a day and already spreading across branches, not on trunk yet), potentially_resolved (hit trunk but that job is green again), flaky (sporadic across two or more branches over more than a day), or pr_only (confined to one branch: one PR's own problem). Also returns breaking_master_jobs, the default-branch jobs whose latest run is red. Pass a row's latest_run_id to run-failure-logs to read the actual failing lines. Caveats: fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and the breaking/resolved distinction needs the job-level source synced: without it those failures fall through to flaky/pr_only rather than being misreported. Counts are absolute, never rates (passing runs aren't in this data).",+ "description": "Live CI failures over the last 2 days, grouped into distinct failures (by failing test id + a normalized error signature) and classified by how each is behaving right now, most urgent first. Reach for this to answer \"what CI failures should I care about right now\": it is the triage counterpart to the test-health queue (which ranks week-long unreliability). Each row's state is the verdict: breaking_master (failing on the default branch and that job's latest run is still red, so trunk is broken now), blocking_merge_queue (failing only on merge-queue gate branches, so it stopped a merge on a commit that had already passed the PR's own CI: the conflict-with-trunk class the queue exists to catch), novel_burst (first seen within a day and already spreading across branches, not on trunk yet), potentially_resolved (hit trunk but that job is green again), flaky (sporadic across two or more branches over more than a day), or pr_only (confined to one branch: one PR's own problem). Also returns breaking_master_jobs, the default-branch jobs whose latest run is red. Pass a row's latest_run_id and latest_ci_engine to run-failure-logs to read the failing lines. Caveats: fingerprinting is pytest-only for now (jest/playwright/cargo failures aren't grouped yet), and the breaking/resolved distinction needs the job-level source synced: without it those failures fall through to flaky/pr_only rather than being misreported. Counts are absolute, never rates (passing runs aren't in this data).","category": "Engineering analytics","feature": "engineering_analytics","summary": "Broken tests triage",@@ -4279,7 +4279,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-ci-failure-logs": {- "description": "The thinned CI failure logs for a pull request, grouped by failed job: reach for this to answer \"why did this PR's CI fail\". Each failed job returns its failure region (the error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, and every line carries its original 1-based line number in the full pre-thinning log so you can locate it in the raw GitHub log. The PR is resolved to ALL its workflow runs across every push (via the pull_requests association, not the latest commit), so earlier pushes' failures are included too. logs_available is false when CI hasn't failed, the logs aged out of the short Logs retention, or a fork PR has no run association to resolve. Use pr-runs or workflow-jobs for the run/job metadata behind these logs.",+ "description": "The thinned CI failure logs for a pull request, grouped by failed job: reach for this to answer \"why did this PR's CI fail\". Each failed job returns its failure region (the error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, and every line carries its original 1-based line number in the full pre-thinning log so you can locate it in the raw GitHub log. The PR is resolved to ALL its workflow runs across every push (via the pull_requests association, not the latest commit), so earlier pushes' failures are included too. logs_available is false when CI hasn't failed, the logs aged out of the short Logs retention, or a fork PR has no run association to resolve. Use pr-runs or workflow-jobs for the run/job metadata behind these logs. Jobs carry ci_engine; null means unknown historical provenance.","category": "Engineering analytics","feature": "engineering_analytics","summary": "CI failure logs for a PR",@@ -4309,7 +4309,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-pr-cost": {- "description": "Estimated CI dollar cost of one pull request, summed over the jobs of all its workflow runs, with breakdowns per workflow (by_workflow) and per run (by_run). Reach for this instead of summing runner minutes by hand: the estimate already classifies runners (billable self-hosted Linux vs free GitHub-hosted), applies the per-vCPU price ladder, and excludes non-Linux and provider-hosted jobs. jobs_available is false when the job-level source isn't synced yet: every figure is then zero/null, so check it before trusting a $0.00. estimated_cost_usd is null (not zero) when nothing was costable, and unsettled_jobs counts billable jobs still running that are left out of the estimate.",+ "description": "Estimated CI dollar cost of one pull request, summed over the jobs of all its workflow runs, with breakdowns per workflow (by_workflow) and per run (by_run). Reach for this instead of summing runner minutes by hand: the estimate already classifies runners (billable self-hosted Linux vs free GitHub-hosted), applies the per-vCPU price ladder, and excludes non-Linux and provider-hosted jobs. jobs_available is false when the job-level source isn't synced yet: every figure is then zero/null, so check it before trusting a $0.00. estimated_cost_usd is null (not zero) when nothing was costable, and unsettled_jobs counts billable jobs still running that are left out of the estimate. Key by_run by (ci_engine, run_id, run_attempt). This covers curated work and excludes suppressed relay/wait overhead; it is not an invoice total.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Estimated CI cost of a PR",@@ -4324,7 +4324,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-run-failure-logs": {- "description": "The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci-failure-logs, for when you have a run id rather than a PR (default-branch failures, the broken-tests panel's latest_run_id, the run page). Each failed job returns its failure region (error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, every line carrying its original 1-based line number in the full pre-thinning log. logs_available is false when the run didn't fail or its logs aged out of the short Logs retention. Use ci-failure-logs instead when you have a PR number and want all its runs' failures.",+ "description": "The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci-failure-logs, for when you have a run id rather than a PR (default-branch failures, the broken-tests panel's latest_run_id, the run page). Each failed job returns its failure region (error lines plus surrounding context, with \"... N lines omitted ...\" markers) as ordered lines, every line carrying its original 1-based line number in the full pre-thinning log. logs_available is false when the run didn't fail or its logs aged out of the short Logs retention. Use ci-failure-logs instead when you have a PR number and want all its runs' failures. Pass ci_engine with run_id (latest_ci_engine for a triage row). Ambiguous integer IDs return 400. Null engine means unknown historical provenance.","category": "Engineering analytics","feature": "engineering_analytics","summary": "CI failure logs for a run",@@ -4369,7 +4369,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-workflow-jobs": {- "description": "The jobs of a single workflow run attempt, each with its status, conclusion, wall-clock duration_seconds, runner tier (runner_provider / runner_label), and estimated_cost_usd. Use this to see where a run spent its time and money job-by-job, or to find the slow or expensive job in a run. Scoped to one run_attempt (the latest unless you pass run_attempt) so a re-run's attempts don't merge. estimated_cost_usd is null for free GitHub-hosted, non-Linux, or unfinished jobs. Returns an empty list when the job-level source isn't synced yet.",+ "description": "The jobs of a single workflow run attempt, each with its status, conclusion, wall-clock duration_seconds, runner tier (runner_provider / runner_label), and estimated_cost_usd. Use this to see where a run spent its time and money job-by-job, or to find the slow or expensive job in a run. Scoped to one run_attempt (the latest unless you pass run_attempt) so a re-run's attempts don't merge. estimated_cost_usd is null for free GitHub-hosted, non-Linux, or unfinished jobs. Returns an empty list when the job-level source isn't synced yet. Pass ci_engine with run_id when following an engine-qualified run; ambiguous integer IDs return 400.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Jobs of a workflow run",@@ -4384,7 +4384,7 @@"feature_flag": "engineering-analytics"},"engineering-analytics-workflow-runner-costs": {- "description": "One workflow's estimated CI cost broken down by runner tier over a window (date_from default -30d), highest spend first. Each row is a tier (provider + runner_label) with its job_count, billable_minutes, and estimated_cost_usd. Use this for \"which runner tier drives this workflow's CI bill\" and to spot oversized runners. Billable self-hosted Linux tiers carry a cost; github-hosted and non-Linux rows are null. Returns an empty list when the job-level source isn't synced yet.",+ "description": "One workflow's estimated CI cost broken down by runner tier over a window (date_from default -30d), highest spend first. Each row is a tier (provider + runner_label) with its job_count, billable_minutes, and estimated_cost_usd. Use this for \"which runner tier drives this workflow's CI bill\" and to spot oversized runners. Billable self-hosted Linux tiers carry a cost; github-hosted and non-Linux rows are null. Returns an empty list when the job-level source isn't synced yet. Suppressed relay and wait overhead is excluded; these curated estimates are not invoice totals.","category": "Engineering analytics","feature": "engineering_analytics","summary": "Workflow cost by runner tier",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 15e8a39be60e..9ca3be02176a 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -18101,6 +18101,18 @@ export namespace Schemas {ready_at: string | null;}+ /**+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI+ */+ export type CIEngineEnum = typeof CIEngineEnum[keyof typeof CIEngineEnum];+++ export const CIEngineEnum = {+ GithubActions: 'github_actions',+ DepotCi: 'depot_ci',+ } as const;+/*** * `breaking_master` - BREAKING_MASTER* * `blocking_merge_queue` - BLOCKING_MERGE_QUEUE@@ -18122,6 +18134,11 @@ export namespace Schemas {} as const;export interface BrokenTestRow {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnum | null;/** Stable identity of this distinct failure: the failing test's node id plus a normalized error signature, so the same failure across runs groups into one row. */fingerprint: string;/** The pytest node id from the CI 'FAILED <id>' line: the failing test. */@@ -18672,9 +18689,14 @@ export namespace Schemas {}export interface CIJobFailureLog {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;/** The thinned failure-log lines in original order, with omission markers. */lines: CIFailureLogLine[];- /** GitHub Actions job id of the failed job. */+ /** Integer job id of the failed job; unique only together with ci_engine. */job_id: number;/** Workflow run id the job belongs to. */run_id: number;@@ -62310,6 +62332,11 @@ export namespace Schemas {}export interface MasterFailureGroup {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnum | null;/** Repository the failures occurred in. */repo: RepoRef;/** GitHub Actions workflow name the failing runs belong to. */@@ -65719,7 +65746,12 @@ export namespace Schemas {}export interface RunCost {- /** GitHub Actions run id this cost is for. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;+ /** Integer run id this cost is for; unique only together with ci_engine. */run_id: number;/** Re-run attempt number; 1 for the first attempt. */run_attempt: number;@@ -65823,6 +65855,11 @@ export namespace Schemas {} as const;export interface PRLifecycleEvent {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;/** Event kind: opened, ready_for_review, converted_to_draft, ci_started, ci_finished, merged, or closed.** * `opened` - OPENED@@ -91581,6 +91618,11 @@ export namespace Schemas {}export interface RunFailureLogs {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;/** Failed CI jobs of this run with their thinned failure logs, grouped by job. */jobs: CIJobFailureLog[];/** Workflow run id the failure logs are for. */@@ -106770,6 +106812,11 @@ export namespace Schemas {}export interface WorkflowHealthItem {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ latest_ci_engine?: CIEngineEnum | null;/** Repository the workflow runs in. */repo: RepoRef;/** Run history across the whole window, oldest first, zero-filled, bucketed by granularity. */@@ -106842,7 +106889,12 @@ export namespace Schemas {}export interface WorkflowJob {- /** GitHub Actions job id. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;+ /** Integer job id; unique only together with ci_engine. */id: number;/** The workflow run id this job belongs to. */run_id: number;@@ -106879,6 +106931,26 @@ export namespace Schemas {* @nullable*/estimated_cost_usd: number | null;+ /**+ * Source-native run id; use with ci_engine for identity.+ * @nullable+ */+ native_run_id?: string | null;+ /**+ * Source-native workflow run id; use with ci_engine for identity.+ * @nullable+ */+ native_workflow_run_id?: string | null;+ /**+ * Source-native job id; use with ci_engine for identity.+ * @nullable+ */+ native_job_id?: string | null;+ /**+ * Source-native attempt id; use with ci_engine for identity.+ * @nullable+ */+ native_attempt_id?: string | null;}export interface WorkflowJobAggregate {@@ -107014,7 +107086,12 @@ export namespace Schemas {}export interface WorkflowRunActivityPoint {- /** GitHub Actions run id. */+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;+ /** Integer run id; unique only together with ci_engine. */run_id: number;/*** Run conclusion ('success', 'failure', 'timed_out', 'cancelled', 'skipped', ...), or null while still in progress.@@ -107046,11 +107123,16 @@ export namespace Schemas {}export interface WorkflowRunDetail {+ /** CI execution engine; null when unknown.+ *+ * * `github_actions` - GitHub Actions+ * * `depot_ci` - Depot CI */+ ci_engine?: CIEngineEnum | null;/** Repository the run belongs to. */repo: RepoRef;- /** GitHub Actions run id. */+ /** Integer run id; unique only together with ci_engine. */id: number;- /** GitHub Actions workflow name. */+ /** CI workflow name. */workflow_name: string;/** Commit SHA the run was triggered on. */head_sha: string;@@ -107089,6 +107171,16 @@ export namespace Schemas {commit_pr_number: number | null;/** True when a merge queue pushed this run to gate pr_number, rather than the author pushing it. Count it when measuring CI; drop it when counting what the author did. */is_merge_queue: boolean;+ /**+ * Source-native run id; use with ci_engine for identity.+ * @nullable+ */+ native_run_id?: string | null;+ /**+ * Source-native workflow run id; use with ci_engine for identity.+ * @nullable+ */+ native_workflow_run_id?: string | null;}export interface WorkflowRunnerCost {@@ -114829,6 +114921,10 @@ export namespace Schemas {};export type EngineeringAnalyticsRunFailureLogsParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsRunFailureLogsCiEngine;/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/@@ -114843,6 +114939,14 @@ export namespace Schemas {source_id?: string;};+ export type EngineeringAnalyticsRunFailureLogsCiEngine = typeof EngineeringAnalyticsRunFailureLogsCiEngine[keyof typeof EngineeringAnalyticsRunFailureLogsCiEngine];+++ export const EngineeringAnalyticsRunFailureLogsCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+ } as const;+export type EngineeringAnalyticsTeamCiActivityParams = {/*** Window start: relative ('-14d', '-7d') or ISO8601. Defaults to -14d; the window may span at most 30 days. An equal-length prior window feeds the *_prior twins; near the 30-day ceiling that prior window can reach past Traces retention, deflating *_prior counts.@@ -114965,6 +115069,10 @@ export namespace Schemas {} as const;export type EngineeringAnalyticsWorkflowJobsParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsWorkflowJobsCiEngine;/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/@@ -114983,13 +115091,25 @@ export namespace Schemas {source_id?: string;};+ export type EngineeringAnalyticsWorkflowJobsCiEngine = typeof EngineeringAnalyticsWorkflowJobsCiEngine[keyof typeof EngineeringAnalyticsWorkflowJobsCiEngine];+++ export const EngineeringAnalyticsWorkflowJobsCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+ } as const;+export type EngineeringAnalyticsWorkflowRunParams = {+ /**+ * CI engine. Required when run_id exists in both engines.+ */+ ci_engine?: EngineeringAnalyticsWorkflowRunCiEngine;/*** 'owner/name' repository to scope to when the selected source syncs several repositories (from the `sources` list). Defaults to the source's first repository.*/repo?: string;/**- * GitHub Actions run id to inspect.+ * Integer run id to inspect; unique only together with ci_engine.*/run_id: number;/**@@ -114998,6 +115118,14 @@ export namespace Schemas {source_id?: string;};+ export type EngineeringAnalyticsWorkflowRunCiEngine = typeof EngineeringAnalyticsWorkflowRunCiEngine[keyof typeof EngineeringAnalyticsWorkflowRunCiEngine];+++ export const EngineeringAnalyticsWorkflowRunCiEngine = {+ DepotCi: 'depot_ci',+ GithubActions: 'github_actions',+ } as const;+export type EngineeringAnalyticsWorkflowRunActivityParams = {/*** Optional exact git branch (head_branch) to scope results to, e.g. 'main'. Omit or leave blank to aggregate across all branches.diff --git a/services/mcp/src/generated/engineering_analytics/api.ts b/services/mcp/src/generated/engineering_analytics/api.tsindex a9dd679e209f..c05a2ac18cc4 100644--- a/services/mcp/src/generated/engineering_analytics/api.ts+++ b/services/mcp/src/generated/engineering_analytics/api.ts@@ -181,6 +181,10 @@ export const EngineeringAnalyticsRunFailureLogsParams = () => zod.object({})export const EngineeringAnalyticsRunFailureLogsQueryParams = () => zod.object({+ ci_engine: zod+ .enum(['depot_ci', 'github_actions'])+ .optional()+ .describe('CI engine. Required when run_id exists in both engines.'),repo: zod.string().optional()@@ -305,6 +309,10 @@ export const EngineeringAnalyticsWorkflowJobsParams = () => zod.object({})export const EngineeringAnalyticsWorkflowJobsQueryParams = () => zod.object({+ ci_engine: zod+ .enum(['depot_ci', 'github_actions'])+ .optional()+ .describe('CI engine. Required when run_id exists in both engines.'),repo: zod.string().optional()diff --git a/services/mcp/src/tools/generated/engineering_analytics.ts b/services/mcp/src/tools/generated/engineering_analytics.tsindex 0259da191ae6..0353d71f9ac2 100644--- a/services/mcp/src/tools/generated/engineering_analytics.ts+++ b/services/mcp/src/tools/generated/engineering_analytics.ts@@ -130,6 +130,7 @@ const engineeringAnalyticsRunFailureLogs = (): ToolBase<method: 'GET',path: `/api/projects/${encodeURIComponent(String(projectId))}/engineering_analytics/run_failure_logs/`,query: {+ ci_engine: params.ci_engine,repo: params.repo,run_id: params.run_id,source_id: params.source_id,@@ -203,6 +204,7 @@ const engineeringAnalyticsWorkflowJobs = (): ToolBase<method: 'GET',path: `/api/projects/${encodeURIComponent(String(projectId))}/engineering_analytics/workflow_jobs/`,query: {+ ci_engine: params.ci_engine,repo: params.repo,run_attempt: params.run_attempt,run_id: params.run_id,