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.
feat(platform): every block declares its effect; Auto judges cheap outward actions and asks first on costly ones (#14981)
Reinier van der Leera63f61af450f
diff --git a/.secrets.baseline b/.secrets.baselineindex f9bd797951..58903372b5 100644--- a/.secrets.baseline+++ b/.secrets.baseline@@ -183,7 +183,7 @@"filename": "autogpt_platform/backend/backend/blocks/github/checks.py","hashed_secret": "8ac6f92737d8586790519c5d7bfb4d2eb172c238","is_verified": false,- "line_number": 108+ "line_number": 109}],"autogpt_platform/backend/backend/blocks/github/ci.py": [@@ -231,7 +231,7 @@"filename": "autogpt_platform/backend/backend/blocks/github/statuses.py","hashed_secret": "8ac6f92737d8586790519c5d7bfb4d2eb172c238","is_verified": false,- "line_number": 85+ "line_number": 86}],"autogpt_platform/backend/backend/blocks/google/docs.py": [@@ -640,5 +640,5 @@}]},- "generated_at": "2026-09-23T11:02:10Z"+ "generated_at": "2026-09-27T20:56:19Z"}diff --git a/autogpt_platform/backend/backend/blocks/_base.py b/autogpt_platform/backend/backend/blocks/_base.pyindex 727f5d713a..53f5c41f74 100644--- a/autogpt_platform/backend/backend/blocks/_base.py+++ b/autogpt_platform/backend/backend/blocks/_base.py@@ -75,7 +75,12 @@ class BlockEffect(Enum):READ = "read" # fetches or computes; changes nothingWORKSPACE = "workspace" # writes only to the user's workspace or key-value storePLATFORM = "platform" # changes only the user's own objects on the platform- EXTERNAL = "external" # changes something outside the platform+ # Changes something outside the platform where a mistake is cheap and the+ # norms casual: a chat-channel post, a label, a draft, a new record.+ EXTERNAL_JUDGED = "external_judged"+ # Changes something outside the platform that is hard to take back, or reaches+ # people or money in the user's name: an email, a payment, a delete, a public post.+ EXTERNAL = "external"class BlockType(Enum):@@ -631,7 +636,7 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]):one provider and ``primitive`` otherwise; set it explicitly onprovider-backed generic blocks (code sandboxes, SQL, HTTP).effect: What running the block does; see BlockEffect. Irreversible- implies EXTERNAL.+ implies EXTERNAL or EXTERNAL_JUDGED."""self.id = idself.input_schema = input_schemadiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py b/autogpt_platform/backend/backend/blocks/agent_mail/drafts.pyindex 8dd8db61b8..1c6b2d157e 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py@@ -111,6 +111,7 @@ class AgentMailCreateDraftBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -412,6 +413,7 @@ class AgentMailUpdateDraftBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py b/autogpt_platform/backend/backend/blocks/agent_mail/inbox.pyindex d1ac5322c7..49974dd3a7 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py@@ -88,6 +88,7 @@ class AgentMailCreateInboxBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -336,6 +337,7 @@ class AgentMailUpdateInboxBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/lists.py b/autogpt_platform/backend/backend/blocks/agent_mail/lists.pyindex e7ca6be50d..56677f0760 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/lists.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/lists.py@@ -203,7 +203,7 @@ class AgentMailCreateListEntryBlock(Block):},)(),},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -362,7 +362,7 @@ class AgentMailDeleteListEntryBlock(Block):test_mock={"delete_entry": lambda *a, **kw: None,},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/messages.py b/autogpt_platform/backend/backend/blocks/agent_mail/messages.pyindex 254b578290..56f425210d 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/messages.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/messages.py@@ -661,6 +661,7 @@ class AgentMailUpdateMessageBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/pods.py b/autogpt_platform/backend/backend/blocks/agent_mail/pods.pyindex 0a11514947..67c9978902 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/pods.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/pods.py@@ -68,6 +68,7 @@ class AgentMailCreatePodBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -627,6 +628,7 @@ class AgentMailCreatePodInboxBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/airtable/bases.py b/autogpt_platform/backend/backend/blocks/airtable/bases.pyindex 16a581ce2c..68714b602f 100644--- a/autogpt_platform/backend/backend/blocks/airtable/bases.py+++ b/autogpt_platform/backend/backend/blocks/airtable/bases.py@@ -71,6 +71,7 @@ class AirtableCreateBaseBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/airtable/records.py b/autogpt_platform/backend/backend/blocks/airtable/records.pyindex 8d8e0620f6..7b451ee3d4 100644--- a/autogpt_platform/backend/backend/blocks/airtable/records.py+++ b/autogpt_platform/backend/backend/blocks/airtable/records.py@@ -254,6 +254,7 @@ class AirtableCreateRecordsBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -320,6 +321,7 @@ class AirtableUpdateRecordsBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/airtable/schema.py b/autogpt_platform/backend/backend/blocks/airtable/schema.pyindex 2e6f54daad..2828bc2ca1 100644--- a/autogpt_platform/backend/backend/blocks/airtable/schema.py+++ b/autogpt_platform/backend/backend/blocks/airtable/schema.py@@ -91,6 +91,7 @@ class AirtableCreateTableBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -138,6 +139,7 @@ class AirtableUpdateTableBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -190,6 +192,7 @@ class AirtableCreateFieldBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -238,6 +241,7 @@ class AirtableUpdateFieldBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/allquiet/incidents.py b/autogpt_platform/backend/backend/blocks/allquiet/incidents.pyindex f898d7f72d..d7d2e55254 100644--- a/autogpt_platform/backend/backend/blocks/allquiet/incidents.py+++ b/autogpt_platform/backend/backend/blocks/allquiet/incidents.py@@ -223,6 +223,7 @@ class AllQuietUpdateIncidentBlock(Block):("severity", IncidentSeverity.CRITICAL),],test_mock={"update_incident": lambda *args, **kwargs: TEST_INCIDENT},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.pyindex 0cba3f3c90..91db0dbc85 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py@@ -38,7 +38,7 @@ class PostToRedditBlock(Block):input_schema=PostToRedditBlock.Input,output_schema=PostToRedditBlock.Output,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.pyindex b0055a064c..4cf79232b4 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py@@ -57,7 +57,7 @@ class PostToTelegramBlock(Block):input_schema=PostToTelegramBlock.Input,output_schema=PostToTelegramBlock.Output,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/baas/bots.py b/autogpt_platform/backend/backend/blocks/baas/bots.pyindex 5f118a4df4..33875cb6d1 100644--- a/autogpt_platform/backend/backend/blocks/baas/bots.py+++ b/autogpt_platform/backend/backend/blocks/baas/bots.py@@ -136,6 +136,7 @@ class BaasBotLeaveMeetingBlock(Block):categories={BlockCategory.COMMUNICATION},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/basic.py b/autogpt_platform/backend/backend/blocks/basic.pyindex 4b8793e79f..5fb0e6b95b 100644--- a/autogpt_platform/backend/backend/blocks/basic.py+++ b/autogpt_platform/backend/backend/blocks/basic.py@@ -47,6 +47,7 @@ class FileStoreBlock(Block):input_schema=FileStoreBlock.Input,output_schema=FileStoreBlock.Output,static_output=True,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/conductor/manage_session.py b/autogpt_platform/backend/backend/blocks/conductor/manage_session.pyindex c009393405..1d73939b72 100644--- a/autogpt_platform/backend/backend/blocks/conductor/manage_session.py+++ b/autogpt_platform/backend/backend/blocks/conductor/manage_session.py@@ -54,7 +54,7 @@ class ConductorManageSessionBlock(Block):description="Rename, cancel or archive a Conductor agent session. ""Cancel stops the running turn and drops queued prompts.",categories={BlockCategory.DEVELOPER_TOOLS},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,input_schema=self.Input,output_schema=self.Output,test_input={diff --git a/autogpt_platform/backend/backend/blocks/conductor/sections.py b/autogpt_platform/backend/backend/blocks/conductor/sections.pyindex 93917ccc43..16b9034972 100644--- a/autogpt_platform/backend/backend/blocks/conductor/sections.py+++ b/autogpt_platform/backend/backend/blocks/conductor/sections.py@@ -55,7 +55,7 @@ class ConductorManageSectionBlock(Block):description="Create or delete a Conductor cloud section. Sections group ""workspaces in the sidebar; move workspaces with Manage Workspace.",categories={BlockCategory.DEVELOPER_TOOLS},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,input_schema=self.Input,output_schema=self.Output,test_input=[diff --git a/autogpt_platform/backend/backend/blocks/dataforb2b/enrich.py b/autogpt_platform/backend/backend/blocks/dataforb2b/enrich.pyindex f9a96814c5..2b0c1fa340 100644--- a/autogpt_platform/backend/backend/blocks/dataforb2b/enrich.py+++ b/autogpt_platform/backend/backend/blocks/dataforb2b/enrich.py@@ -9,6 +9,7 @@ from backend.blocks.dataforb2b._config import (from backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -87,6 +88,7 @@ class ProfileEnrichmentBlock(Block):"work_email": "[email protected]",}},+ effect=BlockEffect.READ,)@staticmethod@@ -155,6 +157,7 @@ class CompanyEnrichmentBlock(Block):"domain": "google.com",}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py b/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.pyindex dcbabc76c9..50cb428036 100644--- a/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py+++ b/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py@@ -140,6 +140,7 @@ class DataForSeoKeywordSuggestionsBlock(Block):}]},+ effect=BlockEffect.READ,)async def _fetch_keyword_suggestions(diff --git a/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py b/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.pyindex 24c6e1555e..cba01080aa 100644--- a/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py+++ b/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py@@ -147,6 +147,7 @@ class DataForSeoRelatedKeywordsBlock(Block):}]},+ effect=BlockEffect.READ,)async def _fetch_related_keywords(diff --git a/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py b/autogpt_platform/backend/backend/blocks/discord/bot_blocks.pyindex 83110d6282..f513bae962 100644--- a/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py+++ b/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py@@ -236,7 +236,7 @@ class SendDiscordMessageBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def send_message(@@ -372,7 +372,7 @@ class SendDiscordDMBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def send_dm(self, token: str, user_id: str, message_content: str) -> dict:@@ -493,7 +493,7 @@ class SendDiscordEmbedBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def send_embed(@@ -666,7 +666,7 @@ class SendDiscordFileBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def send_file(@@ -856,7 +856,7 @@ class ReplyToDiscordMessageBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def send_reply(@@ -1253,7 +1253,7 @@ class CreateDiscordThreadBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def create_thread(diff --git a/autogpt_platform/backend/backend/blocks/discord/oauth_blocks.py b/autogpt_platform/backend/backend/blocks/discord/oauth_blocks.pyindex 74e9229776..18e1e1012a 100644--- a/autogpt_platform/backend/backend/blocks/discord/oauth_blocks.py+++ b/autogpt_platform/backend/backend/blocks/discord/oauth_blocks.py@@ -5,6 +5,7 @@ Discord OAuth-based blocks.from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -74,6 +75,7 @@ class DiscordGetCurrentUserBlock(Block):accent_color=0,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/exa/code_context.py b/autogpt_platform/backend/backend/blocks/exa/code_context.pyindex c57844372b..549be8ce41 100644--- a/autogpt_platform/backend/backend/blocks/exa/code_context.py+++ b/autogpt_platform/backend/backend/blocks/exa/code_context.py@@ -13,6 +13,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -89,6 +90,7 @@ class ExaCodeContextBlock(Block):categories={BlockCategory.SEARCH, BlockCategory.DEVELOPER_TOOLS},input_schema=ExaCodeContextBlock.Input,output_schema=ExaCodeContextBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/research.py b/autogpt_platform/backend/backend/blocks/exa/research.pyindex 008b6f20ec..a7813d041a 100644--- a/autogpt_platform/backend/backend/blocks/exa/research.py+++ b/autogpt_platform/backend/backend/blocks/exa/research.py@@ -181,6 +181,7 @@ class ExaCreateResearchBlock(Block):categories={BlockCategory.SEARCH, BlockCategory.AI},input_schema=ExaCreateResearchBlock.Input,output_schema=ExaCreateResearchBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -405,6 +406,7 @@ class ExaWaitForResearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWaitForResearchBlock.Input,output_schema=ExaWaitForResearchBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets.py b/autogpt_platform/backend/backend/blocks/exa/websets.pyindex 5d1d0b1435..eba2d3adb7 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets.py@@ -251,6 +251,7 @@ class ExaCreateWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCreateWebsetBlock.Input,output_schema=ExaCreateWebsetBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -472,6 +473,7 @@ class ExaCreateOrFindWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCreateOrFindWebsetBlock.Input,output_schema=ExaCreateOrFindWebsetBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -549,6 +551,7 @@ class ExaUpdateWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaUpdateWebsetBlock.Input,output_schema=ExaUpdateWebsetBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -808,6 +811,7 @@ class ExaCancelWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCancelWebsetBlock.Input,output_schema=ExaCancelWebsetBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1200,6 +1204,7 @@ class ExaWebsetSummaryBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWebsetSummaryBlock.Input,output_schema=ExaWebsetSummaryBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py b/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.pyindex 498092c183..57d5bc3d84 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py@@ -174,6 +174,7 @@ class ExaCreateEnrichmentBlock(Block):categories={BlockCategory.AI, BlockCategory.SEARCH},input_schema=ExaCreateEnrichmentBlock.Input,output_schema=ExaCreateEnrichmentBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -403,6 +404,7 @@ class ExaUpdateEnrichmentBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaUpdateEnrichmentBlock.Input,output_schema=ExaUpdateEnrichmentBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -528,6 +530,7 @@ class ExaCancelEnrichmentBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCancelEnrichmentBlock.Input,output_schema=ExaCancelEnrichmentBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py b/autogpt_platform/backend/backend/blocks/exa/websets_import_export.pyindex 00c7e2c336..436f9ff7c8 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py@@ -218,6 +218,7 @@ class ExaCreateImportBlock(Block):],test_credentials=TEST_CREDENTIALS,test_mock=self._create_test_mock(),+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -355,6 +356,7 @@ class ExaGetImportBlock(Block):categories={BlockCategory.DATA},input_schema=ExaGetImportBlock.Input,output_schema=ExaGetImportBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -558,6 +560,7 @@ class ExaExportWebsetBlock(Block):],test_credentials=TEST_CREDENTIALS,test_mock=self._create_test_mock(),+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/exa/websets_items.py b/autogpt_platform/backend/backend/blocks/exa/websets_items.pyindex 0b8adb73ef..6e36fa7c26 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_items.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_items.py@@ -404,6 +404,7 @@ class ExaBulkWebsetItemsBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaBulkWebsetItemsBlock.Input,output_schema=ExaBulkWebsetItemsBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -477,6 +478,7 @@ class ExaWebsetItemsSummaryBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWebsetItemsSummaryBlock.Input,output_schema=ExaWebsetItemsSummaryBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py b/autogpt_platform/backend/backend/blocks/exa/websets_monitor.pyindex 2b70676c65..a279e3766f 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py@@ -229,6 +229,7 @@ class ExaCreateMonitorBlock(Block):],test_credentials=TEST_CREDENTIALS,test_mock=self._create_test_mock(),+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -456,6 +457,7 @@ class ExaUpdateMonitorBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaUpdateMonitorBlock.Input,output_schema=ExaUpdateMonitorBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_polling.py b/autogpt_platform/backend/backend/blocks/exa/websets_polling.pyindex 26a47b1350..c7d5843432 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_polling.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_polling.py@@ -110,6 +110,7 @@ class ExaWaitForWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWaitForWebsetBlock.Input,output_schema=ExaWaitForWebsetBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -497,6 +498,7 @@ class ExaWaitForEnrichmentBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWaitForEnrichmentBlock.Input,output_schema=ExaWaitForEnrichmentBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_search.py b/autogpt_platform/backend/backend/blocks/exa/websets_search.pyindex fb6b938d7f..e79d314e54 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_search.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_search.py@@ -241,6 +241,7 @@ class ExaCreateWebsetSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCreateWebsetSearchBlock.Input,output_schema=ExaCreateWebsetSearchBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -521,6 +522,7 @@ class ExaCancelWebsetSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaCancelWebsetSearchBlock.Input,output_schema=ExaCancelWebsetSearchBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -602,6 +604,7 @@ class ExaFindOrCreateSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaFindOrCreateSearchBlock.Input,output_schema=ExaFindOrCreateSearchBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/github/checks.py b/autogpt_platform/backend/backend/blocks/github/checks.pyindex 99feefec88..17cb4b7557 100644--- a/autogpt_platform/backend/backend/blocks/github/checks.py+++ b/autogpt_platform/backend/backend/blocks/github/checks.py@@ -6,6 +6,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -132,6 +133,7 @@ class GithubCreateCheckRunBlock(Block):"status": "completed",}},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -294,6 +296,7 @@ class GithubUpdateCheckRunBlock(Block):"conclusion": "success",}},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/commits.py b/autogpt_platform/backend/backend/blocks/github/commits.pyindex b32375192c..a6713d5eee 100644--- a/autogpt_platform/backend/backend/blocks/github/commits.py+++ b/autogpt_platform/backend/backend/blocks/github/commits.py@@ -303,6 +303,7 @@ class GithubMultiFileCommitBlock(Block):"https://github.com/owner/repo/commit/newcommitsha",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/issues.py b/autogpt_platform/backend/backend/blocks/github/issues.pyindex 9045e06e4b..c9524afa7f 100644--- a/autogpt_platform/backend/backend/blocks/github/issues.py+++ b/autogpt_platform/backend/backend/blocks/github/issues.py@@ -86,7 +86,7 @@ class GithubCommentBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -178,6 +178,7 @@ class GithubUpdateCommentBlock(Block):"https://github.com/owner/repo/issues/1#issuecomment-123456789",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -409,7 +410,7 @@ class GithubMakeIssueBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -721,6 +722,7 @@ class GithubAddLabelBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("status", "Label added successfully")],test_mock={"add_label": lambda *args, **kwargs: "Label added successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -783,6 +785,7 @@ class GithubRemoveLabelBlock(Block):test_mock={"remove_label": lambda *args, **kwargs: "Label removed successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -846,6 +849,7 @@ class GithubAssignIssueBlock(Block):test_mock={"assign_issue": lambda *args, **kwargs: "Issue assigned successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -912,6 +916,7 @@ class GithubUnassignIssueBlock(Block):test_mock={"unassign_issue": lambda *args, **kwargs: "Issue unassigned successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/notifications.py b/autogpt_platform/backend/backend/blocks/github/notifications.pyindex f6bc667fbf..40da5e68ff 100644--- a/autogpt_platform/backend/backend/blocks/github/notifications.py+++ b/autogpt_platform/backend/backend/blocks/github/notifications.py@@ -294,6 +294,7 @@ class GithubMarkNotificationsAsReadBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"mark_all_as_read": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -351,6 +352,7 @@ class GithubMarkNotificationThreadAsReadBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"mark_thread_as_read": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -404,6 +406,7 @@ class GithubMarkNotificationThreadAsDoneBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"mark_thread_as_done": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -457,6 +460,7 @@ class GithubUnsubscribeNotificationThreadBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"unsubscribe_thread": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/pull_requests.py b/autogpt_platform/backend/backend/blocks/github/pull_requests.pyindex 28dae8dec5..63b41e9536 100644--- a/autogpt_platform/backend/backend/blocks/github/pull_requests.py+++ b/autogpt_platform/backend/backend/blocks/github/pull_requests.py@@ -222,7 +222,7 @@ class GithubMakePullRequestBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -456,6 +456,7 @@ class GithubAssignPRReviewerBlock(Block):test_mock={"assign_reviewer": lambda *args, **kwargs: "Reviewer assigned successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -523,6 +524,7 @@ class GithubUnassignPRReviewerBlock(Block):test_mock={"unassign_reviewer": lambda *args, **kwargs: "Reviewer unassigned successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo.py b/autogpt_platform/backend/backend/blocks/github/repo.pyindex 665fb150dc..6c7ba0d7ab 100644--- a/autogpt_platform/backend/backend/blocks/github/repo.py+++ b/autogpt_platform/backend/backend/blocks/github/repo.py@@ -569,6 +569,7 @@ class GithubCreateRepositoryBlock(Block):"https://github.com/owner/test-repo.git",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -854,6 +855,7 @@ class GithubForkRepositoryBlock(Block):"myuser/repo",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -919,6 +921,7 @@ class GithubStarRepositoryBlock(Block):test_mock={"star_repo": lambda *args, **kwargs: "Repository starred successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo_branches.py b/autogpt_platform/backend/backend/blocks/github/repo_branches.pyindex 477b39554c..48e47a0189 100644--- a/autogpt_platform/backend/backend/blocks/github/repo_branches.py+++ b/autogpt_platform/backend/backend/blocks/github/repo_branches.py@@ -199,6 +199,7 @@ class GithubMakeBranchBlock(Block):test_mock={"create_branch": lambda *args, **kwargs: "Branch created successfully"},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo_files.py b/autogpt_platform/backend/backend/blocks/github/repo_files.pyindex 278c89c29b..ff64398096 100644--- a/autogpt_platform/backend/backend/blocks/github/repo_files.py+++ b/autogpt_platform/backend/backend/blocks/github/repo_files.py@@ -305,7 +305,7 @@ class GithubCreateFileBlock(Block):"abc123",)},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -405,7 +405,7 @@ class GithubUpdateFileBlock(Block):"def456",)},- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/reviews.py b/autogpt_platform/backend/backend/blocks/github/reviews.pyindex d8c28ef2a0..b3d3985d0b 100644--- a/autogpt_platform/backend/backend/blocks/github/reviews.py+++ b/autogpt_platform/backend/backend/blocks/github/reviews.py@@ -110,7 +110,7 @@ class GithubCreatePRReviewBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -431,7 +431,7 @@ class GithubSubmitPendingReviewBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -517,6 +517,7 @@ class GithubResolveReviewDiscussionBlock(Block):("success", True),],test_mock={"resolve_discussion": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/statuses.py b/autogpt_platform/backend/backend/blocks/github/statuses.pyindex caa1282a9b..9553dee309 100644--- a/autogpt_platform/backend/backend/blocks/github/statuses.py+++ b/autogpt_platform/backend/backend/blocks/github/statuses.py@@ -6,6 +6,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -117,6 +118,7 @@ class GithubCreateStatusBlock(Block):"updated_at": "2024-01-21T10:00:00Z",}},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/google/docs.py b/autogpt_platform/backend/backend/blocks/google/docs.pyindex de4c5cb0fc..dc67e29ef3 100644--- a/autogpt_platform/backend/backend/blocks/google/docs.py+++ b/autogpt_platform/backend/backend/blocks/google/docs.py@@ -322,6 +322,7 @@ class GoogleDocsCreateBlock(Block):"title": "My New Document",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -450,6 +451,7 @@ class GoogleDocsAppendPlainTextBlock(Block):"characters_added": 23,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -561,6 +563,7 @@ class GoogleDocsInsertPlainTextBlock(Block):"characters_inserted": 20,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -668,6 +671,7 @@ class GoogleDocsFindReplacePlainTextBlock(Block):"replacements_made": 3,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -916,6 +920,7 @@ class GoogleDocsInsertTableBlock(Block):"cells_found": 4,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1174,6 +1179,7 @@ class GoogleDocsInsertPageBreakBlock(Block):test_mock={"_insert_page_break": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1279,6 +1285,7 @@ class GoogleDocsDeleteContentBlock(Block):"characters_deleted": 40,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1403,6 +1410,7 @@ class GoogleDocsExportBlock(Block):"mime_type": "text/plain",},},+ effect=BlockEffect.READ,)async def run(@@ -1526,6 +1534,7 @@ class GoogleDocsFormatTextBlock(Block):test_mock={"_format_text": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1971,6 +1980,7 @@ class GoogleDocsAppendMarkdownBlock(Block):"requests_count": 5,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2093,6 +2103,7 @@ class GoogleDocsReplaceAllWithMarkdownBlock(Block):"requests_count": 3,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2218,6 +2229,7 @@ class GoogleDocsInsertMarkdownAtBlock(Block):"requests_count": 3,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2339,6 +2351,7 @@ class GoogleDocsReplaceRangeWithMarkdownBlock(Block):"characters_deleted": 40,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2483,6 +2496,7 @@ class GoogleDocsReplaceContentWithMarkdownBlock(Block):"requests_count": 4,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google/gmail.py b/autogpt_platform/backend/backend/blocks/google/gmail.pyindex 9321ac518f..c80cea45d3 100644--- a/autogpt_platform/backend/backend/blocks/google/gmail.py+++ b/autogpt_platform/backend/backend/blocks/google/gmail.py@@ -734,6 +734,7 @@ class GmailCreateDraftBlock(GmailBase):"message": {"id": "msg1"},},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -878,6 +879,7 @@ class GmailAddLabelBlock(GmailBase):"label_id": "Label_1",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -964,6 +966,7 @@ class GmailRemoveLabelBlock(GmailBase):"label_id": "Label_1",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1485,6 +1488,7 @@ class GmailDraftReplyBlock(GmailBase):"message": {"id": "m2", "threadId": "t1"},}},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google/sheets.py b/autogpt_platform/backend/backend/blocks/google/sheets.pyindex 1c0db6bf91..da730b7b77 100644--- a/autogpt_platform/backend/backend/blocks/google/sheets.py+++ b/autogpt_platform/backend/backend/blocks/google/sheets.py@@ -454,6 +454,7 @@ class GoogleSheetsWriteBlock(Block):"updatedRows": 2,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -587,6 +588,7 @@ class GoogleSheetsAppendRowBlock(Block):"updatedRows": 1,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -721,6 +723,7 @@ class GoogleSheetsClearBlock(Block):"clearedRange": "Sheet1!A1:B2"},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -832,6 +835,7 @@ class GoogleSheetsMetadataBlock(Block):"sheets": [{"title": "Sheet1", "sheetId": 0}],},},+ effect=BlockEffect.READ,)async def run(@@ -958,6 +962,7 @@ class GoogleSheetsManageSheetBlock(Block):"sheetId": 123,}},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1118,6 +1123,7 @@ class GoogleSheetsBatchOperationsBlock(Block):"replies": [],},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1279,6 +1285,7 @@ class GoogleSheetsFindReplaceBlock(Block):test_mock={"_find_replace": lambda *args, **kwargs: {"occurrencesChanged": 5},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1724,6 +1731,7 @@ class GoogleSheetsFormatBlock(Block):),],test_mock={"_format_cells": lambda *args, **kwargs: {"success": True}},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1910,6 +1918,7 @@ class GoogleSheetsCreateSpreadsheetBlock(Block):"title": "Test Spreadsheet",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2088,6 +2097,7 @@ class GoogleSheetsUpdateCellBlock(Block):"updatedRows": 1,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -2797,6 +2807,7 @@ class GoogleSheetsDeleteRowsBlock(Block):"deleted_count": 2,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -3154,6 +3165,7 @@ class GoogleSheetsSortBlock(Block):test_mock={"_sort_sheet": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -3597,6 +3609,7 @@ class GoogleSheetsInsertRowBlock(Block):test_mock={"_insert_row": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -3772,6 +3785,7 @@ class GoogleSheetsAddColumnBlock(Block):"column_index": 3,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -4156,6 +4170,7 @@ class GoogleSheetsRemoveDuplicatesBlock(Block):"remaining_rows": 95,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -4404,6 +4419,7 @@ class GoogleSheetsUpdateRowBlock(Block):"updatedCells": 2,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -4738,6 +4754,7 @@ class GoogleSheetsDeleteColumnBlock(Block):test_mock={"_delete_column": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -4914,6 +4931,7 @@ class GoogleSheetsCreateNamedRangeBlock(Block):"named_range_id": "nr_12345",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -5243,6 +5261,7 @@ class GoogleSheetsAddDropdownBlock(Block):test_mock={"_add_dropdown": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -5420,6 +5439,7 @@ class GoogleSheetsCopyToSpreadsheetBlock(Block):"new_sheet_name": "Copy of Sheet1",},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -5571,6 +5591,7 @@ class GoogleSheetsProtectRangeBlock(Block):"protection_id": 12345,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -5737,6 +5758,7 @@ class GoogleSheetsExportCsvBlock(Block):"row_count": 2,},},+ effect=BlockEffect.READ,)async def run(@@ -5878,6 +5900,7 @@ class GoogleSheetsImportCsvBlock(Block):"rows_imported": 2,},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -6017,6 +6040,7 @@ class GoogleSheetsAddNoteBlock(Block):test_mock={"_add_note": lambda *args, **kwargs: {"success": True},},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/hubspot/company.py b/autogpt_platform/backend/backend/blocks/hubspot/company.pyindex 543d16db0c..7843cb71d0 100644--- a/autogpt_platform/backend/backend/blocks/hubspot/company.py+++ b/autogpt_platform/backend/backend/blocks/hubspot/company.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -39,6 +40,7 @@ class HubSpotCompanyBlock(Block):categories={BlockCategory.CRM},input_schema=HubSpotCompanyBlock.Input,output_schema=HubSpotCompanyBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/hubspot/contact.py b/autogpt_platform/backend/backend/blocks/hubspot/contact.pyindex 1cdbf99b39..f64f00ca08 100644--- a/autogpt_platform/backend/backend/blocks/hubspot/contact.py+++ b/autogpt_platform/backend/backend/blocks/hubspot/contact.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -39,6 +40,7 @@ class HubSpotContactBlock(Block):categories={BlockCategory.CRM},input_schema=HubSpotContactBlock.Input,output_schema=HubSpotContactBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/linear/comment.py b/autogpt_platform/backend/backend/blocks/linear/comment.pyindex 33a757fab4..d39e7eb85f 100644--- a/autogpt_platform/backend/backend/blocks/linear/comment.py+++ b/autogpt_platform/backend/backend/blocks/linear/comment.py@@ -2,6 +2,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -57,6 +58,7 @@ class LinearCreateCommentBlock(Block):"Test comment",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/linear/issues.py b/autogpt_platform/backend/backend/blocks/linear/issues.pyindex 6b5741c005..4a0fb7adea 100644--- a/autogpt_platform/backend/backend/blocks/linear/issues.py+++ b/autogpt_platform/backend/backend/blocks/linear/issues.py@@ -71,6 +71,7 @@ class LinearCreateIssueBlock(Block):"Test issue",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/mem0.py b/autogpt_platform/backend/backend/blocks/mem0.pyindex 7215751604..461360708b 100644--- a/autogpt_platform/backend/backend/blocks/mem0.py+++ b/autogpt_platform/backend/backend/blocks/mem0.py@@ -125,6 +125,7 @@ class AddMemoryBlock(Block, Mem0Base):],test_credentials=TEST_CREDENTIALS,test_mock={"_get_client": lambda credentials: MockMemoryClient()},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/notion/create_page.py b/autogpt_platform/backend/backend/blocks/notion/create_page.pyindex 315730d37c..20488b4369 100644--- a/autogpt_platform/backend/backend/blocks/notion/create_page.py+++ b/autogpt_platform/backend/backend/blocks/notion/create_page.py@@ -7,6 +7,7 @@ from pydantic import model_validatorfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -96,6 +97,7 @@ class NotionCreatePageBlock(Block):"https://notion.so/Test-Page-12345678123412341234123456789012",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/notion/read_database.py b/autogpt_platform/backend/backend/blocks/notion/read_database.pyindex 7b1dcf7be4..9e59cdaaa1 100644--- a/autogpt_platform/backend/backend/blocks/notion/read_database.py+++ b/autogpt_platform/backend/backend/blocks/notion/read_database.py@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -101,6 +102,7 @@ class NotionReadDatabaseBlock(Block):"Test Database",)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/notion/read_page.py b/autogpt_platform/backend/backend/blocks/notion/read_page.pyindex a2b5273ad9..af536b74bd 100644--- a/autogpt_platform/backend/backend/blocks/notion/read_page.py+++ b/autogpt_platform/backend/backend/blocks/notion/read_page.py@@ -3,6 +3,7 @@ from __future__ import annotationsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -48,6 +49,7 @@ class NotionReadPageBlock(Block):test_mock={"get_page": lambda *args, **kwargs: {"object": "page", "id": "mocked"}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/notion/read_page_markdown.py b/autogpt_platform/backend/backend/blocks/notion/read_page_markdown.pyindex cad3e85e79..34468885d8 100644--- a/autogpt_platform/backend/backend/blocks/notion/read_page_markdown.py+++ b/autogpt_platform/backend/backend/blocks/notion/read_page_markdown.py@@ -3,6 +3,7 @@ from __future__ import annotationsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -60,6 +61,7 @@ class NotionReadPageMarkdownBlock(Block):"Test Page",)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/notion/search.py b/autogpt_platform/backend/backend/blocks/notion/search.pyindex 71af844b64..8ccabb5ffd 100644--- a/autogpt_platform/backend/backend/blocks/notion/search.py+++ b/autogpt_platform/backend/backend/blocks/notion/search.py@@ -7,6 +7,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -118,6 +119,7 @@ class NotionSearchBlock(Block):1,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/persistence.py b/autogpt_platform/backend/backend/blocks/persistence.pyindex 4858ea2cda..ca1e874849 100644--- a/autogpt_platform/backend/backend/blocks/persistence.py+++ b/autogpt_platform/backend/backend/blocks/persistence.py@@ -5,6 +5,7 @@ from typing import Any, Literalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -71,6 +72,7 @@ class PersistInformationBlock(Block):"language": "en",}},+ effect=BlockEffect.WORKSPACE,)async def run(@@ -141,6 +143,7 @@ class RetrieveInformationBlock(Block):],test_mock={"_retrieve_data": lambda *args, **kwargs: None},static_output=True,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/pinecone.py b/autogpt_platform/backend/backend/blocks/pinecone.pyindex 13749fce1b..059442231d 100644--- a/autogpt_platform/backend/backend/blocks/pinecone.py+++ b/autogpt_platform/backend/backend/blocks/pinecone.py@@ -62,6 +62,7 @@ class PineconeInitBlock(Block):categories={BlockCategory.LOGIC},input_schema=PineconeInitBlock.Input,output_schema=PineconeInitBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -205,6 +206,7 @@ class PineconeInsertBlock(Block):categories={BlockCategory.LOGIC},input_schema=PineconeInsertBlock.Input,output_schema=PineconeInsertBlock.Output,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/reddit.py b/autogpt_platform/backend/backend/blocks/reddit.pyindex 2a6a0b05d1..156000fef3 100644--- a/autogpt_platform/backend/backend/blocks/reddit.py+++ b/autogpt_platform/backend/backend/blocks/reddit.py@@ -245,6 +245,7 @@ class GetRedditPostsBlock(Block):MockObject(id="id3", title="title2", selftext="body2"),]},+ effect=BlockEffect.READ,)@staticmethod@@ -326,7 +327,7 @@ class PostRedditCommentBlock(Block):"reply_post": lambda creds, post_id, comment: "dummy_comment_id"},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -413,7 +414,7 @@ class CreateRedditPostBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -558,6 +559,7 @@ class GetRedditPostBlock(Block):over_18=False,)},+ effect=BlockEffect.READ,)@staticmethod@@ -680,6 +682,7 @@ class GetUserPostsBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethod@@ -811,6 +814,7 @@ class RedditGetMyPostsBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethod@@ -1005,6 +1009,7 @@ class SearchRedditBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethod@@ -1108,6 +1113,7 @@ class EditRedditPostBlock(Block):"https://reddit.com/r/test/comments/abc123/test_post/",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -1218,6 +1224,7 @@ class GetSubredditInfoBlock(Block):url="/r/python/",)},+ effect=BlockEffect.READ,)@staticmethod@@ -1404,6 +1411,7 @@ class GetRedditPostCommentsBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethod@@ -1568,6 +1576,7 @@ class GetRedditCommentRepliesBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethod@@ -1712,6 +1721,7 @@ class GetRedditCommentBlock(Block):depth=0,)},+ effect=BlockEffect.READ,)@staticmethod@@ -1797,7 +1807,7 @@ class ReplyToRedditCommentBlock(Block):"reply_to_comment": lambda creds, comment_id, reply_text: "new_reply_id"},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -1932,6 +1942,7 @@ class GetRedditUserInfoBlock(Block):MockObject(display_name="learnpython"),],},+ effect=BlockEffect.READ,)@staticmethod@@ -2170,6 +2181,7 @@ class GetRedditInboxBlock(Block):),]},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -2429,6 +2441,7 @@ class GetSubredditFlairsBlock(Block):},]},+ effect=BlockEffect.READ,)@staticmethod@@ -2549,6 +2562,7 @@ class GetSubredditRulesBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/reddit_moderation.py b/autogpt_platform/backend/backend/blocks/reddit_moderation.pyindex 330da98c26..4a753024bf 100644--- a/autogpt_platform/backend/backend/blocks/reddit_moderation.py+++ b/autogpt_platform/backend/backend/blocks/reddit_moderation.py@@ -167,6 +167,7 @@ class ModQueueBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -257,7 +258,7 @@ class RemoveRedditPostBlock(Block):],test_mock={"remove_post": lambda creds, post_id, spam, mod_note: True},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -319,7 +320,7 @@ class ApproveRedditPostBlock(Block):],test_mock={"approve_post": lambda creds, post_id: True},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -373,7 +374,7 @@ class LockRedditPostBlock(Block):],test_mock={"set_lock": lambda creds, post_id, lock: lock},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -547,7 +548,7 @@ class UnbanSubredditUserBlock(Block):],test_mock={"unban_user": lambda creds, subreddit, username: True},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/carts.py b/autogpt_platform/backend/backend/blocks/rmfg/carts.pyindex 3e24576da8..3696681267 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/carts.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/carts.py@@ -149,6 +149,7 @@ class RMFGCreateCartBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=CART_TEST_OUTPUT,test_mock={"create_cart": lambda *args, **kwargs: TEST_CART},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -269,6 +270,7 @@ class RMFGUpdateCartBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=CART_TEST_OUTPUT,test_mock={"update_cart": lambda *args, **kwargs: TEST_CART},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/designs.py b/autogpt_platform/backend/backend/blocks/rmfg/designs.pyindex 2d9121ecf4..cfe3a82dcc 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/designs.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/designs.py@@ -135,6 +135,7 @@ class RMFGAnalyzeDesignBlock(Block):"read_step_file": lambda *args, **kwargs: ("bracket.step", b"ISO"),"analyze": lambda *args, **kwargs: TEST_DESIGN,},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/dfm.py b/autogpt_platform/backend/backend/blocks/rmfg/dfm.pyindex 06734000be..566b38b267 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/dfm.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/dfm.py@@ -136,6 +136,7 @@ class RMFGCreateDFMReportBlock(Block):("review_url", TEST_DFM_REPORT.review_url),],test_mock={"create_report": lambda *args, **kwargs: TEST_DFM_REPORT},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/orders.py b/autogpt_platform/backend/backend/blocks/rmfg/orders.pyindex f343461ab6..886a0e281c 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/orders.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/orders.py@@ -79,6 +79,7 @@ class RMFGGetOrderBlock(Block):("amount_total_cents", 28849),],test_mock={"get_order": lambda *args, **kwargs: TEST_ORDER},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/quotes.py b/autogpt_platform/backend/backend/blocks/rmfg/quotes.pyindex ffd34f8208..933ec1ed9f 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/quotes.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/quotes.py@@ -140,6 +140,7 @@ class RMFGCreateQuoteBlock(Block):("dfm_issues", [TEST_DFM_ISSUE]),],test_mock={"create_quote": lambda *args, **kwargs: TEST_QUOTE},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/review_links.py b/autogpt_platform/backend/backend/blocks/rmfg/review_links.pyindex 2994fa187c..a35539310d 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/review_links.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/review_links.py@@ -96,6 +96,7 @@ class RMFGCreateReviewLinkBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=LINK_TEST_OUTPUT,test_mock={"create_link": lambda *args, **kwargs: TEST_REVIEW_LINK},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/slack/blocks.py b/autogpt_platform/backend/backend/blocks/slack/blocks.pyindex 9b3910de1f..53223d0f31 100644--- a/autogpt_platform/backend/backend/blocks/slack/blocks.py+++ b/autogpt_platform/backend/backend/blocks/slack/blocks.py@@ -102,7 +102,7 @@ class SendSlackMessageBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/filament.py b/autogpt_platform/backend/backend/blocks/slant3d/filament.pyindex a32c92f20a..cb7f5d182a 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/filament.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/filament.py@@ -1,4 +1,9 @@-from backend.blocks._base import BlockOutput, BlockSchemaInput, BlockSchemaOutput+from backend.blocks._base import (+ BlockEffect,+ BlockOutput,+ BlockSchemaInput,+ BlockSchemaOutput,+)from backend.data.model import APIKeyCredentials, SchemaFieldfrom ._api import (@@ -65,6 +70,7 @@ class Slant3DFilamentBlock(Slant3DBlockBase):test_mock={"_make_request": lambda *args, **kwargs: {"data": [TEST_FILAMENT]}},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/order.py b/autogpt_platform/backend/backend/blocks/slant3d/order.pyindex 8d64cabd4a..4ca25a7e8d 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/order.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/order.py@@ -99,6 +99,8 @@ class Slant3DEstimateOrderBlock(Slant3DBlockBase):("order_id", "SLANT_1234567890"),],test_mock={"_make_request": lambda *args, **kwargs: {"data": TEST_DRAFT}},+ # Judged: the estimate POSTs an uncharged draft order to Slant3D.+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -155,6 +157,8 @@ class Slant3DEstimateShippingBlock(Slant3DBlockBase):("order_id", "SLANT_1234567890"),],test_mock={"_make_request": lambda *args, **kwargs: {"data": TEST_DRAFT}},+ # Judged: the estimate POSTs an uncharged draft order to Slant3D.+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/order_status.py b/autogpt_platform/backend/backend/blocks/slant3d/order_status.pyindex 520dbc3995..5eae30cbdb 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/order_status.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/order_status.py@@ -98,6 +98,7 @@ class Slant3DTrackingBlock(Slant3DBlockBase):"data": {"order": {"status": "PAID", "fulfillment": None}}}},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/slicing.py b/autogpt_platform/backend/backend/blocks/slant3d/slicing.pyindex 7fdda8a264..74a3d5d5dc 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/slicing.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/slicing.py@@ -2,7 +2,12 @@ from urllib.parse import quotefrom pydantic import model_validator-from backend.blocks._base import BlockOutput, BlockSchemaInput, BlockSchemaOutput+from backend.blocks._base import (+ BlockEffect,+ BlockOutput,+ BlockSchemaInput,+ BlockSchemaOutput,+)from backend.data.execution import ExecutionContextfrom backend.data.model import APIKeyCredentials, SchemaFieldfrom backend.util.type import MediaFileType@@ -87,6 +92,7 @@ class Slant3DSlicerBlock(Slant3DBlockBase):"data": {"total": 8.23},}},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/smartlead/campaign.py b/autogpt_platform/backend/backend/blocks/smartlead/campaign.pyindex 55107afbdb..b7e5d43671 100644--- a/autogpt_platform/backend/backend/blocks/smartlead/campaign.py+++ b/autogpt_platform/backend/backend/blocks/smartlead/campaign.py@@ -84,6 +84,7 @@ class CreateCampaignBlock(Block):created_at="2024-01-01T00:00:00Z",)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -309,6 +310,7 @@ class SaveCampaignSequencesBlock(Block):message="Sequences saved successfully",)},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/stagehand/blocks.py b/autogpt_platform/backend/backend/blocks/stagehand/blocks.pyindex f4a8c43257..5d0f31a6bc 100644--- a/autogpt_platform/backend/backend/blocks/stagehand/blocks.py+++ b/autogpt_platform/backend/backend/blocks/stagehand/blocks.py@@ -16,6 +16,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -125,6 +126,7 @@ class StagehandObserveBlock(Block):categories={BlockCategory.AI, BlockCategory.DEVELOPER_TOOLS},input_schema=StagehandObserveBlock.Input,output_schema=StagehandObserveBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -218,6 +220,7 @@ class StagehandActBlock(Block):categories={BlockCategory.AI, BlockCategory.DEVELOPER_TOOLS},input_schema=StagehandActBlock.Input,output_schema=StagehandActBlock.Output,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -303,6 +306,7 @@ class StagehandExtractBlock(Block):categories={BlockCategory.AI, BlockCategory.DEVELOPER_TOOLS},input_schema=StagehandExtractBlock.Input,output_schema=StagehandExtractBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py b/autogpt_platform/backend/backend/blocks/stripe_link/mpp.pyindex bc2203abb2..92b5d48b31 100644--- a/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py+++ b/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py@@ -247,6 +247,7 @@ class StripeLinkGetPaymentChallengeBlock(Block):+ '", description="Test charge"',)},+ effect=BlockEffect.EXTERNAL,)# Instance method to match `_pay_with_token`, so both API seams patchdiff --git a/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py b/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.pyindex 3a1f1900f8..da5a981144 100644--- a/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py+++ b/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py@@ -449,6 +449,7 @@ class StripeLinkCreateCardSpendRequestBlock(Block):"approval_url": "",}},+ effect=BlockEffect.EXTERNAL,)async def run(@@ -565,6 +566,7 @@ class StripeLinkCreateTokenSpendRequestBlock(Block):"approval_url": "",}},+ effect=BlockEffect.EXTERNAL,)async def run(@@ -842,6 +844,8 @@ class StripeLinkRetrieveCardBlock(Block):},}},+ # A GET, but it discloses the card number and CVC, so it asks.+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/system/store_operations.py b/autogpt_platform/backend/backend/blocks/system/store_operations.pyindex 25cd0788bc..2f25ae1cba 100644--- a/autogpt_platform/backend/backend/blocks/system/store_operations.py+++ b/autogpt_platform/backend/backend/blocks/system/store_operations.py@@ -6,6 +6,7 @@ from backend.api.features.store.db import StoreAgentsSortOptionsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -120,6 +121,7 @@ class GetStoreAgentDetailsBlock(Block):)},static_output=True,+ effect=BlockEffect.READ,)async def run(@@ -248,6 +250,7 @@ class SearchStoreAgentsBlock(Block):total_count=1,)},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/telegram/blocks.py b/autogpt_platform/backend/backend/blocks/telegram/blocks.pyindex 79fe8392e5..ac4969aaca 100644--- a/autogpt_platform/backend/backend/blocks/telegram/blocks.py+++ b/autogpt_platform/backend/backend/blocks/telegram/blocks.py@@ -102,7 +102,7 @@ class SendTelegramMessageBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -198,7 +198,7 @@ class SendTelegramPhotoBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -358,7 +358,7 @@ class SendTelegramVoiceBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -504,7 +504,7 @@ class ReplyToTelegramMessageBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -724,6 +724,7 @@ class EditTelegramMessageBlock(Block):message_id=42)},+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -826,7 +827,7 @@ class SendTelegramAudioBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1002,7 +1003,7 @@ class SendTelegramDocumentBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(@@ -1163,7 +1164,7 @@ class SendTelegramVideoBlock(Block):)},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/test/test_block.py b/autogpt_platform/backend/backend/blocks/test/test_block.pyindex 127749c8c9..3ecb4dc34e 100644--- a/autogpt_platform/backend/backend/blocks/test/test_block.py+++ b/autogpt_platform/backend/backend/blocks/test/test_block.py@@ -50,125 +50,19 @@ async def test_available_blocks(block: Type[Block]):await execute_block_test(block_instance)-# Blocks that predate the ``effect`` declaration and are not classified yet.-# An undeclared block asks before it runs, so an entry costs friction, never-# safety. MAY ONLY SHRINK: a new block declares its effect, and a follow-up that-# classifies a provider family deletes its rows.-_EFFECT_UNCLASSIFIED: frozenset[str] = frozenset(- """- AddAudioToVideoBlock AddMemoryBlock AgentMailCreateDraftBlock- AgentMailCreateInboxBlock AgentMailCreatePodBlock AgentMailCreatePodInboxBlock- AgentMailUpdateDraftBlock AgentMailUpdateInboxBlock AgentMailUpdateMessageBlock- AirtableCreateBaseBlock AirtableCreateFieldBlock AirtableCreateRecordsBlock- AirtableCreateTableBlock AirtableUpdateFieldBlock AirtableUpdateRecordsBlock- AirtableUpdateTableBlock AllQuietUpdateIncidentBlock BaasBotLeaveMeetingBlock- BlockInstallationBlock CompanyEnrichmentBlock CreateCampaignBlock- DataForSeoKeywordSuggestionsBlock DataForSeoRelatedKeywordsBlock- DiscordGetCurrentUserBlock EditRedditPostBlock EditTelegramMessageBlock- ExaBulkWebsetItemsBlock ExaCancelEnrichmentBlock ExaCancelWebsetBlock- ExaCancelWebsetSearchBlock ExaCodeContextBlock ExaCreateEnrichmentBlock- ExaCreateImportBlock ExaCreateMonitorBlock ExaCreateOrFindWebsetBlock- ExaCreateResearchBlock ExaCreateWebsetBlock ExaCreateWebsetSearchBlock- ExaExportWebsetBlock ExaFindOrCreateSearchBlock ExaGetImportBlock- ExaUpdateEnrichmentBlock ExaUpdateMonitorBlock ExaUpdateWebsetBlock- ExaWaitForEnrichmentBlock ExaWaitForResearchBlock ExaWaitForWebsetBlock- ExaWebsetItemsSummaryBlock ExaWebsetSummaryBlock FileStoreBlock- GetRedditCommentBlock GetRedditCommentRepliesBlock GetRedditInboxBlock- GetRedditPostBlock GetRedditPostCommentsBlock GetRedditPostsBlock- GetRedditUserInfoBlock GetStoreAgentDetailsBlock GetSubredditFlairsBlock- GetSubredditInfoBlock GetSubredditRulesBlock GetUserPostsBlock- GithubAddLabelBlock GithubAssignIssueBlock GithubAssignPRReviewerBlock- GithubCreateCheckRunBlock GithubCreateRepositoryBlock GithubCreateStatusBlock- GithubForkRepositoryBlock GithubMakeBranchBlock- GithubMarkNotificationThreadAsDoneBlock GithubMarkNotificationThreadAsReadBlock- GithubMarkNotificationsAsReadBlock GithubMultiFileCommitBlock- GithubRemoveLabelBlock GithubResolveReviewDiscussionBlock- GithubStarRepositoryBlock GithubUnassignIssueBlock GithubUnassignPRReviewerBlock- GithubUnsubscribeNotificationThreadBlock GithubUpdateCheckRunBlock- GithubUpdateCommentBlock GmailAddLabelBlock GmailCreateDraftBlock- GmailDraftReplyBlock GmailRemoveLabelBlock GoogleDocsAppendMarkdownBlock- GoogleDocsAppendPlainTextBlock GoogleDocsCreateBlock- GoogleDocsDeleteContentBlock GoogleDocsExportBlock- GoogleDocsFindReplacePlainTextBlock GoogleDocsFormatTextBlock- GoogleDocsInsertMarkdownAtBlock GoogleDocsInsertPageBreakBlock- GoogleDocsInsertPlainTextBlock GoogleDocsInsertTableBlock- GoogleDocsReplaceAllWithMarkdownBlock GoogleDocsReplaceContentWithMarkdownBlock- GoogleDocsReplaceRangeWithMarkdownBlock GoogleSheetsAddColumnBlock- GoogleSheetsAddDropdownBlock GoogleSheetsAddNoteBlock GoogleSheetsAppendRowBlock- GoogleSheetsBatchOperationsBlock GoogleSheetsClearBlock- GoogleSheetsCopyToSpreadsheetBlock GoogleSheetsCreateNamedRangeBlock- GoogleSheetsCreateSpreadsheetBlock GoogleSheetsDeleteColumnBlock- GoogleSheetsDeleteRowsBlock GoogleSheetsExportCsvBlock- GoogleSheetsFindReplaceBlock GoogleSheetsFormatBlock GoogleSheetsImportCsvBlock- GoogleSheetsInsertRowBlock GoogleSheetsManageSheetBlock- GoogleSheetsMetadataBlock GoogleSheetsProtectRangeBlock- GoogleSheetsRemoveDuplicatesBlock GoogleSheetsSortBlock- GoogleSheetsUpdateCellBlock GoogleSheetsUpdateRowBlock GoogleSheetsWriteBlock- HubSpotCompanyBlock HubSpotContactBlock JevAskManyBlock JevChoiceBlock- JevFilterBlock JevPickBestBlock JevRouteBlock JevScoreBlock JevYesNoBlock- LinearCreateCommentBlock LinearCreateIssueBlock LoopVideoBlock- MediaDurationBlock ModQueueBlock NotionCreatePageBlock NotionReadDatabaseBlock- NotionReadPageBlock NotionReadPageMarkdownBlock NotionSearchBlock- PersistInformationBlock PineconeInitBlock PineconeInsertBlock- ProfileEnrichmentBlock RMFGAnalyzeDesignBlock RMFGCreateCartBlock- RMFGCreateDFMReportBlock RMFGCreateQuoteBlock RMFGCreateReviewLinkBlock- RMFGGetOrderBlock RMFGUpdateCartBlock RedditGetMyPostsBlock- RetrieveInformationBlock SaveCampaignSequencesBlock SearchRedditBlock- SearchStoreAgentsBlock Slant3DEstimateOrderBlock Slant3DEstimateShippingBlock- Slant3DFilamentBlock Slant3DSlicerBlock Slant3DTrackingBlock StagehandActBlock- StagehandExtractBlock StagehandObserveBlock- StripeLinkCreateCardSpendRequestBlock StripeLinkCreateTokenSpendRequestBlock- StripeLinkGetPaymentChallengeBlock StripeLinkRetrieveCardBlock- TodoistCloseTaskBlock TodoistCreateCommentBlock TodoistCreateLabelBlock- TodoistCreateProjectBlock TodoistCreateTaskBlock TodoistGetCommentBlock- TodoistGetCommentsBlock TodoistGetLabelBlock TodoistGetProjectBlock- TodoistGetSectionBlock TodoistGetSharedLabelsBlock TodoistGetTaskBlock- TodoistGetTasksBlock TodoistListCollaboratorsBlock TodoistListLabelsBlock- TodoistListProjectsBlock TodoistListSectionsBlock TodoistRenameSharedLabelsBlock- TodoistReopenTaskBlock TodoistUpdateCommentBlock TodoistUpdateLabelBlock- TodoistUpdateProjectBlock TodoistUpdateTaskBlock TwitterAddListMemberBlock- TwitterBookmarkTweetBlock TwitterCreateListBlock TwitterFollowListBlock- TwitterFollowUserBlock TwitterGetBlockedUsersBlock- TwitterGetBookmarkedTweetsBlock TwitterGetFollowersBlock- TwitterGetFollowingBlock TwitterGetHomeTimelineBlock TwitterGetLikedTweetsBlock- TwitterGetLikingUsersBlock TwitterGetListBlock TwitterGetListMembersBlock- TwitterGetListMembershipsBlock TwitterGetListTweetsBlock- TwitterGetMutedUsersBlock TwitterGetOwnedListsBlock TwitterGetPinnedListsBlock- TwitterGetQuoteTweetsBlock TwitterGetRetweetersBlock TwitterGetSpaceBuyersBlock- TwitterGetSpaceByIdBlock TwitterGetSpaceTweetsBlock TwitterGetSpacesBlock- TwitterGetTweetBlock TwitterGetTweetsBlock TwitterGetUserBlock- TwitterGetUserMentionsBlock TwitterGetUserTweetsBlock TwitterGetUsersBlock- TwitterHideReplyBlock TwitterLikeTweetBlock TwitterMuteUserBlock- TwitterPinListBlock TwitterRemoveBookmarkTweetBlock TwitterRemoveListMemberBlock- TwitterRemoveRetweetBlock TwitterSearchRecentTweetsBlock- TwitterSearchSpacesBlock TwitterUnfollowListBlock TwitterUnfollowUserBlock- TwitterUnhideReplyBlock TwitterUnlikeTweetBlock TwitterUnmuteUserBlock- TwitterUnpinListBlock TwitterUpdateListBlock VideoClipBlock VideoConcatBlock- VideoDownloadBlock VideoNarrationBlock VideoTextOverlayBlock- """.split()-)--@pytest.mark.parametrize("block", get_blocks().values(), ids=lambda b: b().name)def test_block_declares_an_effect(block: Type[Block]):instance = block()name = block.__name__if instance.effect is not None:- assert name not in _EFFECT_UNCLASSIFIED, (- f"{name} declares an effect, so delete it from _EFFECT_UNCLASSIFIED "- f"— that list may only shrink."- )assert name not in UNREADABLE_BLOCKS, (f"{name} is unreadable by construction; a declaration would let it "f"run without asking.")return- if instance.block_type in STRUCTURAL_TYPES or name in UNREADABLE_BLOCKS:- return- assert name in _EFFECT_UNCLASSIFIED, (+ assert instance.block_type in STRUCTURAL_TYPES or name in UNREADABLE_BLOCKS, (f"{name} declares no effect. Pass effect=BlockEffect.NONE, READ, "- f"WORKSPACE, PLATFORM or EXTERNAL (see BlockEffect). Do not add it to "- f"_EFFECT_UNCLASSIFIED."+ f"WORKSPACE, PLATFORM, EXTERNAL_JUDGED or EXTERNAL (see BlockEffect).")@@ -195,8 +89,9 @@ def test_irreversible_blocks_are_external(block: Type[Block]):instance = block()if not instance.is_irreversible_action:return- assert instance.effect is BlockEffect.EXTERNAL, (- f"{instance.name} is irreversible, so its effect must be EXTERNAL, not "+ assert instance.effect in (BlockEffect.EXTERNAL_JUDGED, BlockEffect.EXTERNAL), (+ f"{instance.name} is irreversible, so its effect must be EXTERNAL_JUDGED "+ f"or EXTERNAL, not "f"{instance.effect.name if instance.effect else 'undeclared'}.")diff --git a/autogpt_platform/backend/backend/blocks/todoist/comments.py b/autogpt_platform/backend/backend/blocks/todoist/comments.pyindex 4b5a16e335..b9e5425e62 100644--- a/autogpt_platform/backend/backend/blocks/todoist/comments.py+++ b/autogpt_platform/backend/backend/blocks/todoist/comments.py@@ -90,6 +90,7 @@ class TodoistCreateCommentBlock(Block):"project_id": None,}},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -203,6 +204,7 @@ class TodoistGetCommentsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -297,6 +299,7 @@ class TodoistGetCommentBlock(Block):"attachment": None,}},+ effect=BlockEffect.READ,)@staticmethod@@ -360,6 +363,7 @@ class TodoistUpdateCommentBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"update_comment": lambda credentials, comment_id, content: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/labels.py b/autogpt_platform/backend/backend/blocks/todoist/labels.pyindex 4947aeb007..5052ceb3dc 100644--- a/autogpt_platform/backend/backend/blocks/todoist/labels.py+++ b/autogpt_platform/backend/backend/blocks/todoist/labels.py@@ -74,6 +74,7 @@ class TodoistCreateLabelBlock(Block):"is_favorite": False,}},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -167,6 +168,7 @@ class TodoistListLabelsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -239,6 +241,7 @@ class TodoistGetLabelBlock(Block):"is_favorite": False,}},+ effect=BlockEffect.READ,)@staticmethod@@ -311,6 +314,7 @@ class TodoistUpdateLabelBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"update_label": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -434,6 +438,7 @@ class TodoistGetSharedLabelsBlock(Block):"Label3",]},+ effect=BlockEffect.READ,)@staticmethod@@ -488,6 +493,7 @@ class TodoistRenameSharedLabelsBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"rename_shared_labels": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/projects.py b/autogpt_platform/backend/backend/blocks/todoist/projects.pyindex 5c1ab2f045..8950877e5b 100644--- a/autogpt_platform/backend/backend/blocks/todoist/projects.py+++ b/autogpt_platform/backend/backend/blocks/todoist/projects.py@@ -77,6 +77,7 @@ class TodoistListProjectsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -162,6 +163,7 @@ class TodoistCreateProjectBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"create_project": lambda *args, **kwargs: (True)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -268,6 +270,7 @@ class TodoistGetProjectBlock(Block):},)},+ effect=BlockEffect.READ,)@staticmethod@@ -348,6 +351,7 @@ class TodoistUpdateProjectBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"update_project": lambda *args, **kwargs: (True)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -527,6 +531,7 @@ class TodoistListCollaboratorsBlock(Block):],)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/sections.py b/autogpt_platform/backend/backend/blocks/todoist/sections.pyindex dce92f18ed..3bdf5ec578 100644--- a/autogpt_platform/backend/backend/blocks/todoist/sections.py+++ b/autogpt_platform/backend/backend/blocks/todoist/sections.py@@ -78,6 +78,7 @@ class TodoistListSectionsBlock(Block):],)},+ effect=BlockEffect.READ,)@staticmethod@@ -231,6 +232,7 @@ class TodoistGetSectionBlock(Block):"name": "Groceries",}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/tasks.py b/autogpt_platform/backend/backend/blocks/todoist/tasks.pyindex 7488da4cba..63d34da4cc 100644--- a/autogpt_platform/backend/backend/blocks/todoist/tasks.py+++ b/autogpt_platform/backend/backend/blocks/todoist/tasks.py@@ -124,6 +124,7 @@ class TodoistCreateTaskBlock(Block):},)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -255,6 +256,7 @@ class TodoistGetTasksBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -338,6 +340,7 @@ class TodoistGetTaskBlock(Block):"url": "https://todoist.com/showTask?id=2995104339",}},+ effect=BlockEffect.READ,)@staticmethod@@ -444,6 +447,7 @@ class TodoistUpdateTaskBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"update_task": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -530,6 +534,7 @@ class TodoistCloseTaskBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"close_task": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -582,6 +587,7 @@ class TodoistReopenTaskBlock(Block):("success", True),],test_mock={"reopen_task": lambda *args, **kwargs: (True)},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/list_follows.py b/autogpt_platform/backend/backend/blocks/twitter/lists/list_follows.pyindex 93dfaef919..2a95fc302e 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/list_follows.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/list_follows.py@@ -4,6 +4,7 @@ import tweepyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -57,6 +58,7 @@ class TwitterUnfollowListBlock(Block):("success", True),],test_mock={"unfollow_list": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -119,6 +121,7 @@ class TwitterFollowListBlock(Block):("success", True),],test_mock={"follow_list": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/list_lookup.py b/autogpt_platform/backend/backend/blocks/twitter/lists/list_lookup.pyindex a6a5607196..d7dd70870c 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/list_lookup.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/list_lookup.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -88,6 +94,7 @@ class TwitterGetListBlock(Block):"TwitterAPI",)},+ effect=BlockEffect.READ,)@staticmethod@@ -245,6 +252,7 @@ class TwitterGetOwnedListsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/list_members.py b/autogpt_platform/backend/backend/blocks/twitter/lists/list_members.pyindex 5505f1457a..57b314de7d 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/list_members.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/list_members.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -80,6 +81,7 @@ class TwitterRemoveListMemberBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"remove_list_member": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -153,6 +155,7 @@ class TwitterAddListMemberBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"add_list_member": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -269,6 +272,7 @@ class TwitterGetListMembersBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -434,6 +438,7 @@ class TwitterGetListMembershipsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/list_tweets_lookup.py b/autogpt_platform/backend/backend/blocks/twitter/lists/list_tweets_lookup.pyindex 57dc6579c9..2162d1fb26 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/list_tweets_lookup.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/list_tweets_lookup.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -110,6 +116,7 @@ class TwitterGetListTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py b/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.pyindex acd0dbeba4..8707a763e9 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py@@ -138,6 +138,7 @@ class TwitterUpdateListBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"update_list": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -236,6 +237,7 @@ class TwitterCreateListBlock(Block):("url", "https://twitter.com/i/lists/1234567890"),],test_mock={"create_list": lambda *args, **kwargs: ("1234567890")},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/pinned_lists.py b/autogpt_platform/backend/backend/blocks/twitter/lists/pinned_lists.pyindex 0ebe9503b0..168618d1d4 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/pinned_lists.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/pinned_lists.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -63,6 +64,7 @@ class TwitterUnpinListBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"unpin_list": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -126,6 +128,7 @@ class TwitterPinListBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"pin_list": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -212,6 +215,7 @@ class TwitterGetPinnedListsBlock(Block):["Twitter List"],)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/spaces/search_spaces.py b/autogpt_platform/backend/backend/blocks/twitter/spaces/search_spaces.pyindex a38dc5452e..a08b8098df 100644--- a/autogpt_platform/backend/backend/blocks/twitter/spaces/search_spaces.py+++ b/autogpt_platform/backend/backend/blocks/twitter/spaces/search_spaces.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -105,6 +111,7 @@ class TwitterSearchSpacesBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/spaces/spaces_lookup.py b/autogpt_platform/backend/backend/blocks/twitter/spaces/spaces_lookup.pyindex c31f0efd38..de5129d378 100644--- a/autogpt_platform/backend/backend/blocks/twitter/spaces/spaces_lookup.py+++ b/autogpt_platform/backend/backend/blocks/twitter/spaces/spaces_lookup.py@@ -4,7 +4,13 @@ import tweepyfrom pydantic import BaseModelfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -134,6 +140,7 @@ class TwitterGetSpacesBlock(Block):["Test Space"],)},+ effect=BlockEffect.READ,)@staticmethod@@ -281,6 +288,7 @@ class TwitterGetSpaceByIdBlock(Block):{},)},+ effect=BlockEffect.READ,)@staticmethod@@ -433,6 +441,7 @@ class TwitterGetSpaceBuyersBlock(Block):["testuser"],)},+ effect=BlockEffect.READ,)@staticmethod@@ -563,6 +572,7 @@ class TwitterGetSpaceTweetsBlock(Block):{},)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/bookmark.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/bookmark.pyindex 9d8bfccad9..2bd5d060d3 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/bookmark.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/bookmark.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -71,6 +72,7 @@ class TwitterBookmarkTweetBlock(Block):("success", True),],test_mock={"bookmark_tweet": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -184,6 +186,7 @@ class TwitterGetBookmarkedTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -346,6 +349,7 @@ class TwitterRemoveBookmarkTweetBlock(Block):("success", True),],test_mock={"remove_bookmark_tweet": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/hide.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/hide.pyindex 72ed2096a7..3c85b6d571 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/hide.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/hide.py@@ -3,6 +3,7 @@ import tweepyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -54,6 +55,7 @@ class TwitterHideReplyBlock(Block):("success", True),],test_mock={"hide_reply": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -125,6 +127,7 @@ class TwitterUnhideReplyBlock(Block):("success", True),],test_mock={"unhide_reply": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/like.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/like.pyindex c2a920276c..f4d52bb837 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/like.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/like.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -76,6 +77,7 @@ class TwitterLikeTweetBlock(Block):("success", True),],test_mock={"like_tweet": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -191,6 +193,7 @@ class TwitterGetLikingUsersBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -385,6 +388,7 @@ class TwitterGetLikedTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -547,6 +551,7 @@ class TwitterUnlikeTweetBlock(Block):("success", True),],test_mock={"unlike_tweet": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.pyindex 355f6c758f..7ecf946c61 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py@@ -434,6 +434,7 @@ class TwitterSearchRecentTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/quote.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/quote.pyindex be8d5b3125..f5b2437a40 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/quote.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/quote.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -118,6 +124,7 @@ class TwitterGetQuoteTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.pyindex 3317a9430d..5a06190e54 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py@@ -70,7 +70,7 @@ class TwitterRetweetBlock(Block):],test_mock={"retweet": lambda *args, **kwargs: True},is_irreversible_action=True,- effect=BlockEffect.EXTERNAL,+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -147,6 +147,7 @@ class TwitterRemoveRetweetBlock(Block):("success", True),],test_mock={"remove_retweet": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -273,6 +274,7 @@ class TwitterGetRetweetersBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/timeline.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/timeline.pyindex 347ff5aee1..e20921cb36 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/timeline.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/timeline.py@@ -4,7 +4,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -138,6 +144,7 @@ class TwitterGetUserMentionsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -372,6 +379,7 @@ class TwitterGetHomeTimelineBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -615,6 +623,7 @@ class TwitterGetUserTweetsBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/tweet_lookup.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/tweet_lookup.pyindex f452848288..f65a905d39 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/tweet_lookup.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/tweet_lookup.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -96,6 +102,7 @@ class TwitterGetTweetBlock(Block):"testuser",)},+ effect=BlockEffect.READ,)@staticmethod@@ -261,6 +268,7 @@ class TwitterGetTweetsBlock(Block):{"result_count": 1}, # meta)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/users/blocks.py b/autogpt_platform/backend/backend/blocks/twitter/users/blocks.pyindex 12df24cfe2..d71c1bc75c 100644--- a/autogpt_platform/backend/backend/blocks/twitter/users/blocks.py+++ b/autogpt_platform/backend/backend/blocks/twitter/users/blocks.py@@ -3,7 +3,13 @@ from typing import castimport tweepyfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -87,6 +93,7 @@ class TwitterGetBlockedUsersBlock(Block):None, # next_token)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/users/follows.py b/autogpt_platform/backend/backend/blocks/twitter/users/follows.pyindex 20276b19b4..dcfdb687d1 100644--- a/autogpt_platform/backend/backend/blocks/twitter/users/follows.py+++ b/autogpt_platform/backend/backend/blocks/twitter/users/follows.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -71,6 +72,7 @@ class TwitterUnfollowUserBlock(Block):("success", True),],test_mock={"unfollow_user": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -140,6 +142,7 @@ class TwitterFollowUserBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=[("success", True)],test_mock={"follow_user": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -244,6 +247,7 @@ class TwitterGetFollowersBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -416,6 +420,7 @@ class TwitterGetFollowingBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/users/mutes.py b/autogpt_platform/backend/backend/blocks/twitter/users/mutes.pyindex 31927e2b71..66f883d320 100644--- a/autogpt_platform/backend/backend/blocks/twitter/users/mutes.py+++ b/autogpt_platform/backend/backend/blocks/twitter/users/mutes.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -71,6 +72,7 @@ class TwitterUnmuteUserBlock(Block):("success", True),],test_mock={"unmute_user": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethod@@ -178,6 +180,7 @@ class TwitterGetMutedUsersBlock(Block):None,)},+ effect=BlockEffect.READ,)@staticmethod@@ -304,6 +307,7 @@ class TwitterMuteUserBlock(Block):("success", True),],test_mock={"mute_user": lambda *args, **kwargs: True},+ effect=BlockEffect.EXTERNAL_JUDGED,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/users/user_lookup.py b/autogpt_platform/backend/backend/blocks/twitter/users/user_lookup.pyindex 8d01876955..154909acfa 100644--- a/autogpt_platform/backend/backend/blocks/twitter/users/user_lookup.py+++ b/autogpt_platform/backend/backend/blocks/twitter/users/user_lookup.py@@ -4,7 +4,13 @@ import tweepyfrom pydantic import BaseModelfrom tweepy.client import Response-from backend.blocks._base import Block, BlockCategory, BlockOutput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockCategory,+ BlockEffect,+ BlockOutput,+ BlockSchemaOutput,+)from backend.blocks.twitter._auth import (TEST_CREDENTIALS,TEST_CREDENTIALS_INPUT,@@ -114,6 +120,7 @@ class TwitterGetUserBlock(Block):"Twitter",)},+ effect=BlockEffect.READ,)@staticmethod@@ -295,6 +302,7 @@ class TwitterGetUsersBlock(Block):["Twitter", "Twitter Dev"],)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/typesafe/ask_many.py b/autogpt_platform/backend/backend/blocks/typesafe/ask_many.pyindex a9afdab2ef..9fb472960d 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/ask_many.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/ask_many.py@@ -1,6 +1,6 @@from typing import Any-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -59,6 +59,7 @@ class JevAskManyBlock(JevBlockBase):test_credentials=TEST_CREDENTIALS,test_output=TEST_TRANSPARENCY + [("answers", answers)],test_mock={"call_jev": lambda *args, **kwargs: mock_result(answers)},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/choice.py b/autogpt_platform/backend/backend/blocks/typesafe/choice.pyindex 4fa9614e28..8bd2942852 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/choice.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/choice.py@@ -1,6 +1,6 @@from typesafe_sdk import Choice-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -50,6 +50,7 @@ class JevChoiceBlock(JevBlockBase):{"judgment": CHOICE_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/filter.py b/autogpt_platform/backend/backend/blocks/typesafe/filter.pyindex 366d45d7b7..e7720db1d0 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/filter.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/filter.py@@ -3,7 +3,7 @@ from typing import Anyfrom pydantic import model_validatorfrom typesafe_sdk import Score-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -83,6 +83,7 @@ class JevFilterBlock(JevBlockBase):{"judgment": SCORE_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/pick_best.py b/autogpt_platform/backend/backend/blocks/typesafe/pick_best.pyindex 7159afc963..fa2dc2faee 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/pick_best.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/pick_best.py@@ -3,7 +3,7 @@ from typing import Anyfrom typesafe_sdk import Choice-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -69,6 +69,7 @@ class JevPickBestBlock(JevBlockBase):{"judgment": PICK_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/route.py b/autogpt_platform/backend/backend/blocks/typesafe/route.pyindex 23c120e842..32e35c9ffb 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/route.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/route.py@@ -2,7 +2,7 @@ from typing import Anyfrom typesafe_sdk import Choice-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -74,6 +74,7 @@ class JevRouteBlock(JevBlockBase):{"judgment": CHOICE_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/score.py b/autogpt_platform/backend/backend/blocks/typesafe/score.pyindex 78c6afb892..fabe1736e2 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/score.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/score.py@@ -1,6 +1,6 @@from typesafe_sdk import Score-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -59,6 +59,7 @@ class JevScoreBlock(JevBlockBase):{"judgment": SCORE_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/typesafe/yes_no.py b/autogpt_platform/backend/backend/blocks/typesafe/yes_no.pyindex 045b9046a6..f016876dd7 100644--- a/autogpt_platform/backend/backend/blocks/typesafe/yes_no.py+++ b/autogpt_platform/backend/backend/blocks/typesafe/yes_no.py@@ -2,7 +2,7 @@ from typing import Anyfrom typesafe_sdk import Choice-from backend.blocks._base import BlockCategory, BlockOutput+from backend.blocks._base import BlockCategory, BlockEffect, BlockOutputfrom backend.data.model import SchemaFieldfrom ._base import JevBlockBase@@ -60,6 +60,7 @@ class JevYesNoBlock(JevBlockBase):{"judgment": CHOICE_ANSWER})},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/video/add_audio.py b/autogpt_platform/backend/backend/blocks/video/add_audio.pyindex f91a82a758..08bc8d50e6 100644--- a/autogpt_platform/backend/backend/blocks/video/add_audio.py+++ b/autogpt_platform/backend/backend/blocks/video/add_audio.py@@ -6,6 +6,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -43,6 +44,7 @@ class AddAudioToVideoBlock(Block):categories={BlockCategory.MULTIMEDIA},input_schema=AddAudioToVideoBlock.Input,output_schema=AddAudioToVideoBlock.Output,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/video/clip.py b/autogpt_platform/backend/backend/blocks/video/clip.pyindex 990a8b2f31..19a232de83 100644--- a/autogpt_platform/backend/backend/blocks/video/clip.py+++ b/autogpt_platform/backend/backend/blocks/video/clip.py@@ -7,6 +7,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -59,6 +60,7 @@ class VideoClipBlock(Block):"_store_input_video": lambda *args, **kwargs: "test.mp4","_store_output_video": lambda *args, **kwargs: "clip_test.mp4",},+ effect=BlockEffect.WORKSPACE,)async def _store_input_video(diff --git a/autogpt_platform/backend/backend/blocks/video/concat.py b/autogpt_platform/backend/backend/blocks/video/concat.pyindex 3bf2b5142b..64ffcdbf11 100644--- a/autogpt_platform/backend/backend/blocks/video/concat.py+++ b/autogpt_platform/backend/backend/blocks/video/concat.py@@ -9,6 +9,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -69,6 +70,7 @@ class VideoConcatBlock(Block):"_store_input_video": lambda *args, **kwargs: "test.mp4","_store_output_video": lambda *args, **kwargs: "concat_test.mp4",},+ effect=BlockEffect.WORKSPACE,)async def _store_input_video(diff --git a/autogpt_platform/backend/backend/blocks/video/download.py b/autogpt_platform/backend/backend/blocks/video/download.pyindex b6f87726f3..3125b3a552 100644--- a/autogpt_platform/backend/backend/blocks/video/download.py+++ b/autogpt_platform/backend/backend/blocks/video/download.py@@ -12,6 +12,7 @@ if typing.TYPE_CHECKING:from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -78,6 +79,7 @@ class VideoDownloadBlock(Block):),"_store_output_video": lambda *args, **kwargs: "video.mp4",},+ effect=BlockEffect.WORKSPACE,)async def validate_url(self, url: str) -> None:diff --git a/autogpt_platform/backend/backend/blocks/video/duration.py b/autogpt_platform/backend/backend/blocks/video/duration.pyindex ff904ad650..549cafaf10 100644--- a/autogpt_platform/backend/backend/blocks/video/duration.py+++ b/autogpt_platform/backend/backend/blocks/video/duration.py@@ -6,6 +6,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -40,6 +41,7 @@ class MediaDurationBlock(Block):categories={BlockCategory.MULTIMEDIA},input_schema=MediaDurationBlock.Input,output_schema=MediaDurationBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/video/loop.py b/autogpt_platform/backend/backend/blocks/video/loop.pyindex 0cb360a5b2..ac77d9102b 100644--- a/autogpt_platform/backend/backend/blocks/video/loop.py+++ b/autogpt_platform/backend/backend/blocks/video/loop.py@@ -8,6 +8,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -50,6 +51,7 @@ class LoopVideoBlock(Block):categories={BlockCategory.MULTIMEDIA},input_schema=LoopVideoBlock.Input,output_schema=LoopVideoBlock.Output,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/video/narration.py b/autogpt_platform/backend/backend/blocks/video/narration.pyindex ed3835ec03..4c60e8e934 100644--- a/autogpt_platform/backend/backend/blocks/video/narration.py+++ b/autogpt_platform/backend/backend/blocks/video/narration.py@@ -11,6 +11,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -103,6 +104,7 @@ class VideoNarrationBlock(Block):"_store_input_video": lambda *args, **kwargs: "test.mp4","_store_output_video": lambda *args, **kwargs: "narrated_test.mp4",},+ effect=BlockEffect.WORKSPACE,)async def _store_input_video(diff --git a/autogpt_platform/backend/backend/blocks/video/text_overlay.py b/autogpt_platform/backend/backend/blocks/video/text_overlay.pyindex 86dd30318c..43adc6bfd8 100644--- a/autogpt_platform/backend/backend/blocks/video/text_overlay.py+++ b/autogpt_platform/backend/backend/blocks/video/text_overlay.py@@ -8,6 +8,7 @@ from moviepy.video.io.VideoFileClip import VideoFileClipfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -82,6 +83,7 @@ class VideoTextOverlayBlock(Block):"_store_input_video": lambda *args, **kwargs: "test.mp4","_store_output_video": lambda *args, **kwargs: "overlay_test.mp4",},+ effect=BlockEffect.WORKSPACE,)async def _store_input_video(diff --git a/autogpt_platform/backend/backend/copilot/bot/card_buttons_db_test.py b/autogpt_platform/backend/backend/copilot/bot/card_buttons_db_test.pyindex ec8de1f4b0..f2a7c043df 100644--- a/autogpt_platform/backend/backend/copilot/bot/card_buttons_db_test.py+++ b/autogpt_platform/backend/backend/copilot/bot/card_buttons_db_test.py@@ -662,6 +662,7 @@ async def test_a_rule_set_from_the_channel_holds_only_in_that_bot_chat(rules = [o for o in first.options if o not in ("Approve", "Reject")]platform = Platform(one_linked.platform.upper())judged_safe = AsyncMock(return_value=MagicMock(allowed=True))+ judged_unsafe = AsyncMock(return_value=Judgement(allowed=False, reason="unsure"))redis = await get_redis_async()wider = [chat_rules._scoped_key(scope, test_user_id, None, _POST)@@ -681,12 +682,16 @@ async def test_a_rule_set_from_the_channel_holds_only_in_that_bot_chat(ChatSession.new(user_id=test_user_id, dry_run=False))again = {"text": f"again: {label}"}+ judged_unsafe.reset_mock()with patch("backend.copilot.gate.supervise", judged_safe):in_bot = await check_action(_POST, again, test_user_id, bot)+ with patch("backend.copilot.gate.supervise", judged_unsafe):in_web = await check_action(_POST, again, test_user_id, web)assert in_bot.allowed, label+ # A chat post is judged in Auto: only a leaked rule skips the supervisor.assert not in_web.allowed, label+ judged_unsafe.assert_awaited_once()finally:# A wider rule outlives the test and would ungate every later one.await redis.delete(*wider)diff --git a/autogpt_platform/backend/backend/copilot/gate/__init__.py b/autogpt_platform/backend/backend/copilot/gate/__init__.pyindex 39c068f565..5d99fd86ef 100644--- a/autogpt_platform/backend/backend/copilot/gate/__init__.py+++ b/autogpt_platform/backend/backend/copilot/gate/__init__.py@@ -62,6 +62,8 @@ _ASK_FIRST = "Ask First is on for this chat, so this action needs your approval._OUTWARD = "This action reaches outside the platform, so it needs your approval."# Where the supervisor reads the content of the files a command runs.RUN_FILES_KEY = "files_this_command_runs"+# Where it reads what a judged outward block is: the call names only its id.+RUNS_KEY = "capability_this_call_runs"# A chat driven from these runs in Auto, and its cards are answered in the channel.LINKED_CHAT_PLATFORMS = frozenset({"discord", "slack", "teams", "telegram"})# Any other linked platform has no buttons to answer a card with, so it runs@@ -182,6 +184,9 @@ async def check_action(else None)rule = hit.rule if hit else None+ # No supervisor reads a scheduled run, so a judge rule falls back to the mode.+ if rule == "judge" and subject is not None and subject.schedules:+ rule = None# A judge rule covers irreversible subjects too: the user chose the supervisor.verdict = _RULE_VERDICTS[rule] if rule else verdict_for_effect(mode, effect)estimate = subject.estimate if subject is not None else estimate_for(tool_name)@@ -215,10 +220,20 @@ async def check_action(f"Could not read {', '.join(unread)}, so this could not be checked.")else:+ outward_judged = effect is Effect.EXTERNAL_JUDGED+ # A workflow's name is its author's free text; only a block's is vouched for.+ runs = (+ subject.name+ if outward_judged+ and subject is not None+ and subject.key.startswith("block:")+ else None+ )judgement = await supervise(tool_name=tool_name,- args=_judged_args(args, files),+ args=_judged_args(args, files, runs),user_messages=_typed_messages(session),+ outward_judged=outward_judged,)if judgement.allowed:return ALLOW@@ -301,12 +316,18 @@ def _dollars(microdollars: int) -> str:def _judged_args(- args: dict[str, Any], files: dict[str, str | None] | None+ args: dict[str, Any], files: dict[str, str | None] | None, runs: str | None) -> dict[str, Any]:# Dropped first, so a model cannot hand the supervisor a harmless copy.- judged = {key: value for key, value in args.items() if key != RUN_FILES_KEY}+ judged = {+ key: value+ for key, value in args.items()+ if key not in (RUN_FILES_KEY, RUNS_KEY)+ }if files:judged[RUN_FILES_KEY] = files+ if runs:+ judged[RUNS_KEY] = runsreturn judged@@ -327,6 +348,7 @@ def _typed_messages(session: ChatSession) -> list[str]:__all__ = [+ "RUNS_KEY","RUN_FILES_KEY","Decision","LINKED_CHAT_PLATFORMS",diff --git a/autogpt_platform/backend/backend/copilot/gate/classifier.py b/autogpt_platform/backend/backend/copilot/gate/classifier.pyindex ff477b9ec5..34d1263f0a 100644--- a/autogpt_platform/backend/backend/copilot/gate/classifier.py+++ b/autogpt_platform/backend/backend/copilot/gate/classifier.py@@ -22,6 +22,7 @@ from backend.copilot.config import ChatConfigfrom backend.util.llm.providers import call_provider_openai_compat_syncfrom . import jev+from .judged_rubric import judgedlogger = logging.getLogger(__name__)config = ChatConfig()@@ -29,6 +30,7 @@ config = ChatConfig()ACTION_RUBRIC = (Path(__file__).parent / "action_rubric.txt").read_text(encoding="utf-8")+JUDGED_ACTION_RUBRIC = judged(ACTION_RUBRIC, "llm")# The least of the request a call must leave room for; below it the judge cannot# tell what was asked, so the call is held as too long instead.@@ -60,6 +62,7 @@ async def supervise(tool_name: str,args: dict[str, Any],user_messages: list[str],+ outward_judged: bool = False,) -> Judgement:"""Jev decides when it can; the LLM then only writes an ask's reason andcannot turn it into an allow. Without Jev the LLM decides, as before.@@ -67,7 +70,10 @@ async def supervise(``user_messages`` is everything the user typed, oldest first. The call isjudged against the last few; Jev's ask for going beyond the request isjudged once more against the whole chat, since the request may sit earlier.+ ``outward_judged``: the call is an outward act cheap to get wrong, judged on+ what it sends rather than on leaving the platform (``judged_rubric``)."""+ rubric = JUDGED_ACTION_RUBRIC if outward_judged else ACTION_RUBRICcall = json.dumps({"tool": tool_name, "arguments": args},indent=1,@@ -80,23 +86,25 @@ async def supervise(try:proposed = fence("PROPOSED CALL", _utf8(call))recent = _request(user_messages[-_REQUEST_MESSAGES:])- prompt, over = _fit(recent, proposed)+ prompt, over = _fit(recent, proposed, outward_judged)except Exception:logger.warning(f"Gate could not size the call for {tool_name}", exc_info=True)return Judgement(allowed=False, reason=_FALLBACK_REASON)if over:return Judgement(allowed=False, reason=too_long_reason(over))- first = await jev.judge(prompt) if jev.enabled() else None+ first = await jev.judge(prompt, outward_judged) if jev.enabled() else Noneif first is None:- allowed, reason = await _llm_verdict(prompt, tool_name)+ allowed, reason = await _llm_verdict(prompt, tool_name, rubric)return Judgement(allowed=allowed, reason=reason, decided_by="llm")logger.info(f"Gate first stage {'ask' if first.ask else 'allow'} for {tool_name}: "f"{first.probabilities}")beyond_request = first.ask and first.flagged == _BEYOND_REQUEST- if beyond_request and (whole := _whole_chat(user_messages, proposed, tool_name)):- again = await jev.judge(whole)+ if beyond_request and (+ whole := _whole_chat(user_messages, proposed, tool_name, outward_judged)+ ):+ again = await jev.judge(whole, outward_judged)if again is not None:logger.info(f"Gate first stage {'ask' if again.ask else 'allow'} for "@@ -110,12 +118,14 @@ async def supervise(decided_by="jev",first_stage=first.probabilities,)- answer = await _judge(prompt + "\n\n" + jev.flag_line(first), tool_name)+ answer = await _judge(+ prompt + "\n\n" + jev.flag_line(first, outward_judged), tool_name, rubric+ )# Jev's ask holds even when the LLM would allow: the card never waits on it.if answer is not None and answer[0] == "ask" and answer[1]:reason = answer[1]else:- reason = jev.unpinned_reason(first)+ reason = jev.unpinned_reason(first, outward_judged)return Judgement(allowed=False,reason=reason,@@ -124,15 +134,15 @@ async def supervise()-async def _llm_verdict(prompt: str, tool_name: str) -> tuple[bool, str]:- verdict = await _judge(prompt, tool_name)+async def _llm_verdict(prompt: str, tool_name: str, rubric: str) -> tuple[bool, str]:+ verdict = await _judge(prompt, tool_name, rubric)if verdict is None:return False, _FALLBACK_REASONallow = verdict[0] == "allow"return allow, verdict[1] or ("Allowed." if allow else "Needs your approval.")-async def _judge(prompt: str, tool_name: str) -> tuple[str, str] | None:+async def _judge(prompt: str, tool_name: str, rubric: str) -> tuple[str, str] | None:"""The LLM's ``(word, reason)``; None on any failure."""# Deferred, and private: copilot.service imports the tool registry, whose# BaseTool imports this gate.@@ -144,7 +154,7 @@ async def _judge(prompt: str, tool_name: str) -> tuple[str, str] | None:client=_get_aux_client(),model=config.gate_model,messages=[- {"role": "system", "content": ACTION_RUBRIC},+ {"role": "system", "content": rubric},{"role": "user", "content": prompt},],max_tokens=200,@@ -162,14 +172,18 @@ async def _judge(prompt: str, tool_name: str) -> tuple[str, str] | None:return verdict-def _whole_chat(messages: list[str], proposed: str, tool_name: str) -> str | None:+def _whole_chat(+ messages: list[str], proposed: str, tool_name: str, outward_judged: bool+) -> str | None:"""The prompt with as many of the newest messages as Jev reads whole, oldestdropped first; None when that is no more than the first judgement read."""low, high = _REQUEST_MESSAGES, len(messages)try:while low < high:middle = (low + high + 1) // 2- if jev.overflow(_prompt(_request(messages[-middle:]), proposed)):+ if jev.overflow(+ _prompt(_request(messages[-middle:]), proposed), outward_judged+ ):high = middle - 1else:low = middle@@ -198,19 +212,19 @@ def _utf8(text: str) -> str:return text.encode("utf-8", "backslashreplace").decode("utf-8")-def _fit(request: str, proposed: str) -> tuple[str, int]:+def _fit(request: str, proposed: str, outward_judged: bool) -> tuple[str, int]:"""The prompt with as much of ``request`` as Jev reads beside the whole call,and the bytes still over when even ``_MIN_REQUEST_CHARS`` of it does not fit."""whole = _prompt(request, proposed)- if not jev.overflow(whole):+ if not jev.overflow(whole, outward_judged):return whole, 0low = min(len(request), _MIN_REQUEST_CHARS)- if over := jev.overflow(_prompt(_shorten(request, low), proposed)):+ if over := jev.overflow(_prompt(_shorten(request, low), proposed), outward_judged):return whole, overhigh = len(request) - 1while low < high:middle = (low + high + 1) // 2- if jev.overflow(_prompt(_shorten(request, middle), proposed)):+ if jev.overflow(_prompt(_shorten(request, middle), proposed), outward_judged):high = middle - 1else:low = middlediff --git a/autogpt_platform/backend/backend/copilot/gate/effects.py b/autogpt_platform/backend/backend/copilot/gate/effects.pyindex 8245a57327..a4f792e3f4 100644--- a/autogpt_platform/backend/backend/copilot/gate/effects.py+++ b/autogpt_platform/backend/backend/copilot/gate/effects.py@@ -63,8 +63,11 @@ def graph_effect(graph: "GraphModel") -> Resolved:unreadable = unreadable or blockelif _worse(effect, block, worst):worst = Resolved(effect, block)- if unreadable is None or _irreversible(worst):- return worst._replace(unreadable=unreadable)+ if unreadable is None:+ return worst+ if _irreversible(worst):+ # The unknown step still asks as EXTERNAL does, whatever tier names the run.+ return Resolved(BlockEffect.EXTERNAL, worst.decided_by, unreadable)return Resolved(None, unreadable, unreadable)@@ -141,6 +144,7 @@ _INPUT_DECIDED: dict[UNREADABLE_BLOCKS = frozenset({"AutoPilotBlock",+ "BlockInstallationBlock","ClaudeCodeBlock","CodeGenerationBlock","ExecuteCodeBlock",diff --git a/autogpt_platform/backend/backend/copilot/gate/gate_test.py b/autogpt_platform/backend/backend/copilot/gate/gate_test.pyindex 721f4f7e61..4eb99b3a86 100644--- a/autogpt_platform/backend/backend/copilot/gate/gate_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/gate_test.py@@ -241,13 +241,25 @@ async def test_outward_actions_ask_without_the_supervisor(supervisor = AsyncMock(return_value=Judgement(allowed=True, reason="fine"))with patch(f"{_GATE}.supervise", supervisor):decision = await check_action(- "post_to_chat_platform", {"text": "hi"}, "u", _session(mode)+ "browser_act", {"action": "click"}, "u", _session(mode))assert not decision.allowedassert decision.review_idsupervisor.assert_not_awaited()+async def test_a_chat_platform_post_in_auto_is_judged_as_outward(+ gate_on, clean_session_state+):+ supervisor = AsyncMock(return_value=Judgement(allowed=True, reason="fine"))+ with patch(f"{_GATE}.supervise", supervisor):+ decision = await check_action(+ "post_to_chat_platform", {"text": "hi"}, "u", _session("auto")+ )+ assert decision.allowed+ assert supervisor.await_args.kwargs["outward_judged"] is True++async def test_unsupervised_runs_outward_actions(gate_on, clean_session_state):decision = await check_action("post_to_chat_platform", {"text": "hi"}, "u", _session("unsupervised")diff --git a/autogpt_platform/backend/backend/copilot/gate/jev.py b/autogpt_platform/backend/backend/copilot/gate/jev.pyindex 629190eb1e..b94509295e 100644--- a/autogpt_platform/backend/backend/copilot/gate/jev.py+++ b/autogpt_platform/backend/backend/copilot/gate/jev.py@@ -22,11 +22,14 @@ from backend.blocks.typesafe._client import call_jevfrom backend.copilot.config import ChatConfigfrom backend.util.settings import Settings+from .judged_rubric import JEV_QUESTION_3, QUESTION_3_NAME, judged+logger = logging.getLogger(__name__)config = ChatConfig()_api_key = Settings().secrets.typesafe_jev_api_keyJEV_RUBRIC = (Path(__file__).parent / "jev_rubric.txt").read_text(encoding="utf-8")+JUDGED_JEV_RUBRIC = judged(JEV_RUBRIC, "jev")# The words the LLM's flag line and the fallback reason use for each question.RUBRIC_QUESTIONS = {@@ -35,6 +38,7 @@ RUBRIC_QUESTIONS = {3: "data leaving the platform",4: "a restricted effect by another route",}+JUDGED_RUBRIC_QUESTIONS = {**RUBRIC_QUESTIONS, 3: QUESTION_3_NAME}QUESTIONS: dict[str, Choice | Score | Noul] = {"verdict": Choice(instructions="May the assistant's proposed call run without asking the"@@ -75,6 +79,10 @@ QUESTIONS: dict[str, Choice | Score | Noul] = {" conversation data, a job or hook set up to send something later)?"),}+JUDGED_QUESTIONS: dict[str, Choice | Score | Noul] = {+ **QUESTIONS,+ "q3": Noul(instructions=JEV_QUESTION_3),+}_NOULS = ("must_ask", "q1", "q2", "q3", "q4")FIRST_STAGE = Counter(@@ -101,15 +109,15 @@ def enabled() -> bool:return config.gate_first_stage == "jev" and bool(_api_key)-async def judge(prompt: str) -> JevVerdict | None:+async def judge(prompt: str, outward_judged: bool = False) -> JevVerdict | None:"""Ask when the choice is ask, or when a configured threshold is reachedby ``must_ask``."""try:result = await asyncio.wait_for(call_jev(_api_key,- _state(prompt),- QUESTIONS,+ _state(prompt, outward_judged),+ _questions(outward_judged),model=config.gate_jev_model,timeout=config.gate_jev_timeout_s,),@@ -137,33 +145,42 @@ async def judge(prompt: str) -> JevVerdict | None:return verdict-def overflow(prompt: str) -> int:+def overflow(prompt: str, outward_judged: bool = False) -> int:"""Serialized bytes of ``prompt`` past what one Jev call reads whole; 0 whenit fits."""- state = _state(prompt)- prepared = prepare_state(state, QUESTIONS)+ state = _state(prompt, outward_judged)+ prepared = prepare_state(state, _questions(outward_judged))if not prepared.truncated:return 0return len(serialize(state)) - len(serialize(prepared.state))-def flag_line(verdict: JevVerdict) -> str:+def flag_line(verdict: JevVerdict, outward_judged: bool = False) -> str:n = verdict.flaggedreturn (- f"A check flagged this call; rubric question {n} ({RUBRIC_QUESTIONS[n]}) "- f"is the likeliest (p {verdict.probabilities[f'q{n}']:.2f}). Say where."+ f"A check flagged this call; rubric question {n} "+ f"({_question_names(outward_judged)[n]}) is the likeliest "+ f"(p {verdict.probabilities[f'q{n}']:.2f}). Say where.")-def unpinned_reason(verdict: JevVerdict) -> str:+def unpinned_reason(verdict: JevVerdict, outward_judged: bool = False) -> str:return (- f"A check flagged this as possibly {RUBRIC_QUESTIONS[verdict.flagged]}; "- "could not pinpoint where."+ f"A check flagged this as possibly "+ f"{_question_names(outward_judged)[verdict.flagged]}; could not pinpoint where.")-def _state(prompt: str) -> str:- return JEV_RUBRIC + "\n\n" + prompt+def _state(prompt: str, outward_judged: bool) -> str:+ return (JUDGED_JEV_RUBRIC if outward_judged else JEV_RUBRIC) + "\n\n" + prompt+++def _questions(outward_judged: bool) -> dict[str, Choice | Score | Noul]:+ return JUDGED_QUESTIONS if outward_judged else QUESTIONS+++def _question_names(outward_judged: bool) -> dict[int, str]:+ return JUDGED_RUBRIC_QUESTIONS if outward_judged else RUBRIC_QUESTIONSdef _read(answers: dict[str, dict[str, Any]]) -> JevVerdict | None:diff --git a/autogpt_platform/backend/backend/copilot/gate/jev_test.py b/autogpt_platform/backend/backend/copilot/gate/jev_test.pyindex 2b0eea7822..1c75ccd146 100644--- a/autogpt_platform/backend/backend/copilot/gate/jev_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/jev_test.py@@ -16,7 +16,12 @@ from prometheus_client import REGISTRYfrom backend.blocks.typesafe._budget import prepare_statefrom backend.blocks.typesafe._client import JevCallResultfrom backend.copilot.gate import jev-from backend.copilot.gate.classifier import supervise+from backend.copilot.gate.classifier import (+ ACTION_RUBRIC,+ JUDGED_ACTION_RUBRIC,+ supervise,+)+from backend.copilot.gate.judged_rubric import QUESTION_3_NAME_MOD = "backend.copilot.gate.classifier"_ANSWERS = json.loads(@@ -131,6 +136,70 @@ async def test_without_a_key_jev_is_never_called():llm.assert_awaited_once()[email protected]("outward_judged", [False, True])+async def test_a_judged_outward_call_meets_its_own_rubric_in_both_judges(+ outward_judged,+):+ """Item 3 of the measured rubric asks on anything that leaves the platform,+ so a judged call read by it would always ask, on the second look at the+ whole chat as much as the first."""+ llm = AsyncMock(return_value=_response("ask\nreason: posts a key"))+ call_jev = _jev("ask_on_q1")+ with (+ patch(f"{_MOD}.call_provider_openai_compat_sync", llm),+ patch("backend.copilot.service._get_aux_client", MagicMock()),+ patch.object(jev, "call_jev", call_jev),+ patch.object(jev.config, "gate_first_stage", "jev"),+ patch.object(jev, "_api_key", "test-key"),+ ):+ await supervise(+ tool_name="run_capability",+ args={"id": "discord-send"},+ user_messages=_LONG_CHAT,+ outward_judged=outward_judged,+ )+ jev_rubric = jev.JUDGED_JEV_RUBRIC if outward_judged else jev.JEV_RUBRIC+ assert call_jev.await_count == 2+ for call in call_jev.await_args_list:+ state, questions = call.args[1:3]+ assert state.startswith(jev_rubric + "\n\n<<<BEGIN USER REQUEST")+ assert questions is (jev.JUDGED_QUESTIONS if outward_judged else jev.QUESTIONS)+ system = llm.await_args.kwargs["messages"][0]["content"]+ assert system == (JUDGED_ACTION_RUBRIC if outward_judged else ACTION_RUBRIC)+++ "outward_judged, name",+ [(False, "data leaving the platform"), (True, QUESTION_3_NAME)],+)+async def test_a_judged_call_held_on_question_3_is_named_by_its_own_rubric(+ outward_judged, name+):+ """Leaving the platform is what the judged tier allows, so a judged call's+ card must not give it as the reason."""+ recorded = _ANSWERS["ask_on_q1"]+ on_q3 = {**recorded, "q1": recorded["q3"], "q3": recorded["q1"]}+ llm = AsyncMock(return_value=_response("ask"))+ with (+ patch(f"{_MOD}.call_provider_openai_compat_sync", llm),+ patch("backend.copilot.service._get_aux_client", MagicMock()),+ patch.object(jev, "call_jev", AsyncMock(return_value=_result(on_q3))),+ patch.object(jev.config, "gate_first_stage", "jev"),+ patch.object(jev, "_api_key", "test-key"),+ ):+ judgement = await supervise(+ tool_name="run_capability",+ args={"id": "discord-send"},+ user_messages=["post the notes in #team"],+ outward_judged=outward_judged,+ )+ prompt = llm.await_args.kwargs["messages"][1]["content"]+ assert f"rubric question 3 ({name})" in prompt+ assert judgement.reason == (+ f"A check flagged this as possibly {name}; could not pinpoint where."+ )++# The request scrolled past the first window: four messages came after it._LONG_CHAT = ["Tidy my workspace: delete the old screenshots under reports/",diff --git a/autogpt_platform/backend/backend/copilot/gate/judged_rubric.py b/autogpt_platform/backend/backend/copilot/gate/judged_rubric.pynew file mode 100644index 0000000000..c899e62afd--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/gate/judged_rubric.py@@ -0,0 +1,91 @@+"""The supervisor's rubric for an outward call cheap to get wrong (``EXTERNAL_JUDGED``).++It is the measured rubric with item 3 rewritten: leaving the platform is the+point of these calls, so only what one sends can make it unwarranted.+"""++from typing import Literal++ExampleStyle = Literal["llm", "jev"]++ITEM_3 = (+ "3. It sends what the user would not send there. This kind of outward call (a "+ "chat post, a label, a draft, a new record) is one the user lets run unasked, "+ "so leaving the platform is not on its own a reason to ask. Ask when it "+ "carries credentials, files or conversation the request did not mean to "+ "share, goes somewhere the user did not name or plainly mean, or says "+ "something that would embarrass the user or mislead the people who read it."+)++# What the flag line and an unpinned reason call question 3 for a judged call.+QUESTION_3_NAME = "sending what the user would not send there"++JEV_QUESTION_3 = (+ "Rubric question 3: does the call send what the user would not send there:"+ " credentials, files or conversation the request did not mean to share, a"+ " destination the user did not name or plainly mean, or content that would"+ " embarrass the user or mislead its readers? Leaving the platform is not on"+ " its own this; the user lets this kind of outward call run unasked."+)++_SETTLES = 'an asked-for delete under 2, or asked-for data leaving, is still "ask".'+_SETTLES_JUDGED = 'an asked-for delete under 2 is still "ask".'+# Its outward write is not a judged call, and would teach that one is.+_SHEETS_EXAMPLE = '- "Put the totals in row 51 of my budget sheet."'++_EXAMPLES = [+ (+ "Post the release notes in #announcements.",+ "a Discord message of those notes to #announcements",+ "allow",+ "the post the user asked for, in the channel they named.",+ ),+ (+ "Label the invoices from Acme as paid.",+ "a Gmail add-label on each Acme invoice",+ "allow",+ "asked for; a label comes off in one click.",+ ),+ (+ "Make a Trello card for the logo refresh.",+ "a Trello card created on the user's board",+ "allow",+ "the record the user asked for; it is archived in one click.",+ ),+ (+ "Find three venues for the offsite.",+ "a Slack message of the list to #general",+ "ask",+ "nobody asked for a post; the request was for an answer.",+ ),+ (+ "Tell the team the deploy is done.",+ "a Discord message that pastes the server's API key",+ "ask",+ "the post carries a credential.",+ ),+]+++def judged(rubric: str, style: ExampleStyle) -> str:+ """``rubric`` with item 3 and its closing caveat rewritten for a judged+ outward call, and examples of one; raises if the rubric's wording moved."""+ lines = rubric.split("\n")+ item_3 = [i for i, line in enumerate(lines) if line.startswith("3. ")]+ if len(item_3) != 1 or rubric.count(_SETTLES) != 1:+ raise ValueError("The rubric's item 3 or its caveat moved; re-derive.")+ lines[item_3[0]] = ITEM_3+ sheets = [line for line in lines if line.startswith(_SHEETS_EXAMPLE)]+ # Only Jev's rubric carries it; a reworded copy would stay and teach the judge to ask.+ if len(sheets) != (1 if style == "jev" else 0):+ raise ValueError("The rubric's Sheets example moved; re-derive.")+ lines = [line for line in lines if line not in sheets]+ examples = lines.index("Examples:")+ lines[examples + 1 : examples + 1] = [_example(*e, style) for e in _EXAMPLES]+ return "\n".join(lines).replace(_SETTLES, _SETTLES_JUDGED)+++def _example(request: str, call: str, word: str, reason: str, style: str) -> str:+ if style == "jev":+ return f'- "{request}" / {call} → {word}. reason: {reason}'+ return f'- "{request}" / {call} → {word}: {reason}'diff --git a/autogpt_platform/backend/backend/copilot/gate/judged_rubric_test.py b/autogpt_platform/backend/backend/copilot/gate/judged_rubric_test.pynew file mode 100644index 0000000000..1d05a50671--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/gate/judged_rubric_test.py@@ -0,0 +1,42 @@+import pytest++from backend.copilot.gate.classifier import ACTION_RUBRIC+from backend.copilot.gate.jev import JEV_RUBRIC+from backend.copilot.gate.judged_rubric import (+ _EXAMPLES,+ _SETTLES,+ _SETTLES_JUDGED,+ _SHEETS_EXAMPLE,+ ITEM_3,+ judged,+)++[email protected]("rubric, style", [(ACTION_RUBRIC, "llm"), (JEV_RUBRIC, "jev")])+def test_only_item_3_its_caveat_and_the_examples_change(rubric, style):+ """The measured rubric is what ships; the variant may differ from it only+ where a judged outward call needs it to."""+ lines = judged(rubric, style).split("\n")+ assert [line for line in lines if line.startswith("3. ")] == [ITEM_3]+ assert not any(_SETTLES in line for line in lines)+ assert any(_SETTLES_JUDGED in line for line in lines)+ assert not any(line.startswith(_SHEETS_EXAMPLE) for line in lines)+ for request, call, word, _ in _EXAMPLES:+ assert any(+ line.startswith(f'- "{request}" / {call} → {word}') for line in lines+ )+ kept = [+ line+ for line in rubric.split("\n")+ if not line.startswith(("3. ", _SHEETS_EXAMPLE)) and _SETTLES not in line+ ]+ assert all(line in lines for line in kept)+++def test_a_reworded_sheets_example_refuses_to_build():+ """A reworded copy would slip past the filter and teach the judge that a+ judged write asks."""+ moved = JEV_RUBRIC.replace(_SHEETS_EXAMPLE, '- "Put the totals in row 52."')+ assert moved != JEV_RUBRIC+ with pytest.raises(ValueError):+ judged(moved, "jev")diff --git a/autogpt_platform/backend/backend/copilot/gate/policy.py b/autogpt_platform/backend/backend/copilot/gate/policy.pyindex 7b6a8120c5..191d2019a1 100644--- a/autogpt_platform/backend/backend/copilot/gate/policy.py+++ b/autogpt_platform/backend/backend/copilot/gate/policy.py@@ -40,6 +40,8 @@ class Effect(str, Enum):# Work handed to a chat of one of the user's Experts, which the gate covers itself.TEAM = "team"PLATFORM = "platform"+ # Outward, but cheap to get wrong: Auto lets the supervisor judge it.+ EXTERNAL_JUDGED = "external_judged"EXTERNAL = "external"# Never gated: the call is itself a question to the user, finishes a# review that is already open, or runs nothing.@@ -47,7 +49,15 @@ class Effect(str, Enum):# What the gate can hold for an answer, and so what a rule can be set on.-PARKABLE = frozenset({Effect.SHELL, Effect.TEAM, Effect.PLATFORM, Effect.EXTERNAL})+PARKABLE = frozenset(+ {+ Effect.SHELL,+ Effect.TEAM,+ Effect.PLATFORM,+ Effect.EXTERNAL_JUDGED,+ Effect.EXTERNAL,+ }+)class Verdict(str, Enum):@@ -155,9 +165,10 @@ _PLATFORM = frozenset(# there; Ask First still asks, as that chat runs in Auto._TEAM = frozenset({"delegate_to_expert", "handoff_to_expert"})-_EXTERNAL = frozenset(- {"browser_act", "edit_chat_platform_message", "post_to_chat_platform"}-)+_EXTERNAL = frozenset({"browser_act"})++# A bot post in a chat platform the user linked: the supervisor judges it.+_EXTERNAL_JUDGED = frozenset({"edit_chat_platform_message", "post_to_chat_platform"})_UNGATED = frozenset({@@ -184,6 +195,7 @@ _EFFECTS: dict[str, Effect] = {"bash_exec": Effect.SHELL,**{name: Effect.TEAM for name in _TEAM},**{name: Effect.PLATFORM for name in _PLATFORM},+ **{name: Effect.EXTERNAL_JUDGED for name in _EXTERNAL_JUDGED},**{name: Effect.EXTERNAL for name in _EXTERNAL | _BY_SUBJECT},**{name: Effect.UNGATED for name in _UNGATED},}@@ -197,14 +209,18 @@ _MODE_VERDICTS: dict[AutopilotMode, dict[Effect, Verdict]] = {Effect.SHELL: Verdict.JUDGE,Effect.TEAM: Verdict.ASK,Effect.PLATFORM: Verdict.ASK,+ Effect.EXTERNAL_JUDGED: Verdict.ASK,Effect.EXTERNAL: Verdict.ASK,},+ # An outward act asks until the user's rule on it says otherwise; one cheap+ # to get wrong goes to the supervisor instead."auto": {Effect.READ: Verdict.RUN,Effect.WORKSPACE: Verdict.RUN,Effect.SHELL: Verdict.JUDGE,Effect.TEAM: Verdict.RUN,Effect.PLATFORM: Verdict.JUDGE,+ Effect.EXTERNAL_JUDGED: Verdict.JUDGE,Effect.EXTERNAL: Verdict.ASK,},"unsupervised": {effect: Verdict.RUN for effect in Effect},diff --git a/autogpt_platform/backend/backend/copilot/gate/policy_test.py b/autogpt_platform/backend/backend/copilot/gate/policy_test.pyindex 0418d461ae..ccc4526c5d 100644--- a/autogpt_platform/backend/backend/copilot/gate/policy_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/policy_test.py@@ -36,7 +36,8 @@ def test_the_table_names_no_tool_that_does_not_exist():("delete_folder", Verdict.ASK, Verdict.JUDGE, Verdict.RUN),("delegate_to_expert", Verdict.ASK, Verdict.RUN, Verdict.RUN),("handoff_to_expert", Verdict.ASK, Verdict.RUN, Verdict.RUN),- ("post_to_chat_platform", Verdict.ASK, Verdict.ASK, Verdict.RUN),+ ("post_to_chat_platform", Verdict.ASK, Verdict.JUDGE, Verdict.RUN),+ ("browser_act", Verdict.ASK, Verdict.ASK, Verdict.RUN),],)def test_each_modes_column(tool, ask_first, auto, unsupervised):diff --git a/autogpt_platform/backend/backend/copilot/gate/review.py b/autogpt_platform/backend/backend/copilot/gate/review.pyindex 8d3b41c4b3..070c291fd1 100644--- a/autogpt_platform/backend/backend/copilot/gate/review.py+++ b/autogpt_platform/backend/backend/copilot/gate/review.py@@ -157,11 +157,7 @@ def review_payload(reason=" ".join(reason.split())[:300],reason_kind=reason_kind,decided_by=decided_by,- chat_rules_allowed=(- ["allow", "judge"]- if _offers_rules(tool_name, subject, spend, reason_kind)- else []- ),+ chat_rules_allowed=_rules_offered(tool_name, subject, spend, reason_kind),headline=(Headline(ask="Run", object=subject.name)if subject is not None@@ -307,16 +303,21 @@ def payload_headline(payload: dict[str, Any]) -> str:return Headline.model_validate(payload["headline"]).text-def _offers_rules(+def _rules_offered(tool_name: str,subject: "GateSubject | None",spend: dict[str, int] | None,reason_kind: ReasonKind,-) -> bool:+) -> list[Literal["allow", "judge"]]:# A money card or a held read rules on nothing: neither consults a rule.if spend is not None or reason_kind == "content":- return False- return (subject.effect if subject else effect_for(tool_name)) in PARKABLE+ return []+ if (subject.effect if subject else effect_for(tool_name)) not in PARKABLE:+ return []+ # The gate ignores a judge rule on a schedule.+ return (+ ["allow"] if subject is not None and subject.schedules else ["allow", "judge"]+ )def _payload_subject(diff --git a/autogpt_platform/backend/backend/copilot/gate/review_test.py b/autogpt_platform/backend/backend/copilot/gate/review_test.pyindex 31ada5b8b3..4b62ad6118 100644--- a/autogpt_platform/backend/backend/copilot/gate/review_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/review_test.py@@ -9,14 +9,14 @@ from prisma.enums import ReviewStatusfrom backend.blocks.google.gmail import GmailSendBlockfrom backend.copilot.gate.headline import gated_tools, headline_for-from backend.copilot.gate.policy import PARKABLE, classified_tools, effect_for+from backend.copilot.gate.policy import PARKABLE, Effect, classified_tools, effect_forfrom backend.copilot.gate.review import (find_decision,node_id_for,review_id_for,review_payload,)-from backend.copilot.gate.subject import block_subject, mcp_subject+from backend.copilot.gate.subject import Subject, block_subject, mcp_subjectdef test_the_same_call_is_the_same_approval():@@ -178,7 +178,7 @@ def test_a_bare_tool_is_its_own_subject():"kind": "tool","key": "post_to_chat_platform","name": "Post a message",- "effect": "external",+ "effect": "external_judged","irreversible": False,"block_id": None,}@@ -204,6 +204,15 @@ def test_a_parked_card_offers_both_rules(tool, subject, kind):assert payload["chat_rules_allowed"] == ["allow", "judge"]+def test_a_schedule_card_offers_no_judge_rule():+ """The gate ignores a judge rule on a schedule, so its card must not offer one."""+ schedule = Subject(+ key="workflow:g", name="Digest", effect=Effect.EXTERNAL, schedules=True+ )+ payload = review_payload("run_agent", {}, schedule, reason_kind="subject")+ assert payload["chat_rules_allowed"] == ["allow"]++def test_a_held_read_offers_no_rule():"""A read's release is not a call the gate runs, so no rule covers it."""payload = review_payload("bash_exec", {}, reason_kind="content")diff --git a/autogpt_platform/backend/backend/copilot/gate/subject.py b/autogpt_platform/backend/backend/copilot/gate/subject.pyindex aa635d4c14..33c96ff131 100644--- a/autogpt_platform/backend/backend/copilot/gate/subject.py+++ b/autogpt_platform/backend/backend/copilot/gate/subject.py@@ -39,6 +39,9 @@ class Subject(BaseModel):# What one call is expected to cost, in microdollars; a paid read or# workspace step asks once the chat has spent its ceiling.estimate: int = 0+ # The call creates a schedule: no supervisor reads its runs, so a judge+ # rule cannot speak for it.+ schedules: bool = False# A schema lookup, ``validate_only``, a dry run, or a trigger workflow's details:@@ -81,6 +84,7 @@ def workflow_subject(reason=_reason(effect, name, culprit=decided_by),irreversible=_irreversible(effect, decided_by),estimate=0 if schedules else _priced(effect, lambda: graph_cost_credits(graph)),+ schedules=schedules,)steps = _irreversible_steps(graph)if unreadable is not None and steps:@@ -93,7 +97,7 @@ def workflow_subject(f"{_listed(steps)}.",})- elif subject.effect is Effect.EXTERNAL and len(steps) > 1:+ elif subject.effect in _OUTWARD and len(steps) > 1:# The approval covers the whole run, so the card names every step it covers.subject = subject.model_copy(update={@@ -102,6 +106,25 @@ def workflow_subject("outside the platform.",})+ elif steps and not subject.irreversible:+ # A reversible step of a higher tier names the run; the one that can't be+ # undone must still warn, or approving the card lifts its pause unseen.+ subject = subject.model_copy(+ update={+ "irreversible": True,+ "reason": f"{subject.reason.removesuffix('.')}; it also has "+ f"{_steps(steps)} that can't be undone: {_listed(steps)}.",+ }+ )+ if schedules and subject.effect is Effect.EXTERNAL_JUDGED:+ # No supervisor reads a scheduled run and no irreversible pause catches one.+ return subject.model_copy(+ update={+ "effect": Effect.EXTERNAL,+ "reason": f"{subject.reason.removesuffix('.')}; this also creates "+ "a schedule.",+ }+ )creates = (f"Runs {name} and creates a schedule."if schedules@@ -162,8 +185,10 @@ _EFFECTS = {BlockEffect.READ: Effect.READ,BlockEffect.WORKSPACE: Effect.WORKSPACE,BlockEffect.PLATFORM: Effect.PLATFORM,+ BlockEffect.EXTERNAL_JUDGED: Effect.EXTERNAL_JUDGED,BlockEffect.EXTERNAL: Effect.EXTERNAL,}+_OUTWARD = frozenset({Effect.EXTERNAL_JUDGED, Effect.EXTERNAL})def _priced(effect: BlockEffect | None, credits: Callable[[], int]) -> int:@@ -184,6 +209,7 @@ def _reason(effect: BlockEffect | None, name: str, culprit: Block | None) -> strstep = display_name(culprit) if culprit is not None else namereturn f"{AUTOPILOT_NAME} does not know what {step} does, so he asks."does = {+ BlockEffect.EXTERNAL_JUDGED: "reaches outside the platform",BlockEffect.EXTERNAL: "reaches outside the platform",BlockEffect.PLATFORM: "changes your platform objects",}.get(effect)@@ -216,7 +242,7 @@ def _steps(names: list[str]) -> str:def _irreversible(effect: BlockEffect | None, block: Block | None) -> bool:return (- effect is BlockEffect.EXTERNAL+ effect in (BlockEffect.EXTERNAL_JUDGED, BlockEffect.EXTERNAL)and block is not Noneand block.is_irreversible_action)diff --git a/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.py b/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.pyindex 6ec85832a2..92f39ac36d 100644--- a/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.py@@ -22,6 +22,7 @@ from backend.blocks.ai_image_generator_block import AIImageGeneratorBlockfrom backend.blocks.basic import StoreValueBlockfrom backend.blocks.code_executor import ExecuteCodeStepBlockfrom backend.blocks.discord.bot_blocks import SendDiscordMessageBlock+from backend.blocks.email_block import SendEmailBlockfrom backend.blocks.generic_webhook.triggers import GenericWebhookTriggerBlockfrom backend.blocks.github.issues import GithubAddLabelBlockfrom backend.blocks.github.repo_files import GithubCreateFileBlock@@ -31,7 +32,8 @@ from backend.blocks.io import AgentInputBlock, AgentOutputBlockfrom backend.blocks.search import GetWikipediaSummaryBlockfrom backend.blocks.sql_query_block import SQLQueryBlockfrom backend.copilot import usage_activation_fixtures-from backend.copilot.gate import RUN_FILES_KEY+from backend.copilot.gate import RUN_FILES_KEY, RUNS_KEY, chat_rules+from backend.copilot.gate.chat_rules_test import _Redisfrom backend.copilot.gate.classifier import Judgementfrom backend.copilot.gate.content import ContentVerdictfrom backend.copilot.gate.effects import block_effect, graph_effect@@ -60,6 +62,18 @@ _BASH = "backend.copilot.tools.bash_exec"_CLASSIFIER = "backend.copilot.gate.classifier"_CAP = "backend.copilot.tools.run_capability"_AGENT_GRAPH = "backend.copilot.tools.run_agent._agent_graph"+# The fixtures stub the rule store; the rule tests need the real one.+_REAL_RULE_FOR = chat_rules.rule_for+_REAL_SET_ASK = chat_rules.set_ask+_POST = {"channel_name": "general", "message_content": "hi"}+_URL = "https://hooks.example.com/x"+# SMTP, so CI (no Google OAuth client) does not disable it as it does Gmail.+_EMAIL = {+ "to_email": "[email protected]",+ "subject": "Hi",+ "body": "hi",+ "config": {"smtp_server": "smtp.example.com", "smtp_port": 587},+}def _session(mode: AutopilotMode = "auto") -> ChatSession:@@ -96,6 +110,19 @@ def gate():yield store+def undeclared():+ """Every real block declares an effect; this one is stripped of it."""+ init = GithubAddLabelBlock.__init__++ def without_effect(self):+ init(self)+ self.effect = None++ with patch.object(GithubAddLabelBlock, "__init__", without_effect):+ yield++@pytest.fixturedef ran():"""What reached the block run, if anything did."""@@ -163,22 +190,113 @@ async def test_a_call_that_runs_nothing_never_asks(gate, ran, payload, extra):gate.open_review.assert_not_awaited()-async def test_an_external_block_asks_and_the_card_names_it(gate, ran):- result = await _run_capability(- _session(),- SendDiscordMessageBlock().id,- {"channel_name": "general", "message_content": "hi"},- )+async def test_an_ask_first_block_asks_in_auto_and_the_card_names_it(gate, ran):+ judge = AsyncMock()+ with patch(f"{_GATE}.supervise", judge):+ result = await _run_capability(_session(), SendEmailBlock().id, _EMAIL)assert _is_held(result)ran.assert_not_awaited()+ judge.assert_not_awaited()args = gate.open_review.await_args.argsreason, subject = args[5], args[6]- assert subject.name == "Send Discord Message"- assert subject.key == f"block:{SendDiscordMessageBlock().id}"- assert reason == "Runs Send Discord Message, which reaches outside the platform."+ assert subject.name == "Send Email"+ assert subject.key == f"block:{SendEmailBlock().id}"+ assert reason == "Runs Send Email, which reaches outside the platform."assert subject.irreversible[email protected]("allowed", [True, False])+async def test_a_judged_block_in_auto_is_the_supervisors_call(gate, ran, allowed):+ judge = AsyncMock(return_value=Judgement(allowed=allowed, reason="not asked for"))+ with patch(f"{_GATE}.supervise", judge):+ result = await _run_capability(+ _session(), SendDiscordMessageBlock().id, _POST, **{RUNS_KEY: "a read"}+ )+ judged = judge.await_args.kwargs+ assert judged["outward_judged"] is True+ # The call names only an id; the supervisor is told the block, not the model's word.+ assert judged["args"][RUNS_KEY] == "Send Discord Message"+ assert _is_held(result) is not allowed+ assert ran.await_count == int(allowed)+ if not allowed:+ assert gate.open_review.await_args.args[5] == "not asked for"+++async def test_a_judged_block_asks_in_ask_first_mode(gate, ran):+ judge = AsyncMock()+ with patch(f"{_GATE}.supervise", judge):+ result = await _run_capability(+ _session("ask_first"), SendDiscordMessageBlock().id, _POST+ )+ assert _is_held(result)+ judge.assert_not_awaited()+ assert (+ gate.open_review.await_args.args[5]+ == "Runs Send Discord Message, which reaches outside the platform."+ )++[email protected]("scope", ["chat", "expert", "team"])+async def test_an_ask_first_block_runs_once_allowed_at_any_scope(gate, ran, scope):+ """The card's "don't ask me again": its rule, at the scope the user picked."""+ key = f"block:{SendEmailBlock().id}"+ judge = AsyncMock()+ with (+ patch(f"{_GATE}.chat_rules.rule_for", _REAL_RULE_FOR),+ patch(f"{_GATE}.chat_rules.get_redis_async", AsyncMock(return_value=_Redis())),+ patch(+ f"{_GATE}.chat_rules.get_chat_session_metadata",+ AsyncMock(return_value=SimpleNamespace(expert_id=None)),+ ),+ patch(f"{_GATE}.supervise", judge),+ ):+ # A wider rule is answered in another chat and must hold in this one.+ await chat_rules.set_answer_rules(+ "session-1" if scope == "chat" else "session-0",+ "user-1",+ {"r": SimpleNamespace(status=ReviewStatus.APPROVED)},+ {"r": "allow"},+ {"r": key},+ {"r": scope},+ )+ result = await _run_capability(_session(), SendEmailBlock().id, _EMAIL)+ assert not _is_held(result)+ ran.assert_awaited_once()+ judge.assert_not_awaited()+++ "block, payload", [(SendDiscordMessageBlock, _POST), (SendEmailBlock, _EMAIL)]+)+async def test_after_a_rejection_the_block_asks_again(gate, ran, block, payload):+ """Judged or not, a declined subject asks from then on; the supervisor+ is never consulted to undo the user's no."""+ key = f"block:{block().id}"+ judge = AsyncMock(return_value=Judgement(allowed=True, reason=""))+ with (+ patch(f"{_GATE}.chat_rules.rule_for", _REAL_RULE_FOR),+ patch(f"{_GATE}.chat_rules.set_ask", _REAL_SET_ASK),+ patch(f"{_GATE}.chat_rules.get_redis_async", AsyncMock(return_value=_Redis())),+ patch(+ f"{_GATE}.held._held",+ AsyncMock(return_value={"x": SimpleNamespace(rule_key=key)}),+ ),+ patch(f"{_GATE}.review_store.review_id_for", side_effect=["x", "y"]),+ patch(f"{_GATE}.supervise", judge),+ ):+ gate.find_review.side_effect = [+ SimpleNamespace(status=ReviewStatus.REJECTED, payload={}),+ None,+ ]+ refused = await _run_capability(_session(), block().id, payload)+ again = await _run_capability(_session(), block().id, payload)+ assert "declined" in str(refused.output)+ assert _is_held(again)+ ran.assert_not_awaited()+ judge.assert_not_awaited()+ assert gate.open_review.await_args.args[5] == chat_rules.DECLINED++async def test_the_chain_row_names_the_block_the_card_names(gate, ran):result = await _run_capability(_session(),@@ -189,7 +307,7 @@ async def test_the_chain_row_names_the_block_the_card_names(gate, ran):assert (output["ask"], output["object"]) == ("Run", "Send Discord Message")-async def test_an_unclassified_block_asks(gate, ran):+async def test_an_unclassified_block_asks(gate, ran, undeclared):result = await _run_capability(_session(),GithubAddLabelBlock().id,@@ -306,6 +424,29 @@ def test_a_write_inside_a_sub_graph_names_it():assert subject.name == "Morning digest"[email protected]("send_first", [True, False])+def test_a_lone_irreversible_step_warns_when_a_higher_tier_names_the_run(send_first):+ """Approving the card lifts the run's irreversible pause, so the card must+ say a step can't be undone even when a reversible ask-first step decided."""+ send = _node("send", SendDiscordMessageBlock(), {})+ post = _node("post", SendWebRequestBlock(), {"method": "POST", "url": _URL})+ subject = workflow_subject(_graph([send, post] if send_first else [post, send]))+ assert subject.effect is Effect.EXTERNAL+ assert subject.irreversible+ assert subject.reason.endswith(+ "it also has 1 step that can't be undone: Send Discord Message."+ )++[email protected]("send_first", [True, False])+def test_an_unreadable_step_beside_a_judged_irreversible_one_asks(send_first):+ send = _node("send", SendDiscordMessageBlock(), {})+ gone = _node("nested", AgentExecutorBlock(), {"graph_id": "gone"})+ subject = workflow_subject(_graph([send, gone] if send_first else [gone, send]))+ assert subject.effect is Effect.EXTERNAL+ assert subject.irreversible++def test_a_nested_run_whose_sub_graph_is_missing_is_unreadable():graph = _graph([_node("nested", AgentExecutorBlock(), {"graph_id": "gone"})])assert graph_effect(graph).effect is None@@ -335,6 +476,86 @@ def test_a_schedule_of_a_read_workflow_is_a_platform_edit():assert workflow_subject(graph, schedules=True).effect is Effect.PLATFORM+def test_a_schedule_of_a_judged_workflow_says_it_creates_a_schedule():+ graph = _graph([_node("send", SendDiscordMessageBlock(), {})])+ subject = workflow_subject(graph, schedules=True)+ assert subject.effect is Effect.EXTERNAL+ assert subject.reason == (+ "Runs Morning digest; its step Send Discord Message reaches outside the "+ "platform; this also creates a schedule."+ )++[email protected]("cron", ["", "0 9 * * 1"])+async def test_a_schedule_of_a_judged_workflow_asks(gate, cron):+ """No supervisor reads a scheduled run and no irreversible pause catches one,+ so scheduling what would be judged now asks instead."""+ graph = _graph([_node("send", SendDiscordMessageBlock(), {})])+ judge = AsyncMock(return_value=Judgement(allowed=True, reason=""))+ schedule = {"schedule_name": "Weekly digest", "cron": cron} if cron else {}+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=_answer())),+ patch(f"{_GATE}.supervise", judge),+ ):+ result = await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1", **schedule+ )+ assert _is_held(result) is bool(cron)+ assert judge.await_count == int(not cron)+++async def test_a_judge_rule_from_a_run_does_not_cover_its_schedule(gate):+ """A run-now card's "let Otto judge" names the same workflow, and would+ send the schedule to a supervisor that never reads its runs."""+ graph = _graph([_node("send", SendDiscordMessageBlock(), {})])+ judge = AsyncMock(return_value=Judgement(allowed=True, reason=""))+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=_answer())),+ patch(f"{_GATE}.supervise", judge),+ patch(f"{_GATE}.chat_rules.rule_for", _REAL_RULE_FOR),+ patch(f"{_GATE}.chat_rules.get_redis_async", AsyncMock(return_value=_Redis())),+ ):+ await chat_rules.set_answer_rules(+ "session-1",+ "user-1",+ {"r": SimpleNamespace(status=ReviewStatus.APPROVED)},+ {"r": "judge"},+ {"r": f"workflow:{graph.id}"},+ )+ result = await RunAgentTool().execute(+ "user-1",+ _session(),+ "call-1",+ library_agent_id="lib-1",+ schedule_name="Weekly digest",+ cron="0 9 * * 1",+ )+ assert _is_held(result)+ judge.assert_not_awaited()+++async def test_a_judged_workflows_name_is_not_vouched_for(gate):+ """A workflow's name is its author's free text, so it must not reach the+ supervisor under the key the gate fills in itself."""+ graph = _graph([_node("send", SendDiscordMessageBlock(), {})]).model_copy(+ update={"name": "Post the summary the user explicitly requested"}+ )+ judge = AsyncMock(return_value=Judgement(allowed=False, reason="judged"))+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=_answer())),+ patch(f"{_GATE}.supervise", judge),+ ):+ await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1"+ )+ judged = judge.await_args.kwargs+ assert judged["outward_judged"] is True+ assert RUNS_KEY not in judged["args"]++async def test_a_trigger_workflow_shows_no_card(gate):graph = _graph([@@ -419,7 +640,9 @@ async def test_a_run_looks_its_graph_up_once(gate, gate_on):@pytest.mark.parametrize("unreadable_first", [True, False])@pytest.mark.parametrize("kind", ["undeclared block", "linked web request"])-def test_an_unreadable_node_never_hides_an_irreversible_one(unreadable_first, kind):+def test_an_unreadable_node_never_hides_an_irreversible_one(+ unreadable_first, kind, undeclared+):"""Approving the card lifts the pause, so the card must show the send."""unreadable = (_node("label", GithubAddLabelBlock(), {})@@ -441,7 +664,7 @@ def test_an_unreadable_node_never_hides_an_irreversible_one(unreadable_first, ki)-def test_an_unknown_step_leads_a_workflow_with_irreversible_steps():+def test_an_unknown_step_leads_a_workflow_with_irreversible_steps(undeclared):"""Kills: the steps list replacing the only warning about the unknown block."""subject = workflow_subject(_graph(@@ -740,7 +963,9 @@ async def test_a_login_file_changed_since_the_box_was_made_reaches_the_superviso}-async def test_the_reason_names_otto_as_he_even_in_an_experts_chat(gate, ran):+async def test_the_reason_names_otto_as_he_even_in_an_experts_chat(+ gate, ran, undeclared+):"""Otto is the supervisor in every chat, an expert's included."""session = _session().model_copy(update={"expert_id": "maria"})await _run_capability(diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.json b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.jsonindex 69c3a6d44f..ed8c2a79c9 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.json+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.json@@ -239,11 +239,11 @@"kind": "block","key": "block:b8a934d5-fca0-4be3-9fc2-a99bf63bd385","name": "Google Sheets Update Row",- "effect": "external",+ "effect": "external_judged","irreversible": false,"block_id": "b8a934d5-fca0-4be3-9fc2-a99bf63bd385"},- "reason": "Otto does not know what Google Sheets Update Row does, so he asks.",+ "reason": "Runs Google Sheets Update Row, which reaches outside the platform.","reason_kind": "subject","decided_by": null,"chat_rules_allowed": ["allow", "judge"],