Skip to content

feat: scope preview feature flags to the agents extension - #10636

Merged
Hui Miao (huimiu) merged 7 commits into
mainfrom
hui/foundry-shared-feature-access
Oct 23, 2026
Merged

Hui Miao (huimiu) merged 7 commits into
mainfrom
hui/foundry-shared-feature-access

Conversation

@huimiu

@huimiu Hui Miao (huimiu) commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #10659

Summary

Keep preview opt-in handling inside the Microsoft Foundry agents extension instead of a shared package in azd core. This PR adds the flag check, a small feature registry, and a design doc. It doesn't gate any commands yet. Each agents preview needs its own alpha.<ID> key, and alpha.all is ignored. Core azd's global alpha behavior is unchanged.

Changes

  • Add azureaiagent/internal/featureflags with Feature{ID, EnvVar, Description} and IsEnabled(ctx, client, feature, environmentName). Remove the root extensions/featureflags package and its README.
  • registry.go lists every agents preview: ManagedHarness, Voice, and LongRunning, each with a short optional description. All() returns a copy of the list and Lookup(id) finds one by ID. Tests check the agents. prefix, env var naming, unique IDs and vars, and descriptions.
  • A feature is on if alpha.<ID> is on in config (case-insensitive), or its declared env var is true per strconv.ParseBool in the process env or the selected environment's .env. Opt-ins are additive. Global, unrelated, or non-enabling values can't cancel an explicit opt-in.
  • An explicitly selected environment is passed through as is. A missing optional scope is skipped only when no environment was selected. Real source errors are returned even if another source enables the feature. Reads aren't cached and don't print, write, or call auth.
  • Add docs/specs/preview-feature-flags.md in the agents extension: ownership, dependency direction, API, registry, error handling, discovery vs runtime checks, and trade-offs. Planned use is limited to managed harness agents, voice agents, and long-running invocation. General hosted agents and plain prompts stay ungated. These checks don't apply to evaluations or routines requests sent to existing agents.
  • Add CheckEnvironmentFlag(flags). It rejects an --environment flag that was set to an empty value before any source is read. A missing or unset flag still means the default environment. The spec lists the caller contract.
  • The spec has a new section on azd alpha features. alpha.all and AZD_ALPHA_ENABLE_<NAME> variables don't turn these previews on. Each one needs its own opt-in. The agents README notes the same carve out in the stacked feat: gate Foundry agent previews independently #10640.
  • Keep the existing source combination, scope, error, and snapshot tests. New tests check that alpha.all and AZD_ALPHA_ENABLE_<NAME> values are ignored for every registered feature, that an explicit empty --environment is rejected and that global or unrelated values can't override an explicit opt-in.
  • Add three indirect dependencies (heredoc/v2, azblob, azfile) needed by the host-sentinel compatibility tests in this module. azd stays at v1.37.0, the same pin as main. No root module replace, dependency upgrade, core or RPC change, release bump, or changelog entry.

Validation

  • Go 1.26.4 in cli/azd/extensions/azure.ai.agents: go build ./..., go vet ./..., and go test ./... pass. gofmt is clean.
  • golangci-lint with the repo config reports 0 issues. cSpell passes on touched files.

E2E

Built azd and the extension from this PR (ef8a606dc) and swapped the extension binary into the local install. Real Azure runs used a temporary Foundry project in eastus2 with gpt-4.1-mini. The resource group was deleted and the account purged afterwards.

The last five rows ran after the review fixes. This PR gates no command, so they used azd and the extension built from the #10657 head (7cf859518), which contains this PR at 35ac9bd34. Each used an isolated azd config.

Scenario Expected Result
Root, init, and invoke help with every flag off no gating yet, previews still listed previews listed
azd package of a prompt-voice project, flag off no gate in this PR packaged
Prompt agent azd deploy, real Azure deployed deployed
azd config set alpha.all on, then config list-alpha and init --kind prompt-voice all Off, init refused all Off, refused
AZD_ALPHA_ENABLE_AGENTS_VOICE=true voice stays Off Off
alpha.agents.voice on or process AZD_FOUNDRY_EXT_ENABLE_AGENTS_VOICE=true voice On On
invoke --long-running -e "" and --environment "", opt-in only in the default env rejected as an empty environment, default env not used rejected
invoke -e "" with no preview flag on a deployed prompt agent, real Azure unchanged, reply reply "pong"

Compatibility

Agents code imports azureaiagent/internal/featureflags. IsEnabled keeps its signature and Feature only gains the optional Description field. Opt-in is per-feature config or the exact env var. An explicit empty --environment is now an error for preview checks. alpha.all no longer turns on agents previews. Runtime OR semantics are unchanged. Downstream agents changes don't need replace github.com/azure/azure-dev/cli/azd => ../../ just to import featureflags.

@azure-pipelines

azure-pipelines Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
24 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the ext-foundry microsoft.foundry meta package or Foundry/AI extensions overall. Not individual extension issues. label Oct 20, 2026
@huimiu
Hui Miao (huimiu) added this pull request to stack #10637 October 20, 2026 13:32
@huimiu
Hui Miao (huimiu) marked this pull request as draft October 20, 2026 13:46
@huimiu
Hui Miao (huimiu) removed this pull request from stack #10637 October 21, 2026 02:27
@huimiu
Hui Miao (huimiu) force-pushed the hui/foundry-shared-feature-access branch from 44d9a2b to 464590d Compare October 21, 2026 03:12
@huimiu
Hui Miao (huimiu) changed the base branch from hui/foundry-feature-flags-core to main October 21, 2026 03:12
@huimiu
Hui Miao (huimiu) added this pull request to stack #10647 October 21, 2026 03:12
@github-actions github-actions Bot added the area/extensions Extensions (general) label Oct 21, 2026
@huimiu Hui Miao (huimiu) changed the title feat: add shared Foundry extension feature access feat: scope preview feature flags to the agents extension Oct 21, 2026
@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Oct 21, 2026
@huimiu
Hui Miao (huimiu) removed this pull request from stack #10647 October 21, 2026 12:36
@huimiu
Hui Miao (huimiu) added this pull request to stack #10658 October 21, 2026 12:36
@huimiu
Hui Miao (huimiu) marked this pull request as ready for review October 21, 2026 14:16
Copilot AI lite review requested due to automatic review settings October 21, 2026 14:16

Copilot AI 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.

🟡 Changes recommended

One or more issues must be addressed before approval.

2 open issues
What changed in this PR

Adds an agents-local preview feature registry and evaluator, with comprehensive tests and design documentation.

Changes:

  • Adds per-feature config and environment opt-in handling.
  • Registers managed harness, voice, and long-running features.
  • Updates module dependencies and documents the design.
File Description
cli/​azd/​extensions/​azure.ai.agents/​internal/​featureflags/​registry.go Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​internal/​featureflags/​registry_test.go Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​internal/​featureflags/​featureflags.go Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​internal/​featureflags/​featureflags_test.go Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​go.sum Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​go.mod Updated as part of this pull request.
cli/​azd/​extensions/​azure.ai.agents/​docs/​specs/​preview-feature-flags.md Updated as part of this pull request.

Review effort: Lite

@github-actions

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag Rick Winter (@RickWinter) and Kristen Womack (@kristenwomack) to let us know.

Comment thread cli/azd/extensions/azure.ai.agents/internal/featureflags/featureflags.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/featureflags/featureflags.go Outdated
Add a self-contained featureflags package for first-party Foundry
extensions. A feature is enabled when any layer opts in: user config
alpha.<id> or alpha.all set to on, the process env var, the selected
azd environment .env, or any azure.yaml services[].env map. It reads
only through existing azd gRPC services and needs no core change.
Add an optional Description to Feature and a registry with All and
Lookup so every agents preview is declared in one place.
Copilot AI lite review requested due to automatic review settings October 22, 2026 00:14
@huimiu
Hui Miao (huimiu) force-pushed the hui/foundry-shared-feature-access branch from ef8a606 to 495ee0d Compare October 22, 2026 00:14

Copilot AI 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.

🟡 Changes recommended

Two moderate findings remain regarding undocumented service-level opt-ins and an incomplete feature-flag source contract.

3 open issues

Review effort: Lite

Comment thread cli/azd/extensions/azure.ai.agents/docs/specs/preview-feature-flags.md Outdated
Document that agents previews need their own opt-in and are not turned on by alpha.all or AZD_ALPHA_ENABLE_* variables. Add CheckEnvironmentFlag so callers reject an explicit empty --environment before reading any source.
Copilot AI lite review requested due to automatic review settings October 22, 2026 01:58

Copilot AI 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.

🔵 Needs a closer look

The documented azd dependency version is inconsistent, and the service-environment opt-in source is undocumented or needs to be removed.

3 open issues
1 previously missed issue

In code that hasn't changed since last review

Low severity Document azure.yaml service env opt-in source

cli/​azd/​extensions/​azure.ai.agents/​docs/​specs/​preview-feature-flags.md:96

The enablement table is incomplete: IsEnabled also treats AZD_FOUNDRY_EXT_ENABLE_* values from every persisted azure.yaml service's env map as opt-ins (featureflags.go:147-151), including unrelated services. Please document this source and its scope here, or remove that source if the supported contract is limited to process and selected-environment values; otherwise users cannot explain why a service configuration enables an agents preview.

Review effort: Lite

Copilot AI lite review requested due to automatic review settings October 22, 2026 02:20

Copilot AI 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.

🔵 Needs a closer look

Resolve or document the azure.yaml service environment source and align the implementation, specification, and opt-in contract.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Restrict opt-in evaluation to process and azd environment sources

cli/​azd/​extensions/​azure.ai.agents/​internal/​featureflags/​featureflags.go:153

This adds every service's azure.yaml environment map as an opt-in source, but the contract and the implementation above only allow process environment and the selected azd .env values. A project can therefore enable a preview merely by declaring AZD_FOUNDRY_EXT_ENABLE_*: "true" for any service, including when no default environment exists, and this also makes the documented alpha.all/unrelated-value isolation incomplete. Remove this loop and evaluate only the declared process and azd environment sources.

3 resolved since last review

Review effort: Lite

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.agents PR build

Note

This is an unsigned development build. Install it only if you trust this PR.

Install the extension:

azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10636/azure-ai-agents.zip"
  • Version: 1.0.0-beta.21.pr.10636.6986910
  • Merge commit: e6b522c

@huimiu
Hui Miao (huimiu) merged commit 62be57a into main Oct 23, 2026
44 checks passed
@huimiu
Hui Miao (huimiu) deleted the hui/foundry-shared-feature-access branch October 23, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/extensions Extensions (general) ext-agents azure.ai.agents extension ext-foundry microsoft.foundry meta package or Foundry/AI extensions overall. Not individual extension issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add preview feature flags to the agents extension

3 participants