feat: accept instruction as a list, let flavors append to it - #4144
Merged
Conversation
Collaborator
|
👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push. Commits that are not verified: See GitHub's guide on signing commits for setup instructions. I've added |
… to it An agent's `instruction` was a plain string, so the only way for a flavor to add to the system prompt was to replace it wholesale — duplicating the entire prompt in the patch and defeating the point of flavors. Gordon's `skills` flavor hit exactly this: a ~10-line `<skills>` block that should be appended to a ~130-line base prompt. Let `instruction` be written as a list of strings, joined by a blank line like several `instruction_file` entries are. The normalisation happens in Agents.UnmarshalYAML, which already round-trips each agent through a raw mapping, so AgentConfig.Instruction stays a string for every consumer, strict-mode and error positions are unchanged, and HCL configs (converted to YAML first) get it for free. Marshalling emits the joined string: the list is input sugar only. In flavor patches, `key+` now promotes a scalar base to a one-element sequence before appending, so `instruction+: [extra]` extends a string instruction instead of erroring. A mapping base is still rejected. Bad promotions (e.g. `model+`) surface as the usual type error at parse time, consistent with "a flavored config is validated like a hand-written one". Signed-off-by: David Gageot <david.gageot@docker.com>
…n keys
The "bump the top-level version" hint only fired for unknown fields. New
syntax that changes a value's shape — `instruction` as a list, or a flavor
`instruction+` on a version-13 document — failed with a bare "cannot
unmarshal []interface {} into ... string" instead. The existing probe
("does a newer schema parse this document?") already answers that case,
so match yaml.TypeError as well and word the hint around syntax rather
than keys.
Signed-off-by: David Gageot <david.gageot@docker.com>
dgageot
force-pushed
the
feat/instruction-list
branch
from
September 3, 2026 14:17
5d91038 to
76c8452
Compare
trungutt
approved these changes
Sep 3, 2026
aheritier
approved these changes
Sep 3, 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.
A flavor could only replace an agent's
instructionwholesale: appending even a short block to a long system prompt meant duplicating the entire prompt inside the patch. The concrete case is docker/gordon'sskillsflavor, which appends a ~10-line<skills>block to a ~130-line base prompt.What changes
instructionaccepts a list of strings. The parts are joined by a blank line, like severalinstruction_fileentries. Normalisation happens inAgents.UnmarshalYAML, which already round-trips each agent through a raw mapping, soAgentConfig.Instructionstays a plainstringfor every consumer, strict mode and error positions are unchanged, and HCL configs (converted to YAML first) get it for free. Marshalling emits the joined string: the list is input sugar only.Flavor
key+promotes a scalar base to a one-element sequence before appending, soinstruction+: [extra]extends a string instruction instead of erroring. A mapping base is still rejected. A nonsensical promotion (e.g.model+) surfaces as the usual type error at parse time, consistent with "a flavored config is validated like a hand-written one".The "bump
version" hint also fires on type errors. The list form only exists in the latest schema (15); documents pinned to 13 or 14 keep rejecting it, but now withhint: this syntax is supported by config version 15; update the top-level 'version' field (currently 13)instead of a barecannot unmarshal []interface {} into ... string.With
--flavor tersethe instruction becomesYou are a helpful assistant.\n\nAnswer in one sentence.Also updates
agent-schema.json, the agents/flavors/overview docs, and adds aterseflavor toexamples/flavors.yaml.Validation
go test ./pkg/config/... ./pkg/teamloader/... ./pkg/oci/...(includes schema-vs-examples and doc-YAML tests)golangci-lint run,go run ./lint .docker agent debug config examples/flavors.yaml --flavor terse, and on gordon.yaml: theskillsflavor rewritten withinstruction+resolves to the same config as the standalone flavor file.