← Back to Pull requests

Add DDA rollback functionality #2838

Closed
unknown closed this pull request without merging on Apr 07, 2026 13:46 UTC
View on GitHub
unknown unknown commented on Mar 26, 2026 20:43 UTC
Author

What does this PR do?

Adds rollback functionality for DDAs with fleet experiments. Includes:
stop: trigger rollback (for eventual stopExperiment)
timeout: rollback after 15min of a running experiment
abort: user makes a manual change (ignores manual change if done at the same time as the timeout b/c of complexity)

Motivation

https://datadoghq.atlassian.net/browse/CONTP-1404

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

Agent: vX.Y.Z
Cluster Agent: vX.Y.Z

Describe your test plan

Setup:
Deploy the operator with createControllerRevisions and datadogAgentInternalEnabled set to true: https://github.com/DataDog/datadog-operator/blob/62fdb0618c3a62289f84e936b813b2789d674c21/cmd/main.go#L188-L189
Create a DDA

Stop signal:
Start an experiment (see below for how to mock)
Mock stopping the experiment by patching the status:

kubectl patch dd <name> --type=merge --subresource status --patch 'status: {experiment: {phase: stopped}}'

Check that the DDA spec is rolled back to the initial pre-experiment state
Check that the experiment phase is rollback (kubectl describe dd <name>)

Timeout
Start an experiment (see below for how to mock)
Wait 15 minutes (not configurable, sorry)
Check that the DDA spec is rolled back to the initial pre-experiment state
Check that the experiment phase is timeout (kubectl describe dd <name>)

Abort
Start an experiment (see below for how to mock)
Patch the spec again

kubectl patch datadogagent <name> -n <namespace> --type merge -p '{"spec":{"global":{"tags":["experiment:true","manual-change:true"]}}}'

Check that the experiment phase is aborted (kubectl describe dd <name>)
  • Check that the DDA spec matches the change you just made (no rollback to pre-experiment or experiment spec)
  • Start an experiment (mock the start experiment signal):

    # patch dda spec
    # note: this can be any spec change
    kubectl patch datadogagent <name> -n <namespace> --type merge -p '{"spec":{"global":{"tags":["experiment:true"]}}}'
    # patch dda status
    # generation should match the current (post spec patch) dda's generation
    kubectl patch datadogagent <name> -n <namespace> --type merge --subresource=status -p "{\"status\":{\"experiment\":{\"phase\":\"running\",\"id\":\"test-exp-1\",\"generation\":$(kubectl get datadogagent <name> -n <namespace> -o jsonpath='{.metadata.generation}')}}}"
    

    Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies

  • PR has a milestone or the qa/skip-qa label

  • All commits are signed (see: [signing commits][1])
  • [1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

    Diff: 370 lines (+277 / -93) across 4 files Reviewer: arbll Review duration: 16863m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 370 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2838"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%