Skip to content

feat(backend/copilot-bot): Telegram adapter — third platform on the chat bus - #13561

Merged
Bentlybro merged 15 commits into
devfrom
feat/copilot-bot-telegram
Jul 14, 2026
Merged

feat(backend/copilot-bot): Telegram adapter — third platform on the chat bus#13561
Bentlybro merged 15 commits into
devfrom
feat/copilot-bot-telegram

Conversation

@Bentlybro

@Bentlybro Bentlybro commented Jul 14, 2026

Copy link
Copy Markdown
Member

Why / What / How

Why: The whole point of the adapter architecture was that new chat platforms become drop-in folders. Telegram is the third platform and the first built entirely on the post-cleanup shared layer — it's both a feature and the proof the abstraction holds: zero changes to the core (handler, streaming, prompts, linking, threads all untouched).

What:

Transport (adapters/telegram/)

  • WebhookAdapter over the Bot API: one updates route on the main backend API, secret-token header verification (constant-time, via the shared read_verified_webhook_body), fire-and-forget dispatch inside Telegram's retry window.
  • Chat model: private chat = DM (auto-converse); groups engage only on @mention or reply-to-bot (natural Telegram UX for continuing) — the bot never subscribes itself to a human-owned group. Forum-topic placement rides in the encoded target (chat_id|thread_id).
  • Files: document/photo/video/audio/voice in via getFile (20MB Bot API cap); out via sendDocument, with images as inline photos (sendPhoto).
  • CommonMark → Telegram HTML with injection-safe escaping; code spans placeholder-stashed so markdown inside code is never rewritten.
  • No SDK dependency — a small pooled-httpx client covers the needed Bot API surface.

Commands & polish

  • /setup /help /unlink via the shared command_core (noun = "group") + /new (session reset, Discord parity).
  • Command menu self-registers via setMyCommands on startup — no manual BotFather step, can't drift from code.
  • 👀 reaction ack on the triggering message — instant pickup feedback ahead of the typing indicator.
  • Button URLs degrade gracefully: login_url → plain URL button → plain-text link (Telegram rejects e.g. localhost button URLs — found live, now covered).

Seamless linking (login_url)

  • Link buttons are Telegram login_url buttons: tapping attaches a signed identity to the opened URL. The /link page forwards it; the confirm routes verify the HMAC-SHA256 payload (keyed on SHA256(bot_token), 24h freshness) and require the link token to have been minted for that exact Telegram user — a forwarded/leaked link URL now fails instead of binding to whoever opened it.
  • Strictly additive for other platforms: the confirm body is optional; without telegram_auth the code path is identical to before (Discord/Slack unaffected).
  • Activation needs BotFather /setdomain per environment; until then the plain button fallback shows.

Surfaces & analytics

  • Bots settings card renders automatically from the registry, with a t.me/<bot>?startgroup=true add-to-group button when the username is configured.
  • Admin analytics parity: command_used events (group-scoped), and my_chat_member updates feed the server roster (added → recorded with title, kicked/left → marked gone). Platform filter + badge included.

Config (documented in .env.default + config.py): AUTOPILOT_BOT_TELEGRAM_TOKEN + AUTOPILOT_BOT_TELEGRAM_WEBHOOK_SECRET gate the adapter; AUTOPILOT_BOT_TELEGRAM_USERNAME powers the add-bot link. One-time per bot: BotFather /setprivacy → Disable (default privacy mode swallows group messages — found live), and setWebhook with allowed_updates=["message","my_chat_member"].

Stacked on #13553 — retarget to dev when it merges. Infra creds staged separately (mirrors the Slack #370 pattern).

Changes 🏗️

Commit-per-concern: adapter+tests → surfaces/README → polish pack → review fixes → seamless login → button fallback → privacy docs → analytics.

Checklist 📋

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • Backend: 550 tests across bot + platform_linking + architecture (45 telegram-specific: dispatch/verify/outbound/commands/login/analytics)
    • Frontend: link page 9/9 (incl. telegram_auth forwarding), admin bots 4/4; prettier/eslint/tsc clean
    • Live end-to-end against a real Telegram bot (webhook via public HTTPS): DM link flow → streamed chat ✅ · group /setup → link → @mention with 👀 ack + reply ✅ · reply-to-bot continuation ✅ · command menu auto-registration ✅ · localhost button fallback ✅ · privacy-mode + allowed_updates gotchas found live and documented ✅
    • Seamless login_url flow: coded + unit-tested; live validation on dev after /setdomain (needs a public frontend domain, impossible locally)

@Bentlybro
Bentlybro requested a review from a team as a code owner July 14, 2026 09:27
@Bentlybro
Bentlybro requested review from 0ubbe and ntindle and removed request for a team July 14, 2026 09:27
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)

Walkthrough

Adds Telegram as a Copilot platform with webhook handling, commands, Bot API messaging, login verification, platform-linking support, frontend integration, and database accessor wiring.

Changes

Telegram integration

Layer / File(s) Summary
Configuration and platform wiring
autogpt_platform/backend/.env.default, backend/util/settings.py, backend/copilot/bot/..., backend/api/features/platform_linking/..., frontend/src/app/(platform)/...
Adds Telegram credentials, adapter mounting, platform metadata, documentation, tests, and frontend platform options/layout updates.
Bot API and message formatting
backend/copilot/bot/adapters/telegram/api_client.py, targets.py, text.py, *_test.py
Adds Telegram API requests, file transfers, target encoding, and CommonMark-to-HTML conversion with tests.
Telegram command handling
backend/copilot/bot/adapters/telegram/commands.py, commands_test.py
Adds command parsing and handling for setup, help, unlink, and conversation reset flows.
Webhook and inbound message processing
backend/copilot/bot/adapters/telegram/adapter.py, adapter_test.py
Adds webhook authentication, asynchronous update dispatch, engagement filtering, membership tracking, contexts, and attachments.
Outbound Telegram delivery
backend/copilot/bot/adapters/telegram/adapter.py, adapter_test.py
Adds topic-aware messages, replies, links, files, typing actions, proactive posts, and mention rendering.
Telegram login verification and linking
backend/copilot/bot/adapters/telegram/login.py, backend/api/features/platform_linking/*, frontend/src/app/(no-navbar)/link/[token]/*, frontend/src/app/api/openapi.json
Verifies Telegram login payloads, binds identities during link confirmation, forwards frontend auth data, and updates the API contract.

Organization lookup wiring

Layer / File(s) Summary
Database accessor and chat lookup
backend/data/*, backend/platform_linking/chat*
Adds the organizations database accessor and RPC exposure, and routes default team lookup through that accessor.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: documentation

Suggested reviewers: ntindle, majdyz, 0ubbe, abhi1992002

Poem

I’m a rabbit with Telegram code,
Hopping updates down the webhook road.
Commands bloom, links verify bright,
Topics and mentions render right.
Nibble, test, and ship tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding Telegram as a third chat-platform adapter.
Description check ✅ Passed The description is clearly about the Telegram adapter, linking, commands, and related backend/frontend updates in this PR.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/copilot-bot-telegram

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py (1)

17-27: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Prevent nested formatting tags in code blocks and escape HTML quotes.

Applying regex replacements sequentially allows markdown inside code blocks to be inadvertently transformed into HTML tags (e.g., <b> inside <pre>). This violates Telegram's strict HTML nesting rules (which forbid formatting tags inside code blocks) and will cause the API to reject the message with an HTTP 400 Bad Request.

Additionally, quote=False leaves double quotes unescaped. If a URL naturally contains quotes, it will break the <a href="..."> attribute boundary, which also causes Telegram to reject the message.

Use the default quote=True and protect code blocks by temporarily substituting them with placeholders during the inline regex passes.

🐛 Proposed fix to protect code blocks and escape quotes
-def to_html(text: str) -> str:
-    """Render CommonMark code blocks, inline code, bold, and links as
-    Telegram HTML. Everything else is escaped so user/model output can't
-    inject tags."""
-    escaped = html.escape(text, quote=False)
-    escaped = _CODE_BLOCK_RE.sub(lambda m: f"<pre>{m.group(1).strip()}</pre>", escaped)
-    escaped = _INLINE_CODE_RE.sub(r"<code>\1</code>", escaped)
-    escaped = _BOLD_RE.sub(r"<b>\1</b>", escaped)
-    escaped = _LINK_RE.sub(r'<a href="\2">\1</a>', escaped)
-    return escaped
+def to_html(text: str) -> str:
+    """Render CommonMark code blocks, inline code, bold, and links as
+    Telegram HTML. Everything else is escaped so user/model output can't
+    inject tags."""
+    escaped = html.escape(text)  # quote=True by default to protect href boundaries
+    
+    placeholders = {}
+    
+    def stash(match: re.Match, tag: str) -> str:
+        key = f"__CODE_{len(placeholders)}__"
+        content = match.group(1).strip() if tag == "pre" else match.group(1)
+        placeholders[key] = f"<{tag}>{content}</{tag}>"
+        return key
+
+    escaped = _CODE_BLOCK_RE.sub(lambda m: stash(m, "pre"), escaped)
+    escaped = _INLINE_CODE_RE.sub(lambda m: stash(m, "code"), escaped)
+    
+    escaped = _BOLD_RE.sub(r"<b>\1</b>", escaped)
+    escaped = _LINK_RE.sub(r'<a href="\2">\1</a>', escaped)
+    
+    for key, val in placeholders.items():
+        escaped = escaped.replace(key, val)
+        
+    return escaped
🤖 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/copilot/bot/adapters/telegram/text.py`
around lines 17 - 27, Update to_html so html.escape uses quote=True, and protect
code-block matches with temporary placeholders before applying _INLINE_CODE_RE,
_BOLD_RE, and _LINK_RE. Restore the rendered <pre> blocks after those inline
replacements so markdown inside code blocks remains unchanged and HTML
attributes remain safely escaped.
🧹 Nitpick comments (3)
autogpt_platform/backend/backend/api/features/platform_linking/registry.py (1)

88-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider stripping @ from the username to prevent malformed URLs.

Even though the environment variable description instructs users to provide the username without the @, it's a common mistake to include it. Defensively stripping it ensures the t.me link remains valid regardless of user error.

💡 Proposed fix
         add_bot_url=(
-            f"https://t.me/{username}?startgroup=true"
+            f"https://t.me/{username.lstrip('@')}?startgroup=true"
             if (enabled and username)
             else None
         ),
🤖 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/api/features/platform_linking/registry.py`
around lines 88 - 93, Normalize the username used by the add_bot_url
construction to remove a leading “@” before interpolating it into the Telegram
URL. Update the username handling near add_bot_url while preserving the existing
enabled-and-username guard and None behavior.
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py (1)

24-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case to verify that markdown formatting is ignored inside code blocks.

To prevent regressions of the HTML nesting logic, it is highly recommended to add a test case ensuring that formatting markers (like **) inside code blocks remain untouched.

🧪 Proposed test addition
 def test_plain_text_survives_unchanged():
     assert to_html("just words, no markup") == "just words, no markup"
+
+
+def test_formatting_ignored_inside_code_blocks():
+    # Verifies that nested tags (like <b> inside <pre>) are not incorrectly generated
+    assert to_html("```\n**bold** and [link](url)\n```") == "<pre>**bold** and [link](url)</pre>"
+    assert to_html("`**bold**`") == "<code>**bold**</code>"
🤖 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/copilot/bot/adapters/telegram/text_test.py`
around lines 24 - 26, Add a regression test alongside
test_plain_text_survives_unchanged that passes markdown markers inside both
fenced and inline code blocks to to_html, asserting the markers remain literal
and the expected pre/code wrappers are preserved.
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py (1)

28-30: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Reuse httpx.AsyncClient to benefit from connection pooling.

Creating a new httpx.AsyncClient in a context manager for every request discards the connection pool, forcing a new TCP and TLS handshake on every Telegram API call. Since bot adapters often dispatch many messages, reusing a single client instance will significantly improve throughput and reduce latency.

Consider instantiating self._client = httpx.AsyncClient(...) in __init__ and reusing it across requests (ensuring it is properly closed when the bot adapter is shut down, if applicable).

Also applies to: 54-57, 70-71

🤖 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/copilot/bot/adapters/telegram/api_client.py`
around lines 28 - 30, Update the Telegram API client initialization and request
flow to create one reusable httpx.AsyncClient with the existing timeout, then
have the request method reuse self._client instead of opening a context-managed
client per call. Ensure the shared client is closed during the adapter’s
existing shutdown or cleanup lifecycle, if one is available.
🤖 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/copilot/bot/adapters/telegram/adapter.py`:
- Around line 197-229: Update _extract_attachments to treat absent or invalid
file_size values as unknown rather than converting them to zero. Skip or reject
those attachments before adding them to inbound, including both _FILE_FIELDS
entries and selected photo resolutions, so collect_attachments cannot bypass
max_attachment_bytes.

---

Outside diff comments:
In `@autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py`:
- Around line 17-27: Update to_html so html.escape uses quote=True, and protect
code-block matches with temporary placeholders before applying _INLINE_CODE_RE,
_BOLD_RE, and _LINK_RE. Restore the rendered <pre> blocks after those inline
replacements so markdown inside code blocks remains unchanged and HTML
attributes remain safely escaped.

---

Nitpick comments:
In `@autogpt_platform/backend/backend/api/features/platform_linking/registry.py`:
- Around line 88-93: Normalize the username used by the add_bot_url construction
to remove a leading “@” before interpolating it into the Telegram URL. Update
the username handling near add_bot_url while preserving the existing
enabled-and-username guard and None behavior.

In
`@autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py`:
- Around line 28-30: Update the Telegram API client initialization and request
flow to create one reusable httpx.AsyncClient with the existing timeout, then
have the request method reuse self._client instead of opening a context-managed
client per call. Ensure the shared client is closed during the adapter’s
existing shutdown or cleanup lifecycle, if one is available.

In `@autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py`:
- Around line 24-26: Add a regression test alongside
test_plain_text_survives_unchanged that passes markdown markers inside both
fenced and inline code blocks to to_html, asserting the markers remain literal
and the expected pre/code wrappers are preserved.
🪄 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: 4fd215c7-b790-4796-a532-5ec01e5dffac

📥 Commits

Reviewing files that changed from the base of the PR and between b76a5ac and 8c22418.

📒 Files selected for processing (17)
  • autogpt_platform/backend/.env.default
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry_test.py
  • autogpt_platform/backend/backend/copilot/bot/README.md
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/__init__.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/config.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes.py
  • autogpt_platform/backend/backend/util/settings.py
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/__tests__/main.test.tsx
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/components/helpers.ts

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.36036% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.96%. Comparing base (fc8cc4f) to head (2d4689f).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #13561      +/-   ##
==========================================
+ Coverage   75.94%   75.96%   +0.02%     
==========================================
  Files        2672     2683      +11     
  Lines      202948   203820     +872     
  Branches    19562    19616      +54     
==========================================
+ Hits       154120   154836     +716     
- Misses      44589    44666      +77     
- Partials     4239     4318      +79     
Flag Coverage Δ
platform-backend 82.78% <85.21%> (+0.01%) ⬆️
platform-frontend 45.96% <100.00%> (+0.07%) ⬆️
platform-frontend-e2e 30.96% <ø> (-0.64%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 82.78% <85.21%> (+0.01%) ⬆️
Platform Frontend 49.90% <100.00%> (-0.08%) ⬇️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py Outdated
Comment thread autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py`:
- Around line 157-167: Update the fallback text construction in the Telegram
command reply flow to HTML-escape both reply.button_label and reply.button_url
before appending them to params["text"], which is sent with HTML parse mode. Add
the required html import and preserve the existing fallback sendMessage
behavior.
🪄 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: 1d166137-2732-4034-892c-33510fffeac6

📥 Commits

Reviewing files that changed from the base of the PR and between 8c22418 and 1cc8c5b.

📒 Files selected for processing (23)
  • autogpt_platform/backend/.env.default
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/README.md
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/config.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
  • autogpt_platform/frontend/src/app/api/openapi.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • autogpt_platform/backend/backend/copilot/bot/README.md
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/config.py
  • autogpt_platform/backend/.env.default
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry_test.py
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: integration_test
  • GitHub Check: check API types
  • GitHub Check: Seer Code Review
  • GitHub Check: end-to-end tests
  • GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (19)
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: Use poetry run ... command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies like openpyxl
Use absolute imports with from 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 — avoid hasattr/getattr/isinstance for 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 %s for deferred interpolation in debug log statements for efficiency; use f-strings elsewhere for readability (e.g., logger.debug("Processing %s items", count) vs logger.info(f"Processing {count} items"))
Sanitize error paths by using os.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
Use transaction=True for Redis pipelines to ensure atomicity on multi-step operations
Use max(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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
autogpt_platform/{backend,autogpt_libs}/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Format frontend code using pnpm format

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/__generated__/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

autogpt_platform/frontend/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components/handlers
No any types unless the value genuinely can be anything
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from @/app/api/__generated__/endpoints/ following the pattern use{Method}{Version}{OperationName}, and regenerate with pnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local /components folder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not use useCallback or useMemo unless asked to optimise a given function

autogpt_platform/frontend/src/**/*.{ts,tsx}: Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Always import the -Icon-suffixed alias from @phosphor-icons/react (e.g. TrashIcon, PlusIcon, SquareIcon) — bare exports are deprecated
Do not use useCallback or useMemo unless asked to optimize a given function
Never use src/components/__legacy__/* — use design system components from src/components/

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Component props should use interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}: Use Vitest + RTL + MSW for integration tests as the primary testing approach (~90%, page-level), use Playwright for E2E critical flows, and use Storybook for design system components
Run frontend integration tests with pnpm test:unit (Vitest + RTL + MSW)

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/**/*.{tsx,jsx}: No dark: Tailwind classes — the design system handles dark mode
Use Next.js <Link> for internal navigation — never raw <a> tags
Use Tailwind CSS only for styling with design tokens and Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/app/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Write integration tests in __tests__/ next to page.tsx using Vitest + RTL + MSW for new pages/features

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Use Orval-generated MSW handlers from @/app/api/__generated__/endpoints/{tag}/{tag}.msw.ts for API mocking

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Avoid index and barrel files

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

No barrel files or index.ts re-exports in the frontend

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
autogpt_platform/frontend/src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not type hook returns, let Typescript infer as much as possible

autogpt_platform/frontend/src/**/*.ts: Extract component logic into custom hooks grouped by concern, not by component, with each hook in its own .ts file
Do not type hook returns; let TypeScript infer as much as possible

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
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.py naming 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
Use AsyncMock from unittest.mock for async functions in tests
When writing tests, use Test-Driven Development (TDD): write failing tests marked with @pytest.mark.xfail before implementation, then remove the marker once the implementation is complete
When creating snapshots in tests, use poetry run pytest path/to/test.py --snapshot-update; always review snapshot changes with git diff before committing

Files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
autogpt_platform/backend/backend/api/features/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Files:

  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
autogpt_platform/backend/**/api/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/AGENTS.md)

autogpt_platform/backend/**/api/**/*.py: Use Security() instead of Depends() for authentication dependencies to get proper OpenAPI security specification
Follow SSE (Server-Sent Events) protocol: use data: lines for frontend-parsed events (must match Zod schema) and : comment lines for heartbeats/status

Files:

  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
🧠 Learnings (27)
📚 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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-03-04T08:04:35.881Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12273
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:216-220
Timestamp: 2026-03-04T08:04:35.881Z
Learning: In the AutoGPT Copilot backend, ensure that SVG images are not treated as vision image types by excluding 'image/svg+xml' from INLINEABLE_MIME_TYPES and MULTIMODAL_TYPES in tool_adapter.py; the Claude API supports PNG, JPEG, GIF, and WebP for vision. SVGs (XML text) should be handled via the text path instead, not the vision path.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-04-01T04:17:41.600Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12632
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-01T04:17:41.600Z
Learning: When reviewing AutoGPT Copilot tool implementations, accept that `readOnlyHint=True` (provided via `ToolAnnotations`) may be applied unconditionally to *all* tools—even tools that have side effects (e.g., `bash_exec`, `write_workspace_file`, or other write/save operations). Do **not** flag these tools for having `readOnlyHint=True`; this is intentional to enable fully-parallel dispatch by the Anthropic SDK/CLI and has been E2E validated. Only flag `readOnlyHint` issues if they conflict with the established `ToolAnnotations` behavior (e.g., missing/incorrect propagation relative to the intended annotation mechanism).

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-06-06T12:22:37.648Z
Learnt from: anvyle
Repo: Significant-Gravitas/AutoGPT PR: 13302
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:579-583
Timestamp: 2026-06-06T12:22:37.648Z
Learning: When writing LLM-facing instruction strings that trigger tool calls in this AutoGPT codebase, use the exact registered tool name `view_agent_output` (as defined in `backend/copilot/tools/agent_output.py` via its `name` property and exported via `TOOL_REGISTRY`). Do not reference the bare name `agent_output`, since it is not a valid tool name and will cause tool invocation to fail.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-23T05:29:43.085Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13200
File: autogpt_platform/backend/backend/executor/scheduler.py:590-593
Timestamp: 2026-05-23T05:29:43.085Z
Learning: When reviewing Python code that uses Pydantic discriminated/tagged unions (e.g., `Annotated[Union[...], Field(discriminator="kind")]`), recognize that using `isinstance(x, SomeVariantInfo)` to narrow the union is an intentional and correct runtime guard and should also enable static type narrowing in tools like Pyright. Do not recommend replacing such `isinstance`-based narrowing with `cast(...)` when the check already proves the variant at runtime.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-07T18:48:14.242Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13040
File: autogpt_platform/backend/backend/blocks/llm.py:0-0
Timestamp: 2026-05-07T18:48:14.242Z
Learning: In this repository, isort may split imports from the same module into separate blocks when some imports are aliased (e.g., `from module import X as Y`) and others are not. Preserve the two-block layout when it results from isort (such as keeping `from openai.types.chat import ChatCompletion as OpenAIChatCompletion` separate from non-aliased imports from `openai.types.chat`). Do not treat that split as a style issue during review; merging them into a single block can fail CI with `Imports are incorrectly sorted and/or formatted`.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-26T14:24:34.866Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13217
File: autogpt_platform/backend/backend/api/features/search/service.py:137-137
Timestamp: 2026-05-26T14:24:34.866Z
Learning: In the Significant-Gravitas/AutoGPT backend, treat `user_id` (an opaque UUID used only for correlation/tracing) as non-PII. Do not flag direct logging of `user_id` in `logger.warning`/`logger.info` statements as a PII exposure issue, as the established convention is to log `user_id` for tracing while reserving PII for fields like email or display name.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-06-11T19:39:10.493Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 13337
File: autogpt_platform/backend/backend/copilot/graphiti/reranker.py:0-0
Timestamp: 2026-06-11T19:39:10.493Z
Learning: In the Significant-Gravitas/AutoGPT Python backend, when calling the OpenAI Python client `chat.completions.create`, construct the `messages` payload using the concrete typed-dict variants from `openai.types.chat` (e.g., `ChatCompletionSystemMessageParam`, `ChatCompletionUserMessageParam`, etc.) rather than trying to instantiate `ChatCompletionMessageParam` directly. `ChatCompletionMessageParam` is a `Union` alias and is not constructible, so `ChatCompletionMessageParam(role=..., content=...)` should fail type checking. Build each message element with the appropriate concrete typed dict and then annotate the resulting list as `list[ChatCompletionMessageParam]` (e.g., `messages: list[ChatCompletionMessageParam] = [ChatCompletionSystemMessageParam(...), ...]`).

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '`@/app/api/__generated__/`' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
📚 Learning: 2026-04-13T13:11:07.445Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:07.445Z
Learning: In `autogpt_platform/frontend`, do not flag direct interpolation of `executionID` UUID strings into URL query parameters (e.g., `activeItem=${executionID}` in JSX/Next links). If the value is a UUID string matching `[0-9a-f-]`, it contains no reserved URL characters, so additional `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Only treat it as an encoding issue if the query-param value is not guaranteed to be UUID-formatted (i.e., may include characters outside `[0-9a-f-]`).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-15T22:49:06.896Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/components/ExecutionsTable.tsx:0-0
Timestamp: 2026-04-15T22:49:06.896Z
Learning: In the AutoGPT frontend (React Query + toast/ErrorCard patterns), do not require `Sentry.captureException` in React Query mutation `catch` blocks. React Query handles error propagation for mutation paths, so follow the established pattern: show toast notifications for mutation errors and use `ErrorCard` for render/fetch errors. Only add `Sentry.captureException` for truly manual/unexpected exception paths that are outside React Query’s control (e.g., standalone async utilities or event handlers not wired through React Query).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-07-03T04:19:11.799Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13474
File: autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx:38-38
Timestamp: 2026-07-03T04:19:11.799Z
Learning: When reviewing Tailwind usage in .tsx components, allow intentional raw hex color values if they exactly match the design-spec and there is no equivalent Tailwind design token/utility class available (e.g., a utility like `bg-zinc-50` may be a different shade than the required `#f9f9f9`). Do not flag these as "design-token violations" as long as the reviewer can confirm that an appropriate Tailwind token does not exist or would not match the exact color.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-20T13:17:39.951Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12854
File: autogpt_platform/frontend/src/app/(platform)/library/__tests__/briefing.test.tsx:84-84
Timestamp: 2026-04-20T13:17:39.951Z
Learning: In the AutoGPT frontend, `testing-library/react` cleanup is already handled globally after each test via `src/tests/integrations/vitest.setup.tsx`. Therefore, for integration test files under `__tests__/`, do NOT add redundant `afterEach(() => cleanup())`. Only add local `afterEach` teardown for resources that are not covered globally—specifically, when using fake timers, add `afterEach(() => vi.useRealTimers())` (or equivalent) to restore real timers and prevent cross-test interference.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-20T20:07:22.981Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/__tests__/ExecutionsTable.test.tsx:27-76
Timestamp: 2026-04-20T20:07:22.981Z
Learning: In this codebase, Orval-generated API modules under `src/app/api/__generated__/` are not committed to git and must be generated via `pnpm generate:api` (requires a running backend). In integration tests, it’s acceptable—and expected—to stub generated hooks/modules by mocking them with `vi.mock("`@/app/api/__generated__/endpoints/`{tag}/{tag}")`. Do not treat `vi.mock` of these generated hook modules as a violation of the MSW handler guideline, since the corresponding MSW handlers cannot be imported at test time when generated files are absent.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-03-01T07:58:56.207Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:58:56.207Z
Learning: When a backend field represents sensitive data, use a secret type (e.g., Pydantic SecretStr with length constraints) so OpenAPI marks it as a password/writeOnly field. Apply this pattern to similar sensitive request fields across API schemas so generated TypeScript clients and docs treat them as secrets and do not mishandle sensitivity. Review all openapi.jsons where sensitive inputs are defined and replace plain strings with SecretStr-like semantics with appropriate minLength constraints.

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-04-14T06:39:49.111Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12773
File: autogpt_platform/frontend/src/app/api/openapi.json:12803-12806
Timestamp: 2026-04-14T06:39:49.111Z
Learning: In OpenAPI specs, ensure the schema/message length caps for the StreamChatRequest.message and QueuePendingMessageRequest.message fields are set to the intended values: StreamChatRequest.message maxLength must be 64000 and QueuePendingMessageRequest.message maxLength must be 32000. Keep QueuePendingMessageRequest.message consistent with PendingMessage.content, and ensure the pending (queue) ceiling never exceeds the stream ceiling because both ultimately feed the same LLM context window. Update any legacy smaller limits (e.g., 4000/16000) to these newer ceilings.

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
📚 Learning: 2026-03-07T07:43:09.871Z
Learnt from: kcze
Repo: Significant-Gravitas/AutoGPT PR: 12328
File: autogpt_platform/frontend/src/app/api/openapi.json:1116-1118
Timestamp: 2026-03-07T07:43:09.871Z
Learning: For autogpt_platform/frontend/src/app/api/openapi.json, preserve the existing behavior: HTTPBearerJWT is declared at the router level with Depends(auth.get_user_id) returning None for unauthenticated users; treat as optional auth. Do not change per-operation security descriptions unless you plan a repo-wide OpenAPI update. If you change this file, prefer clarifying operation descriptions rather than altering security requirements.

Applied to files:

  • autogpt_platform/frontend/src/app/api/openapi.json
🔇 Additional comments (18)
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py (1)

1-42: LGTM!

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py (1)

1-59: LGTM!

autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx (1)

182-225: LGTM!

autogpt_platform/frontend/src/app/api/openapi.json (1)

10051-10063: LGTM!

Also applies to: 10214-10226, 14810-14826

autogpt_platform/backend/backend/api/features/platform_linking/routes.py (1)

8-11: LGTM!

Also applies to: 42-61, 98-106, 123-131

autogpt_platform/backend/backend/platform_linking/db.py (1)

247-263: LGTM!

Also applies to: 276-276, 328-330, 341-341

autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py (1)

414-444: LGTM!

Also applies to: 446-472, 474-488, 491-504

autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts (1)

30-51: LGTM!

autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts (1)

14-14: LGTM!

Also applies to: 76-84

autogpt_platform/backend/backend/api/features/platform_linking/registry.py (1)

75-95: LGTM!

autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py (1)

11-56: LGTM!

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py (2)

22-102: LGTM on the pooled-client refactor and send_photo/_send_multipart extraction otherwise — connection pooling, _drop_none, and the shared multipart helper are clean.


103-110: 🔒 Security & Privacy

No token leak here. collect_attachments() catches download failures and logs a fixed message, so HTTPStatusError from download_file() does not reach a logger.

			> Likely an incorrect or invalid review comment.
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py (1)

1-499: LGTM! The membership tracking, engagement/mention rules, attachment size-gating fix (now backed by test_attachments_without_declared_size_are_skipped), and send_link/send_file fallback logic all check out against the accompanying tests.

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py (1)

155-319: LGTM!

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py (1)

11-19: LGTM!

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py (1)

28-35: LGTM!

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py (1)

80-112: LGTM!

@Bentlybro
Bentlybro force-pushed the feat/copilot-bot-telegram branch from 55838e5 to 0745641 Compare July 14, 2026 13:56
ntindle
ntindle previously approved these changes Jul 14, 2026
@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to 👍🏼 Mergeable in AutoGPT development kanban Jul 14, 2026
Base automatically changed from refactor/copilot-bot-cleanup to dev July 14, 2026 17:21
@Bentlybro
Bentlybro dismissed ntindle’s stale review July 14, 2026 17:21

The base branch was changed.

@github-actions github-actions Bot added the conflicts Automatically applied to PRs with merge conflicts label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Third platform on the chat bus, first to ride the post-cleanup shared
layer end to end: WebhookAdapter + read_verified_webhook_body (secret-token
header, constant-time), command_core for /setup + /unlink (noun=group),
base no-op defaults (only start_typing is implemented — Telegram has a
typing action but no named threads or ephemeral messages).

Chat model: private chat = DM (auto-converse); group/supergroup engages
only on @mention or reply-to-bot — the bot never subscribes itself to a
human-owned group. Forum-topic placement rides in the encoded target
(chat_id|thread_id). Files: document/photo/video/audio/voice in via getFile
(20MB bot cap), sendDocument out. Raw httpx Bot API client — the needed
surface is too small for an SDK dependency.

Registry gains TELEGRAM with a t.me ?startgroup add link when the bot
username is configured; webhook factory gates on token + webhook secret.
Telegram joins the admin platform filter (the badge and Bots settings card
derive automatically from PLATFORM_OPTIONS / the registry). The
unknown-platform fallback test fixture moves to MATRIX now that TELEGRAM is
a known platform. README documents the telegram adapter folder + env vars.
… photos, /new

Discord-parity + native-feel pack: a 👀 reaction acks the triggering message
instantly (ahead of the slower typing indicator); the command menu registers
itself via setMyCommands on startup so BotFather needs no manual step and
the menu can't drift from the code; image artifacts send as inline photos
(sendPhoto) instead of file documents; /new clears the target's session.
Webhook factory tests now pin telegram config so ambient env can't flip
them.
…uoting, pooled client

to_html now stashes code blocks/inline code behind placeholders while
bold/link rewriting runs, so markdown inside code (**kwargs, URLs in
comments) is never corrupted; quote=True keeps double-quoted URLs valid
inside href attributes. The t.me link strips a leading @ from the
configured username. TelegramClient holds one pooled httpx.AsyncClient for
the adapter's lifetime (mirrors Slack's AsyncWebClient) instead of a
client per call.
The bot's link buttons upgrade to Telegram login_url buttons (plain-URL
fallback when the domain isn't registered with @Botfather, so local/dev
keeps working). Telegram appends a signed identity to the opened URL; the
/link page forwards it and the confirm routes verify the HMAC-SHA256
payload (keyed on SHA256(bot_token), 24h freshness) and require the link
token to have been minted for that exact Telegram user — a forwarded or
leaked link URL now fails instead of binding to whoever opened it.

Strictly additive for other platforms: the confirm body is optional and
verification only engages when telegram_auth is present — Discord/Slack
confirms hit the identical pre-existing path (550 tests across bot +
platform_linking + architecture pass).
…ain-text links

Telegram validates inline-keyboard button URLs and refuses e.g. localhost
(the local-dev FRONTEND_BASE_URL), which killed the whole link prompt with
'Wrong HTTP URL'. When the button send fails, resend with the URL appended
as plain text — the flow now works in every environment; real deployments
with public HTTPS URLs keep the button.
Group privacy mode (BotFather default) silently swallows plain group
messages, so @mentions and reply-to-bot never reach the webhook — found
live: the bot appeared as 'has no access to messages'. /setprivacy Disable
plus re-adding the bot to existing groups fixes it.
Commands now emit command_used events (group-scoped like Discord), and
my_chat_member updates feed the admin server roster — bot added to a group
records the guild, kicked/left marks it gone. setWebhook docs gain
allowed_updates=[message, my_chat_member] since Telegram only delivers the
update types the webhook subscribes to.
NotAuthorizedError from the login-identity check now maps to 403 on both
confirm routes instead of an unhandled 500. Chat-id detection accepts any
integer (short early-account IDs are valid). The help text is CommonMark
like every other reply, killing the fragile 'is _HELP_TEXT' identity check.
Attachments without a declared file_size are skipped — the size cap is
enforced pre-fetch against the declared size, so an undeclared one can't
be admitted.
The fallback appends the label + URL to a message still sent with
parse_mode=HTML, so a bare & in the URL (query params) read as a malformed
entity and Telegram rejected the fallback as well. Escape the appended
text; two stale bot findings verified already-fixed (help text is
CommonMark, undeclared-size attachments are skipped).
Full-width stacked cards stop scaling past a couple of platforms — with
Telegram landing this page is already a wall. Cards now flow in a
responsive grid (single column on small screens, two at lg within the
1100px settings shell), items-start so short cards don't stretch to their
row neighbour.
The earlier commit removed the pre-rendered-HTML special case but the
matching help-text conversion silently never applied, so /help rendered
literal &lt;b&gt; entities. Converted for real, and the test now asserts
the rendered <b> tag and the absence of escaped entities so a substring
match can't hide this again.
…Manager

The orgs feature wired get_user_default_team into start_chat_turn as a
direct Prisma call, but PlatformLinkingManager deliberately holds no DB
connection — all its data access rides the DatabaseManager accessors
(which IS the centralized connection pool per its docstring). The direct
call therefore kills every bot chat turn on dev (Discord/Slack/any
platform) with ClientNotConnectedError.

Expose get_user_default_team on the DatabaseManager, add the orgs_db()
accessor following the established is_connected-or-RPC pattern, and call
it from chat.py — connected processes keep their direct path, the linking
manager gets the pooled one.
@github-actions github-actions Bot mentioned this pull request Jul 14, 2026
11 tasks
@Bentlybro
Bentlybro force-pushed the feat/copilot-bot-telegram branch from 0745641 to e73ffad Compare July 14, 2026 17:31
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions Bot removed the conflicts Automatically applied to PRs with merge conflicts label Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Overlap Detection

This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.

🔴 Merge Conflicts Detected

The following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.

🟡 Medium Risk — Some Line Overlap

These PRs have some overlapping changes:

🟢 Low Risk — File Overlap Only

These PRs touch the same files but different sections (click to expand)

Summary: 1 conflict(s), 1 medium risk, 8 low risk (out of 10 PRs with file overlap)


Auto-generated on push. Ignores: openapi.json, lock files.

Comment thread autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
autogpt_platform/backend/backend/data/db_accessors.py (1)

173-181: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep imports at module scope or document the cycle-safe exception.

This new accessor adds local imports that are not heavy optional dependencies, contrary to the backend import guideline. Move them to module scope if safe; otherwise document and verify that lazy loading is required to avoid an import cycle.

🤖 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/data/db_accessors.py` around lines 173 -
181, The orgs_db accessor introduces undocumented local imports for regular
backend dependencies. Move the orgs import and get_database_manager_async_client
import to module scope if this does not create a cycle; otherwise retain the
lazy imports and document the cycle-safe exception, verifying that deferred
loading is required.

Source: Coding guidelines

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py (3)

192-240: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

_build_context exceeds the ~40-line function guideline.

At ~49 lines, this mixes context assembly with the group-engagement decision (mention/reply detection + text cleanup, Lines 205-223). Consider extracting the engagement check into a named helper for readability.

♻️ Proposed refactor
+    async def _group_engagement(
+        self, chat: dict[str, Any], text: str
+    ) -> Optional[tuple[str, bool]]:
+        """Returns (cleaned_text, engaged) for a group message, or None if
+        the bot wasn't addressed."""
+        bot_id, bot_username = await self._bot_identity()
+        mentioned = bool(
+            bot_username
+            and re.search(rf"@{re.escape(bot_username)}\b", text, re.IGNORECASE)
+        )
+        reply_to = (chat.get("reply_to_message") or {}).get("from") or {}
+        replied_to_bot = bool(bot_id) and str(reply_to.get("id", "")) == bot_id
+        if not mentioned and not replied_to_bot:
+            return None
+        if bot_username:
+            text = re.sub(
+                rf"@{re.escape(bot_username)}\b", "", text, flags=re.IGNORECASE
+            ).strip()
+        return text, True

As per coding guidelines, "Keep functions under ~40 lines; extract named helpers when a function grows longer."

🤖 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/copilot/bot/adapters/telegram/adapter.py`
around lines 192 - 240, The _build_context method is too long because it
combines context assembly with group-engagement logic. Extract the non-private
mention/reply detection and bot-mention text cleanup into a named helper, then
call it from _build_context while preserving the existing early rejection and
cleaned-text behavior.

Source: Coding guidelines


329-377: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

send_link exceeds the ~40-line function guideline.

At ~49 lines with three distinct fallback attempts (login_url → URL button → plain text), extracting the URL-button and plain-text-fallback branches into a helper would improve readability without changing behavior.

As per coding guidelines, "Keep functions under ~40 lines; extract named helpers when a function grows longer."

🤖 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/copilot/bot/adapters/telegram/adapter.py`
around lines 329 - 377, The send_link method exceeds the function-length
guideline because it contains the login URL, plain URL button, and plain-text
fallback logic. Extract the URL-button attempt and plain-text fallback into a
focused helper, keeping send_link responsible for preparing params and
preserving the existing fallback order and behavior.

Source: Coding guidelines


67-482: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

File exceeds the ~300-line guideline (503 lines total).

TelegramAdapter combines webhook auth/dispatch, inbound context/attachment extraction, outbound rendering/sending, and proactive posting all in one file. Consider splitting by responsibility (e.g., inbound handling into a mixin/module, outbound sending into another) per the "-- Inbound --", "-- Outbound --", "-- Proactive output --" section markers already present, which is a natural split boundary.

As per coding guidelines, "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)."

🤖 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/copilot/bot/adapters/telegram/adapter.py`
around lines 67 - 482, Split TelegramAdapter’s responsibilities into focused
modules or mixins using the existing “Inbound,” “Outbound,” and “Proactive
output” boundaries: move webhook dispatch/context/attachment logic, outbound
message/file/rendering logic, and proactive channel-posting logic out of the
oversized adapter file. Preserve TelegramAdapter’s public interface and shared
state/helper behavior, including _bot_identity, while keeping each resulting
file near the ~300-line guideline.

Source: Coding guidelines

🤖 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/copilot/bot/adapters/telegram/adapter.py`:
- Around line 137-162: Wrap the full `_dispatch_update` processing flow,
including `commands.handle()`, context construction, reaction acknowledgement,
and the message callback, in a single try/except that calls `logger.exception`
immediately on failure. Preserve the existing early-return behavior and avoid
leaving exceptions from the fire-and-forget task unhandled.
- Around line 286-295: Update the mention anchor builder in _render to
HTML-escape the user-controlled name before interpolating it into the anchor
text. Preserve the existing URL, allowlist behavior, and resolve_mentions flow
while ensuring special characters in first_name cannot produce invalid or
unintended Telegram markup.

---

Nitpick comments:
In `@autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py`:
- Around line 192-240: The _build_context method is too long because it combines
context assembly with group-engagement logic. Extract the non-private
mention/reply detection and bot-mention text cleanup into a named helper, then
call it from _build_context while preserving the existing early rejection and
cleaned-text behavior.
- Around line 329-377: The send_link method exceeds the function-length
guideline because it contains the login URL, plain URL button, and plain-text
fallback logic. Extract the URL-button attempt and plain-text fallback into a
focused helper, keeping send_link responsible for preparing params and
preserving the existing fallback order and behavior.
- Around line 67-482: Split TelegramAdapter’s responsibilities into focused
modules or mixins using the existing “Inbound,” “Outbound,” and “Proactive
output” boundaries: move webhook dispatch/context/attachment logic, outbound
message/file/rendering logic, and proactive channel-posting logic out of the
oversized adapter file. Preserve TelegramAdapter’s public interface and shared
state/helper behavior, including _bot_identity, while keeping each resulting
file near the ~300-line guideline.

In `@autogpt_platform/backend/backend/data/db_accessors.py`:
- Around line 173-181: The orgs_db accessor introduces undocumented local
imports for regular backend dependencies. Move the orgs import and
get_database_manager_async_client import to module scope if this does not create
a cycle; otherwise retain the lazy imports and document the cycle-safe
exception, verifying that deferred loading is required.
🪄 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: 8c082097-5c3e-4d77-b899-47726889602c

📥 Commits

Reviewing files that changed from the base of the PR and between 3760546 and e73ffad.

📒 Files selected for processing (33)
  • autogpt_platform/backend/.env.default
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/copilot/bot/README.md
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/__init__.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/config.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/util/settings.py
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/__tests__/main.test.tsx
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/components/helpers.ts
  • autogpt_platform/frontend/src/app/(platform)/settings/bots/components/BotsList/BotsList.tsx
  • autogpt_platform/frontend/src/app/api/openapi.json
🚧 Files skipped from review as they are similar to previous changes (23)
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/targets.py
  • autogpt_platform/frontend/src/app/(platform)/settings/bots/components/BotsList/BotsList.tsx
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/components/helpers.ts
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/config.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login.py
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes.py
  • autogpt_platform/frontend/src/app/api/openapi.json
  • autogpt_platform/backend/backend/copilot/bot/README.md
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/helpers.ts
  • autogpt_platform/backend/backend/copilot/bot/webhook_routes_test.py
  • autogpt_platform/frontend/src/app/(platform)/admin/bots/tests/main.test.tsx
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/login_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/api_client.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry.py
  • autogpt_platform/backend/backend/platform_linking/db.py
  • autogpt_platform/backend/backend/api/features/platform_linking/registry_test.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter_test.py
  • autogpt_platform/backend/backend/util/settings.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/text_test.py
  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/commands_test.py
📜 Review details
⏰ Context from checks skipped due to timeout. (9)
  • GitHub Check: check API types
  • GitHub Check: integration_test
  • GitHub Check: Seer Code Review
  • GitHub Check: Analyze (python)
  • GitHub Check: Check PR Status
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: end-to-end tests
🧰 Additional context used
📓 Path-based instructions (21)
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: Use poetry run ... command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies like openpyxl
Use absolute imports with from 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 — avoid hasattr/getattr/isinstance for 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 %s for deferred interpolation in debug log statements for efficiency; use f-strings elsewhere for readability (e.g., logger.debug("Processing %s items", count) vs logger.info(f"Processing {count} items"))
Sanitize error paths by using os.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
Use transaction=True for Redis pipelines to ensure atomicity on multi-step operations
Use max(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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
autogpt_platform/backend/backend/data/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

All data access in backend requires user ID checks; verify this for any 'data/*.py' changes

Files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/data/db_manager.py
autogpt_platform/{backend,autogpt_libs}/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Format Python code with poetry run format

Files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
autogpt_platform/**/data/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

For changes touching data/*.py, validate user ID checks or explain why not needed

Files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/data/db_manager.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.py naming 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
Use AsyncMock from unittest.mock for async functions in tests
When writing tests, use Test-Driven Development (TDD): write failing tests marked with @pytest.mark.xfail before implementation, then remove the marker once the implementation is complete
When creating snapshots in tests, use poetry run pytest path/to/test.py --snapshot-update; always review snapshot changes with git diff before committing

Files:

  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
autogpt_platform/backend/.env*

📄 CodeRabbit inference engine (autogpt_platform/AGENTS.md)

Backend environment configuration: backend/.env.default provides defaults (tracked in git), backend/.env provides user overrides (gitignored)

Files:

  • autogpt_platform/backend/.env.default
autogpt_platform/**/.env*

📄 CodeRabbit inference engine (autogpt_platform/AGENTS.md)

Platform environment configuration: .env.default provides Supabase/shared defaults (tracked in git), .env provides user overrides (gitignored)

Files:

  • autogpt_platform/backend/.env.default
autogpt_platform/backend/backend/api/features/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Update routes in '/backend/backend/api/features/' and add/update Pydantic models in the same directory for API development

Files:

  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
autogpt_platform/backend/**/api/**/*.py

📄 CodeRabbit inference engine (autogpt_platform/backend/AGENTS.md)

autogpt_platform/backend/**/api/**/*.py: Use Security() instead of Depends() for authentication dependencies to get proper OpenAPI security specification
Follow SSE (Server-Sent Events) protocol: use data: lines for frontend-parsed events (must match Zod schema) and : comment lines for heartbeats/status

Files:

  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Format frontend code using pnpm format

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/__generated__/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

autogpt_platform/frontend/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components/handlers
No any types unless the value genuinely can be anything
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from @/app/api/__generated__/endpoints/ following the pattern use{Method}{Version}{OperationName}, and regenerate with pnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local /components folder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not use useCallback or useMemo unless asked to optimise a given function

autogpt_platform/frontend/src/**/*.{ts,tsx}: Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Always import the -Icon-suffixed alias from @phosphor-icons/react (e.g. TrashIcon, PlusIcon, SquareIcon) — bare exports are deprecated
Do not use useCallback or useMemo unless asked to optimize a given function
Never use src/components/__legacy__/* — use design system components from src/components/

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Component props should use interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}: Use Vitest + RTL + MSW for integration tests as the primary testing approach (~90%, page-level), use Playwright for E2E critical flows, and use Storybook for design system components
Run frontend integration tests with pnpm test:unit (Vitest + RTL + MSW)

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/**/*.{tsx,jsx}: No dark: Tailwind classes — the design system handles dark mode
Use Next.js <Link> for internal navigation — never raw <a> tags
Use Tailwind CSS only for styling with design tokens and Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/app/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Write integration tests in __tests__/ next to page.tsx using Vitest + RTL + MSW for new pages/features

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Use Orval-generated MSW handlers from @/app/api/__generated__/endpoints/{tag}/{tag}.msw.ts for API mocking

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Avoid index and barrel files

Files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
🧠 Learnings (26)
📚 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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-23T05:29:43.085Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13200
File: autogpt_platform/backend/backend/executor/scheduler.py:590-593
Timestamp: 2026-05-23T05:29:43.085Z
Learning: When reviewing Python code that uses Pydantic discriminated/tagged unions (e.g., `Annotated[Union[...], Field(discriminator="kind")]`), recognize that using `isinstance(x, SomeVariantInfo)` to narrow the union is an intentional and correct runtime guard and should also enable static type narrowing in tools like Pyright. Do not recommend replacing such `isinstance`-based narrowing with `cast(...)` when the check already proves the variant at runtime.

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-04-21T04:35:34.710Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12865
File: autogpt_platform/backend/backend/data/credit.py:1584-1584
Timestamp: 2026-04-21T04:35:34.710Z
Learning: When reviewing this codebase, don’t flag snake_case attribute names (e.g., `subscription_tier`, `stripe_customer_id`, `top_up_config`) on the app-layer Pydantic `User` model as “wrong” field names. These are correct for the app-layer model and are expected to be mapped from the Prisma-layer camelCase fields (e.g., `subscriptionTier`, `stripeCustomerId`) inside methods like `User.from_db()`. Only Prisma-returned/raw objects would use camelCase, but functions like `get_user_by_id(user_id: str)` are expected to return the Pydantic app-layer model.

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/data/db_manager.py
📚 Learning: 2026-05-07T15:32:39.703Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13033
File: autogpt_platform/backend/backend/data/generate_data.py:111-117
Timestamp: 2026-05-07T15:32:39.703Z
Learning: When reviewing the Python data-generation layer, do not treat missing `user_id`/user filtering in calls to graph-metadata resolvers as a security issue if the `graph_id` inputs are already guaranteed to be user-scoped by earlier upstream SQL (e.g., `WHERE "userId" = ...`). In particular, `_resolve_agent_name(graph_id)` in `generate_data.py` correctly calls `get_graph_metadata(graph_id=graph_id)` without a `user_id` parameter by design, because name resolution must also work for user-executed shared/marketplace agents that the user may not own.

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/data/db_manager.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.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/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-07T18:48:14.242Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 13040
File: autogpt_platform/backend/backend/blocks/llm.py:0-0
Timestamp: 2026-05-07T18:48:14.242Z
Learning: In this repository, isort may split imports from the same module into separate blocks when some imports are aliased (e.g., `from module import X as Y`) and others are not. Preserve the two-block layout when it results from isort (such as keeping `from openai.types.chat import ChatCompletion as OpenAIChatCompletion` separate from non-aliased imports from `openai.types.chat`). Do not treat that split as a style issue during review; merging them into a single block can fail CI with `Imports are incorrectly sorted and/or formatted`.

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-05-26T14:24:34.866Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13217
File: autogpt_platform/backend/backend/api/features/search/service.py:137-137
Timestamp: 2026-05-26T14:24:34.866Z
Learning: In the Significant-Gravitas/AutoGPT backend, treat `user_id` (an opaque UUID used only for correlation/tracing) as non-PII. Do not flag direct logging of `user_id` in `logger.warning`/`logger.info` statements as a PII exposure issue, as the established convention is to log `user_id` for tracing while reserving PII for fields like email or display name.

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-06-11T19:39:10.493Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 13337
File: autogpt_platform/backend/backend/copilot/graphiti/reranker.py:0-0
Timestamp: 2026-06-11T19:39:10.493Z
Learning: In the Significant-Gravitas/AutoGPT Python backend, when calling the OpenAI Python client `chat.completions.create`, construct the `messages` payload using the concrete typed-dict variants from `openai.types.chat` (e.g., `ChatCompletionSystemMessageParam`, `ChatCompletionUserMessageParam`, etc.) rather than trying to instantiate `ChatCompletionMessageParam` directly. `ChatCompletionMessageParam` is a `Union` alias and is not constructible, so `ChatCompletionMessageParam(role=..., content=...)` should fail type checking. Build each message element with the appropriate concrete typed dict and then annotate the resulting list as `list[ChatCompletionMessageParam]` (e.g., `messages: list[ChatCompletionMessageParam] = [ChatCompletionSystemMessageParam(...), ...]`).

Applied to files:

  • autogpt_platform/backend/backend/data/db_accessors.py
  • autogpt_platform/backend/backend/platform_linking/chat_test.py
  • autogpt_platform/backend/backend/data/db_manager.py
  • autogpt_platform/backend/backend/platform_linking/chat.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py
  • autogpt_platform/backend/backend/api/features/platform_linking/routes.py
  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-02-27T10:45:49.499Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/helpers.tsx:23-24
Timestamp: 2026-02-27T10:45:49.499Z
Learning: Prefer using generated OpenAPI types from '`@/app/api/__generated__/`' for payloads defined in openapi.json (e.g., MCPToolsDiscoveredResponse, MCPToolOutputResponse). Use inline TypeScript interfaces only for payloads that are SSE-stream-only and not exposed via OpenAPI. Apply this pattern to frontend tool components (e.g., RunMCPTool) and related areas where similar SSE/openapi-discrepancies occur; avoid re-implementing types when a generated type is available.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-13T13:11:07.445Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:07.445Z
Learning: In `autogpt_platform/frontend`, do not flag direct interpolation of `executionID` UUID strings into URL query parameters (e.g., `activeItem=${executionID}` in JSX/Next links). If the value is a UUID string matching `[0-9a-f-]`, it contains no reserved URL characters, so additional `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Only treat it as an encoding issue if the query-param value is not guaranteed to be UUID-formatted (i.e., may include characters outside `[0-9a-f-]`).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-15T22:49:06.896Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/components/ExecutionsTable.tsx:0-0
Timestamp: 2026-04-15T22:49:06.896Z
Learning: In the AutoGPT frontend (React Query + toast/ErrorCard patterns), do not require `Sentry.captureException` in React Query mutation `catch` blocks. React Query handles error propagation for mutation paths, so follow the established pattern: show toast notifications for mutation errors and use `ErrorCard` for render/fetch errors. Only add `Sentry.captureException` for truly manual/unexpected exception paths that are outside React Query’s control (e.g., standalone async utilities or event handlers not wired through React Query).

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-07-03T04:19:11.799Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13474
File: autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx:38-38
Timestamp: 2026-07-03T04:19:11.799Z
Learning: When reviewing Tailwind usage in .tsx components, allow intentional raw hex color values if they exactly match the design-spec and there is no equivalent Tailwind design token/utility class available (e.g., a utility like `bg-zinc-50` may be a different shade than the required `#f9f9f9`). Do not flag these as "design-token violations" as long as the reviewer can confirm that an appropriate Tailwind token does not exist or would not match the exact color.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-20T13:17:39.951Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12854
File: autogpt_platform/frontend/src/app/(platform)/library/__tests__/briefing.test.tsx:84-84
Timestamp: 2026-04-20T13:17:39.951Z
Learning: In the AutoGPT frontend, `testing-library/react` cleanup is already handled globally after each test via `src/tests/integrations/vitest.setup.tsx`. Therefore, for integration test files under `__tests__/`, do NOT add redundant `afterEach(() => cleanup())`. Only add local `afterEach` teardown for resources that are not covered globally—specifically, when using fake timers, add `afterEach(() => vi.useRealTimers())` (or equivalent) to restore real timers and prevent cross-test interference.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-04-20T20:07:22.981Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/__tests__/ExecutionsTable.test.tsx:27-76
Timestamp: 2026-04-20T20:07:22.981Z
Learning: In this codebase, Orval-generated API modules under `src/app/api/__generated__/` are not committed to git and must be generated via `pnpm generate:api` (requires a running backend). In integration tests, it’s acceptable—and expected—to stub generated hooks/modules by mocking them with `vi.mock("`@/app/api/__generated__/endpoints/`{tag}/{tag}")`. Do not treat `vi.mock` of these generated hook modules as a violation of the MSW handler guideline, since the corresponding MSW handlers cannot be imported at test time when generated files are absent.

Applied to files:

  • autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
📚 Learning: 2026-03-04T08:04:35.881Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12273
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:216-220
Timestamp: 2026-03-04T08:04:35.881Z
Learning: In the AutoGPT Copilot backend, ensure that SVG images are not treated as vision image types by excluding 'image/svg+xml' from INLINEABLE_MIME_TYPES and MULTIMODAL_TYPES in tool_adapter.py; the Claude API supports PNG, JPEG, GIF, and WebP for vision. SVGs (XML text) should be handled via the text path instead, not the vision path.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-04-01T04:17:41.600Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12632
File: autogpt_platform/backend/backend/copilot/tools/workspace_files.py:0-0
Timestamp: 2026-04-01T04:17:41.600Z
Learning: When reviewing AutoGPT Copilot tool implementations, accept that `readOnlyHint=True` (provided via `ToolAnnotations`) may be applied unconditionally to *all* tools—even tools that have side effects (e.g., `bash_exec`, `write_workspace_file`, or other write/save operations). Do **not** flag these tools for having `readOnlyHint=True`; this is intentional to enable fully-parallel dispatch by the Anthropic SDK/CLI and has been E2E validated. Only flag `readOnlyHint` issues if they conflict with the established `ToolAnnotations` behavior (e.g., missing/incorrect propagation relative to the intended annotation mechanism).

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
📚 Learning: 2026-06-06T12:22:37.648Z
Learnt from: anvyle
Repo: Significant-Gravitas/AutoGPT PR: 13302
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:579-583
Timestamp: 2026-06-06T12:22:37.648Z
Learning: When writing LLM-facing instruction strings that trigger tool calls in this AutoGPT codebase, use the exact registered tool name `view_agent_output` (as defined in `backend/copilot/tools/agent_output.py` via its `name` property and exported via `TOOL_REGISTRY`). Do not reference the bare name `agent_output`, since it is not a valid tool name and will cause tool invocation to fail.

Applied to files:

  • autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py
🪛 ast-grep (0.44.1)
autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py

[warning] 210-210: Regex pattern passed to re is built from a non-literal (variable, call, concatenation, or f-string) value. If that value is attacker-controlled it can introduce a malicious pattern with catastrophic backtracking (ReDoS). Use a hardcoded literal pattern, or validate/escape untrusted input with re.escape() and bound the regex complexity before compiling.
Context: re.search(rf"@{re.escape(bot_username)}\b", text, re.IGNORECASE)
Note: [CWE-1333] Inefficient Regular Expression Complexity.

(redos-non-literal-regex-python)


[warning] 219-221: Regex pattern passed to re is built from a non-literal (variable, call, concatenation, or f-string) value. If that value is attacker-controlled it can introduce a malicious pattern with catastrophic backtracking (ReDoS). Use a hardcoded literal pattern, or validate/escape untrusted input with re.escape() and bound the regex complexity before compiling.
Context: re.sub(
rf"@{re.escape(bot_username)}\b", "", text, flags=re.IGNORECASE
)
Note: [CWE-1333] Inefficient Regular Expression Complexity.

(redos-non-literal-regex-python)

🔇 Additional comments (9)
autogpt_platform/backend/backend/data/db_manager.py (1)

33-33: LGTM!

Also applies to: 436-437, 712-712

autogpt_platform/backend/backend/platform_linking/chat.py (1)

25-25: LGTM!

Also applies to: 244-244, 353-353

autogpt_platform/backend/backend/platform_linking/chat_test.py (1)

38-40: LGTM!

Also applies to: 446-449

autogpt_platform/backend/.env.default (1)

238-244: LGTM!

autogpt_platform/backend/backend/api/features/platform_linking/routes.py (1)

8-11: LGTM!

Also applies to: 42-61, 98-106, 123-131

autogpt_platform/backend/backend/api/features/platform_linking/routes_test.py (1)

414-444: LGTM!

Also applies to: 446-472, 474-488, 491-504

autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx (1)

149-162: LGTM!

Also applies to: 164-181, 182-226, 272-272

autogpt_platform/backend/backend/copilot/bot/adapters/telegram/adapter.py (2)

242-282: LGTM! Missing/zero file_size is now treated as unknown and skipped (Lines 250-255, 265) rather than defaulting to 0 and bypassing max_attachment_bytes, addressing the earlier finding on this method.


15-46: LGTM!

Also applies to: 50-64, 111-135, 164-190, 297-328, 379-419, 422-466, 470-503

@Bentlybro
Bentlybro added this pull request to the merge queue Jul 14, 2026
Merged via the queue into dev with commit 963a6fd Jul 14, 2026
45 checks passed
@Bentlybro
Bentlybro deleted the feat/copilot-bot-telegram branch July 14, 2026 19:26
@github-project-automation github-project-automation Bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Jul 14, 2026
@github-project-automation github-project-automation Bot moved this to Done in Frontend Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end size/xl

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants