AI-7283 Compare branch dependency changes against their base branch before triggering the Agent build #25545
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25545"
general
weight: 0.35
iliakur
What does this PR do?
Makes
build-agent-autocompare a branch's dependency changes against the branch it was cut from, instead of against the previous push:rules:changesusescompare_to: refs/heads/master. Master keeps the previous-push comparison.ddev release branch createrewrites thatcompare_toto the new release branch, in the same commit that points the trigger at the Agent release branch. Branches cut from a release branch inherit its YAML and compare against the release. This rewrite always happens: unlike the trigger branch, it doesn't wait for theDataDog/datadog-agentbranch to exist.build-agent-manualwhen no Agent build was triggered.Tracked in AI-7283.
Motivation
On 2026-09-17, a bulk rebase of month-old PRs triggered hundreds of
datadog-agentpipelines (thread). Withoutcompare_to, branch pipelines diff against the previous push. Rebasing a stale branch onto master therefore pulls in master's.depschanges. For example, the force-pusha3000d85cb->ff99b109c3on #24422 had an 803-file diff that included.deps/*, even though the PR only changestraefik_mesh/tests/test_unit.py.compare_toonly sees the branch's own changes, because GitLab diffs the branch against its merge base withcompare_to, not against the tip ofcompare_to. Whencompare_tois set, therules:changesclause callsCi::Pipeline#modified_paths_since:It has worked this way since
compare_towas introduced in gitlab!90968. I also checked it on a scratch gitlab.com project with real pushes.old-ruleis the current rule, andnew-ruleis the one in this PR:| Push | old-rule | new-rule |
|---|---|---|
| New branch, tests only | runs | skipped |
| Second push to that branch, tests only | skipped | skipped |
| Master bumps
.deps| runs | runs || Stale branch rebased onto master and force-pushed | runs | skipped |
| Stale branch merges master | runs | skipped |
| New branch that bumps
.deps| runs | runs || Follow-up push to that branch, tests only | skipped | runs |
The first row comes from GitLab treating a branch's first push as having no previous push to compare against, so
changeswithoutcompare_tomatches whatever files changed (Gitlab::Git::Push#branch_added?,return true unless modified_paths). That's what happened when I pushed directly to gitlab.com. I didn't see it on gitlab.ddbuild.io, where branches come in through the GitHub mirror. The first GitLab pipeline of five recent branches (kyle.neale/iris-pp-assets,nubtron/velero-kubectl-download-retry,guillermo.julian/kueue-ha,aarakke/github-async-for-new-features,zhengda.lu/mongodb-9-support) triggered nodatadog-agentpipeline, while this PR's first pipeline triggered one. Between 2026-09-20 and 2026-10-06, 415 branches ran GitLab pipelines and 99 Agent builds were triggered.The last row is the trade-off. Once a branch changes dependencies, every later push to it triggers an Agent build, not just pushes that touch
.deps. After the lockfile commit, extra pushes to dependency-bump PRs are already discouraged, because they invalidate wheel promotion.Release branches
#22302 removed an earlier
compare_to: "master"for branches cut from release branches. Comparing those branches to master counts every commit that exists only on the release branch as the branch's own change. That includes the release's.depslockfiles and thebranch: 7.x.xtrigger rewrite. On the current release branches:With the
compare_torewrite, a dependency bump cut from a release branch triggers the Agent build against that release when its own changes touch.deps, and backports that don't touch dependencies don't trigger it. datadog-agent already uses the same pattern on our GitLab instance: itsCOMPARE_TO_BRANCHismainonmainand7.84.xon7.84.x. Release branches cut before this change keep their own copy of the YAML, so their previous-push rule is unchanged. This needs to land before7.86.xis cut.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged[AI-7283]: https://datadoghq.atlassian.net/browse/AI-7283?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ