Files
AutoGPT/autogpt_platform/backend
claude[bot] 2f64f1e412 fix(backend): handle slug collisions in store submission creation
Fixes UniqueViolationError when users try to create store submissions with duplicate slugs.

The issue was that create_store_submission() only checked for existing listings by agentGraphId,
but the database has a unique constraint on (owningUserId, slug). This caused failures when:
1. User creates agent A with slug "my-agent"
2. User creates agent B with same slug "my-agent"
3. Code didn't find duplicate (searched by agentGraphId only)
4. Database rejected due to unique constraint violation

Changes:
- Add slug uniqueness check before creating new store listing
- Generate unique slug with counter suffix when collision detected (e.g., "my-agent-1", "my-agent-2")
- Add safeguard to prevent infinite loop (max 100 attempts)
- Improve logging to track slug changes

Co-authored-by: Toran Bruce Richards <Torantulino@users.noreply.github.com>
2025-09-03 10:12:53 +00:00
..