Fix user plugin precedence in provider and profile merges

User-first discovery let last-value-wins merges overwrite community
provider and profile definitions with bundled values. Apply bundled root
groups first in provider loading, profile loading and catalogs, and Agent
Editor metadata.

Share the existing root-priority key and use stable sorting at merge sites,
preserving same-root order and cached lookup lists. Add collision, fallback,
scoped-override and prompt/schema/dispatch regressions, and update DOX.

Validation: 206 focused tests and 17 checks against the bind-mounted Docker
framework runtime passed. git diff --check and helper DOX coverage passed.
This commit is contained in:
Alessandro 2026-10-08 15:51:32 +02:00
parent 573f3c2e05
commit a4e65d4721
9 changed files with 179 additions and 23 deletions

View file

@ -15,6 +15,8 @@
## Local Contracts
- Plugin profile metadata layers merge bundled roots before user roots using
stable root-priority sorting, matching runtime profile loading and catalogs.
- The editor performs zero model calls.
- Profile list requests stay lightweight: summary rows inspect only sparse
editor-owned keys and files and never construct full save or removal plans.

View file

@ -554,7 +554,11 @@ def _profile_directories(
Path(files.get_abs_path("agents", profile_id)),
)
]
for directory in plugins.get_enabled_plugin_paths(agent, "agents", profile_id):
for directory in sorted(
plugins.get_enabled_plugin_paths(agent, "agents", profile_id),
key=plugins.get_plugin_root_priority,
reverse=True,
):
directories.append(("plugin", Path(directory)))
directories.append(("user", USER_AGENTS_ROOT / profile_id))