Skip to content

Restore OpenFeature agentless activation and lifecycle hardening - #6418

Open
leoromanovsky wants to merge 4 commits into
leoromanovsky/update-system-tests-ruby-agentlessfrom
leoromanovsky/restore-ruby-agentless
Open

leoromanovsky wants to merge 4 commits into
leoromanovsky/update-system-tests-ruby-agentlessfrom
leoromanovsky/restore-ruby-agentless

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Ruby applications need feature-flag configuration delivery to start during application/provider initialization, including applications that never receive a traced web request.

That startup behavior and its lifecycle handling were rolled back because the shared Ruby test adapter aborted when Remote Configuration was already running. The adapter compatibility fix has now merged, allowing us to restore the functionality.

Changes and Decisions

This PR retains separate commits restoring the two previously merged changes, including their original tests and type signatures; the original system-tests pin changes are excluded:

  • Configuration delivery startup: start agentless polling when the OpenFeature SDK initializes the provider, and start Remote Configuration during Datadog initialization when that source is selected
  • Provider lifecycle and recovery: restore delivery ownership across multiple providers, provider replacement and shutdown, post-fork handling compatible with current worker and barrier resets, and readiness/error notifications as configuration becomes available or is lost

Follow-up fixes cancel initialization on shutdown without stopping shared delivery, make failed startup retryable, align enablement with source selection, order recovery after SDK errors, and prevent shutdown from leaking error handlers.

Merge the prerequisite system-tests pin update first, then retarget this PR to master; review should confirm the restored delivery behavior, compatibility with the updated adapter, and the initialization and shutdown fixes.

Restore the #6295 portion of the combined rollback 7523fb2 by reapplying 65dca5e without its system-tests workflow pin. The prerequisite pin update now uses the merged system-tests startup compatibility fix.

Environment: Datadog workspace
Restore the #6323 portion of the combined rollback 7523fb2 by reapplying 994bde1 without its unmerged system-tests workflow pin. Preserve the provider replacement, shutdown, recovery, and fork handling from the reviewed implementation.

Environment: Datadog workspace
@dd-octo-sts dd-octo-sts Bot added core Involves Datadog core libraries openfeature A new component that provider an ability to configure feature flags labels Oct 5, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 3 partially typed methods, and clears 1 partially typed method. It increases the percentage of typed methods from 72.36% to 72.63% (+0.27%).

Partially typed methods (+3-1) ❌ Introduced:
sig/datadog/core/remote/component.rbs:44
└── def self.build: (
          untyped settings,
          Datadog::Core::Configuration::AgentSettings agent_settings,
          logger: Core::Logger,
          telemetry: Datadog::Core::Telemetry::Component
        ) -> Datadog::Core::Remote::Component?
sig/datadog/open_feature/provider.rbs:94
└── def provider_error: (Hash[Symbol, untyped] details) -> void
sig/datadog/open_feature/provider.rbs:96
└── def provider_ready: (Hash[Symbol, untyped] details) -> void
✅ Cleared:
sig/datadog/core/remote/component.rbs:37
└── def self.build: (
          untyped settings,
          Datadog::Core::Configuration::AgentSettings agent_settings,
          logger: Core::Logger,
          telemetry: Datadog::Core::Telemetry::Component,
          ?open_feature_component_provider: (^() -> Datadog::OpenFeature::Component?)?
        ) -> Datadog::Core::Remote::Component?

Untyped other declarations

This PR introduces 1 partially typed other declaration. It increases the percentage of typed other declarations from 86.46% to 86.64% (+0.18%).

Partially typed other declarations (+1-0) ❌ Introduced:
sig/datadog/open_feature/provider.rbs:10
└── type provider_event_handler = ^(Hash[Symbol, untyped]) -> void

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept on the line before the definition to remove it from the stats.

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

✨ Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 3 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-rb | microbenchmarks: [other] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-rb | microbenchmarks: [profiling] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

Check Pull Request CI Status | all-jobs-are-green

View more details · View in GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 95.45%
• Overall Coverage: 90.71% (+0.05%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0804532 | Docs | View more details | Give us feedback!

@leoromanovsky
leoromanovsky marked this pull request as ready for review October 5, 2026 15:04
@leoromanovsky
leoromanovsky requested review from a team as code owners October 5, 2026 15:04
@leoromanovsky
leoromanovsky requested review from Strech, hhan2024 and typotter and removed request for a team October 5, 2026 15:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T15:26:00.395685Z c7f7449 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-05T15:20:24.065087Z c7f7449 Draft marked ready
ℹ️ About Codex in GitHub

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7f7449f57

ℹ️ About Codex in GitHub

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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/open_feature/provider.rb
Comment thread lib/datadog/open_feature/provider.rb
@p-datadog

Copy link
Copy Markdown
Member

DI changes in diff to pass keyword argument instead of positional approved.

@leoromanovsky
leoromanovsky added this pull request to stack #6423 October 5, 2026 16:29
Preserve the latest Remote Configuration worker and barrier fork reset together with synchronized client replacement.

Environment: Datadog
Cancel pending initialization without stopping shared delivery, reset failed activation for retry, align enablement with source selection, and preserve SDK error/recovery ordering across shutdown races. Cover each reported failure with deterministic regressions and retain current Remote Configuration fork reset behavior.

Environment: Datadog

@TonyCTHsu TonyCTHsu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. It is a revert + revert

@Strech Strech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to ask to move some leaked knowledge into OpenFeature back from Core components. The rest looks 👍🏼

Comment on lines +263 to +270
begin
@open_feature_activation.after_fork
rescue => e
# Feature Flags is optional and must never interrupt other post-fork handlers.
description = "Feature Flags delivery failed to restart after fork"
logger.error("#{description}: #{e.class}: #{e.message}")
telemetry.report(e, description: description)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

responsibility-wise, why not @open_feature_activation.after_fork performing those logging and fail-safe operations? IMHO in core component is should be safe to call after_fork and consider it exception-free method

Comment on lines +285 to +293
begin
@open_feature_activation.start!
Datadog::OpenFeature.reattach(@open_feature_activation)
rescue => e
# Feature Flags is optional and must never interrupt library startup.
description = "Feature Flags delivery failed to start"
logger.error("#{description}: #{e.class}: #{e.message}")
telemetry.report(e, description: description)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if it's an its own method in OpenFeature that handles that combo and also report errors to offload this manual work from core component?

def initialize(receivers)
@receivers = receivers
@receivers = receivers.dup
@receivers_mutex = Mutex.new

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no other mutex, let's shorten in to mutex

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries openfeature A new component that provider an ability to configure feature flags

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants