Skip to content

RAG refactor (v7) breaks configs without explicit version field — migration unreachable #2250

@aheritier

Description

@aheritier

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:

  1. Better error message: When parsing fails on an agent with an unknown rag field, 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.
    
  2. Auto-migration for unversioned configs: When no version is 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

  1. Create a config file without a version field that uses the old agent-level rag syntax:
    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
  2. Run docker-agent → unknown field "rag" error

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ragFor work/issues that have to do with the RAG featureskind/bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions