mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-10 14:55:16 -05:00
e596ea87cbae55eedba3bc58f144702e9e310504
13 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4f908d5cb3 |
fix(platform): Improve Linear Search Block [SECRT-1880] (#11967)
## Summary Implements [SECRT-1880](https://linear.app/autogpt/issue/SECRT-1880) - Improve Linear Search Block ## Changes ### Models (`models.py`) - Added `State` model with `id`, `name`, and `type` fields for workflow state information - Added `state: State | None` field to `Issue` model ### API Client (`_api.py`) - Updated `try_search_issues()` to: - Add `max_results` parameter (default 10, was ~50) to reduce token usage - Add `team_id` parameter for team filtering - Return `createdAt`, `state`, `project`, and `assignee` fields in results - Fixed `try_get_team_by_name()` to return descriptive error message when team not found instead of crashing with `IndexError` ### Block (`issues.py`) - Added `max_results` input parameter (1-100, default 10) - Added `team_name` input parameter for optional team filtering - Added `error` output field for graceful error handling - Added categories (`PRODUCTIVITY`, `ISSUE_TRACKING`) - Updated test fixtures to include new fields ## Breaking Changes | Change | Before | After | Mitigation | |--------|--------|-------|------------| | Default result count | ~50 | 10 | Users can set `max_results` up to 100 if needed | ## Non-Breaking Changes - `state` field added to `Issue` (optional, defaults to `None`) - `max_results` param added (has default value) - `team_name` param added (optional, defaults to `None`) - `error` output added (follows established pattern from GitHub blocks) ## Testing - [x] Format/lint checks pass - [x] Unit test fixtures updated Resolves SECRT-1880 --------- Co-authored-by: Toran Bruce Richards <toran.richards@gmail.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Toran Bruce Richards <Torantulino@users.noreply.github.com> |
||
|
|
3b092f34d8 |
feat(platform): Add Get Linear Issues Block (#11415)
Added the ability to get all issues for a given project. ### Changes 🏗️ - added api query - added new models - added new block that gets all issues for a given project ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] I have ensured the new block works in dev - [x] I have ensured the other linear blocks still work |
||
|
|
2f8cdf62ba |
feat(backend): Standardize error handling with BlockSchemaInput & BlockSchemaOutput base class (#11257)
<!-- Clearly explain the need for these changes: --> This PR addresses the need for consistent error handling across all blocks in the AutoGPT platform. Previously, each block had to manually define an `error` field in their output schema, leading to code duplication and potential inconsistencies. Some blocks might forget to include the error field, making error handling unpredictable. ### Changes 🏗️ <!-- Concisely describe all of the changes made in this pull request: --> - **Created `BlockSchemaOutput` base class**: New base class that extends `BlockSchema` with a standardized `error` field - **Created `BlockSchemaInput` base class**: Added for consistency and future extensibility - **Updated 140+ block implementations**: Changed all block `Output` classes from `class Output(BlockSchema):` to `class Output(BlockSchemaOutput):` - **Removed manual error field definitions**: Eliminated hundreds of duplicate `error: str = SchemaField(...)` definitions - **Updated type annotations**: Changed `Block[BlockSchema, BlockSchema]` to `Block[BlockSchemaInput, BlockSchemaOutput]` throughout the codebase - **Fixed imports**: Added `BlockSchemaInput` and `BlockSchemaOutput` imports to all relevant files - **Maintained backward compatibility**: Updated `EmptySchema` to inherit from `BlockSchemaOutput` **Key Benefits:** - Consistent error handling across all blocks - Reduced code duplication (removed ~200 lines of repetitive error field definitions) - Type safety improvements with distinct input/output schema types - Blocks can still override error field with more specific descriptions when needed ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Verified `poetry run format` passes (all linting, formatting, and type checking) - [x] Tested block instantiation works correctly (MediaDurationBlock, UnrealTextToSpeechBlock) - [x] Confirmed error fields are automatically present in all updated blocks - [x] Verified block loading system works (successfully loads 353+ blocks) - [x] Tested backward compatibility with EmptySchema - [x] Confirmed blocks can still override error field with custom descriptions - [x] Validated core schema inheritance chain works correctly #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) *Note: No configuration changes were needed for this refactoring.* 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Lluis Agusti <hi@llu.lu> Co-authored-by: Ubbe <hi@ubbe.dev> |
||
|
|
eba67e0a4b |
fix(platform/blocks): update linear oauth to use refresh tokens (#10998)
<!-- Clearly explain the need for these changes: --> ### Need 💡 This PR addresses Linear issue SECRT-1665, which mandates an update to Linear's OAuth2 implementation. Linear is transitioning from long-lived access tokens to short-lived access tokens with refresh tokens, with a deadline of April 1, 2026. This change is crucial to ensure continued integration with Linear and to support their new token management system, including a migration path for existing long-lived tokens. ### Changes 🏗️ - **`autogpt_platform/backend/backend/blocks/linear/_oauth.py`**: - Implemented full support for refresh tokens, including HTTP Basic Authentication for token refresh requests. - Added `migrate_old_token()` method to exchange old long-lived access tokens for new short-lived tokens with refresh tokens using Linear's `/oauth/migrate_old_token` endpoint. - Enhanced `get_access_token()` to automatically detect and attempt migration for old tokens, and to refresh short-lived tokens when they expire. - Improved error handling and token expiration management. - Updated `_request_tokens` to handle both authorization code and refresh token flows, supporting Linear's recommended authentication methods. - **`autogpt_platform/backend/backend/blocks/linear/_config.py`**: - Updated `TEST_CREDENTIALS_OAUTH` mock data to include realistic `access_token_expires_at` and `refresh_token` for testing the new token lifecycle. - **`LINEAR_OAUTH_IMPLEMENTATION.md`**: - Added documentation detailing the new Linear OAuth refresh token implementation, including technical details, migration strategy, and testing notes. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Verified OAuth URL generation and parameter encoding. - [x] Confirmed HTTP Basic Authentication header creation for refresh requests. - [x] Tested token expiration logic with a 5-minute buffer. - [x] Validated migration detection for old vs. new token types. - [x] Checked code syntax and import compatibility. #### For configuration changes: - [ ] `.env.default` is updated or already compatible with my changes - [ ] `docker-compose.yml` is updated or already compatible with my changes - [ ] I have included a list of my configuration changes in the PR description (under **Changes**) --- Linear Issue: [SECRT-1665](https://linear.app/autogpt/issue/SECRT-1665) <a href="https://cursor.com/background-agent?bcId=bc-95f4c668-f7fa-4057-87e5-622ac81c0783"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a> <a href="https://cursor.com/agents?id=bc-95f4c668-f7fa-4057-87e5-622ac81c0783"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Nicholas Tindle <ntindle@users.noreply.github.com> Co-authored-by: Bentlybro <Github@bentlybro.com> |
||
|
|
f906fd9298 |
fix(backend): Allow Project.content to be optional for linear search projects (#11118)
Changed the type of the 'content' field in the Project model to accept None, making it optional instead of required. Linear doesn't always return data here if its not set by the user. <!-- Clearly explain the need for these changes: --> ### Changes 🏗️ - Makes the content optional <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Manually test it works with our data <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved handling of projects with no content by making content optional. - Prevents validation errors during project creation, import, or sync when content is missing. - Enhances compatibility with integrations that may omit content fields. - No impact on existing projects with content; behavior remains unchanged. - No user action required. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9e79add436 |
fix(backend): Change progress type to float in Linear Project (#11117)
### Changes 🏗️ - Changed the type of the `progress` field in the `LinearTask` model from `int` to `float` to fix [BUILDER-3V5](https://sentry.io/organizations/significant-gravitas/issues/6929150079/). ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Root cause analysis confirms fix -- testing will need to occur in dev environment before release to prod but this should merge now <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Progress indicators now support decimal values, allowing more precise tracking (e.g., 42.5% instead of 42%). This enables finer-grained updates in the interface and any integrations consuming progress data. - Users may notice smoother progress changes during long-running tasks, with improved accuracy in percentage displays across relevant views and APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co> |
||
|
|
83f96b75c7 |
fix(backend): Ensure we only present working auth options on blocks (#10454)
To allow for a simpler dev experience, the new SDK now auto discovers providers and registers them. However, the OAuth system was still requiring these credentials to be hardcoded in the settings object. This PR changes that to verify the env var is present during registration and then allows the OAuth system to load them from the env. ### Changes 🏗️ - **OAuth Registration**: Modified `ProviderBuilder.with_oauth(..)` to check OAuth env vars exist during registration - **OAuth Loading**: Updated OAuth system to load credentials from env vars if not using secrets - **Block Filtering**: Added `is_block_auth_configured()` function to check if a block has valid authorization options configured at runtime - **Test Updates**: Fixed failing SDK registry tests to properly mock environment variables for OAuth registration ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Verified OAuth system checks that env vars exist during provider registration - [x] Confirmed OAuth system can use env vars directly without requiring hardcoded secrets - [x] Tested that blocks with unconfigured OAuth providers are filtered out - [x] All SDK registry tests pass with proper env var mocking #### For configuration changes: - [x] `.env.example` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) - OAuth providers now require their client ID and secret env vars to be set for registration - No changes required to `.env.example` or `docker-compose.yml` --------- Co-authored-by: Reinier van der Leer <pwuts@agpt.co> |
||
|
|
243400e128 |
feat(platform): Add Block Development SDK with auto-registration system (#10074)
## Block Development SDK - Simplifying Block Creation ### Problem Currently, creating a new block requires manual updates to **5+ files** scattered across the codebase: - `backend/data/block_cost_config.py` - Manually add block costs - `backend/integrations/credentials_store.py` - Add default credentials - `backend/integrations/providers.py` - Register new providers - `backend/integrations/oauth/__init__.py` - Register OAuth handlers - `backend/integrations/webhooks/__init__.py` - Register webhook managers This creates significant friction for developers, increases the chance of configuration errors, and makes the platform difficult to scale. ### Solution This PR introduces a **Block Development SDK** that provides: - Single import for all block development needs: `from backend.sdk import *` - Automatic registration of all block configurations - Zero external file modifications required - Provider-based configuration with inheritance ### Changes 🏗️ #### 1. **New SDK Module** (`backend/sdk/`) - **`__init__.py`**: Unified exports of 68+ block development components - **`registry.py`**: Central auto-registration system for all block configurations - **`builder.py`**: `ProviderBuilder` class for fluent provider configuration - **`provider.py`**: Provider configuration management - **`cost_integration.py`**: Automatic cost application system #### 2. **Provider Builder Pattern** ```python # Configure once, use everywhere my_provider = ( ProviderBuilder("my-service") .with_api_key("MY_SERVICE_API_KEY", "My Service API Key") .with_base_cost(5, BlockCostType.RUN) .build() ) ``` #### 3. **Automatic Cost System** - Provider base costs automatically applied to all blocks using that provider - Override with `@cost` decorator for block-specific pricing - Tiered pricing support with cost filters #### 4. **Dynamic Provider Support** - Modified `ProviderName` enum to accept any string via `_missing_` method - No more manual enum updates for new providers #### 5. **Application Integration** - Added `sync_all_provider_costs()` to `initialize_blocks()` for automatic cost registration - Maintains full backward compatibility with existing blocks #### 6. **Comprehensive Examples** (`backend/blocks/examples/`) - `simple_example_block.py` - Basic block structure - `example_sdk_block.py` - Provider with credentials - `cost_example_block.py` - Various cost patterns - `advanced_provider_example.py` - Custom API clients - `example_webhook_sdk_block.py` - Webhook configuration #### 7. **Extensive Testing** - 6 new test modules with 30+ test cases - Integration tests for all SDK features - Cost calculation verification - Provider registration tests ### Before vs After **Before SDK:** ```python # 1. Multiple complex imports from backend.data.block import Block, BlockCategory, BlockOutput from backend.data.model import SchemaField, CredentialsField # ... many more imports # 2. Update block_cost_config.py BLOCK_COSTS[MyBlock] = [BlockCost(...)] # 3. Update credentials_store.py DEFAULT_CREDENTIALS.append(...) # 4. Update providers.py enum # 5. Update oauth/__init__.py # 6. Update webhooks/__init__.py ``` **After SDK:** ```python from backend.sdk import * # Everything configured in one place my_provider = ( ProviderBuilder("my-service") .with_api_key("MY_API_KEY", "My API Key") .with_base_cost(10, BlockCostType.RUN) .build() ) class MyBlock(Block): class Input(BlockSchema): credentials: CredentialsMetaInput = my_provider.credentials_field() data: String = SchemaField(description="Input data") class Output(BlockSchema): result: String = SchemaField(description="Result") # That's it\! No external files to modify ``` ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Created new blocks using SDK pattern with provider configuration - [x] Verified automatic cost registration for provider-based blocks - [x] Tested cost override with @cost decorator - [x] Confirmed custom providers work without enum modifications - [x] Verified all example blocks execute correctly - [x] Tested backward compatibility with existing blocks - [x] Ran all SDK tests (30+ tests, all passing) - [x] Created blocks with credentials and verified authentication - [x] Tested webhook block configuration - [x] Verified application startup with auto-registration #### For configuration changes: - [x] `.env.example` is updated or already compatible with my changes (no changes needed) - [x] `docker-compose.yml` is updated or already compatible with my changes (no changes needed) - [x] I have included a list of my configuration changes in the PR description (under **Changes**) ### Impact - **Developer Experience**: Block creation time reduced from hours to minutes - **Maintainability**: All block configuration in one place - **Scalability**: Support hundreds of blocks without enum updates - **Type Safety**: Full IDE support with proper type hints - **Testing**: Easier to test blocks in isolation --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com> |
||
|
|
97e72cb485 |
feat(backend): Make execution engine async-first (#10138)
This change introduced async execution for blocks and the execution engine. Paralellism will be achieved through a single process asynchronous execution instead of process concurrency. ### Changes 🏗️ * Support async execution for the graph executor * Removed process creation for node execution * Update all blocks to support async executions ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Manual graph executions, tested many of the impacted blocks. |
||
|
|
3771a0924c |
fix(backend): Update deprecated code caused by upgrades (#9758)
This series of upgrades: https://github.com/significant-gravitas/autogpt/pull/9727 https://github.com/Significant-Gravitas/AutoGPT/pull/9728 https://github.com/Significant-Gravitas/AutoGPT/pull/9560 Caused some code in the repo being deprecated, this PR addresses those. ### Changes 🏗️ Fix pydantic config, usage of field, usage of proper prisma `CreateInput` type, pytest loop-scope. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] CI, manual test on running some agents. --------- Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co> |
||
|
|
ac8a466cda |
feat(platform): Add username+password credentials type; fix email and reddit blocks (#9113)
<!-- Clearly explain the need for these changes: --> Update and adds a basic credential field for use in integrations like reddit ### Changes 🏗️ <!-- Concisely describe all of the changes made in this pull request: --> - Reddit - Drops the Username and Password for reddit from the .env - Updates Reddit block with modern provider and credential system - moves clientid and secret to reading from `Settings().secrets` rather than input on the block - moves user agent to `Settings().config` - SMTP - update the block to support user password and modern credentials - Add `UserPasswordCredentials` - Default API key expiry to None explicitly to help type cohesion - add `UserPasswordCredentials` with a weird form of `bearer` which we ideally remove because `basic` is a more appropriate name. This is dependent on `Webhook _base` allowing a subset of `Credentials` - Update `Credentials` and `CredentialsType` - Fix various `OAuth2Credentials | APIKeyCredentials` -> `Credentials` mismatches between base and derived classes - Replace `router/@post(create_api_key_credentials)` with `create_credentials` which now takes a credential and is discriminated by `type` provided by the credential - UI/Frontend - Updated various pages to have saved credential types, icons, and text for User Pass Credentials - Update credential input to have an input/modals/selects for user/pass combos - Update the types to support having user/pass credentials too (we should make this more centralized) - Update Credential Providres to support user_password - Update `client.ts` to support the new streamlined credential creation method and endpoint - DX - Sort the provider names **again** TODO: - [x] Reactivate Conditionally Disabling Reddit ~~- [ ] Look into moving Webhooks base to allow subset of `Credentials` rather than requiring all webhooks to support the input of all valid `Credentials` types~~ Out of scope - [x] Figure out the `singleCredential` calculator in `credentials-input.tsx` so that it also respects User Pass credentials and isn't a logic mess ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Test with agents --------- Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co> |
||
|
|
996efaf4fc |
fix: check if linear is enabled before showing blocks (#9338)
<!-- Clearly explain the need for these changes: --> Linear blocks show up even if oauth isn't configured ### Changes 🏗️ disables the linear blocks if oauth isn't configured <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] checked block list with and without oauth configured |
||
|
|
56612f16cf |
feat(platform): Linear integration (#9269)
<!-- Clearly explain the need for these changes: --> I want to be able to do stuff with linear automatically ### Changes 🏗️ - Adds all the backing details to add linear auth and API access with oauth (and prep for API key) <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [ ] I have clearly listed my changes in the PR description - [ ] I have made a test plan - [ ] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [ ] ... <details> <summary>Example test plan</summary> - [ ] Create from scratch and execute an agent with at least 3 blocks - [ ] Import an agent from file upload, and confirm it executes correctly - [ ] Upload agent to marketplace - [ ] Import an agent from marketplace and confirm it executes correctly - [ ] Edit an agent from monitor, and confirm it executes correctly </details> #### For configuration changes: - [ ] `.env.example` is updated or already compatible with my changes - [ ] `docker-compose.yml` is updated or already compatible with my changes - [ ] I have included a list of my configuration changes in the PR description (under **Changes**) <details> <summary>Examples of configuration changes</summary> - Changing ports - Adding new services that need to communicate with each other - Secrets or environment variable changes - New or infrastructure changes such as databases </details> --------- Co-authored-by: Aarushi <50577581+aarushik93@users.noreply.github.com> |