← Back to Pull requests

fix(appsec): restore settings when ASM_FEATURES changes #22053

Merged
florentinl merged 3 files (103 lines) on Nov 24, 2026 17:17 UTC
View on GitHub
florentinl florentinl commented on Nov 24, 2026 12:24 UTC
Author

Description

Removing a remote configuration that set both App and API Protection activation and the automatic user event collection mode reset only activation. Replacing the same configuration with one that omitted a setting could also leave the old value in effect.

Treat each ASM_FEATURES update as a full replacement for its path. For each affected setting, use the most recently delivered configuration that still specifies it. Reset the setting only when no remaining configuration supplies it.

Customer impact

Removing a remote override no longer leaves automatic user event collection in the wrong mode or clears a setting still supplied by another configuration. When the last mode override is removed, the locally configured mode applies again.

Testing

  • Added regression tests for combined removals, partial replacements, overlapping configurations, and fallback to the local user event mode.

  • AppSec remote configuration tests on Python 3.11: 46 passed, 1 expected failure. scripts/lint checks and focused type checks passed.
  • Risks

    The change only affects how the AppSec remote configuration callback resolves activation and automatic user event collection settings. It does not change the remote configuration protocol, product lifecycle, or fork handling.

    Diff: 103 lines (+87 / -16) across 3 files Reviewer: avara1986 Review duration: 293m
    All Vouch review confidence checks passed
    Residual risk 0.06 = Change Risk (0.34) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 103 lines diff across 3 files
    0.34
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.71 · 5 substantive comment(s)
    0.71
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    80%
    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.278
    Real PR Conversation Timeline
    11 items
    datadog-datadog-us1-prod[bot] datadog-datadog-us1-prod[bot] commented on Nov 24, 2026 12:24 UTC
    Bot

    View session in Datadog

    Bits Code status: ✅ Done

    Comment @datadog to request changes

    cit-pr-commenter-54b7da[bot] cit-pr-commenter-54b7da[bot] commented on Nov 24, 2026 12:25 UTC
    Bot

    Codeowners resolved as

    Resolved from the full PR diff against main using the target branch CODEOWNERS file.
    CODEOWNERS team requests not listed below are not required by the current file set.

    ddtrace/appsec/_remoteconfiguration.py                                  @DataDog/asm-python
    releasenotes/notes/fix-appsec-rc-auto-user-instrum-mode-removal-28074e245a143804.yaml  @DataDog/apm-python
    tests/appsec/appsec/test_remoteconfiguration.py                         @DataDog/asm-python
    

    cit-pr-commenter-54b7da[bot] cit-pr-commenter-54b7da[bot] commented on Nov 24, 2026 12:25 UTC
    Bot

    Dependency direction analysis

    ⚠️ Existing dependency direction violations

    There are 22 dependency direction violations that already exist on the base branch and have not been changed by this PR.

    <details><summary>Show existing violations (showing 5 of 22 highest severity)</summary>

    ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=103)
    ddtrace.llmobs._integrations.bedrock_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
    ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
    ddtrace.internal.span_bus -×-> ddtrace._trace.span  (internal-core -> product:tracing, score=35)
    ddtrace.llmobs._llmobs -×-> ddtrace._trace.span  (product:llmobs -> product:tracing, score=33)
    

    </details>

    To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

    > uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json
    > 

    datadog-datadog-us1-prod[bot] datadog-datadog-us1-prod[bot] commented on Nov 24, 2026 12:26 UTC
    Bot

    <a target='_blank' href='https://app.datadoghq.com/ci/pipeline-executions?query=ci_level%3Ajob+%40git.commit.sha%3A2862e9f5d1310b3b9ca4759b92aa1fbcd82f21df&referrer=pr-comment&start=1795533256000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture></a> &nbsp;<a target='_blank' href='https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3A6d25acd25677399911c025c65ef21d7fb1ffd335&referrer=pr-comment&start=1795533256000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok-light.svg" alt="Tests" align="center" /></picture></a>

    <details><summary><b>🎉 All green!</b></summary>

    🧪 All tests passed
    ❄️ No new flaky tests detected
    </details>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 2862e9f | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | <a href="https://app.datadoghq.com/ci/pull-request/Z2l0aHViLmNvbS9kYXRhZG9nL2RkLXRyYWNlLXB5LzIyMDUz?referrer=pr-comment">View more details</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    pr-commenter[bot] pr-commenter[bot] commented on Nov 24, 2026 12:56 UTC
    Bot

    Benchmarks

    Benchmark execution time: 2026-11-24 16:18:02

    Comparing candidate commit 2862e9f5d1310b3b9ca4759b92aa1fbcd82f21df in PR branch dd/reset-auto-user-instrum-on-asm-features-removal with baseline commit b801aa3dea9c3e34ee3b72e2fe502f40a0d6b837 in branch main.

    📊 Benchmarking dashboard

    Found 0 performance improvements and 0 performance regressions! Performance is the same for 589 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.

    <details>
    <summary><h3>Explanation</h3></summary>

    This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

    🟩 = significantly better candidate vs. baseline
    🟥 = significantly worse candidate vs. baseline

    We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

    If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

    Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

    <details>
    <summary><h4>More details about the CI and significant changes</h4></summary>

    You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

    CIs of the difference of means are often centered around 0%, because often changes are not that big:

    ---------------------------------(------|---^--------)-------------------------------->
                                  -0.6%    0%  0.3%     +1.2%
                                     |          |        |
             lower bound of the CI --'          |        |
    sample mean (center of the CI) -------------'        |
             upper bound of the CI ----------------------'
    

    As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

    For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

    ----------------------------------------|---------|---(---------^---------)---------->
                                           0%        1%  1.3%      2.2%      3.1%
                                                      |   |         |         |
           significant impact threshold --------------'   |         |         |
                          lower bound of CI --------------'         |         |
           sample mean (center of the CI) --------------------------'         |
                          upper bound of CI ----------------------------------'
    

    </details>

    </details>

    <details>
    <summary><h3>Unstable benchmarks</h3></summary>

    These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

    scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-641.896ns; +771.113ns] or [-5.976%; +7.179%]
  • scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-37.828ns; +37.316ns] or [-5.900%; +5.820%]
  • scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1978.072ns; +1677.699ns] or [-9.870%; +8.371%]
  • scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1415.852ns; +2140.752ns] or [-7.330%; +11.083%]
  • scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-341.364ns; +388.396ns] or [-7.987%; +9.087%]
  • scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-148.686ns; +289.434ns] or [-5.596%; +10.894%]
  • scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-62.364ns; +117.375ns] or [-4.580%; +8.620%]
  • scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-4039.618ns; +4851.614ns] or [-8.359%; +10.040%]
  • scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-893.961ns; +946.611ns] or [-8.674%; +9.185%]
  • scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-33.333µs; +44.886µs] or [-5.794%; +7.802%]
  • </details>

    <details>
    <summary><h3>Known flaky benchmarks</h3></summary>

    These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

    Known flaky benchmarks without significant changes:

  • scenario:packagespackageforrootmodulemapping-cache_off
  • </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 24, 2026 13:37 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"2862e9f5d1310b3b9ca4759b92aa1fbcd82f21df","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":"2862e9f5d1310b3b9ca4759b92aa1fbcd82f21df","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} -->
    <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"2862e9f5d1310b3b9ca4759b92aa1fbcd82f21df","mergeGateEnabled":false,"pullRequestNumber":22053,"repository":"DataDog/dd-trace-py","status":"completed"} -->
    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-24T15:45:27.880419Z">2026-11-24T15:45:27.880419Z</relative-time> | 2862e9f | New commits |
    | 🔒 Security Review | ✅ Completed <relative-time datetime="2026-11-24T15:48:45.311058Z">2026-11-24T15:48:45.311058Z</relative-time> | 2862e9f | New commits |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    </details>

    datadog-datadog-us1-prod[bot] datadog-datadog-us1-prod[bot] commented on Nov 24, 2026 13:40 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wNiw4LDgsMCwwLDAsMi4yNC44MWw2LS45M2ExOC4xMiwxOC4xMiwwLDAsMCwyLTE0LjMxYy0uOTMtMy01Ljc5LTkuMS02LjE0LTkuNDMtMS4yMi0xLjE3LjIxLTUuNy0yLjIxLTEwLjY1Qzg0LjY1LDI5LjU0LDc4LDI0LjA5LDc1LjA5LDIxLjcyYy44NS42Miw2LjEsMi43NCw4LjU1LDUuNjkuMjMtLjMuMzItMS44OS41My0yLjI5LTIuMS0yLjc2LTIuMjYtNy42Ni0yLjI2LTlBMTQuODcsMTQuODcsMCwwLDAsODAuNjksMTFhOC4xNiw4LjE2LDAsMCwxLDIuNjUsNC41MywxOC41MSwxOC41MSwwLDAsMCwzLjgyLDguMzRjMy40Myw0LjI2LDYuNTIsNi40NSw4LjA4LD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Myw0LjY3LTMuODgsNC44Ny0yLjUyLjM0LTQuOTEtMS03LjYzLTMuMDZBMi4yMywyLjIzLDAsMCwxLDc5LjI1LDU2LjYyWk01NS4zNCwzOS43NWM0LTIuNzMsOS4xNi0xLjY1LDguMy0uODMtMS42NSwxLjU2LjU0LDEuMS43OCw0YTUsNSwwLDAsMS0xLjEyLDRBMjUuNDksMjUuNDksMCwwLDAsNTguNyw0OGEyNiwyNiwwLDAsMC0yLjg1LDEuMTMsNy4zMiw3LjMyLDAsMCwxLS43My0uNTVBNS41Myw1LjUzLDAsMCwxLDU1LjM0LDM5Ljc1Wm02MC4xMSwyNy44Mi0zMi41MSw1LjlhMTYsMTYsMCwwLDEtMy43NSwzLjMzLDExLjc1LDExLjc1LDAsMCwxLTkuMjkuODUsMjAsMjAsMCwwLDEtMy43MS0xLjE5bC03Ljk1LDEuMSw0LjgzLDQwLjIsNTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: PASS" height="36"/>

    <details>
    <summary>More details</summary>

    Source inspection supports correct fallback across partial replacements, overlapping configurations, and combined removals, including restoration of the local user-event mode after the final override disappears.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 2161759</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=be973525-9226-48d8-ac9a-a39517a4fd33 -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:55846ab50e0266df6e87a5be8a1427825bbeaadc64f785734e6e892adf9d3974:bundle -->

    avara1986 avara1986 approved these changes on Nov 24, 2026 13:56 UTC
    Approved Reviewer

    Approved these changes.

    florentinl florentinl commented on Nov 24, 2026 16:19 UTC
    Author

    /merge

    gh-worker-devflow-routing-ef8351[bot] gh-worker-devflow-routing-ef8351[bot] commented on Nov 24, 2026 16:19 UTC
    Bot

    <!-- "FeedbackWorkflowId":"17d870e2-00bd-49fb-98b8-946f17ea63cc_39" -->
    View all feedbacks in Devflow UI.

    2026-11-24 16:19:07 UTC :information_source: Start processing command /merge

    ---
    2026-11-24 16:19:21 UTC :information_source: MergeQueue: Pull request is not mergeable yet

    It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.

  • Run /remove to cancel it.
  • ---
    2026-11-24 16:29:08 UTC :information_source: MergeQueue: merge request added to the queue

    The expected merge time in main is approximately 1h (p90).

    ---
    2026-11-24 17:17:31 UTC :information_source: MergeQueue: This merge request was merged

    Reviewers
    Assignees
    florentinl florentinl
    Labels
    risk: low confidence: 80.9% 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: 33.7% (LOW) · Higher = larger blast radius
    33.7%
    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: 80.9% · Lower = rushed or shallow review
    80.9%
    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: 6.4% · Safe to merge
    6.4%