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.
refactor(platform): narrow the external-action soul rule to what is enforced (#14210)
Reinier van der Leer47929acee3cb
diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.pyindex 04d985beb7..0b62062895 100644--- a/autogpt_platform/backend/backend/api/features/experts/models.py+++ b/autogpt_platform/backend/backend/api/features/experts/models.py@@ -18,7 +18,12 @@ ExpertRunStatus = Literal[]AI_DISCLOSURE_RULE = "The expert discloses that it is AI when acting externally."-EXTERNAL_ACTION_APPROVAL_RULE = "External actions require approval."+# Only some outward calls are actually gated for approval — is_sensitive_action+# (backend/blocks/_base.py, checked in backend/data/graph.py:261) covers 17 of+# 513 blocks — so this is phrased as expert behaviour, not a platform guarantee.+EXTERNAL_ACTION_APPROVAL_RULE = "The expert asks for approval before acting externally."+# Dual-audience: this tuple is both Soul-drawer UI copy and injected LLM+# instruction text. Reword for one audience without silently breaking the other.PROTECTED_SOUL_RULES = (AI_DISCLOSURE_RULE, EXTERNAL_ACTION_APPROVAL_RULE)EXPERT_NAME_MAX_LENGTH = 100diff --git a/autogpt_platform/backend/backend/copilot/expert_context_test.py b/autogpt_platform/backend/backend/copilot/expert_context_test.pyindex 8e2e27a434..a068abedb5 100644--- a/autogpt_platform/backend/backend/copilot/expert_context_test.py+++ b/autogpt_platform/backend/backend/copilot/expert_context_test.py@@ -255,8 +255,8 @@ class TestBuildExpertIdentitySuffix:assert "Never invent customer evidence." in resultassert "<what_ive_learned>" not in resultassert "Nothing recorded yet." not in result- assert "discloses that it is AI" in result- assert "External actions require approval" in result+ for rule in PROTECTED_SOUL_RULES:+ assert rule and rule in result@pytest.mark.asyncioasync def test_voice_preferences_are_fenced_as_untrusted_quoted_data(self):diff --git a/autogpt_platform/backend/snapshots/expert_pod_assign b/autogpt_platform/backend/snapshots/expert_pod_assignindex ff3a3c5e25..e6ef0b2f85 100644--- a/autogpt_platform/backend/snapshots/expert_pod_assign+++ b/autogpt_platform/backend/snapshots/expert_pod_assign@@ -14,7 +14,7 @@"pod_id": "pod-1","protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "Marketing Specialist","schedules_paused_at": null,diff --git a/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failureindex 37d89c9076..c51f5a8f1d 100644--- a/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure+++ b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure@@ -15,7 +15,7 @@"pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "","schedules_paused_at": null,diff --git a/autogpt_platform/backend/snapshots/expert_raise_attachments b/autogpt_platform/backend/snapshots/expert_raise_attachmentsindex 0f95e74056..8d01e4d170 100644--- a/autogpt_platform/backend/snapshots/expert_raise_attachments+++ b/autogpt_platform/backend/snapshots/expert_raise_attachments@@ -15,7 +15,7 @@"pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "Research Assistant","schedules_paused_at": null,diff --git a/autogpt_platform/backend/snapshots/expert_raise_default b/autogpt_platform/backend/snapshots/expert_raise_defaultindex eb322d117f..eaa9508db9 100644--- a/autogpt_platform/backend/snapshots/expert_raise_default+++ b/autogpt_platform/backend/snapshots/expert_raise_default@@ -15,7 +15,7 @@"pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "","schedules_paused_at": null,diff --git a/autogpt_platform/backend/snapshots/expert_soul_update b/autogpt_platform/backend/snapshots/expert_soul_updateindex 4d1ce2bbaf..a8d1e73ca4 100644--- a/autogpt_platform/backend/snapshots/expert_soul_update+++ b/autogpt_platform/backend/snapshots/expert_soul_update@@ -14,7 +14,7 @@"pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "Marketing Specialist","schedules_paused_at": null,diff --git a/autogpt_platform/backend/snapshots/expert_templates_list b/autogpt_platform/backend/snapshots/expert_templates_listindex 59fa4fb504..a5bd404a7e 100644--- a/autogpt_platform/backend/snapshots/expert_templates_list+++ b/autogpt_platform/backend/snapshots/expert_templates_list@@ -15,7 +15,7 @@"pod_id": null,"protected_soul_rules": ["The expert discloses that it is AI when acting externally.",- "External actions require approval."+ "The expert asks for approval before acting externally."],"role": "Marketing Specialist","schedules_paused_at": null,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsxindex ca9d0f3988..138a788d36 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx@@ -159,7 +159,7 @@ const mariaExpert: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: false,source_template_id: "template-maria",diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsxindex f880830000..4730fdfc4e 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx@@ -57,7 +57,7 @@ const mariaTemplate: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: true,source_template_id: null,diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsxindex 80d86414b2..bae53b70d4 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx@@ -47,7 +47,7 @@ const hiredMaria: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: false,source_template_id: "template-maria",diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsxindex c8f674aea8..244bcf73f7 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx@@ -105,7 +105,7 @@ const maria: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: false,source_template_id: "template-maria",diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsxindex 5116804193..04cc9e5e39 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx@@ -163,7 +163,7 @@ const hiredMaria: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: false,source_template_id: "template-maria",@@ -414,7 +414,14 @@ describe("TeamPage", () => {),).toBeDefined();expect(- screen.getByText("External actions require approval."),+ screen.getByText(+ "The expert asks for approval before acting externally.",+ ),+ ).toBeDefined();+ expect(+ screen.getByText(+ "These rules are part of every expert's soul and cannot be edited.",+ ),).toBeDefined();expect(screen.getAllByRole("textbox")).toHaveLength(4);expect(screen.queryByRole("button", { name: /remove/i })).toBeNull();diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsxindex c18c9e0c59..e4c2f37285 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx@@ -281,7 +281,7 @@ function ProtectedRules({ rules }: { rules: string[] }) {))}</div><Text variant="small" className="mt-3 text-zinc-400">- These safeguards are always active and cannot be edited.+ These rules are part of every expert's soul and cannot be edited.</Text></section>);diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsxindex 67ff6dd192..4af3c0fc48 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx@@ -39,7 +39,7 @@ const mariaExpert: Expert = {boundaries: "Never invent customer evidence.",protected_soul_rules: ["The expert discloses that it is AI when acting externally.",- "External actions require approval.",+ "The expert asks for approval before acting externally.",],is_template: false,source_template_id: "template-maria",