Repository navigation
fix(AIC-3572): treat a variation without _ldMeta.enabled as disabled - #184
Merged
Merged
Conversation
extract_variation only refused `_ldMeta.enabled is False` and defaulted a missing flag to enabled. JS and Go refuse anything but an explicit enabled: true, and inspect_config already reported these as disabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apucacao
approved these changes
Oct 21, 2026
andrewklatzke
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes AIC-3572.
Why
When a variation comes back with no
_ldMeta, or with_ldMetabut noenabledfield,extract_variationtreated it as enabled and ran the model. Only an explicitenabled: falsewas refused. The JS SDK (lifecycle.ts,if (!variation?._ldMeta?.enabled) throw) and the Go SDK (aiserver/lifecycle.go,if !meta.Enabled) both refuse these variations, and Python's owninspect_configalready reports them asenabled: false, so one SDK said "disabled" while the other ran the call.Behaviour change (changelog): a config served without
_ldMeta.enabled(for example a plain JSON flag used as an AI config) now raisesVariation '<key>' is disabled.instead of running.Fix
packages/client/src/launchdarkly_ai_server/lifecycle.py:extract_variationraises the existing "is disabled" error unless_ldMetais a dict with a truthyenabled. A non-dict ornull_ldMetais guarded.meta["enabled"]is now alwaysTruepast that check.packages/client/tests/test_lifecycle.py: newTestExtractVariationMissingEnabled, parametrized over no_ldMetaand_ldMeta: {}. Each case asserts thatextract_variationraises andinspect_configreturnsenabled: False.Testing
make test: 2546 passed, 14 skippedmake typecheck: no issues in 75 source filesmake lint: all checks passed.make format-check: 161 files already formatted.DID NOT RAISE RuntimeError._ldMeta.enabledexplicitly, and the full suite passes unchanged.Related: https://github.com/launchdarkly/ai-sdks-monorepo/pull/69
🤖 Generated with Claude Code
Note
Overview
Aligns Python
extract_variationwith spec §3.10 and the JS/Go SDKs: a variation is only runnable when_ldMetais a dict with a truthyenabled. Missing_ldMeta, an empty_ldMeta, or noenabledfield now raisesVariation '<key>' is disabled.instead of proceeding to parse and invoke the model (previously onlyenabled: falsewas rejected).After that gate, returned
meta["enabled"]is alwaysTruerather than defaulting from metadata.inspect_configalready reported these cases as disabled; invoke paths now match.Adds parametrized tests (
no_ldMeta,empty_ldMeta) assertingextract_variationraises andinspect_configreturnsenabled: false.Reviewed by Cursor Bugbot for commit 6fc85ea. Bugbot is set up for automated code reviews on this repo. Configure here.