feat(blocks): add Slack SendSlackMessageBlock - #13008
Conversation
WalkthroughAdds Slack message integration: API helpers ( ChangesSlack Message Integration
Sequence Diagram(s) sequenceDiagram
participant Executor
participant SendSlackMessageBlock
participant _post_message
participant post_message
participant SlackAPI
Executor->>SendSlackMessageBlock: run(input_data, credentials)
SendSlackMessageBlock->>_post_message: forward parameters
_post_message->>post_message: call with channel, text, options
post_message->>SlackAPI: POST /api/chat.postMessage (Bearer token)
SlackAPI-->>post_message: JSON response (ok / error)
alt ok=false
post_message-->>_post_message: raise SlackAPIException
else ok=true
post_message-->>_post_message: SlackMessageResult
end
_post_message-->>SendSlackMessageBlock: SlackMessageResult or propagate exception
SendSlackMessageBlock-->>Executor: yield ts, channel
🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels: Suggested reviewers:
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #13008 +/- ##
==========================================
+ Coverage 70.07% 70.09% +0.01%
==========================================
Files 2170 2174 +4
Lines 161871 162147 +276
Branches 16647 16659 +12
==========================================
+ Hits 113433 113650 +217
- Misses 45115 45177 +62
+ Partials 3323 3320 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/blocks/slack/blocks.py (1)
108-122: ⚡ Quick winNon-standard
try/exceptinrun()— remove it per established block patterns.The block framework's
_execute()in_base.pyalready catches all uncaught exceptions fromrun()and converts them toBlockExecutionError. Catching here and re-raising asValueErrordiscardsSlackAPIException.error's structured attribute and adds no value. The learnings for this codebase explicitly say not to add per-blocktry/exceptinrun()unless you need to control partial output (which you don't here).♻️ Proposed refactor
async def run( self, input_data: Input, *, credentials: APIKeyCredentials, **kwargs ) -> BlockOutput: - try: - result = await self._post_message( - credentials=credentials, - channel=input_data.channel, - text=input_data.text, - thread_ts=input_data.thread_ts, - username=input_data.username, - icon_emoji=input_data.icon_emoji, - unfurl_links=input_data.unfurl_links, - mrkdwn=input_data.mrkdwn, - ) - yield "ts", result.ts - yield "channel", result.channel - except Exception as e: - raise ValueError(f"Failed to send Slack message: {e}") from e + result = await self._post_message( + credentials=credentials, + channel=input_data.channel, + text=input_data.text, + thread_ts=input_data.thread_ts, + username=input_data.username, + icon_emoji=input_data.icon_emoji, + unfurl_links=input_data.unfurl_links, + mrkdwn=input_data.mrkdwn, + ) + yield "ts", result.ts + yield "channel", result.channelBased on learnings: "Do not add per-block try/except in individual block run() methods, as this is not the established pattern (e.g., Gmail, Slack, Todoist blocks omit it). The block framework's _execute() in _base.py already catches unhandled exceptions."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@autogpt_platform/backend/backend/blocks/slack/blocks.py` around lines 108 - 122, Remove the per-block try/except in the run() method so exceptions from self._post_message propagate to the block framework; specifically, delete the try/except that catches Exception and raises ValueError, call self._post_message directly, and yield "ts" and "channel" from the returned result (preserving result.ts and result.channel); this preserves SlackAPIException.error and lets _execute() convert uncaught errors to BlockExecutionError rather than wrapping them in ValueError.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/docs-claude-review.yml:
- Around line 16-19: Update the stale comment above the workflow conditional to
match the actual `if` expression (which checks
`github.event.pull_request.author_association == 'OWNER' ||
github.event.pull_request.author_association == 'MEMBER'`): replace "Only run
for PRs from members/collaborators" with a concise, accurate message such as
"Only run for PRs from repository OWNERs or MEMBERs" (or similar wording) so the
comment reflects the current condition.
In `@autogpt_platform/backend/backend/blocks/slack/_auth.py`:
- Around line 23-26: The concatenated description string for the Slack Bot Token
in _auth.py is missing a space between "required" and "OAuth"; update the
description (the description parameter/string for the Slack Bot Token) to
include a space either at the end of the preceding string or at the start of the
"OAuth scopes" string so it becomes "...add the required OAuth scopes...".
Ensure the corrected string is used where the description variable/argument is
defined.
In `@docs/integrations/block-integrations/slack/blocks.md`:
- Line 26: Update the table row for the "mrkdwn" field so the description
capitalizes "Markdown" (change "Enable Slack markdown formatting in the message
text." to "Enable Slack Markdown formatting in the message text."); locate the
"mrkdwn" entry in the blocks.md table and edit the description text accordingly
to use the proper noun "Markdown".
---
Nitpick comments:
In `@autogpt_platform/backend/backend/blocks/slack/blocks.py`:
- Around line 108-122: Remove the per-block try/except in the run() method so
exceptions from self._post_message propagate to the block framework;
specifically, delete the try/except that catches Exception and raises
ValueError, call self._post_message directly, and yield "ts" and "channel" from
the returned result (preserving result.ts and result.channel); this preserves
SlackAPIException.error and lets _execute() convert uncaught errors to
BlockExecutionError rather than wrapping them in ValueError.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6eea29c3-4228-4b23-a316-dca0be461f54
⛔ Files ignored due to path filters (1)
autogpt_platform/frontend/public/integrations/slack.pngis excluded by!**/*.png
📒 Files selected for processing (11)
.github/workflows/claude.yml.github/workflows/docs-claude-review.ymlautogpt_platform/backend/backend/blocks/slack/__init__.pyautogpt_platform/backend/backend/blocks/slack/_api.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/integrations/providers.pydocs/integrations/README.mddocs/integrations/SUMMARY.mddocs/integrations/block-integrations/slack/blocks.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: check API types
- GitHub Check: integration_test
- GitHub Check: lint
- GitHub Check: type-check (3.12)
- GitHub Check: lint
- GitHub Check: test (3.13)
- GitHub Check: test (3.12)
- GitHub Check: test (3.11)
- GitHub Check: type-check (3.13)
- GitHub Check: type-check (3.11)
- GitHub Check: end-to-end tests
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (typescript)
- GitHub Check: check-docs-sync
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (5)
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
autogpt_platform/backend/backend/blocks/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/backend/blocks/**/*.py: Inherit from 'Block' base class with input/output schemas when adding new blocks in backend
Implement 'run' method with proper error handling in backend blocks
Generate block UUID using 'uuid.uuid4()' when creating new blocks in backend
Write tests alongside block implementation when adding new blocks in backend
autogpt_platform/backend/backend/blocks/**/*.py: For blocks handling files, usestore_media_file()withreturn_format="for_local_processing"when processing with local tools (ffmpeg, MoviePy, PIL)
For blocks handling files, usestore_media_file()withreturn_format="for_external_api"when sending content to external APIs (Replicate, OpenAI)
For blocks returning files, usestore_media_file()withreturn_format="for_block_output"to enable auto-adaptation to execution context (workspace:// in CoPilot, data URI in graphs)
When creating new blocks, inherit fromBlockbase class, define input/output schemas usingBlockSchema, implement asyncrunmethod, and generate unique block ID usinguuid.uuid4()
Files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
autogpt_platform/{backend,autogpt_libs}/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Format Python code with
poetry run format
Files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
autogpt_platform/backend/backend/blocks/**/_config.py
📄 CodeRabbit inference engine (autogpt_platform/backend/AGENTS.md)
When adding a new block, configure the provider using
ProviderBuilderin_config.py
Files:
autogpt_platform/backend/backend/blocks/slack/_config.py
docs/integrations/**/*.md
📄 CodeRabbit inference engine (docs/AGENTS.md)
docs/integrations/**/*.md: Block documentationhow_it_worksmanual section should provide a technical explanation of the block's processing logic in 1-2 paragraphs, mention validation/error handling/edge cases, and use code examples with backticks
Block documentationuse_casemanual section should provide exactly 3 practical use cases in bold heading format with short one-sentence descriptions
Documentation descriptions should be concise and action-oriented, focusing on practical real-world scenarios with consistent terminology and avoiding overly technical jargon
Files:
docs/integrations/block-integrations/slack/blocks.mddocs/integrations/README.mddocs/integrations/SUMMARY.md
🧠 Learnings (13)
📚 Learning: 2026-02-05T04:11:00.596Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11796
File: autogpt_platform/backend/backend/blocks/video/concat.py:3-4
Timestamp: 2026-02-05T04:11:00.596Z
Learning: In autogpt_platform/backend/backend/blocks/**/*.py, when creating a new block, generate a UUID once with uuid.uuid4() and hard-code the resulting string as the block's id parameter. Do not call uuid.uuid4() at runtime; IDs must be constant across all imports and runs to ensure stability.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-16T16:32:21.686Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/pods.py:62-74
Timestamp: 2026-03-16T16:32:21.686Z
Learning: In autogpt_platform/backend/backend/blocks/, the Block base class execute() already wraps run() in a try/except to convert uncaught exceptions into BlockExecutionError/BlockUnknownError. Do not add per-block try/except in individual block run() methods, as this is not the established pattern (e.g., Gmail, Slack, Todoist blocks omit it). Only use explicit try/except within blocks that need to distinguish between success and error yield paths inside a generator (e.g., attachment blocks). This guidance applies to all Python files under autogpt_platform/backend/backend/blocks/ and similar block implementations; avoid duplicating error handling in run() unless a block requires generator-based branching.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-04-23T12:55:26.122Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12893
File: autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.py:24-24
Timestamp: 2026-04-23T12:55:26.122Z
Learning: Cost billing via the cost(*costs) decorator is applied at input-evaluation time (before a block’s run() executes). Therefore, mutating input_data inside run() will not change billing. When a block’s billing depends on a field plus URL/sniff-derived signals, treat the explicitly declared billing field (e.g., is_video) as the only billing source—set it correctly before run() (or in the code path that occurs before the decorator evaluates input_data). This should be checked for all blocks under autogpt_platform/backend/backend/blocks/ so billing signals are not mistakenly assumed to update during run().
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-05T15:42:08.207Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12297
File: .claude/skills/backend-check/SKILL.md:14-16
Timestamp: 2026-03-05T15:42:08.207Z
Learning: In Python files under autogpt_platform/backend (recursively), rely on poetry run format to perform formatting (Black + isort) and linting (ruff). Do not run poetry run lint as a separate step after poetry run format, since format already includes linting checks.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-16T16:30:11.452Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:11.452Z
Learning: In autogpt_platform/backend/backend/blocks/ (and related blocks under autogpt_platform/backend/backend/blocks/), do not add try/except blocks around a block's run() method for standard error propagation. The block executor framework (backend/executor/manager.py) catches uncaught exceptions from run() and emits them on the 'error' output. Only add explicit try/except blocks when you need to control partial outputs in failure cases (e.g., certain outputs must not be yielded on error, as in attachment blocks). This is the standard pattern across the codebase; apply it broadly to blocks' run() implementations.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-16T16:30:23.196Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/pods.py:62-74
Timestamp: 2026-03-16T16:30:23.196Z
Learning: In any Python file under autogpt_platform/backend/backend/blocks, do not add a try/except around run() solely for standard error handling. The block framework’s _execute() in _base.py already catches unhandled exceptions and re-raises as BlockExecutionError or BlockUnknownError. If you yield ("error", message), _execute() raises BlockExecutionError immediately, so the error port will not propagate downstream. Reserve explicit try/except for scenarios where you must control partial output (e.g., attachment blocks that must skip yielding content_base64 on failure).
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-16T16:30:11.452Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:11.452Z
Learning: Do not wrap synchronous AgentMail SDK calls with asyncio.to_thread() in blocks under autogpt_platform/backend/backend/blocks (and across the codebase). The block executor runs node execution in dedicated threads via asyncio.run_coroutine_threadsafe (see manager.py around lines ~745-752 and ~1079). The existing pattern avoids using asyncio.to_thread for SDK calls inside async run() methods, so maintain that approach and do not add to_thread usage in these code paths.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-16T16:35:40.236Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/api/features/workflow_import.py:54-63
Timestamp: 2026-03-16T16:35:40.236Z
Learning: Avoid using the word 'competitor' in public-facing identifiers and text. Use neutral naming for API paths, model names, function names, and UI text. Examples: rename 'CompetitorFormat' to 'SourcePlatform', 'convert_competitor_workflow' to 'convert_workflow', '/competitor-workflow' to '/workflow'. Apply this guideline to files under autogpt_platform/backend and autogpt_platform/frontend.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-03-31T15:37:38.626Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/backend/backend/copilot/tools/agent_generator/fixer.py:37-47
Timestamp: 2026-03-31T15:37:38.626Z
Learning: When validating/constructing Anthropic API model IDs in Significant-Gravitas/AutoGPT, allow the hyphen-separated Claude Opus 4.6 model ID `claude-opus-4-6` (it corresponds to `LlmModel.CLAUDE_4_6_OPUS` in `autogpt_platform/backend/backend/blocks/llm.py`). Do NOT require the dot-separated form in Anthropic contexts. Only OpenRouter routing variants should use the dot separator (e.g., `anthropic/claude-opus-4.6`); `claude-opus-4-6` should be treated as correct when passed to Anthropic, and flagged only if it’s used in the OpenRouter path where the dot form is expected.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-04-15T02:43:36.890Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12780
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-15T02:43:36.890Z
Learning: When reviewing Python exception handlers, do not flag `isinstance(e, X)` checks as dead/unreachable if the caught exception `X` is a subclass of the exception type being handled. For example, if `X` (e.g., `VirusScanError`) inherits from `ValueError` (directly or via an intermediate class) and it can be raised within an `except ValueError:` block, then `isinstance(e, X)` inside that handler is reachable and should not be treated as dead code.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-04-22T11:46:04.431Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/config.py:0-0
Timestamp: 2026-04-22T11:46:04.431Z
Learning: Do not flag the Claude Sonnet 4.6 model ID as incorrect when it uses the project’s established hyphenated convention: `anthropic/claude-sonnet-4-6`. This hyphen form is the intentional, production convention and should be treated as valid (including in files like llm.py, blocks tests, reasoning.py, `_is_anthropic_model` tests, and config defaults). Note that OpenRouter also accepts the dot variant `anthropic/claude-sonnet-4.6`, so either form may be tolerated, but `anthropic/claude-sonnet-4-6` should be considered the standard to match project usage.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
📚 Learning: 2026-04-22T11:46:12.892Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/baseline/service.py:322-332
Timestamp: 2026-04-22T11:46:12.892Z
Learning: In this codebase (Significant-Gravitas/AutoGPT), OpenRouter-routed Anthropic model IDs should use the hyphen-separated convention (e.g., `anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-6`). Although OpenRouter may accept both hyphen and dot variants, treat the hyphen-separated form as the intended, correct codebase-wide convention and do not flag it as an error. Only flag the dot-separated variant (e.g., `anthropic/claude-sonnet-4.6`) as incorrect when reviewing/validating model ID strings for OpenRouter-routed Anthropic models.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/_config.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/integrations/providers.pyautogpt_platform/backend/backend/blocks/slack/_api.py
🪛 LanguageTool
docs/integrations/block-integrations/slack/blocks.md
[uncategorized] ~26-~26: Did you mean the formatting language “Markdown” (= proper noun)?
Context: .... | bool | No | | mrkdwn | Enable Slack markdown formatting in the message text. | bool ...
(MARKDOWN_NNP)
🔇 Additional comments (7)
.github/workflows/claude.yml (1)
15-28: LGTM — gating change is consistent and correct.Removing
COLLABORATORfrom theauthor_associationcheck mirrors the same change made indocs-claude-review.yml, and the remaining multi-event condition structure is logically sound.autogpt_platform/backend/backend/integrations/providers.py (1)
48-48: LGTM —ProviderName.SLACKcorrectly positioned and consistently valued.autogpt_platform/backend/backend/blocks/slack/_config.py (1)
1-10: LGTM — provider registration correctly wired to"api_key"auth type.autogpt_platform/backend/backend/blocks/slack/_api.py (1)
36-65: LGTM —call_slack_apicorrectly validates theokflag and raises a typed exception.docs/integrations/README.md (1)
357-357: LGTM — entry correctly placed and link/description match the block.docs/integrations/SUMMARY.md (1)
108-108: LGTM — TOC entry is correctly placed alphabetically.autogpt_platform/backend/backend/blocks/slack/blocks.py (1)
97-102: ⚡ Quick winThe framework properly handles this case. The test utility (
autogpt_platform/backend/backend/util/test.py, lines 122-142) detects when the target method is async usinginspect.iscoroutinefunction()and wraps synchronous mock values in anasync defcoroutine before patching. Whenawait self._post_message(...)is called, it awaits the wrapper, which internally invokes the synchronous lambda and returns its result. No issue here.
3035594 to
33f49fd
Compare
…lify block - Remove unnecessary _config.py (ProviderBuilder not needed for API-key-only providers) - Fix missing space in _auth.py credentials description - Remove redundant try/except in blocks.py - Capitalize 'Markdown' in docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests cover: - SlackAPIException (inheritance, error code, message format) - SlackMessageResult (basic fields, extra fields) - call_slack_api (success, API error, unknown error, empty data) - post_message (basic, optional params, omitted params, error propagation) - SendSlackMessageBlock (UUID, category, schemas, run yields, param passing, error wrapping, generic exception wrapping, framework integration test) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
33f49fd to
3f37bb1
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/blocks/slack/slack_test.py (1)
246-247: ⚡ Quick winMove local imports to module scope.
uuid,BlockCategory, andexecute_block_testshould be imported at top-level for consistency with backend rules.As per coding guidelines, "Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies like `openpyxl`".Proposed fix
from typing import Any from unittest.mock import AsyncMock, MagicMock, patch import pytest +import uuid +from backend.blocks._base import BlockCategory from backend.blocks.slack._api import ( SlackAPIException, SlackMessageResult, @@ from backend.blocks.slack._auth import TEST_CREDENTIALS, TEST_CREDENTIALS_INPUT from backend.blocks.slack.blocks import SendSlackMessageBlock +from backend.util.test import execute_block_test @@ def test_block_id_is_valid_uuid(self): - import uuid - uuid.UUID(self.block.id, version=4) @@ def test_block_category(self): - from backend.blocks._base import BlockCategory - assert BlockCategory.SOCIAL in self.block.categories @@ async def test_framework_test_mock_works(self): """Verify the test_mock fixture from __init__ works with execute_block_test.""" - from backend.util.test import execute_block_test - await execute_block_test(self.block)Also applies to: 251-252, 356-357
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@autogpt_platform/backend/backend/blocks/slack/slack_test.py` around lines 246 - 247, In slack_test.py move the local imports to module scope: import uuid and import BlockCategory and execute_block_test at the top of the file instead of inside test functions; locate uses of uuid, BlockCategory, and execute_block_test (references around the current local imports and the tests that call execute_block_test) and add the corresponding top-level import statements so the tests no longer perform local/inner imports (also fix the other occurrences noted around the 251-252 and 356-357 regions).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@autogpt_platform/backend/backend/blocks/slack/slack_test.py`:
- Around line 318-333: The tests in slack_test.py (notably
test_run_wraps_api_error_as_value_error and the similar case around lines
336-351) assert that block.run() converts exceptions into ValueError, which
forces per-block try/excepts; instead update the tests to expect the original
SlackAPIException to be propagated (or to assert that the executor/wrapper will
handle wrapping), e.g. replace the pytest.raises(ValueError, ...) with
pytest.raises(SlackAPIException, ...) or otherwise assert that run() does not
perform custom exception wrapping so the Block execute()/executor can manage
error wrapping. Ensure references point to the test function names
test_run_wraps_api_error_as_value_error and the analogous test at 336-351 and to
the patched method _post_message on self.block.
- Line 88: The test currently silences the type checker with "# type: ignore" on
the assertion "assert r.extra_field == 'hi'"; remove the suppressor and instead
assert the extra field via the model's explicit extra storage or serialized
output (e.g., inspect r.dict()/r.json() or use getattr on the response object)
so the check doesn't rely on an undefined attribute; update the assertion to
access the extra data through the model serialization API (for the object
referenced as r) and assert equality to "hi" without any linter suppressor.
---
Nitpick comments:
In `@autogpt_platform/backend/backend/blocks/slack/slack_test.py`:
- Around line 246-247: In slack_test.py move the local imports to module scope:
import uuid and import BlockCategory and execute_block_test at the top of the
file instead of inside test functions; locate uses of uuid, BlockCategory, and
execute_block_test (references around the current local imports and the tests
that call execute_block_test) and add the corresponding top-level import
statements so the tests no longer perform local/inner imports (also fix the
other occurrences noted around the 251-252 and 356-357 regions).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f50eddc-ade4-4610-9de4-5f69bc33a771
⛔ Files ignored due to path filters (1)
autogpt_platform/frontend/public/integrations/slack.pngis excluded by!**/*.png
📒 Files selected for processing (6)
autogpt_platform/backend/backend/blocks/slack/__init__.pyautogpt_platform/backend/backend/blocks/slack/_api.pyautogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/blocks.pyautogpt_platform/backend/backend/blocks/slack/slack_test.pyautogpt_platform/backend/backend/integrations/providers.py
✅ Files skipped from review due to trivial changes (3)
- autogpt_platform/backend/backend/blocks/slack/_auth.py
- autogpt_platform/backend/backend/blocks/slack/blocks.py
- autogpt_platform/backend/backend/blocks/slack/_api.py
🚧 Files skipped from review as they are similar to previous changes (1)
- autogpt_platform/backend/backend/integrations/providers.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: end-to-end tests
- GitHub Check: lint
- GitHub Check: integration_test
- GitHub Check: test (3.11)
- GitHub Check: lint
- GitHub Check: test (3.13)
- GitHub Check: type-check (3.12)
- GitHub Check: type-check (3.13)
- GitHub Check: type-check (3.11)
- GitHub Check: test (3.12)
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (4)
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
autogpt_platform/backend/backend/blocks/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/backend/blocks/**/*.py: Inherit from 'Block' base class with input/output schemas when adding new blocks in backend
Implement 'run' method with proper error handling in backend blocks
Generate block UUID using 'uuid.uuid4()' when creating new blocks in backend
Write tests alongside block implementation when adding new blocks in backend
autogpt_platform/backend/backend/blocks/**/*.py: For blocks handling files, usestore_media_file()withreturn_format="for_local_processing"when processing with local tools (ffmpeg, MoviePy, PIL)
For blocks handling files, usestore_media_file()withreturn_format="for_external_api"when sending content to external APIs (Replicate, OpenAI)
For blocks returning files, usestore_media_file()withreturn_format="for_block_output"to enable auto-adaptation to execution context (workspace:// in CoPilot, data URI in graphs)
When creating new blocks, inherit fromBlockbase class, define input/output schemas usingBlockSchema, implement asyncrunmethod, and generate unique block ID usinguuid.uuid4()
Files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
autogpt_platform/{backend,autogpt_libs}/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Format Python code with
poetry run format
Files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
autogpt_platform/backend/**/*_test.py
📄 CodeRabbit inference engine (autogpt_platform/backend/AGENTS.md)
autogpt_platform/backend/**/*_test.py: Use pytest with snapshot testing for API responses
Colocate test files with source files using*_test.pynaming convention
Mock at boundaries — mock where the symbol is used, not where it's defined; after refactoring, update mock targets to match new module paths
UseAsyncMockfromunittest.mockfor async functions in tests
When writing tests, use Test-Driven Development (TDD): write failing tests marked with@pytest.mark.xfailbefore implementation, then remove the marker once the implementation is complete
When creating snapshots in tests, usepoetry run pytest path/to/test.py --snapshot-update; always review snapshot changes withgit diffbefore committing
Files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
🧠 Learnings (13)
📚 Learning: 2026-02-05T04:11:00.596Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11796
File: autogpt_platform/backend/backend/blocks/video/concat.py:3-4
Timestamp: 2026-02-05T04:11:00.596Z
Learning: In autogpt_platform/backend/backend/blocks/**/*.py, when creating a new block, generate a UUID once with uuid.uuid4() and hard-code the resulting string as the block's id parameter. Do not call uuid.uuid4() at runtime; IDs must be constant across all imports and runs to ensure stability.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-16T16:32:21.686Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/pods.py:62-74
Timestamp: 2026-03-16T16:32:21.686Z
Learning: In autogpt_platform/backend/backend/blocks/, the Block base class execute() already wraps run() in a try/except to convert uncaught exceptions into BlockExecutionError/BlockUnknownError. Do not add per-block try/except in individual block run() methods, as this is not the established pattern (e.g., Gmail, Slack, Todoist blocks omit it). Only use explicit try/except within blocks that need to distinguish between success and error yield paths inside a generator (e.g., attachment blocks). This guidance applies to all Python files under autogpt_platform/backend/backend/blocks/ and similar block implementations; avoid duplicating error handling in run() unless a block requires generator-based branching.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-04-23T12:55:26.122Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12893
File: autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.py:24-24
Timestamp: 2026-04-23T12:55:26.122Z
Learning: Cost billing via the cost(*costs) decorator is applied at input-evaluation time (before a block’s run() executes). Therefore, mutating input_data inside run() will not change billing. When a block’s billing depends on a field plus URL/sniff-derived signals, treat the explicitly declared billing field (e.g., is_video) as the only billing source—set it correctly before run() (or in the code path that occurs before the decorator evaluates input_data). This should be checked for all blocks under autogpt_platform/backend/backend/blocks/ so billing signals are not mistakenly assumed to update during run().
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-05T15:42:08.207Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12297
File: .claude/skills/backend-check/SKILL.md:14-16
Timestamp: 2026-03-05T15:42:08.207Z
Learning: In Python files under autogpt_platform/backend (recursively), rely on poetry run format to perform formatting (Black + isort) and linting (ruff). Do not run poetry run lint as a separate step after poetry run format, since format already includes linting checks.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-16T16:30:11.452Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:11.452Z
Learning: In autogpt_platform/backend/backend/blocks/ (and related blocks under autogpt_platform/backend/backend/blocks/), do not add try/except blocks around a block's run() method for standard error propagation. The block executor framework (backend/executor/manager.py) catches uncaught exceptions from run() and emits them on the 'error' output. Only add explicit try/except blocks when you need to control partial outputs in failure cases (e.g., certain outputs must not be yielded on error, as in attachment blocks). This is the standard pattern across the codebase; apply it broadly to blocks' run() implementations.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-16T16:30:23.196Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/pods.py:62-74
Timestamp: 2026-03-16T16:30:23.196Z
Learning: In any Python file under autogpt_platform/backend/backend/blocks, do not add a try/except around run() solely for standard error handling. The block framework’s _execute() in _base.py already catches unhandled exceptions and re-raises as BlockExecutionError or BlockUnknownError. If you yield ("error", message), _execute() raises BlockExecutionError immediately, so the error port will not propagate downstream. Reserve explicit try/except for scenarios where you must control partial output (e.g., attachment blocks that must skip yielding content_base64 on failure).
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-16T16:30:11.452Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:11.452Z
Learning: Do not wrap synchronous AgentMail SDK calls with asyncio.to_thread() in blocks under autogpt_platform/backend/backend/blocks (and across the codebase). The block executor runs node execution in dedicated threads via asyncio.run_coroutine_threadsafe (see manager.py around lines ~745-752 and ~1079). The existing pattern avoids using asyncio.to_thread for SDK calls inside async run() methods, so maintain that approach and do not add to_thread usage in these code paths.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-16T16:35:40.236Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/api/features/workflow_import.py:54-63
Timestamp: 2026-03-16T16:35:40.236Z
Learning: Avoid using the word 'competitor' in public-facing identifiers and text. Use neutral naming for API paths, model names, function names, and UI text. Examples: rename 'CompetitorFormat' to 'SourcePlatform', 'convert_competitor_workflow' to 'convert_workflow', '/competitor-workflow' to '/workflow'. Apply this guideline to files under autogpt_platform/backend and autogpt_platform/frontend.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-03-31T15:37:38.626Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12623
File: autogpt_platform/backend/backend/copilot/tools/agent_generator/fixer.py:37-47
Timestamp: 2026-03-31T15:37:38.626Z
Learning: When validating/constructing Anthropic API model IDs in Significant-Gravitas/AutoGPT, allow the hyphen-separated Claude Opus 4.6 model ID `claude-opus-4-6` (it corresponds to `LlmModel.CLAUDE_4_6_OPUS` in `autogpt_platform/backend/backend/blocks/llm.py`). Do NOT require the dot-separated form in Anthropic contexts. Only OpenRouter routing variants should use the dot separator (e.g., `anthropic/claude-opus-4.6`); `claude-opus-4-6` should be treated as correct when passed to Anthropic, and flagged only if it’s used in the OpenRouter path where the dot form is expected.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-04-15T02:43:36.890Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12780
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-15T02:43:36.890Z
Learning: When reviewing Python exception handlers, do not flag `isinstance(e, X)` checks as dead/unreachable if the caught exception `X` is a subclass of the exception type being handled. For example, if `X` (e.g., `VirusScanError`) inherits from `ValueError` (directly or via an intermediate class) and it can be raised within an `except ValueError:` block, then `isinstance(e, X)` inside that handler is reachable and should not be treated as dead code.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-04-22T11:46:04.431Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/config.py:0-0
Timestamp: 2026-04-22T11:46:04.431Z
Learning: Do not flag the Claude Sonnet 4.6 model ID as incorrect when it uses the project’s established hyphenated convention: `anthropic/claude-sonnet-4-6`. This hyphen form is the intentional, production convention and should be treated as valid (including in files like llm.py, blocks tests, reasoning.py, `_is_anthropic_model` tests, and config defaults). Note that OpenRouter also accepts the dot variant `anthropic/claude-sonnet-4.6`, so either form may be tolerated, but `anthropic/claude-sonnet-4-6` should be considered the standard to match project usage.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
📚 Learning: 2026-04-22T11:46:12.892Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12881
File: autogpt_platform/backend/backend/copilot/baseline/service.py:322-332
Timestamp: 2026-04-22T11:46:12.892Z
Learning: In this codebase (Significant-Gravitas/AutoGPT), OpenRouter-routed Anthropic model IDs should use the hyphen-separated convention (e.g., `anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-6`). Although OpenRouter may accept both hyphen and dot variants, treat the hyphen-separated form as the intended, correct codebase-wide convention and do not flag it as an error. Only flag the dot-separated variant (e.g., `anthropic/claude-sonnet-4.6`) as incorrect when reviewing/validating model ID strings for OpenRouter-routed Anthropic models.
Applied to files:
autogpt_platform/backend/backend/blocks/slack/slack_test.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/integrations/block-integrations/slack/blocks.md`:
- Line 13: Update the "How it works" section for the Slack block to include
explicit validation and error/edge-case behavior: describe that the block calls
Slack's chat.postMessage API with the bot token (mention `chat.postMessage`, the
returned `ts` and use as `thread_ts`), then list possible failures (invalid
token or missing `chat:write`/`chat:write.customize` scopes, unknown/invalid
channel, Slack returning non-`ok` responses or rate-limit errors) and how each
surfaces on block outputs (e.g., error status, error message field, and no `ts`
produced); keep it 1–2 paragraphs and include inline code spans for
`chat.postMessage`, `ts`, `thread_ts`, and typical error indicators so callers
know what to validate and expect.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 709b2256-4ea4-4cc7-a55c-62b095522ea2
📒 Files selected for processing (1)
docs/integrations/block-integrations/slack/blocks.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: check API types
- GitHub Check: lint
- GitHub Check: integration_test
- GitHub Check: check-overlaps
- GitHub Check: types
- GitHub Check: lint
- GitHub Check: test (3.12)
- GitHub Check: type-check (3.11)
- GitHub Check: test (3.11)
- GitHub Check: type-check (3.13)
- GitHub Check: test (3.13)
- GitHub Check: type-check (3.12)
- GitHub Check: Analyze (python)
- GitHub Check: check-docs-sync
- GitHub Check: end-to-end tests
- GitHub Check: Check PR Status
- GitHub Check: Analyze (typescript)
🧰 Additional context used
📓 Path-based instructions (1)
docs/integrations/**/*.md
📄 CodeRabbit inference engine (docs/AGENTS.md)
docs/integrations/**/*.md: Block documentationhow_it_worksmanual section should provide a technical explanation of the block's processing logic in 1-2 paragraphs, mention validation/error handling/edge cases, and use code examples with backticks
Block documentationuse_casemanual section should provide exactly 3 practical use cases in bold heading format with short one-sentence descriptions
Documentation descriptions should be concise and action-oriented, focusing on practical real-world scenarios with consistent terminology and avoiding overly technical jargon
Files:
docs/integrations/block-integrations/slack/blocks.md
🪛 LanguageTool
docs/integrations/block-integrations/slack/blocks.md
[uncategorized] ~26-~26: Did you mean the formatting language “Markdown” (= proper noun)?
Context: .... | bool | No | | mrkdwn | Enable Slack markdown formatting in the message text. | bool ...
(MARKDOWN_NNP)
…ve docs - Use model_extra instead of type: ignore in test_extra_fields_allowed - Fix error propagation tests to match simplified run() (no try/except wrapper) - Add error/edge-case behavior to docs how_it_works section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
docs/integrations/block-integrations/slack/blocks.md (1)
28-28:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCapitalize “Markdown” in the
mrkdwndescription.Use the proper noun capitalization for consistency with documentation terminology.
📝 Proposed fix
-| mrkdwn | Enable Slack markdown formatting in the message text. | bool | No | +| mrkdwn | Enable Slack Markdown formatting in the message text. | bool | No |As per coding guidelines, “Documentation descriptions should be concise and action-oriented, focusing on practical real-world scenarios with consistent terminology and avoiding overly technical jargon”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/integrations/block-integrations/slack/blocks.md` at line 28, Update the table entry for the Slack block option 'mrkdwn' to use proper noun capitalization: change the description text from "Enable Slack markdown formatting in the message text." to "Enable Slack Markdown formatting in the message text." Locate the 'mrkdwn' row in the blocks.md table and edit only the description string to capitalise "Markdown" for consistency with documentation terminology.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@docs/integrations/block-integrations/slack/blocks.md`:
- Line 28: Update the table entry for the Slack block option 'mrkdwn' to use
proper noun capitalization: change the description text from "Enable Slack
markdown formatting in the message text." to "Enable Slack Markdown formatting
in the message text." Locate the 'mrkdwn' row in the blocks.md table and edit
only the description string to capitalise "Markdown" for consistency with
documentation terminology.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6cb646c0-c41d-41f9-83bf-64515f041818
📒 Files selected for processing (3)
autogpt_platform/backend/backend/blocks/slack/_auth.pyautogpt_platform/backend/backend/blocks/slack/slack_test.pydocs/integrations/block-integrations/slack/blocks.md
✅ Files skipped from review due to trivial changes (1)
- autogpt_platform/backend/backend/blocks/slack/_auth.py
🚧 Files skipped from review as they are similar to previous changes (1)
- autogpt_platform/backend/backend/blocks/slack/slack_test.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: check API types
- GitHub Check: lint
- GitHub Check: integration_test
- GitHub Check: end-to-end tests
- GitHub Check: Analyze (python)
- GitHub Check: Check PR Status
- GitHub Check: check-overlaps
- GitHub Check: type-check (3.12)
- GitHub Check: test (3.13)
- GitHub Check: test (3.12)
- GitHub Check: test (3.11)
- GitHub Check: type-check (3.11)
🧰 Additional context used
📓 Path-based instructions (1)
docs/integrations/**/*.md
📄 CodeRabbit inference engine (docs/AGENTS.md)
docs/integrations/**/*.md: Block documentationhow_it_worksmanual section should provide a technical explanation of the block's processing logic in 1-2 paragraphs, mention validation/error handling/edge cases, and use code examples with backticks
Block documentationuse_casemanual section should provide exactly 3 practical use cases in bold heading format with short one-sentence descriptions
Documentation descriptions should be concise and action-oriented, focusing on practical real-world scenarios with consistent terminology and avoiding overly technical jargon
Files:
docs/integrations/block-integrations/slack/blocks.md
🪛 LanguageTool
docs/integrations/block-integrations/slack/blocks.md
[style] ~15-~15: Consider using a different verb for a more formal wording.
Context: ...lack error code so you can diagnose and fix the issue. Network failures and unexpec...
(FIX_RESOLVE)
[uncategorized] ~28-~28: Did you mean the formatting language “Markdown” (= proper noun)?
Context: .... | bool | No | | mrkdwn | Enable Slack markdown formatting in the message text. | bool ...
(MARKDOWN_NNP)
11041d5
## AutoPilot Scheduling, New Design & Out of Beta Changelog covering platform versions `v0.6.59` through `v0.6.63` (May 7 – June 10, 2026). ### Featured sections - **AutoPilot major upgrades** — native scheduling (#13190), self-distilled skills registry (#13195), message queuing (#12841) - **New login & signup** — animated panel, aurora, integrations marquee (#13169) - **Subscriptions out of beta** — plans & payments fully live (#12935) - **Settings rebuilt + profile dropdown** — cleaner layout, integrations tab, quick-action menu (#13138, #12976) ### Improvements listed (not featured) - Trigger On Anything (#12740) - Export Chat as Markdown (#13070) - Auto-open artifact panel (#12997) - Slack block (#13008) - Cost breakdown in briefing panel (#13129) - Session sidebar pagination (#13128) - Faster first response in AutoPilot (#12828) ### Files changed - `docs/platform/changelog/may-7-june-10-2026.md` — new changelog page - `docs/platform/.gitbook/assets/` — 5 new hero images - `docs/platform/SUMMARY.md` — new entry at top - `docs/platform/changelog/README.md` — new row at top of table
Slack was missing from AutoGPT's block library despite being one of the most widely used tools for team notifications and workflow automation. Without it, sending Slack messages required a raw HTTP block with a manually constructed payload and no credential integration or UI discoverability.
This PR adds a
SendSlackMessageBlockthat posts messages to any Slack channel, DM, or thread via the Slack Web API. It follows the same structure as the existing Telegram and Discord integrations.Slack uses a static Bot Token rather than an OAuth flow, so the block uses
APIKeyCredentialswith no redirect handling. The HTTP call is wrapped in a private_post_messagemethod so the block test harness can mock the network call without patching an import path. The block outputsts, Slack's unique message timestamp, which can be passed intothread_tson a subsequent block to chain replies in a thread.Added 🏗️
backend/integrations/providers.py— AddedSLACK = "slack"to theProviderNameenum, which is required foris_block_auth_configured()to recognize Slack and enable the block in the UI.backend/blocks/slack/_auth.py— DefinesSlackCredentialsasAPIKeyCredentials. ExportsSlackCredentialsFieldwith bot token setup instructions, andTEST_CREDENTIALSwithTEST_CREDENTIALS_INPUTfor the block test harness.backend/blocks/slack/_api.py— HTTP layer for the Slack Web API.call_slack_apiposts tohttps://slack.com/api/{method}with a Bearer token and raisesSlackAPIExceptiononok: false.post_messagebuilds thechat.postMessagepayload and returns a typedSlackMessageResult.backend/blocks/slack/_config.py— Registers Slack viaProviderBuilderso it appears in the integrations settings UI with the correct description and supported auth type.backend/blocks/slack/blocks.py—SendSlackMessageBlockin category SOCIAL. Required inputs are the bot token, a channel ID or name, and the message text. Optional inputs includethread_tsfor thread replies,usernameandicon_emojiwhich require thechat:write.customizescope, andunfurl_linksandmrkdwn. Outputs aretsandchannel.docs/integrations/block-integrations/slack/blocks.md— Inputs and outputs tables generated from block introspection; the description, how-it-works, and use-case sections written by hand.frontend/public/integrations/slack.png— 512x512 logo asset for the integrations UI.Checklist 📋
For code changes:
load_all_blocks()SendSlackMessageBlockruns correctly with_post_messagemockedSLACKis recognized byis_block_auth_configured()ruffandblackpass on all files inbackend/blocks/slack/