AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): stop the roster seed from overwriting hired experts' skills (#14513)
Reinier van der Leerd9dd2ffb2111
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.pyindex fbbeccbebf..bff09a4986 100644--- a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py@@ -3277,6 +3277,10 @@ async def test_seed_backfills_presentation_fields_onto_hired_copies(assert hired.expert.avatar_url is Noneassert hired.expert.bio is Noneassert hired.expert.skills == []+ # The owner's own skill edit after hire, which no re-seed may touch.+ await prisma.models.Expert.prisma().update(+ where={"id": hired.expert.id}, data={"skills": ["Customer interviews"]}+ )entry: seed.RosterEntry = {"name": template.name,@@ -3298,8 +3302,9 @@ async def test_seed_backfills_presentation_fields_onto_hired_copies(assert refreshed.avatar_url == "/experts/maria.svg"assert refreshed.tagline == "Refreshed tagline"assert refreshed.bio == "Maria is a senior marketing strategist."- assert refreshed.skills == ["Content strategy", "SEO writing"]- # A user's rename of their own hire survives the refresh.+ # A user's rename and skill list survive the refresh: the template's+ # skills neither replace the owner's nor get merged back into them.+ assert refreshed.skills == ["Customer interviews"]assert refreshed.name == "My Maria"diff --git a/autogpt_platform/backend/backend/api/features/experts/seed.py b/autogpt_platform/backend/backend/api/features/experts/seed.pyindex ed7a9e74c0..55eecf85c9 100644--- a/autogpt_platform/backend/backend/api/features/experts/seed.py+++ b/autogpt_platform/backend/backend/api/features/experts/seed.py@@ -6,8 +6,8 @@ Upserts the three roster templates (Maria, Max, Frankie) by template name,so repeated runs keep the same template ids. Preload workflows are resolvedfrom official store listing slugs; all listings are validated before anytemplate is mutated. Each upsert also refreshes the presentation fields-(avatar, tagline, bio, skills) on experts already hired from that template,-so roster changes reach existing users and not just new hires.+(avatar, tagline, bio) on experts already hired from that template, so+roster changes reach existing users and not just new hires."""import asyncio@@ -314,9 +314,9 @@ async def _backfill_hired_copies(template: prisma.models.Expert) -> int:A hire copies the template row, so roster updates would otherwise onlyever reach new hires and everyone who hired earlier would keep a blank- avatar/tagline/bio/skills forever. ``name`` is deliberately excluded —- users may have renamed their hire — as are ``role``/``identity``, which- drive live persona behaviour.+ avatar/tagline/bio forever. ``name`` is deliberately excluded — users may+ have renamed their hire — as are ``role``/``identity``, which drive live+ persona behaviour, and ``skills``, which the owner edits after hire."""return await prisma.models.Expert.prisma().update_many(where={"sourceTemplateId": template.id, "isTemplate": False},@@ -324,7 +324,6 @@ async def _backfill_hired_copies(template: prisma.models.Expert) -> int:"avatarUrl": template.avatarUrl,"tagline": template.tagline,"bio": template.bio,- "skills": template.skills,},)