-
Notifications
You must be signed in to change notification settings - Fork 322
Description
Summary
PR #2210 ("Refactor RAG from agent-level config to standard toolset type") moved rag from an agent-level field to a standard toolset entry (type: rag with ref). A v6→v7 migration was added in pkg/config/latest/parse.go to automatically convert the old syntax, but it is unreachable for configs that don't set an explicit version field.
Root Cause
In pkg/config/config.go line 32:
raw.Version = cmp.Or(raw.Version, latest.Version)When no version is specified, the config defaults to the latest version ("7"). This means the YAML is parsed directly by the v7 strict parser, which rejects the old rag field on AgentConfig with:
[13:1] unknown field "rag"
The v6→v7 upgrader in parse.go only triggers when the config is parsed as a previous.Config (v6), which requires version: "6" to be explicitly set — something most users never do.
Impact
Any user who had a working config with agent-level rag: [...] (the documented syntax before v1.37.0) and upgrades docker-agent will get a cryptic unknown field "rag" error. The migration path exists but is silently bypassed.
This affects configs that reference the schema URL ($schema=https://raw.githubusercontent.com/docker/docker-agent/main/agent-schema.json) since the schema was updated to remove rag from agent properties, and users following it would never have set a version field.
Suggested Improvements
Two complementary improvements could reduce friction:
-
Better error message: When parsing fails on an agent with an unknown
ragfield, detect this specific case and suggest the fix:agent 'root': unknown field "rag" — the agent-level rag field was replaced by toolset entries in config v7. Replace rag: [name] with toolset entries: - type: rag ref: name Or add version: "6" to your config for automatic migration. -
Auto-migration for unversioned configs: When no
versionis set and strict v7 parsing fails, attempt a v6 parse + migration before returning the error. This would make the migration actually work for the majority of users.
Workarounds
Users can fix their configs by either:
- Adding
version: "6"to trigger the automatic migration - Manually replacing
rag: [name1, name2]on each agent with toolset entries:toolsets: # ... existing toolsets ... - type: rag ref: name1 - type: rag ref: name2
Reproduction
- Create a config file without a
versionfield that uses the old agent-levelragsyntax:rag: my-docs: docs: [README.md] strategies: - type: bm25 database: data/bm25.db agents: root: model: balanced instruction: "Hello" rag: [my-docs] toolsets: - type: shell
- Run docker-agent →
unknown field "rag"error
References
- PR Refactor RAG from agent-level config to standard toolset type #2210: Refactor RAG from agent-level config to standard toolset type
- Commit
cab21861: The refactor commit pkg/config/config.go:32: Default version assignmentpkg/config/latest/parse.go: v6→v7 migration code