Skip to content

feat(openfeature): add shared agentless EVP fallback - #6574

Open
leoromanovsky wants to merge 11 commits into
masterfrom
leo.romanovsky/fflsdk-184-ruby-evp
Open

leoromanovsky wants to merge 11 commits into
masterfrom
leo.romanovsky/fflsdk-184-ruby-evp

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Why

Ruby applications using agentless Feature Flags configuration still depend on a local Agent to deliver exposures and flag evaluations. These signals need to reach Datadog when that receiver is unavailable.

What

Both writers share local EVP discovery and sticky HTTPS intake fallback, while Remote Configuration retains its existing transport. Current batches replay only after 404/405 or proven pre-transmission failures; ambiguous failures switch future batches, while 403/429/5xx retain local delivery.

Risk

Merge after required CI passes; revert before release to restore Agent-only delivery. API keys stay off local requests; exposure shutdown waits six seconds for agentless delivery, or the flush interval plus five seconds for Remote Configuration.

Details

Delivery and shutdown decisions

Discovery prefers an Agent or relay that forwards EVP origin metadata, then authenticated direct intake. Without direct credentials, an older Agent's advertised EVP endpoint remains usable. Direct intake refuses redirects.

Discovery and requests each allow five seconds, clipped to the remaining agentless shutdown deadline. This is not a five-second bound on the entire component shutdown. The component signals the flag-evaluation writer before waiting for exposures. Forced termination can add one second after the exposure wait. Shutdown rejects late events, including after fork.

The configured Agent URL path prefix remains supported for local discovery and event delivery when its endpoint matches the resolved Agent settings. Traces and Remote Configuration retain their existing fixed paths.

Cross-SDK references

Related delivery work: Java #12844 and #12978, and .NET #9351. Ruby shares one selector so both writers reuse discovery and fallback decisions.

Test coverage and local validation

Regression tests cover rejected-response routing, pre-transmission classification, shutdown after fork, and socket closure during stalled TLS without garbage collection. OpenFeature suites pass on Ruby 3.4 and 4.0 with latest/minimum dependencies: 1493/1489 examples per Ruby, zero failures. Full Steep and changed-file RuboCop pass.

Validation

Tested commit Validation Result
DataDog/dd-trace-rb@b8c93df58c3eb7945dd536b60cac71741deeacdd
DataDog/system-tests@3948230151ab3881e8f7b79c6e3d51cbebf1f118
Local system tests: Agent, sidecar and direct delivery; safe replay, rejection, duplicates and shutdown; Rails 7.2, Ruby 3.4.7, Agent 7.84.5, serverless-init 1.10.4, Linux/arm64 20 passed; 0 failed; 0 skipped. Mock intake only.
DataDog/dd-trace-rb@b8c93df58c3eb7945dd536b60cac71741deeacdd
DataDog/system-tests@454958979d69b523f4042837dcec762c0683ea24
Local system tests: 404 exposure replay and ambiguous evaluation routing after scenario registration changes; Rails 7.2, Ruby 3.4.7, Linux/arm64 2 passed; 0 failed; 0 skipped. Mock intake only.

@leoromanovsky leoromanovsky added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Oct 27, 2026
@linear-code

linear-code Bot commented Oct 27, 2026

Copy link
Copy Markdown

FFLSDK-184

@dd-octo-sts dd-octo-sts Bot added the openfeature A new component that provider an ability to configure feature flags label Oct 27, 2026
@dd-octo-sts

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

Copy link
Copy Markdown
Contributor

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 7 partially typed methods, and clears 1 partially typed method. It increases the percentage of typed methods from 73.69% to 73.75% (+0.06%).

Partially typed methods (+7-1) ❌ Introduced:
sig/datadog/open_feature/transport/agentless.rbs:37
└── def send_exposures: (Hash[Symbol, untyped]) -> Response
sig/datadog/open_feature/transport/agentless.rbs:39
└── def send_flag_evaluations: (Hash[String, untyped]) -> Response
sig/datadog/open_feature/transport/agentless.rbs:47
└── def send_batch: (String, Hash[Symbol, untyped] | Hash[String, untyped]) -> Response
sig/datadog/open_feature/transport/agentless.rbs:53
└── def compatible_route: (Hash[String, untyped]?) -> String?
sig/datadog/open_feature/transport/agentless.rbs:55
└── def local_route: (Hash[String, untyped]?) -> String?
sig/datadog/open_feature/transport/http_client.rbs:31
└── def read_info: (Net::HTTPResponse) -> Hash[String, untyped]?
sig/datadog/open_feature/transport/response.rbs:13
└── def initialize: (?code: Integer?, ?info: Hash[String, untyped]?, ?pre_send: bool) -> void
✅ Cleared:
sig/datadog/core/transport/http/adapters/unix_socket.rbs:44
└── def self.new: (untyped uds_path, ?Hash[untyped, untyped] options) -> instance

Untyped other declarations

This PR introduces 1 partially typed other declaration. It increases the percentage of typed other declarations from 86.94% to 87.02% (+0.08%).

Partially typed other declarations (+1-0) ❌ Introduced:
sig/datadog/open_feature/transport/response.rbs:9
└── attr_reader info: Hash[String, untyped]?

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 27, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 90.56%
• Overall Coverage: 92.62% (-0.03%)

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

@leoromanovsky
leoromanovsky marked this pull request as ready for review October 27, 2026 03:02
@leoromanovsky
leoromanovsky requested review from a team as code owners October 27, 2026 03:02
@leoromanovsky
leoromanovsky requested review from anmarchenko and removed request for a team October 27, 2026 03:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-27T03:10:16.277741Z ff41edc Draft marked ready
🔒 Security Review ✅ Completed 2026-10-27T03:07:52.671084Z ff41edc 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.

@datadog-prod-us1-4 datadog-prod-us1-4 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.

Bits Code Review: FAIL

An empty HTTPS proxy environment variable causes direct exposure and flag-evaluation batches to be dropped. The localized suggestion handles empty values while preserving configured proxies and no_proxy exclusions.

Open Bits AI session

🤖 Bits Code Review · Commit ff41edc

@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: ff41edc95f

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

@greghuels
greghuels removed their request for review October 27, 2026 10:33
@buraizu buraizu self-assigned this Oct 27, 2026
Preserve bounded delivery shutdown, fork isolation, and shared transport construction alongside the new Feature Flags diagnostics. Replace the timed shutdown test sleep with deterministic synchronization.

@buraizu buraizu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! I've posted a few edit requests for the new docs content, but let me know if you have any questions or feedback.

Comment thread docs/GettingStarted.md Resolved
Comment thread docs/GettingStarted.md Resolved
Comment thread unreleased/20261027015119.json Resolved
Comment thread docs/GettingStarted.md Resolved
Address review feedback with user-focused delivery guidance, precise fallback and reconfiguration behavior, and clearer release wording.

Environment: Datadog workspace
@leoromanovsky
leoromanovsky requested a review from buraizu October 27, 2026 23:57
Comment thread lib/datadog/open_feature/component.rb Resolved
Comment thread docs/GettingStarted.md Resolved
@leoromanovsky

leoromanovsky commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

FFE reviewer selection

Reviewers: @vjfridge, @sameerank

Why: Agentless and serverless delivery — The PR adds a shared agentless event transport. Reviewers come from the matched pod.

🤖 Automated selection.

Selection details

Initiative: project / deployment-modes

Why this match: The PR adds a shared agentless event transport. It discovers a local EVP endpoint and falls back to direct HTTPS intake, so exposure and flag-evaluation events reach Datadog without a persistent Agent. This is the evaluation/exposure event egress that deployment-modes covers. The component wires this transport into both writers when the configuration source is agentless. The shutdown changes bound the agentless delivery deadlines and drain the writers. They are part of that delivery path and do not change OpenFeature provider lifecycle or evaluation metadata contracts, so the openfeature-architecture area is not added.

  • @vjfridge — primary (agentless-delivery): Matched pod member. Existing review coverage preserved.
  • @sameerank — core (agentless-delivery): Matched pod member. Existing review coverage preserved.

The PR author was excluded. Existing reviewers and teams were preserved.

Debug or fix a problem

Workflow run · Bits Code session

  • Wrong project or pod? Clarify this PR’s purpose, or correct the reviewer registry and publish the change. Sheet edits take effect after publication.
  • Need another reviewer now? Request them in GitHub. This workflow only adds requests and keeps existing reviewers.
  • Stuck beyond five minutes or failed? Inspect the run’s failed step and available Bits session. After fixing the cause, rerun the workflow with this PR URL and dry_run=false. Unchanged completed runs are skipped. If the receipt says needs_reconciliation or a write outcome is uncertain, ask the workflow owner to reconcile GitHub and the receipt before retrying; do not delete the lock blindly.
  • Report a problem: Comment on the reviewer-routing skill PR with this PR URL, the workflow run link, and the expected initiative or reviewer correction.
Evidence and run details

✅ Complete — reviewer coverage verified. The workflow checked pending requests or submitted reviews on the evaluated head.

Generated asynchronously by the FFE reviewer-routing workflow.

Changed paths: lib/datadog/open_feature/transport/agentless.rb, lib/datadog/open_feature/transport/http_client.rb, lib/datadog/open_feature/transport/response.rb, lib/datadog/open_feature/component.rb, lib/datadog/open_feature/exposures/worker.rb, lib/datadog/open_feature/flag_evaluation/writer.rb, lib/datadog/open_feature/agentless/transport.rb

Evaluated head: 040f61acd2218abb320e2a916f5a21b10a25b686

Registry revision: revision:efde5129-b144-41ab-b630-1adf6ad22901

Pinned skill source: 7e3283c602f6b18a7e3e623eecb52d3a9c091a2e

Instructions: workflow-injected snapshot (no plugin loaded)

Instruction snapshot SHA-256: 52ed8cb68675dde1a47addaefe4a9500891c24014abf7dade6dfe38cf836c1d2

Preserve older-Agent delivery without direct credentials, decode proxy and
configuration URL credentials across supported URI versions, and warn when
no event route is available. Start evaluation shutdown before waiting for
exposures and use five-second discovery and delivery budgets.

Add deterministic regressions and clarify Agent and proxy requirements.

Environment: Datadog workspace

@datadog-prod-us1-4 datadog-prod-us1-4 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.

Bits Code Review: PASS

More details

Agentless Feature Flags share local EVP discovery and sticky HTTPS fallback for both event writers, with bounded shutdown; Remote Configuration remains Agent-only. The empty-proxy delivery bug is fixed, and no review findings remain open; this follow-up did not execute tests or validate production intake.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit a3cc55b

@leoromanovsky leoromanovsky added the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 13, 2026
@leoromanovsky leoromanovsky removed the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 13, 2026
@leoromanovsky
leoromanovsky enabled auto-merge (squash) November 13, 2026 03:04
protected

def after_fork
self.buffer = Buffer.new(@buffer_limit)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Comment from Codex working with @sameerank:

[P2] Keep teardown terminal across this fork reset

graceful_shutdown closes the buffer, but it does not set enabled = false until the blocking stop returns. If the first enqueue in a child races with teardown in that child, start if forked? can reach this after_fork, replace the closed buffer with an open one, and start another worker. A deterministic fork/thread regression returned true from that enqueue, sent one exposure after shutdown had returned, and left the replacement worker running.

Please record a terminal stop-requested state before closing or waiting, re-check it around the fork restart, and keep any replacement child buffer closed when teardown has begun. If restart creates a thread during the race, stop it after leaving the async lifecycle lock.

Executed validation

The baseline regression failed with 1,491 examples and one failure. A candidate fix with the lifecycle checks above, an ordinary post-fork positive control, and the separate first-delivery regression passed both OpenFeature dependency appraisals: 2,984 aggregate examples and zero failures.

def enqueue(event)
return false unless enabled?

start if forked?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Comment from Codex working with @sameerank:

[P2] Wake the restarted poller after the first child enqueue

This starts the restarted poller before the first child event is pushed. The poller can observe the new buffer while it is empty and enter its 30-second interval wait; the later buffer.push(event) does not signal that wait. A deterministic barrier around this ordering left the child event undelivered after 200 ms, and the existing shutdown path can hide the delay by waking the poller.

Please remember whether this enqueue performed the fork restart and, after its push succeeds, signal that restarted poller. Limiting the signal to this first post-fork path preserves ordinary batching behavior.

Executed validation

The baseline regression failed with 1,492 examples and one timeout. The candidate wakeup, together with the shutdown-race fix and a normal post-fork positive control, passed both OpenFeature dependency appraisals: 2,984 aggregate examples and zero failures.

Comment thread docs/GettingStarted.md

Feature Flags respects `DD_TRACE_DEBUG` and outputs debugging diagnostics when it is enabled.

#### Event delivery with agentless configuration

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.

Not a blocker or anything - but is it maybe time to extract FFE documentation into a separate .md file?

end

def work_pending?
!buffer.empty?

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.

nit: buffer.any?

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

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos 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.

7 participants