Skip to content

Commit 6cf779d

Browse files
nick-inkeepclaude
andauthored
fix: scope sub_agent_skills unique constraint to tenant/project/agent (#2190)
* fix: scope sub_agent_skills unique constraint to tenant/project/agent The unique constraint on sub_agent_skills was only on (sub_agent_id, skill_id), causing cross-tenant collisions when different tenants use sub-agents with the same ID and skill. Updated to include tenant_id, project_id, and agent_id. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add cross-tenant regression test for sub_agent_skills unique constraint Addresses review feedback: verifies different tenants can use the same (sub_agent_id, skill_id) combination, and same-tenant duplicates are still blocked. Also fixes trailing newline in migration SQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6dd0e8d commit 6cf779d

File tree

6 files changed

+3868
-1
lines changed

6 files changed

+3868
-1
lines changed

.changeset/cuddly-purple-fish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@inkeep/agents-core": patch
3+
---
4+
5+
Fix multi-tenant unique constraint on sub_agent_skills table to scope by tenant, project, and agent
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE "sub_agent_skills" DROP CONSTRAINT "sub_agent_skills_sub_agent_skill_unique";--> statement-breakpoint
2+
ALTER TABLE "sub_agent_skills" ADD CONSTRAINT "sub_agent_skills_sub_agent_skill_unique" UNIQUE("tenant_id","project_id","agent_id","sub_agent_id","skill_id");

0 commit comments

Comments
 (0)