mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
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>