feat(backend/copilot): inline picker-backed inputs via run_block + accept AgentInputBlock subclasses - #12880
Conversation
…tInputBlock subclasses Resolves #12875. CoPilot's agent-builder was hardcoding Google Drive file IDs into consuming blocks' constantInput instead of wiring AgentGoogleDriveFileInputBlock. The resulting agents either failed schema validation or failed at execution because no _credentials_id was attached. Platform-side fixes: - validate_io_blocks now accepts any block with uiType "Input"/"Output" as satisfying the required-IO check, so specialized subclasses like AgentGoogleDriveFileInputBlock, AgentDropdownInputBlock, etc. count on their own. Previously only the literal base-class IDs passed, forcing CoPilot to keep a throwaway AgentInputBlock alongside real inputs. - New validate_google_drive_file_inputs rule flags hardcoded values on fields backed by GoogleDriveFileField (detected via format "google-drive-picker" or the auto_credentials marker). The error points users to AgentGoogleDriveFileInputBlock with the correct block_id and explains the _credentials_id requirement. Prompt-tuning in agent_generation_guide.md: - Documents specialized input subclasses as satisfying the IO requirement. - New section "REQUIRED: AgentGoogleDriveFileInputBlock for Google Drive files" teaches the correct pattern: target shape, allowed_views mapping (SPREADSHEETS/DOCUMENTS/PRESENTATIONS), detection rules, and a worked example for a Sheets-summarizing agent. Tests: subclass-input acceptance, subclass-output acceptance, and seven cases covering the Drive anti-pattern validator (hardcoded object, bare string, linked field, linked-wins-over-default, null default, non-Drive fields, and the producer's own value exempted).
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughDocs add mandatory Google Drive picker input patterns and wiring; validator changes detect IO blocks by registry Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. 🔴 Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
🟢 Low Risk — File Overlap OnlyThese PRs touch the same files but different sections (click to expand)
Summary: 6 conflict(s), 0 medium risk, 10 low risk (out of 16 PRs with file overlap) Auto-generated on push. Ignores: |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py (1)
592-610: Split Drive-field detection coverage by schema cue.
_drive_sheets_block()always sets bothformat == "google-drive-picker"andauto_credentials.provider == "google", so the tests don’t prove the validator handles each documented detection path independently. Add one case for format-only and one for auto-credentials-only.🧪 Suggested test shape
+ def test_format_only_drive_field_fails(self): + v = AgentValidator() + sheets = _drive_sheets_block() + spreadsheet_schema = sheets["inputSchema"]["properties"]["spreadsheet"] + spreadsheet_schema.pop("auto_credentials") + node = _make_node( + block_id=sheets["id"], + input_default={"spreadsheet": {"id": "1abc"}}, + ) + + assert v.validate_google_drive_file_inputs(_make_agent(nodes=[node]), [sheets]) is False + + def test_auto_credentials_only_drive_field_fails(self): + v = AgentValidator() + sheets = _drive_sheets_block() + spreadsheet_schema = sheets["inputSchema"]["properties"]["spreadsheet"] + spreadsheet_schema.pop("format") + node = _make_node( + block_id=sheets["id"], + input_default={"spreadsheet": {"id": "1abc"}}, + ) + + assert v.validate_google_drive_file_inputs(_make_agent(nodes=[node]), [sheets]) is False🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py` around lines 592 - 610, The test helper _drive_sheets_block currently sets both format="google-drive-picker" and auto_credentials.provider="google", so update tests in validator_test to cover the two independent detection paths: add one block variant that only includes the input_schema property "spreadsheet" with format "google-drive-picker" (remove auto_credentials) and another variant that only includes "spreadsheet" with auto_credentials.provider="google" (remove format), then add assertions that the validator recognizes Drive integration for each variant; use the existing helper name _drive_sheets_block to create the base and create two modified copies for format-only and auto-credentials-only test cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md`:
- Around line 173-178: The fenced ASCII-art block containing
AgentGoogleDriveFileInputBlock → GoogleSheetsReadBlock / GoogleDocsReadBlock /
GoogleSheetsUpdateCellBlock / GoogleSlidesReadBlock should include a language
identifier so markdownlint treats it as code; update the fence that wraps the
block to use an explicit language (for example ```text) around the block showing
[AgentGoogleDriveFileInputBlock] and the related [GoogleSheetsReadBlock],
[GoogleDocsReadBlock], [GoogleSheetsUpdateCellBlock], [GoogleSlidesReadBlock]
entries.
In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py`:
- Around line 778-816: The code currently treats any inbound link (linked_sinks)
as sufficient to skip Drive-file validation and only checks top-level
input_default keys, which lets non-picker links and nested defaults bypass
checks; update the link-collection and validation logic so linked_sinks records
the source block type and sink name (e.g., store tuples or map sink_id -> set of
(sink_name, source_block_type) using link.get("source_block_id") to lookup
block_lookup[...] .get("type")), then in the node loop only skip validation when
a linked sink is both sink_name == "result" and the source block type is
"AgentGoogleDriveFileInputBlock" (reference linked_sinks and block_lookup), and
when checking input_default treat nested keys as matches too (consider keys
equal to field_name or starting with f"{field_name}_" or descend into nested
dicts to find field_name) so values like "spreadsheet_#_id" or nested defaults
are validated.
---
Nitpick comments:
In
`@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py`:
- Around line 592-610: The test helper _drive_sheets_block currently sets both
format="google-drive-picker" and auto_credentials.provider="google", so update
tests in validator_test to cover the two independent detection paths: add one
block variant that only includes the input_schema property "spreadsheet" with
format "google-drive-picker" (remove auto_credentials) and another variant that
only includes "spreadsheet" with auto_credentials.provider="google" (remove
format), then add assertions that the validator recognizes Drive integration for
each variant; use the existing helper name _drive_sheets_block to create the
base and create two modified copies for format-only and auto-credentials-only
test cases.
🪄 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: ba937616-4823-4f88-982f-d8f66bd30dcc
📒 Files selected for processing (3)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: check API types
- GitHub Check: Seer Code Review
- GitHub Check: type-check (3.11)
- GitHub Check: test (3.12)
- GitHub Check: test (3.13)
- GitHub Check: test (3.11)
- GitHub Check: end-to-end tests
- GitHub Check: Check PR Status
- GitHub Check: Analyze (typescript)
- GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (4)
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
autogpt_platform/backend/**/*_test.py
📄 CodeRabbit inference engine (autogpt_platform/backend/AGENTS.md)
autogpt_platform/backend/**/*_test.py: Use pytest with snapshot testing for API responses
Colocate test files with source files using*_test.pynaming convention
Mock at boundaries — mock where the symbol is used, not where it's defined; after refactoring, update mock targets to match new module paths
UseAsyncMockfromunittest.mockfor async functions in tests
When writing tests, use Test-Driven Development (TDD): write failing tests marked with@pytest.mark.xfailbefore implementation, then remove the marker once the implementation is complete
When creating snapshots in tests, usepoetry run pytest path/to/test.py --snapshot-update; always review snapshot changes withgit diffbefore committing
Files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py
autogpt_platform/backend/**/*.md
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Document agent responsibilities and interfaces in markdown files
Files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12879
File: autogpt_platform/backend/backend/copilot/baseline/service.py:0-0
Timestamp: 2026-04-22T05:57:34.861Z
Learning: In `autogpt_platform/backend/backend/copilot/baseline/service.py`, the approved pattern for `_run_task_subagent` (PR `#12879`, commit 187f0a5) uses a nested `try/except Exception` inside an outer `try/finally`. The outer `finally` block resets `_TASK_DEPTH_VAR` (via `_TASK_DEPTH_VAR.reset(token)`) AND calls `_absorb_inner_usage(parent_state, inner_state)` unconditionally, so both the depth ContextVar and usage roll-up are guaranteed on all exit paths including `CancelledError`/`KeyboardInterrupt`/`SystemExit`. The inner `except Exception` catches and converts failures into a `TaskResponse` error payload that is returned as `StreamToolOutputAvailable`. Do NOT flag missing ContextVar reset or usage roll-up on BaseException paths in this function.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:12.102Z
Learning: Agents must validate inputs before processing
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Write tests alongside block implementation when adding new blocks in backend
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py
📚 Learning: 2026-04-08T17:27:45.740Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.740Z
Learning: Applies to autogpt_platform/**/data/**/*.py : For changes touching `data/*.py`, validate user ID checks or explain why not needed
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-08T17:28:23.439Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:23.439Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : When creating new blocks, inherit from `Block` base class, define input/output schemas using `BlockSchema`, implement async `run` method, and generate unique block ID using `uuid.uuid4()`
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-04T12:19:39.243Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12279
File: autogpt_platform/backend/backend/copilot/tools/base.py:184-188
Timestamp: 2026-03-04T12:19:39.243Z
Learning: In autogpt_platform/backend/backend/copilot/tools/, ensure that anonymous users always pass user_id=None to tool execution methods. The anon_ prefix (e.g., anon_123) is used only for PostHog/analytics distinct_id and must not be used as an actual user_id. Use a simple truthiness check on user_id (e.g., if user_id: ... else: ... or a dedicated is_authenticated flag) to distinguish anonymous from authenticated users, and review all tool execution call sites within this directory to prevent accidentally forwarding an anon_ user_id to tools.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-31T14:22:26.566Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:26.566Z
Learning: In files under autogpt_platform/backend/backend/copilot/tools/, ensure agent graph enrichment uses the typed Pydantic model `backend.data.graph.Graph` for `AgentInfo.graph` (i.e., `Graph | None`), not `dict[str, Any]`. When enriching with graph data (e.g., `_enrich_agents_with_graph`), prefer calling `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly to retrieve the typed `Graph` object rather than routing through JSON conversions like `get_agent_as_json()` / `graph_to_json()`.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator_test.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Document all agents in AGENTS.md with their name, description, input/output schemas, and usage examples
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-15T14:10:18.177Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/backend/copilot/graphiti/CLAUDE.md:0-0
Timestamp: 2026-04-15T14:10:18.177Z
Learning: Agent documentation should be maintained in AGENTS.md and kept synchronized with code changes
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-31T14:22:29.127Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:29.127Z
Learning: When reviewing code under autogpt_platform/backend/backend/copilot/tools/, the `AgentInfo.graph` field (in agent_search.py / models.py) uses `Graph | None` (the typed `backend.data.graph.Graph` Pydantic model), NOT `dict[str, Any]`. The enrichment function `_enrich_agents_with_graph` calls `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly rather than going through `get_agent_as_json()` / `graph_to_json()`. This was updated in PR `#12622` (commit 22d05bc).
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:18.189Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:18.189Z
Learning: Applies to autogpt_platform/backend/**/*.md : Document agent responsibilities and interfaces in markdown files
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:23.306Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:23.306Z
Learning: Applies to autogpt_platform/frontend/**/AGENTS.md : Document agent responsibilities and capabilities in AGENTS.md with clear descriptions of what each agent does
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Include clear usage examples in AGENTS.md for each agent to facilitate integration and reduce onboarding time
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-08T23:28:21.675Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12334
File: docs/integrations/block-integrations/github/repo.md:11-40
Timestamp: 2026-03-08T23:28:21.675Z
Learning: In Significant-Gravitas/AutoGPT, new GitHub block documentation stubs in `docs/integrations/block-integrations/github/` are auto-generated by a docs script with placeholder text (`_Add technical explanation here._` / `_Add practical use case examples here._`) inside `<!-- MANUAL: how_it_works
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Maintain AGENTS.md as the single source of truth for agent specifications and interfaces across the codebase
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-15T14:10:18.177Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/backend/copilot/graphiti/CLAUDE.md:0-0
Timestamp: 2026-04-15T14:10:18.177Z
Learning: Applies to autogpt_platform/backend/backend/copilot/graphiti/**/*agent*.{ts,tsx,yaml,yml,json} : Agent configuration should be stored in separate YAML/JSON configuration files and not hardcoded
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-26T13:40:13.262Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12577
File: autogpt_platform/frontend/src/app/(platform)/admin/components/AdminUserSearch.tsx:0-0
Timestamp: 2026-03-26T13:40:13.262Z
Learning: In `autogpt_platform/frontend`, the non-legacy `Input` component (`TextField`) requires `label` and `id` props and has a fundamentally different API from the legacy `@/components/__legacy__/ui/input`. The entire admin section intentionally continues to use the legacy `Input` for simple form inputs (e.g., search boxes) where those props are unnecessary. Do not flag the use of `@/components/__legacy__/ui/input` in admin components as a blocking issue until a lightweight non-legacy Input alternative is available.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:12.102Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:12.102Z
Learning: Agents must validate inputs before processing
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-16T16:30:20.657Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:20.657Z
Learning: In autogpt_platform/backend/backend/blocks/agent_mail/ (and other blocks under autogpt_platform/backend/backend/blocks/), the block executor framework (backend/executor/manager.py lines ~708-733) automatically catches all uncaught exceptions from a block's `run()` method and emits them on the `"error"` output. Explicit try/except blocks within `run()` are therefore not required for standard error propagation — they are only needed when partial output behaviour must be controlled (e.g., preventing some outputs from being yielded on failure, as in attachment blocks). This is the standard pattern across the codebase.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
🪛 markdownlint-cli2 (0.22.0)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
[warning] 173-173: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (1)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md (1)
161-166: No changes needed—the documentedallowed_viewsguidance is correct.Both
"DOCS"and"DOCUMENTS"are valid enum values in theAttachmentViewtype. The documentation correctly distinguishes their use:["DOCUMENTS"]for specialized Docs blocks (as seen in actual implementations indocs.py), and["DOCS", "SPREADSHEETS", "PRESENTATIONS"]for the generic Drive input block default. Generated graphs would accept either value without validation errors.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #12880 +/- ##
==========================================
+ Coverage 68.07% 68.13% +0.06%
==========================================
Files 1919 1920 +1
Lines 149037 149235 +198
Branches 15541 15554 +13
==========================================
+ Hits 101451 101683 +232
+ Misses 44568 44530 -38
- Partials 3018 3022 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
… feedback - Only links whose source is an AgentGoogleDriveFileInputBlock (or subclass) suppress the anti-pattern check. A link from any other block does not carry `_credentials_id`, so it must not silence the validator. This uses the `node_lookup` parameter that was previously accepted but unused. - Detect nested `_#_` hardcoded defaults (e.g. `spreadsheet_#_id`) as equivalent to a top-level hardcode — they bypass the picker credentials flow in the same way. - Tag the fenced code block in agent_generation_guide.md with `text` to satisfy markdownlint. - Add tests: format-only and auto-credentials-only detection paths, link from non-Drive source still flagged, nested `_#_` default still flagged.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py (1)
831-844: Add block ID constant to helpers and import in validator.The UUID
d3b32f15-6fd7-40e3-be52-e083f51b19a2at line 836 is hardcoded in the error message. AddAGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_IDtohelpers.pyalongside the other block ID constants (following the existingAGENT_EXECUTOR_BLOCK_ID,AGENT_INPUT_BLOCK_ID, etc. pattern), export it in__all__, and import it invalidator.pyto replace the hardcoded UUID. This centralizes the reference, prevents drift if the ID ever changes, and enables other validators and fixer code to share the constant.♻️ Proposed refactor
from .helpers import ( AGENT_EXECUTOR_BLOCK_ID, + AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID, AGENT_INPUT_BLOCK_ID, AGENT_OUTPUT_BLOCK_ID, ... ) ... - f"provided at run time by an AgentGoogleDriveFileInputBlock " - f"(block_id 'd3b32f15-6fd7-40e3-be52-e083f51b19a2') so " + f"provided at run time by an AgentGoogleDriveFileInputBlock " + f"(block_id '{AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID}') so "🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py` around lines 831 - 844, Replace the hardcoded UUID in the error string inside Validator.add_error call with a shared constant: add AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID = "d3b32f15-6fd7-40e3-be52-e083f51b19a2" to helpers.py alongside the other AGENT_* block ID constants, export it via __all__, then import that constant in validator.py and use AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID in the f-string inside the validator method (the add_error call shown) instead of the literal UUID so the validator references the centralized symbol.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py`:
- Around line 831-844: Replace the hardcoded UUID in the error string inside
Validator.add_error call with a shared constant: add
AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID = "d3b32f15-6fd7-40e3-be52-e083f51b19a2"
to helpers.py alongside the other AGENT_* block ID constants, export it via
__all__, then import that constant in validator.py and use
AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID in the f-string inside the validator
method (the add_error call shown) instead of the literal UUID so the validator
references the centralized symbol.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d6e15aca-921b-49eb-8067-c35549b6bc8c
📒 Files selected for processing (3)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.pyautogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py
✅ Files skipped from review due to trivial changes (1)
- autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
🚧 Files skipped from review as they are similar to previous changes (1)
- autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: check API types
- GitHub Check: Seer Code Review
- GitHub Check: Analyze (python)
- GitHub Check: end-to-end tests
- GitHub Check: type-check (3.13)
- GitHub Check: test (3.11)
- GitHub Check: test (3.13)
- GitHub Check: test (3.12)
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.py
🧠 Learnings (15)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
📚 Learning: 2026-03-31T14:22:26.566Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:26.566Z
Learning: In files under autogpt_platform/backend/backend/copilot/tools/, ensure agent graph enrichment uses the typed Pydantic model `backend.data.graph.Graph` for `AgentInfo.graph` (i.e., `Graph | None`), not `dict[str, Any]`. When enriching with graph data (e.g., `_enrich_agents_with_graph`), prefer calling `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly to retrieve the typed `Graph` object rather than routing through JSON conversions like `get_agent_as_json()` / `graph_to_json()`.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-10T08:39:22.025Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-10T08:38:36.655Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/tools/run_block.py:349-370
Timestamp: 2026-03-10T08:38:36.655Z
Learning: In the AutoGPT CoPilot HITL (Human-In-The-Loop) flow (`autogpt_platform/backend/backend/copilot/tools/run_block.py`), the review card presented to users sets `editable: false`, meaning reviewers cannot modify the input payload. Therefore, credentials resolved before `is_block_exec_need_review()` remain valid and do not need to be recomputed after the review step — the original `input_data` is unchanged through the review lifecycle.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-08T17:26:12.102Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:12.102Z
Learning: Agents must validate inputs before processing
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-16T16:30:20.657Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:20.657Z
Learning: In autogpt_platform/backend/backend/blocks/agent_mail/ (and other blocks under autogpt_platform/backend/backend/blocks/), the block executor framework (backend/executor/manager.py lines ~708-733) automatically catches all uncaught exceptions from a block's `run()` method and emits them on the `"error"` output. Explicit try/except blocks within `run()` are therefore not required for standard error propagation — they are only needed when partial output behaviour must be controlled (e.g., preventing some outputs from being yielded on failure, as in attachment blocks). This is the standard pattern across the codebase.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.py
📚 Learning: 2026-03-04T12:19:39.243Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12279
File: autogpt_platform/backend/backend/copilot/tools/base.py:184-188
Timestamp: 2026-03-04T12:19:39.243Z
Learning: In autogpt_platform/backend/backend/copilot/tools/, ensure that anonymous users always pass user_id=None to tool execution methods. The anon_ prefix (e.g., anon_123) is used only for PostHog/analytics distinct_id and must not be used as an actual user_id. Use a simple truthiness check on user_id (e.g., if user_id: ... else: ... or a dedicated is_authenticated flag) to distinguish anonymous from authenticated users, and review all tool execution call sites within this directory to prevent accidentally forwarding an anon_ user_id to tools.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.py
🔇 Additional comments (3)
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py (3)
658-733: LGTM on the IO-block refactor.Switching from substring matching on
block_idto auiType-driven collection (with base IDs preserved as fallback for minimal test inputs) correctly accommodates specialized subclasses likeAgentGoogleDriveFileInputBlock. The error messages now reference both the base block and the specialized variants, which is helpful guidance for the fixer LLM.
789-801: Drive-source link gating looks correct.Restricting
drive_linked_sinksto links whose source node is anAgentGoogleDriveFileInputBlock(or subclass) correctly enforces the_credentials_idrequirement — a link from any other block can't provide the OAuth plumbing. The prior review concern about non-picker links silencing the check is addressed.
849-888: Optional/union-wrappedGoogleDriveFileFieldschemas are not currently at risk, but could be handled more defensively.
_is_google_drive_picker_fieldonly inspects the top-level schema dict forformat == "google-drive-picker"orauto_credentials.provider == "google". If a field were declared asOptional[GoogleDriveFileField], Pydantic v2 would emit{"anyOf": [{"format": "google-drive-picker", ...}, {"type": "null"}]}, placing both keys inside the union rather than at the top level.However, this is not a current issue:
AgentGoogleDriveFileInputBlock.valueis declared asOptional[GoogleDriveFileField], but its customgenerate_schema()method manually places the picker markers (formatandauto_credentials) at the top level, bypassing the anyOf wrapping.- All consumer blocks (e.g.,
GoogleSheetsReadBlock) useGoogleDriveFileFielddirectly withoutOptional, so they emit markers at the top level.Future-proofing would involve descending into
anyOfvariants (ascheck_nested_inputdoes for dict validation at line 530), but this is a lower-priority improvement since no current code triggers the gap.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md`:
- Around line 139-143: The docs show inconsistent allowed_views tokens: change
occurrences of "DOCS" in the examples/default list to the canonical "DOCUMENTS"
(or vice versa if project-wide canonical is "DOCS") so the guide uses one
consistent value; update the default array line that currently reads `["DOCS",
"SPREADSHEETS", "PRESENTATIONS"]` to `["DOCUMENTS", "SPREADSHEETS",
"PRESENTATIONS"]` to match the `["DOCUMENTS"]` example and avoid generating
invalid picker configs.
🪄 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: 86086d5f-81a8-481c-8275-790c2c6fa0ed
📒 Files selected for processing (1)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: check API types
- GitHub Check: types
- GitHub Check: test (3.12)
- GitHub Check: type-check (3.13)
- GitHub Check: test (3.11)
- GitHub Check: lint
- GitHub Check: test (3.13)
- GitHub Check: type-check (3.11)
- GitHub Check: type-check (3.12)
- GitHub Check: lint
- GitHub Check: end-to-end tests
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (typescript)
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (1)
autogpt_platform/backend/**/*.md
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Document agent responsibilities and interfaces in markdown files
Files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
🧠 Learnings (21)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
📚 Learning: 2026-04-15T14:10:18.177Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/backend/copilot/graphiti/CLAUDE.md:0-0
Timestamp: 2026-04-15T14:10:18.177Z
Learning: Agent documentation should be maintained in AGENTS.md and kept synchronized with code changes
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Document all agents in AGENTS.md with their name, description, input/output schemas, and usage examples
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:23.306Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:23.306Z
Learning: Applies to autogpt_platform/frontend/**/AGENTS.md : Document agent responsibilities and capabilities in AGENTS.md with clear descriptions of what each agent does
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:18.189Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:18.189Z
Learning: Applies to autogpt_platform/backend/**/*.md : Document agent responsibilities and interfaces in markdown files
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-08T23:28:21.675Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12334
File: docs/integrations/block-integrations/github/repo.md:11-40
Timestamp: 2026-03-08T23:28:21.675Z
Learning: In Significant-Gravitas/AutoGPT, new GitHub block documentation stubs in `docs/integrations/block-integrations/github/` are auto-generated by a docs script with placeholder text (`_Add technical explanation here._` / `_Add practical use case examples here._`) inside `<!-- MANUAL: how_it_works
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-31T14:22:29.127Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:29.127Z
Learning: When reviewing code under autogpt_platform/backend/backend/copilot/tools/, the `AgentInfo.graph` field (in agent_search.py / models.py) uses `Graph | None` (the typed `backend.data.graph.Graph` Pydantic model), NOT `dict[str, Any]`. The enrichment function `_enrich_agents_with_graph` calls `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly rather than going through `get_agent_as_json()` / `graph_to_json()`. This was updated in PR `#12622` (commit 22d05bc).
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-15T14:10:18.177Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/backend/copilot/graphiti/CLAUDE.md:0-0
Timestamp: 2026-04-15T14:10:18.177Z
Learning: Applies to autogpt_platform/backend/backend/copilot/graphiti/**/*agent*.{ts,tsx} : All agent implementations should follow the standard agent interface pattern with methods for initialization, execution, and error handling
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Maintain AGENTS.md as the single source of truth for agent specifications and interfaces across the codebase
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:26:28.252Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Include clear usage examples in AGENTS.md for each agent to facilitate integration and reduce onboarding time
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-07T10:12:18.517Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12691
File: .claude/skills/orchestrate/SKILL.md:0-0
Timestamp: 2026-04-07T10:12:18.517Z
Learning: In Significant-Gravitas/AutoGPT's Claude skill markdown files under `.claude/skills/orchestrate/`, fenced code blocks in `SKILL.md`-style skill documents may intentionally omit a fenced code language (no `text`, `bash`, etc.). These blocks are used for Claude Code inline pseudocode/conceptual helpers rather than runnable scripts. During reviews, avoid treating MD040 (fenced-code-language) as an issue for these specific skill-format blocks, even if the language identifier is missing, since this omission is expected and has been accepted as a false positive for this skill format.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-27T09:36:59.358Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12591
File: .claude/skills/setup-repo/SKILL.md:32-33
Timestamp: 2026-03-27T09:36:59.358Z
Learning: In the Significant-Gravitas/AutoGPT repository, bash code blocks inside `.claude/skills/*/SKILL.md` files are illustrative guidance patterns for AI agents to adapt, not directly executable scripts. Code correctness standards (e.g., regex safety, error handling) for these snippets should be evaluated against their role as intent-communicating documentation rather than production code.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-10T08:39:22.025Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-21T11:41:05.877Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 0
File: :0-0
Timestamp: 2026-04-21T11:41:05.877Z
Learning: In `autogpt_platform/backend/backend/copilot/baseline/service.py` (PR `#12870`, commits 080d42b9d and 3d7b38162), the `_close_reasoning_block_if_open(state)` helper centralises all four reasoning-block-close call sites (text branch, tool_calls branch, stream-end, exception path). The outer `finally` block of `_baseline_llm_caller` calls this helper plus stripper flush + `StreamTextEnd` to guarantee matched end events are emitted before `StreamFinishStep` on both normal and exception paths. Do NOT flag duplicated close logic or missing reasoning-end-on-exception as issues in this function.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-07T18:08:03.548Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12701
File: .claude/skills/orchestrate/scripts/verify-complete.sh:120-121
Timestamp: 2026-04-07T18:08:03.548Z
Learning: In Significant-Gravitas/AutoGPT, verify-complete.sh (`.claude/skills/orchestrate/scripts/verify-complete.sh`) uses `commits[-1].committedDate` (not `updatedAt`) to identify stale CHANGES_REQUESTED reviews. This is intentional: `updatedAt` changes on any PR activity (bot comments, label changes, description edits), which would falsely classify a reviewer's CHANGES_REQUESTED as stale — a silent false negative. The `committedDate` edge case (commit created locally before a review but pushed after) only causes a false positive (unnecessary re-brief), which is the safer failure mode. Do not suggest switching to `updatedAt` for this comparison.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-24T21:25:15.983Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12536
File: autogpt_platform/frontend/src/app/api/openapi.json:5770-5790
Timestamp: 2026-03-24T21:25:15.983Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12536`
File: autogpt_platform/frontend/src/app/api/openapi.json
Learning: The OpenAPI spec file is auto-generated; per established convention, endpoints generally declare only 200/201, 401, and 422 responses. Do not suggest adding explicit 403/404 response entries for single operations unless planning a repo-wide spec update. Prefer clarifying such behaviors in endpoint descriptions/docstrings instead of altering response maps.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-04-08T17:28:23.439Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/AGENTS.md:0-0
Timestamp: 2026-04-08T17:28:23.439Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : When creating new blocks, inherit from `Block` base class, define input/output schemas using `BlockSchema`, implement async `run` method, and generate unique block ID using `uuid.uuid4()`
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/backend/blocks/**/*.py : Inherit from 'Block' base class with input/output schemas when adding new blocks in backend
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 Learning: 2026-03-26T13:40:13.262Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12577
File: autogpt_platform/frontend/src/app/(platform)/admin/components/AdminUserSearch.tsx:0-0
Timestamp: 2026-03-26T13:40:13.262Z
Learning: In `autogpt_platform/frontend`, the non-legacy `Input` component (`TextField`) requires `label` and `id` props and has a fundamentally different API from the legacy `@/components/__legacy__/ui/input`. The entire admin section intentionally continues to use the legacy `Input` for simple form inputs (e.g., search boxes) where those props are unnecessary. Do not flag the use of `@/components/__legacy__/ui/input` in admin components as a blocking issue until a lightweight non-legacy Input alternative is available.
Applied to files:
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📚 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/sdk/agent_generation_guide.md
🔇 Additional comments (1)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md (1)
114-191: Strong addition—this section clearly defines the Drive-file contract and wiring pattern.The new required pattern, detection cues, and remediation guidance are concrete and should prevent the hardcoded-ID anti-pattern effectively.
As per coding guidelines, this update documents agent responsibilities and interfaces in markdown files.
Use the same AttachmentView token (DOCS) that the runtime default uses in io.py, so the guide and error message don't suggest DOCUMENTS while the default list uses DOCS. Both are valid literals, but mixing them inside the same paragraph makes the guidance inconsistent.
…/Significant-Gravitas/AutoGPT into fix/copilot-drive-file-validator
There was a problem hiding this comment.
🧹 Nitpick comments (1)
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py (1)
831-844: Avoid hard-coding theAgentGoogleDriveFileInputBlockUUID in the error string.Line 836 embeds the literal
'd3b32f15-6fd7-40e3-be52-e083f51b19a2'. Any future ID change (or a test double) will silently drift the guidance while tests still pass. Prefer exporting a named constant fromhelpers(alongsideAGENT_INPUT_BLOCK_ID/AGENT_OUTPUT_BLOCK_ID) and interpolating it.♻️ Proposed fix
from .helpers import ( AGENT_EXECUTOR_BLOCK_ID, + AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID, AGENT_INPUT_BLOCK_ID, AGENT_OUTPUT_BLOCK_ID, MCP_TOOL_BLOCK_ID, TOOL_ORCHESTRATOR_BLOCK_ID,- f"provided at run time by an AgentGoogleDriveFileInputBlock " - f"(block_id 'd3b32f15-6fd7-40e3-be52-e083f51b19a2') so " + f"provided at run time by an AgentGoogleDriveFileInputBlock " + f"(block_id '{AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID}') so "🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py` around lines 831 - 844, The error message in validator.py currently hardcodes the AgentGoogleDriveFileInputBlock UUID; instead export a named constant (e.g. AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID) from the helpers module alongside AGENT_INPUT_BLOCK_ID / AGENT_OUTPUT_BLOCK_ID, import that constant into autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py, and replace the literal 'd3b32f15-6fd7-40e3-be52-e083f51b19a2' in the self.add_error string with an f-string interpolation of the new constant so future ID changes or test doubles will be reflected automatically.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py`:
- Around line 831-844: The error message in validator.py currently hardcodes the
AgentGoogleDriveFileInputBlock UUID; instead export a named constant (e.g.
AGENT_GOOGLE_DRIVE_FILE_INPUT_BLOCK_ID) from the helpers module alongside
AGENT_INPUT_BLOCK_ID / AGENT_OUTPUT_BLOCK_ID, import that constant into
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py, and
replace the literal 'd3b32f15-6fd7-40e3-be52-e083f51b19a2' in the self.add_error
string with an f-string interpolation of the new constant so future ID changes
or test doubles will be reflected automatically.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 94484dab-0029-433b-af15-2565f26f5e75
📒 Files selected for processing (2)
autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdautogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
✅ Files skipped from review due to trivial changes (1)
- autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: check API types
- GitHub Check: test (3.12)
- GitHub Check: test (3.11)
- GitHub Check: type-check (3.13)
- GitHub Check: type-check (3.12)
- GitHub Check: test (3.13)
- GitHub Check: end-to-end tests
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/backend/**/*.py: Use Python 3.11 (required; managed by Poetry via pyproject.toml) for backend development
Always run 'poetry run format' (Black + isort) before linting in backend development
Always run 'poetry run lint' (ruff) after formatting in backend development
autogpt_platform/backend/**/*.py: Usepoetry run ...command for executing Python package dependencies
Use top-level imports only — avoid local/inner imports except for lazy imports of heavy optional dependencies likeopenpyxl
Use absolute imports withfrom backend.module import ...for cross-package imports; single-dot relative imports are acceptable for sibling modules within the same package; avoid double-dot relative imports
Do not use duck typing — avoidhasattr/getattr/isinstancefor type dispatch; use typed interfaces/unions/protocols instead
Use Pydantic models over dataclass/namedtuple/dict for structured data
Do not use linter suppressors — no# type: ignore,# noqa,# pyright: ignore; fix the type/code instead
Prefer list comprehensions over manual loop-and-append patterns
Use early return with guard clauses first to avoid deep nesting
Use%sfor deferred interpolation indebuglog statements for efficiency; use f-strings elsewhere for readability (e.g.,logger.debug("Processing %s items", count)vslogger.info(f"Processing {count} items"))
Sanitize error paths by usingos.path.basename()in error messages to avoid leaking directory structure
Be aware of TOCTOU (Time-Of-Check-Time-Of-Use) issues — avoid check-then-act patterns for file access and credit charging
Usetransaction=Truefor Redis pipelines to ensure atomicity on multi-step operations
Usemax(0, value)guards for computed values that should never be negative
Keep files under ~300 lines; if a file grows beyond this, split by responsibility (extract helpers, models, or a sub-module into a new file)
Keep functions under ~40 lines; extract named helpers when a function grows longer
...
Files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.py
🧠 Learnings (25)
📓 Common learnings
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 12536
File: autogpt_platform/frontend/src/app/api/openapi.json:5770-5790
Timestamp: 2026-03-24T21:25:15.983Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12536`
File: autogpt_platform/frontend/src/app/api/openapi.json
Learning: The OpenAPI spec file is auto-generated; per established convention, endpoints generally declare only 200/201, 401, and 422 responses. Do not suggest adding explicit 403/404 response entries for single operations unless planning a repo-wide spec update. Prefer clarifying such behaviors in endpoint descriptions/docstrings instead of altering response maps.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/tools/run_block.py:349-370
Timestamp: 2026-03-10T08:38:36.655Z
Learning: In the AutoGPT CoPilot HITL (Human-In-The-Loop) flow (`autogpt_platform/backend/backend/copilot/tools/run_block.py`), the review card presented to users sets `editable: false`, meaning reviewers cannot modify the input payload. Therefore, credentials resolved before `is_block_exec_need_review()` remain valid and do not need to be recomputed after the review step — the original `input_data` is unchanged through the review lifecycle.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/frontend/src/tests/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:28.252Z
Learning: Applies to autogpt_platform/frontend/src/tests/**/AGENTS.md : Document all agents in AGENTS.md with their name, description, input/output schemas, and usage examples
📚 Learning: 2026-04-08T17:27:45.740Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T17:27:45.740Z
Learning: Applies to autogpt_platform/**/data/**/*.py : For changes touching `data/*.py`, validate user ID checks or explain why not needed
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-08T17:26:12.102Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2026-04-08T17:26:12.102Z
Learning: Agents must validate inputs before processing
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-31T14:22:26.566Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12622
File: autogpt_platform/backend/backend/copilot/tools/agent_search.py:223-236
Timestamp: 2026-03-31T14:22:26.566Z
Learning: In files under autogpt_platform/backend/backend/copilot/tools/, ensure agent graph enrichment uses the typed Pydantic model `backend.data.graph.Graph` for `AgentInfo.graph` (i.e., `Graph | None`), not `dict[str, Any]`. When enriching with graph data (e.g., `_enrich_agents_with_graph`), prefer calling `graph_db().get_graph(graph_id, version=None, user_id=user_id)` directly to retrieve the typed `Graph` object rather than routing through JSON conversions like `get_agent_as_json()` / `graph_to_json()`.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-10T08:39:22.025Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:22.025Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-17T10:57:12.953Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12440
File: autogpt_platform/backend/backend/copilot/workflow_import/converter.py:0-0
Timestamp: 2026-03-17T10:57:12.953Z
Learning: In Significant-Gravitas/AutoGPT PR `#12440`, `autogpt_platform/backend/backend/copilot/workflow_import/converter.py` was fully rewritten (commit 732960e2d) to no longer make direct LLM/OpenAI API calls. The converter now builds a structured text prompt for AutoPilot/CoPilot instead. There is no `response.choices` access or any direct LLM client usage in this file. Do not flag `response.choices` access or LLM client initialization patterns as issues in this file.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-10T08:38:36.655Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/tools/run_block.py:349-370
Timestamp: 2026-03-10T08:38:36.655Z
Learning: In the AutoGPT CoPilot HITL (Human-In-The-Loop) flow (`autogpt_platform/backend/backend/copilot/tools/run_block.py`), the review card presented to users sets `editable: false`, meaning reviewers cannot modify the input payload. Therefore, credentials resolved before `is_block_exec_need_review()` remain valid and do not need to be recomputed after the review step — the original `input_data` is unchanged through the review lifecycle.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-16T17:00:02.827Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12439
File: autogpt_platform/backend/backend/blocks/autogpt_copilot.py:0-0
Timestamp: 2026-03-16T17:00:02.827Z
Learning: In autogpt_platform/backend/backend/blocks/autogpt_copilot.py, the recursion guard uses two module-level ContextVars: `_copilot_recursion_depth` (tracks current nesting depth) and `_copilot_recursion_limit` (stores the chain-wide ceiling). On the first invocation, `_copilot_recursion_limit` is set to `max_recursion_depth`; nested calls use `min(inherited_limit, max_recursion_depth)`, so they can only lower the cap, never raise it. The entry/exit logic is extracted into module-level helper functions. This is the approved pattern for preventing runaway sub-agent recursion in AutogptCopilotBlock (PR `#12439`, commits 348e9f8e2 and 3b70f61b1).
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-18T14:03:32.534Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12473
File: autogpt_platform/backend/backend/copilot/tools/agent_browser_integration_test.py:86-195
Timestamp: 2026-03-18T14:03:32.534Z
Learning: In Significant-Gravitas/AutoGPT, the integration tests in `autogpt_platform/backend/backend/copilot/tools/agent_browser_integration_test.py` intentionally use real external URLs (example.com, httpbin.org). They are gated with `pytest.mark.skipif(shutil.which("agent-browser") is None, ...)`, so they are automatically skipped in standard CI where agent-browser is not installed. They are designed to be run explicitly inside the Docker environment to verify that system Chromium (AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium) actually launches and can fetch pages end-to-end. Do not flag the use of real network calls in these tests as a flakiness concern.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-22T05:57:34.861Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12879
File: autogpt_platform/backend/backend/copilot/baseline/service.py:0-0
Timestamp: 2026-04-22T05:57:34.861Z
Learning: In `autogpt_platform/backend/backend/copilot/baseline/service.py`, the approved pattern for `_run_task_subagent` (PR `#12879`, commit 187f0a5) uses a nested `try/except Exception` inside an outer `try/finally`. The outer `finally` block resets `_TASK_DEPTH_VAR` (via `_TASK_DEPTH_VAR.reset(token)`) AND calls `_absorb_inner_usage(parent_state, inner_state)` unconditionally, so both the depth ContextVar and usage roll-up are guaranteed on all exit paths including `CancelledError`/`KeyboardInterrupt`/`SystemExit`. The inner `except Exception` catches and converts failures into a `TaskResponse` error payload that is returned as `StreamToolOutputAvailable`. Do NOT flag missing ContextVar reset or usage roll-up on BaseException paths in this function.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-04-07T18:08:03.548Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12701
File: .claude/skills/orchestrate/scripts/verify-complete.sh:120-121
Timestamp: 2026-04-07T18:08:03.548Z
Learning: In Significant-Gravitas/AutoGPT, verify-complete.sh (`.claude/skills/orchestrate/scripts/verify-complete.sh`) uses `commits[-1].committedDate` (not `updatedAt`) to identify stale CHANGES_REQUESTED reviews. This is intentional: `updatedAt` changes on any PR activity (bot comments, label changes, description edits), which would falsely classify a reviewer's CHANGES_REQUESTED as stale — a silent false negative. The `committedDate` edge case (commit created locally before a review but pushed after) only causes a false positive (unnecessary re-brief), which is the safer failure mode. Do not suggest switching to `updatedAt` for this comparison.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-03-10T08:38:33.249Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/tools/run_block.py:297-300
Timestamp: 2026-03-10T08:38:33.249Z
Learning: In autogpt_platform/backend/backend/copilot/tools/run_block.py, the auto-approval key for sensitive block HITL review uses graph_exec_id (copilot-session-{session_id}) + node_id (copilot-node-{block_id}). This is intentional: approving a block type within a CoPilot session auto-approves all future invocations of that same block type within the same session, mirroring how auto-approve works in normal graph execution. The user explicitly opts into this session-scoped behavior via an auto-approve toggle. Without the toggle (default), each individual invocation requires its own approval.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.py
📚 Learning: 2026-03-16T16:30:20.657Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 12417
File: autogpt_platform/backend/backend/blocks/agent_mail/threads.py:80-102
Timestamp: 2026-03-16T16:30:20.657Z
Learning: In autogpt_platform/backend/backend/blocks/agent_mail/ (and other blocks under autogpt_platform/backend/backend/blocks/), the block executor framework (backend/executor/manager.py lines ~708-733) automatically catches all uncaught exceptions from a block's `run()` method and emits them on the `"error"` output. Explicit try/except blocks within `run()` are therefore not required for standard error propagation — they are only needed when partial output behaviour must be controlled (e.g., preventing some outputs from being yielded on failure, as in attachment blocks). This is the standard pattern across the codebase.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.py
📚 Learning: 2026-03-04T12:19:39.243Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12279
File: autogpt_platform/backend/backend/copilot/tools/base.py:184-188
Timestamp: 2026-03-04T12:19:39.243Z
Learning: In autogpt_platform/backend/backend/copilot/tools/, ensure that anonymous users always pass user_id=None to tool execution methods. The anon_ prefix (e.g., anon_123) is used only for PostHog/analytics distinct_id and must not be used as an actual user_id. Use a simple truthiness check on user_id (e.g., if user_id: ... else: ... or a dedicated is_authenticated flag) to distinguish anonymous from authenticated users, and review all tool execution call sites within this directory to prevent accidentally forwarding an anon_ user_id to tools.
Applied to files:
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.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/tools/agent_generator/validator.py
🔇 Additional comments (1)
autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py (1)
658-733: No changes required —uiTypekey is consistent across serialization and validation.The original concern about a mismatch between
uiType(read by the validator) andui_type(used in tests) is unfounded. The test helper function has a parameter namedui_type(Python convention), but it correctly writesblock["uiType"]to the dict (line 75 of validator_test.py). Production serialization in_base.py(line 611, 629) also produces"uiType". All code paths use the camelCase key consistently; the snake_case parameter name in the test is incidental and does not affect the dict serialization.
The agent-generation-guide collapse expanded the AgentGoogleDriveFileInput block description. Regenerate the auto-maintained block docs so check-docs-sync passes.
…sError field_name, provider, and picker_config were attached to the exception but never read by any caller (CoPilot's execute_block only uses str(e) and rebuilds the picker UI from the full input schema via get_inputs_from_schema). picker_config in particular was never even passed at construction time. Remove the dead surface area.
/pr-test --fix report — GOE2E pass on Scenarios
Fixes committedNone. Non-blocking observations (follow-ups)
VerdictGO — safe to merge / deploy. Headline features verified end-to-end:
|
…Card helpers Adds 6 cases exercising coerceExpectedInputs + buildExpectedInputsSchema against the generic schema-key passthrough (format / google_drive_picker_config / auto_credentials), plus the reserved-key isolation check. Closes the codecov/patch gap on the frontend diff.
…inputs + elevate run_block prompt
Observed on dev: when asked to read a private Google Sheet, CoPilot
answered "I can't access private sheets, share publicly or use the
builder" instead of calling run_block and letting the picker render.
Self-diagnosis confirmed the LLM knew the rule ("omit the spreadsheet
field, the picker will appear") but didn't apply it — the rule was
buried in a tool-notes sub-section and the fallback path (omit required
field) returned a schema preview, not the picker card.
Fixes:
- run_block: when missing required fields include picker-backed fields
(format=google-drive-picker or auto_credentials present), return
SetupRequirementsResponse directly so the frontend renders the picker
inline. Previous behaviour returned BlockDetailsResponse (schema
preview) which made the LLM's next guess "ask the user for the URL."
- prompting: elevate "Picker-backed inputs via run_block" to a
top-level tool-behavior note. Add a concrete worked example (exact
JSON), an explicit ❌ list ("don't ask for URL", "don't hardcode ID",
"don't refuse"), and make clear the picker is the ONLY source of the
attached credentials.
- auto_credentials: sharpen MissingAutoCredentialsError message to
mention the inline picker so the LLM understands the retry path
instead of asking the user for more data.
Test: new test_missing_picker_field_returns_setup_requirements in
run_block_test.py covering the picker-short-circuit branch.
Introduced by #12883 — module-level `import secrets` sat after class/function definitions, tripping ruff E402 on our branch post-merge. One-line hoist unblocks lint.
…picker prompt Refactor: instead of a dedicated validate_only branch that rebuilt the BlockDetailsResponse, piggyback on the existing schema-preview return. Guard the picker short-circuit with `not validate_only` so introspection never renders a setup card. Detail message is now dynamic (ready-to-run vs missing-inputs list). Prompt section deduped + generalized — dropped the Drive/Sheets/Docs-specific wording; now speaks about picker-backed fields and their detection via schema hints without naming any provider. validate_only pre-flight documented as the safe probe for no-required-field blocks.
…red lock leak - Move picker-backed required-field detection from run_block.py into `prepare_block_for_execution` — extends the existing `if missing_credentials and not dry_run` branch's SetupRequirementsResponse instead of constructing a parallel copy. Both OAuth-missing and picker-missing now flow through the same setup-card builder. - Wrap execute_block's post-auto-cred body in a try/finally so locks release on ALL exit paths (coerce raise, credit-check raise, insufficient-balance early return, timeout). Previously the inner wait_for try/finally was the only release path, stranding locks in Redis until TTL if anything raised before it. Addresses Sentry review r3135420231. - Inline the `full_description` local in GoogleDriveFileField.
Two new regression tests for Sentry r3135420231: confirm auto_locks release when (a) coerce_inputs_to_schema raises between acquire and the inner wait_for try, (b) insufficient-credits early-return fires before execution. Both paths bypassed the inner finally pre-e5d069cfd; now covered by the outer try/finally that wraps the post-acquire body.
…are_block_for_execution Sentry r3135709745: calling run_block with validate_only=True on a block with missing picker-backed required fields was returning SetupRequirementsResponse (rendering the picker) because the early-return branch in prepare_block_for_execution only gated on dry_run, not validate_only. The flag flowed through run_block but never reached the check. Fix: add validate_only param to prepare_block_for_execution and include it in the guard; run_block passes it through. New test test_validate_only_bypasses_picker_setup_card covers the exact condition.
Why / What / How
Why: Resolves #12875. CoPilot's agent-builder was hardcoding Google Drive file IDs into consuming blocks'
input_defaultinstead of wiring anAgentGoogleDriveFileInputBlock. A beta user hit this across 13 saved versions of one agent. Root causes:validate_io_blocksonly accepted the literal baseAgentInputBlock/AgentOutputBlockIDs, so even when CoPilot used a specialized subclass likeAgentGoogleDriveFileInputBlockas the only input, the validator forced it to keep a throwaway base alongside — entrenching the anti-pattern.run_blocksilently failed because the auto-credentials flow (picker attaches_credentials_id) existed only in the graph executor, never in CoPilot's direct-execution path.agent_generation_guide.mdinstead of on the blocks themselves, so it duplicated and drifted from the code.run_blockand letting the picker render — the prompt rule was buried and the fallback path (omitted required picker field) returned a generic schema preview.What: Four coordinated platform + CoPilot improvements. No block-specific validator rules, no Drive-specific code in UI or prompt.
How:
1.
validate_io_blockssubclass supportAccepts any block with
uiType == "Input"/"Output"(populated fromBlock.block_typeat registration).AgentGoogleDriveFileInputBlock,AgentDropdownInputBlock,AgentTableInputBlock, etc. stand alone. Base-ID fallback preserved for call sites that pass a minimal blocks list.2. Inline picker via
run_block_acquire_auto_credentialsfrombackend/executor/manager.pyinto sharedbackend/executor/auto_credentials.py(exportsacquire_auto_credentials+MissingAutoCredentialsError).backend/copilot/tools/helpers.py::execute_block. When_credentials_idis present, the block executes with creds injected (chained flows work). When missing/null,execute_blockreturns the existingSetupRequirementsResponse— frontend'sFormRendererrenders the picker inline via the existingGoogleDrivePickerField/GoogleDrivePickerInput. On pick, the LLM re-invokesrun_blockwith the populated input — same continuation pattern as OAuth-missing-credentials. No new response types, no new continuation tool, no new frontend component.run_blocknow short-circuits toSetupRequirementsResponsewhen missing required fields include a picker-backed field, skipping the schema-preview round trip the LLM would otherwise take.get_inputs_from_schemaspreads the full property schema (**schema) instead of whitelisting — anyformat/json_schema_extra/ custom widget config flows through to the generic custom-field dispatch on the frontend. Future picker formats (date pickers, file pickers, etc.) work without backend changes.SetupRequirementsCard/helpers.tsuses index-signature passthrough for arbitrary schema keys — no widget-specific code in that layer.3.
validate_onlyparameter onrun_blockrun_block(id, {})is not always a safe probe — for blocks with zero required inputs, it executes. Newvalidate_only: trueparameter returnsBlockDetailsResponse(schema + missing-input list) without executing, rendering picker cards, or charging credits. Same response shape as the existing schema preview — no new branch, just an extra condition on the existing one. LLM uses this for pre-flight when it's unsure whether a block has required inputs.4. Block-local picker guidance
Agent-generation picker guidance relocated from the guide onto the blocks themselves — surfaced at
find_blocktime, exactly when the LLM decides to wire a picker-backed consumer:GoogleDriveFileField(shared factory for every Drive field on Sheets/Docs/etc.) appends a standard hint to the caller's description covering: feed from the specialized input block, never hardcode (even one parsed from a URL), picker is the only credential source.AgentGoogleDriveFileInputBlock's block description now covers when it's required, theallowed_viewsmapping, wiring direction, and a concrete link-shape example.agent_generation_guide.mdloses the dedicated 71-line Drive section. The IO-blocks section now tells the LLM specialized subclasses satisfy the requirement and carry their own usage guidance in block/field descriptions — read them whenfind_blocksurfaces a match.run_block" section in the CoPilot prompt, written generically (picker fields detected viaformat/auto_credentialsschema hints, no provider names hardcoded) — covers: don't ask the user for URLs/IDs, don't refuse private-resource asks, chained picker objects pass through as-is.MissingAutoCredentialsErrormessage so when a bare ID reaches execution, the error explicitly tells the LLM the picker renders inline (not "ask the user for something").Changes 🏗️
backend/copilot/tools/agent_generator/validator.py—_collect_io_block_ids+ subclass-awarevalidate_io_blocks.backend/executor/auto_credentials.py(new) — sharedacquire_auto_credentials+MissingAutoCredentialsError.backend/executor/manager.py— imports from the shared module, drops the local copy.backend/copilot/tools/helpers.py—execute_blockcallsacquire_auto_credentials, merges kwargs, releases locks infinally, returnsSetupRequirementsResponseon missing creds.get_inputs_from_schemaspreads the full property schema.backend/copilot/tools/run_block.py— picker-field short-circuit +validate_onlyparameter.backend/copilot/prompting.py— "Picker-backed inputs viarun_block" + "Pre-flight withvalidate_only" sections.backend/blocks/google/_drive.py—GoogleDriveFileFieldappends the agent-builder hint to every Drive consumer's description.backend/blocks/io.py—AgentGoogleDriveFileInputBlockdescription expanded.backend/copilot/sdk/agent_generation_guide.md— Drive section removed, IO-blocks subclass note expanded.frontend/.../SetupRequirementsCard/helpers.ts— index-signature passthrough for arbitrary schema keys; schema fields propagate into the generated RJSF schema.TestExecuteBlockAutoCredentials(4 cases) +validate_only+ picker-short-circuit cases inrun_block_test.py;manager_auto_credentials_test.pymoved to new import path; 6 new frontend cases inSetupRequirementsCard/__tests__/helpers.test.tscovering schema passthrough.import secretsinbackend/integrations/managed_providers/ayrshare.py— ruff E402 introduced by refactor(platform): migrate Ayrshare to standard managed-credential flow #12883 was blocking our lint post-merge.Checklist 📋
For code changes:
SetupRequirementsCardhelpers — 75/75 pass (including 6 new passthrough cases)poetry run format(ruff + isort + black) clean on touched files (pre-existing pyright errors in unrelatedgraphiti_core/StreamEvent/ etc. files not introduced by this PR)custom/google_drive_picker_fieldfor a Drive consumer block called viarun_blockAgentGoogleDriveFileInputBlock→GoogleSheetsReadBlock→AgentOutputBlock) with no throwaway baseAgentInputBlockFor configuration changes: