fix(agent-repository): resolve copied agent name conflicts - #3803
Open
MoeexT wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in mechanism to resolve agent name / display_name conflicts during agent imports, and enables it specifically for marketplace (agent repository) imports to prevent duplicate-name collisions that block publishing and can misroute “edit” flows that rely on unique agent names.
Changes:
- Add
resolve_name_conflictsplumbing throughimport_agent_impl(...),import_agent_by_agent_id(...), andimport_agent_with_skills_impl(...). - When enabled, automatically suffix-conflict agent
nameanddisplay_name(e.g.,_1) before creating the imported agent. - Extend service tests to assert the flag is passed for repository imports and verify suffixing behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
backend/services/agent_service.py |
Adds resolve_name_conflicts flag and implements name/display_name conflict resolution during import. |
backend/services/agent_repository_service.py |
Enables conflict resolution for all repository import paths (with and without skills). |
test/backend/services/test_agent_service.py |
Adds/updates tests to cover conflict resolution behavior and new function signature. |
test/backend/services/test_agent_repository_service.py |
Asserts repository import passes resolve_name_conflicts=True into import routines. |
Suppressed comments (1)
backend/services/agent_service.py:2529
- Same as agent_name: if display_name suffix generation hits max_suffix_attempts, the resulting error lacks any context (which display_name/tenant caused it). Re-raise with the base display_name and tenant_id so the failure is diagnosable.
agent_display_name = _generate_unique_display_name_with_suffix(
agent_display_name,
tenant_id=tenant_id,
agents_cache=agents_cache,
)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2508
to
+2512
| if resolve_name_conflicts: | ||
| agents_cache = query_all_agent_info_by_tenant_id(tenant_id) | ||
| if _check_agent_name_duplicate( | ||
| agent_name, | ||
| tenant_id=tenant_id, |
Comment on lines
+2515
to
+2519
| agent_name = _generate_unique_agent_name_with_suffix( | ||
| agent_name, | ||
| tenant_id=tenant_id, | ||
| agents_cache=agents_cache, | ||
| ) |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MoeexT
force-pushed
the
fix/moeext/repo-agent-copy
branch
from
August 29, 2026 01:17
083841c to
6dcbe72
Compare
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.
fix: