feat: config flavors — named YAML patches enabled at run time via --flavor#3768
Merged
Conversation
Flavors are named partial-config patches defined under a top-level `flavors` section and activated with the repeatable `--flavor` flag. Merge semantics are JSON Merge Patch (RFC 7386) with `key+`/`key-` extensions for appending to or removing from arrays and mappings. Assisted-By: docker/docker-agent
Assisted-By: Docker AI Agent
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The config-flavors implementation is well-engineered. The merge logic in pkg/config/flavors.go correctly follows JSON Merge Patch (RFC 7386) semantics with the key+/key- extensions, slices.Clone guards prevent aliasing across multi-flavor iterations, the yaml.MapSlice round-trip preserves document order, and all error paths return properly. No bugs were introduced by this PR.
Sayt-0
approved these changes
Jul 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.
Agent configs are often nearly identical across environments or use-cases — the same tools, the same model, just a different system prompt or a disabled tool. Until now the only way to handle this was to maintain separate YAML files that drift apart over time, or to rely on external templating.
This PR introduces flavors: named YAML patches declared in a top-level
flavorssection of an agent config and applied at load time via a repeatable--flavorflag. Merge semantics follow JSON Merge Patch (RFC 7386) — objects merge recursively, scalars and arrays replace,nulldeletes a key — with two extensions: akey+suffix appends to an existing array, and akey-suffix removes entries (from an object by key name, from an array by scalar equality or partial object match). Document order is preserved usingyaml.MapSliceso the root agent is always the first entry and never silently shifts. Flavors not declared in a config are silently ignored (a debug log is emitted) so the flag is safe to use across a fleet of configs where only some support a given flavor. The--flavorflag is wired into every command that loads an agent:run,chat,eval,serve api/a2a/mcp,acp,debug, and the sandbox/kit/agent-picker code paths. External OCI and URL sub-agents receive the same set of enabled flavors.The feature lands on the latest schema only (v13);
agent-schema.jsonis updated and HCL gainsflavors "name" {}block syntax with a detection keyword. An annotated example lives atexamples/flavors.yamland a full docs page is added underdocs/configuration/flavors/. Unit tests inpkg/config/flavors_test.gocover merge, order, delete, append, remove, and error paths including regression cases.task build,task test, andtask lintall pass; two pre-existing example tests that require Docker Model Runner also fail onmainand are unrelated to this change.