Skip to content

Conversation

@PratyushSingh2002
Copy link
Contributor

This PR adds a new block called Concatenate Lists under the Lists category.
It takes two or more lists as input and combines them into a single list output.

Changes made

Added ConcatenateListsBlock class

Defined input and output schemas

Added validation to ensure all inputs are lists

Used itertools.chain for efficient list merging

Handled invalid input gracefully with error messages

ntindle and others added 5 commits October 31, 2025 12:28
…11.1 (Significant-Gravitas#11294)

- Significant-Gravitas#11273

- Bump `apscheduler` to v3.11.1 which contains a fix for the issue

- [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] "It's a rather ugly solution but the test proves that it works."
~the maintainer
  - [x] CI passes
### Changes 🏗️

- Prevent removing progress of user onboarding tasks by merging arrays
on the backend instead of replacing them
- New endpoint for onboarding reset

### 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] Tasks are not being reset
  - [x] `/onboarding/reset` works
@PratyushSingh2002 PratyushSingh2002 requested a review from a team as a code owner November 3, 2025 00:55
@PratyushSingh2002 PratyushSingh2002 requested review from Bentlybro and majdyz and removed request for a team November 3, 2025 00:55
@github-project-automation github-project-automation bot moved this to 🆕 Needs initial review in AutoGPT development kanban Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

This PR targets the master branch but does not come from dev or a hotfix/* branch.

Automatically setting the base branch to dev.

@netlify
Copy link

netlify bot commented Nov 3, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 8f14e86
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/6907fd72ddae3c0008c8472a
@github-actions github-actions bot changed the base branch from master to dev November 3, 2025 00:55
@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Nov 3, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Schema-Run Mismatch

The input schema defines a single list under key lists, but run expects a positional lists argument rather than reading from a structured inputs dict. Verify this matches the framework’s expected run signature and IO handling so the block receives inputs correctly.

def run(self, lists: list) -> dict:
    """Merge multiple lists into a single list."""
    try:
        # Validate that the input is a list
        if not isinstance(lists, list):
            raise ValueError("Input must be a list of lists")
Error Contract

On failure, run returns {"error": ...} which does not match the declared output schema (only result is defined). Confirm whether errors should raise exceptions or conform to a standardized error field to avoid downstream schema violations.

except Exception as e:
    return {"error": str(e)}
Message Clarity

Validation messages could include the actual type encountered to aid debugging (e.g., include type(lists).__name__ or index of offending element) while keeping them concise.

if not isinstance(lists, list):
    raise ValueError("Input must be a list of lists")

# Ensure every element inside is also a list
for lst in lists:
    if not isinstance(lst, list):
        raise ValueError("All elements inside 'lists' must be lists")
@deepsource-io
Copy link

deepsource-io bot commented Nov 3, 2025

Here's the code health analysis summary for commits a02b8d9..8f14e86. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
❗ 3 occurences introduced
🎯 3 occurences resolved
View Check ↗
DeepSource Python LogoPython✅ Success
❗ 7 occurences introduced
🎯 4 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.
@AutoGPT-Agent
Copy link

Thank you for contributing to the project with the new ConcatenateListsBlock! However, there are several issues that need to be addressed before this PR can be merged:

  1. Out-of-scope changes: Your PR includes significant changes to onboarding functionality, API endpoints, and frontend components that aren't related to implementing the ConcatenateListsBlock. These include:

    • Adding reset_user_onboarding functionality
    • Modifying update_user_onboarding behavior
    • Adding a new API endpoint for onboarding reset
    • Frontend changes for onboarding reset
    • Package version updates

    Please either:

    • Remove these unrelated changes and submit them in a separate PR, or
    • Update your PR title and description to accurately reflect all the changes being made
  2. PR title format: Your title should follow the conventional commit format with type and scope, for example: feat(blocks): Implement ConcatenateListsBlock

  3. Missing checklist: While a checklist can be omitted for non-material changes, your PR introduces new functionality that should have a test plan. Please include the checklist from the template with your test plan.

The ConcatenateListsBlock implementation itself looks good, but we need to resolve these process issues before merging.

@AutoGPT-Agent
Copy link

Thank you for implementing the ConcatenateListsBlock! The implementation of the block itself looks good, but there are several issues with this PR that need to be addressed before it can be merged:

  1. PR Template: Please include the required checklist from the PR template, including your test plan for how you verified the block works correctly.

  2. Out of Scope Changes: This PR includes several changes that are unrelated to the ConcatenateListsBlock implementation:

    • Significant changes to onboarding functionality (reset_user_onboarding function, updates to update_user_onboarding)
    • Changes to frontend onboarding reset page
    • Dependency updates (apscheduler)
    • Change to llm.py

    Please remove these unrelated changes and submit them in separate PRs. Each PR should focus on a single coherent change.

  3. PR Title Format: The title should follow the conventional commit format. For this PR, it should be something like: feat(platform/blocks): implement ConcatenateListsBlock

The block implementation itself looks good - I like the use of itertools.chain for efficiency and the proper validation of inputs. Once the above issues are addressed, this would be ready to merge.

Comment on lines +13 to +23
description="List of lists to concatenate",
),
},
output_schema={
"result": SchemaField(
type=BlockIOType.LIST,
description="Concatenated list result",
),
},
)
class ConcatenateListsBlock(BlockIOBase):
Copy link

Choose a reason for hiding this comment

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

Bug: Non-existent imports and base class prevent module loading.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The module attempts to import BlockIOBase, BlockIOType, and block from backend.data.block_decorator, but these entities do not exist in the codebase. BlockIOBase is also used as the base class for ConcatenateListsBlock. This will cause an ImportError or ModuleNotFoundError when Python attempts to load the module, preventing the block from being registered.

💡 Suggested Fix

Update imports to reference existing modules and classes, such as Block from backend.data.block. Ensure the base class ConcatenateListsBlock inherits from Block.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: autogpt_platform/backend/backend/blocks/concatenate_lists_block.py#L1-L23

Potential issue: The module attempts to import `BlockIOBase`, `BlockIOType`, and `block`
from `backend.data.block_decorator`, but these entities do not exist in the codebase.
`BlockIOBase` is also used as the base class for `ConcatenateListsBlock`. This will
cause an `ImportError` or `ModuleNotFoundError` when Python attempts to load the module,
preventing the block from being registered.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +16 to +21
output_schema={
"result": SchemaField(
type=BlockIOType.LIST,
description="Concatenated list result",
),
},
Copy link

Choose a reason for hiding this comment

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

Bug: Schema definitions are dictionaries, but validation expects Pydantic models.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The input_schema and output_schema are defined as dictionaries within ConcatenateListsBlock. However, the block validation logic in backend/blocks/__init__.py expects these schemas to be Pydantic model classes with a .model_fields attribute. Attempting to access block.output_schema.model_fields on a dictionary will raise an AttributeError during block registration.

💡 Suggested Fix

Redefine input_schema and output_schema as Pydantic BlockSchemaInput and BlockSchemaOutput classes, respectively, following the established pattern for other blocks.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: autogpt_platform/backend/backend/blocks/concatenate_lists_block.py#L16-L21

Potential issue: The `input_schema` and `output_schema` are defined as dictionaries
within `ConcatenateListsBlock`. However, the block validation logic in
`backend/blocks/__init__.py` expects these schemas to be Pydantic model classes with a
`.model_fields` attribute. Attempting to access `block.output_schema.model_fields` on a
dictionary will raise an `AttributeError` during block registration.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +31 to +41
# Ensure every element inside is also a list
for lst in lists:
if not isinstance(lst, list):
raise ValueError("All elements inside 'lists' must be lists")

# Merge efficiently using itertools
result = list(chain.from_iterable(lists))
return {"result": result}

except Exception as e:
return {"error": str(e)}
Copy link

Choose a reason for hiding this comment

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

Bug: run method returns a dict, but framework expects an async generator.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The run method of ConcatenateListsBlock is defined as a synchronous function that returns a dictionary. The framework's Block.execute() method, however, expects run to be an async generator that yields tuples of ("output_name", output_data). This mismatch will cause a TypeError when Block.execute() attempts to async for over the dictionary returned by run.

💡 Suggested Fix

Modify the run method to be an async generator that yields output tuples, aligning with the Block.execute() interface.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: autogpt_platform/backend/backend/blocks/concatenate_lists_block.py#L24-L41

Potential issue: The `run` method of `ConcatenateListsBlock` is defined as a synchronous
function that returns a dictionary. The framework's `Block.execute()` method, however,
expects `run` to be an `async` generator that `yield`s tuples of `("output_name",
output_data)`. This mismatch will cause a `TypeError` when `Block.execute()` attempts to
`async for` over the dictionary returned by `run`.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment