Skip to content

fix(platform): Improve Linear Search Block [SECRT-1880]#11967

Merged
Torantulino merged 5 commits intodevfrom
otto/secrt-1880-improve-linear-search-block
Feb 4, 2026
Merged

fix(platform): Improve Linear Search Block [SECRT-1880]#11967
Torantulino merged 5 commits intodevfrom
otto/secrt-1880-improve-linear-search-block

Conversation

@Otto-AGPT
Copy link
Contributor

Summary

Implements 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

  • Format/lint checks pass
  • Unit test fixtures updated

Resolves SECRT-1880

SECRT-1880

- Add state field (with id, name, type) to Issue model for duplicate detection
- Add State model for workflow state information
- Update try_search_issues() to return createdAt, state, project, and assignee
- Add max_results parameter (default 10, was ~50) to reduce token usage
- Add team_name filter to scope results to specific team
- Fix try_get_team_by_name() to return descriptive error when team not found
- Add error output to LinearSearchIssuesBlock for graceful error handling
- Add categories to LinearSearchIssuesBlock (PRODUCTIVITY, ISSUE_TRACKING)
@Otto-AGPT Otto-AGPT requested a review from a team as a code owner February 4, 2026 14:31
@Otto-AGPT Otto-AGPT requested review from Bentlybro and Pwuts and removed request for a team February 4, 2026 14:31
@github-project-automation github-project-automation bot moved this to 🆕 Needs initial review in AutoGPT development kanban Feb 4, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

The Linear search block now supports limiting results and optional team filtering. The API and Issue model were expanded to include state, createdAt, project, and assignee. Team name resolution was added to convert human-friendly names to Linear team IDs.

Changes

Cohort / File(s) Summary
API Layer
autogpt_platform/backend/backend/blocks/linear/_api.py
Added defensive check in try_get_team_by_name (raises 404 if no nodes). Extended try_search_issues signature to accept max_results and optional team_id; GraphQL query now requests createdAt, state, project, and assignee; returns Issue objects built from expanded node data.
Block Logic & Tests
autogpt_platform/backend/backend/blocks/linear/issues.py
Added max_results (int, 1–100, default 10) and optional team_name to block Input; added error to Output. search_issues and run updated to resolve team_nameteam_id via client and pass max_results/team_id to API client. Test fixtures updated (identifiers, createdAt, state).
Data Models
autogpt_platform/backend/backend/blocks/linear/models.py
Introduced State class (id, name, optional type) and added optional state field to Issue.
Documentation
docs/integrations/README.md, docs/integrations/block-integrations/linear/issues.md
Relocated "Linear Search Issues" entry and updated docs to include max_results and team_name, clarify error wording, describe returned fields (state, createdAt, project, assignee) and note result limiting to control token usage.

Sequence Diagram

sequenceDiagram
    actor User as "User"
    participant Block as "LinearSearchBlock"
    participant Client as "LinearAPIClient"
    participant Linear as "Linear GraphQL API"

    User->>Block: search_issues(term, team_name?, max_results?)
    alt team_name provided
        Block->>Client: try_get_team_by_name(team_name)
        Client->>Linear: query teams by name
        Linear-->>Client: team nodes
        Client-->>Block: team_id
    else no team_name
        Block->>Block: team_id = None
    end
    Block->>Client: try_search_issues(term, first=max_results, teamId=team_id)
    Client->>Linear: query issues (term, first, teamId) requesting state, createdAt, project, assignee
    Linear-->>Client: issue nodes with expanded fields
    Client-->>Block: list[Issue] (includes state, createdAt, project, assignee)
    Block-->>User: search results
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hop, hop through Linear's lane tonight,
I fetch team IDs and prune the sight,
Ten tidy issues with states and dates,
Projects and assignees join the plates,
The rabbit smiles — duplicate hunts light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(platform): Improve Linear Search Block [SECRT-1880]' is specific, clear, and accurately reflects the main change of enhancing the Linear search block with state, team filtering, and result limiting capabilities.
Description check ✅ Passed The description is comprehensive and related to the changeset, documenting all changes to models, API client, and block implementation, including breaking and non-breaking changes.
Linked Issues check ✅ Passed The changes directly address all five objectives from SECRT-1880: adding state field [models.py], populating createdAt/project/assignee [_api.py], reducing default results to 10 with max_results parameter [issues.py], and adding team_name filter parameter [_api.py, issues.py].
Out of Scope Changes check ✅ Passed All changes are within scope of SECRT-1880. The additions of State model, max_results parameter, team filtering, error field, and documentation updates align with the linked issue requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch otto/secrt-1880-improve-linear-search-block

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 37264fc and 356ef41.

📒 Files selected for processing (1)
  • docs/integrations/block-integrations/linear/issues.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/integrations/block-integrations/linear/issues.md
⏰ 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). (6)
  • GitHub Check: Seer Code Review
  • GitHub Check: types
  • GitHub Check: Check PR Status
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.11)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 4, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (1)
docs/integrations/block-integrations/linear/issues.md (1)

92-96: 🛠️ Refactor suggestion | 🟠 Major

Update "How it works" section to reflect new filtering and limiting capabilities.

The section currently doesn't mention the max_results parameter or team_name filtering, which are central to the improvements in this PR. As per coding guidelines, the "How It Works" section should include 1-2 paragraphs describing processing logic, validation, and error handling.

📝 Proposed enhancement with processing details
 <!-- MANUAL: how_it_works -->
-This block searches for issues in Linear using a text query. It searches across issue titles, descriptions, and other fields to find matching issues.
+This block searches for issues in Linear using a text query. It searches across issue titles, descriptions, and other fields to find matching issues. You can limit the number of results returned using the `max_results` parameter (default: 10, max: 100) to control token consumption and response size.
 
-Returns a list of issues matching the search term.
+Optionally filter results by team name to narrow searches to specific workspaces. If a team name is provided, the block resolves it to a team ID before searching. Returns matching issues with their state, creation date, project, and assignee information. If the search or team resolution fails, an error message is returned.
 <!-- END MANUAL -->

As per coding guidelines, the "How It Works" section should provide a technical explanation including processing logic, validation, and error handling.

🧹 Nitpick comments (1)
docs/integrations/block-integrations/linear/issues.md (1)

103-103: Document the default value and valid range for max_results.

Based on the PR objectives, the default is 10 and the valid range is 1–100. Including this information helps users understand the behavior without needing to consult additional documentation or test the block.

📝 Proposed documentation enhancement
-| max_results | Maximum number of results to return | int | No |
+| max_results | Maximum number of results to return (default: 10, range: 1-100) | int | No |
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f897e8d and 11fe703.

📒 Files selected for processing (2)
  • docs/integrations/README.md
  • docs/integrations/block-integrations/linear/issues.md
🧰 Additional context used
📓 Path-based instructions (2)
docs/integrations/**/*.md

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/integrations/**/*.md: Provide a technical explanation of how the block functions in the 'How It Works' section, including 1-2 paragraphs describing processing logic, validation, error handling, or edge cases, with code examples in backticks when helpful
Provide exactly 3 practical use cases in the 'Use Case' section, formatted with bold headings followed by short one-sentence descriptions

Files:

  • docs/integrations/block-integrations/linear/issues.md
  • docs/integrations/README.md
docs/**/*.md

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/**/*.md: Keep documentation descriptions concise and action-oriented, focusing on practical, real-world scenarios
Use consistent terminology with other blocks and avoid overly technical jargon unless necessary in documentation

Files:

  • docs/integrations/block-integrations/linear/issues.md
  • docs/integrations/README.md
⏰ 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). (6)
  • GitHub Check: Seer Code Review
  • GitHub Check: types
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
  • GitHub Check: test (3.11)
  • GitHub Check: Check PR Status
🔇 Additional comments (1)
docs/integrations/README.md (1)

573-573: LGTM! Correct categorization.

The relocation of "Linear Search Issues" to the "Issue Tracking" section accurately reflects its functionality and improves documentation organization.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@Torantulino Torantulino requested a review from ntindle February 4, 2026 16:57
Otto-AGPT and others added 2 commits February 4, 2026 16:57
- Update 'How it works' section to describe max_results and team_name filtering
- Add default value and range to max_results input description
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (1)
docs/integrations/block-integrations/linear/issues.md (1)

1-122: ⚠️ Potential issue | 🔴 Critical

Critical: Documentation out of sync with code – run the block docs generator.

The CI pipeline failed with: "Documentation is out of sync with code. Run the block docs generator to fix."

You must run the documentation generator script before merging:

poetry run python scripts/generate_block_docs.py

This ensures the documentation accurately reflects the block's actual implementation.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 11fe703 and 37264fc.

📒 Files selected for processing (1)
  • docs/integrations/block-integrations/linear/issues.md
🧰 Additional context used
📓 Path-based instructions (2)
docs/integrations/**/*.md

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/integrations/**/*.md: Provide a technical explanation of how the block functions in the 'How It Works' section, including 1-2 paragraphs describing processing logic, validation, error handling, or edge cases, with code examples in backticks when helpful
Provide exactly 3 practical use cases in the 'Use Case' section, formatted with bold headings followed by short one-sentence descriptions

Files:

  • docs/integrations/block-integrations/linear/issues.md
docs/**/*.md

📄 CodeRabbit inference engine (docs/CLAUDE.md)

docs/**/*.md: Keep documentation descriptions concise and action-oriented, focusing on practical, real-world scenarios
Use consistent terminology with other blocks and avoid overly technical jargon unless necessary in documentation

Files:

  • docs/integrations/block-integrations/linear/issues.md
🪛 GitHub Actions: Block Documentation Sync Check
docs/integrations/block-integrations/linear/issues.md

[error] 1-1: Documentation is out of sync with code. Run the block docs generator to fix. Command that failed: poetry run python scripts/generate_block_docs.py

⏰ 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). (6)
  • GitHub Check: Seer Code Review
  • GitHub Check: types
  • GitHub Check: test (3.11)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.13)
  • GitHub Check: Check PR Status
🔇 Additional comments (2)
docs/integrations/block-integrations/linear/issues.md (2)

93-95: Excellent technical documentation!

The "How It Works" section effectively covers processing logic, validation (max_results range), error handling (search and team resolution failures), and edge cases (team name resolution). The two-paragraph structure with code examples in backticks aligns perfectly with the coding guidelines. As per coding guidelines, the technical explanation should include 1-2 paragraphs describing processing logic, validation, error handling, or edge cases, with code examples in backticks when helpful.


114-119: Use cases are well-structured.

The three use cases follow the required format with bold headings and concise one-sentence descriptions, focusing on practical scenarios (duplicate detection, related issue lookup, and quick keyword search). As per coding guidelines, the Use Case section should provide exactly 3 practical use cases formatted with bold headings followed by short one-sentence descriptions.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@Torantulino
Copy link
Member

@claude please regenerate the block docs to satisfy the CI Check

@claude
Copy link
Contributor

claude bot commented Feb 4, 2026

Claude finished @Torantulino's task in 1m 49s —— View job


Regenerated Block Documentation

  • Read repo setup instructions (CLAUDE.md)
  • Locate and run the block docs generator script
  • Verify docs are in sync (--check passes)
  • Commit and push updated docs

Ran poetry run python scripts/generate_block_docs.py which updated docs/integrations/block-integrations/linear/issues.md to match the code. The change was minor — the max_results input description was manually edited in a prior commit to include (default: 10, range: 1-100), but the auto-generator derives that field from code where the description is just "Maximum number of results to return". The doc is now in sync and the CI check should pass.
|

@Torantulino
Copy link
Member

Tested in dev cloud environment and working, good to merge!

@Torantulino Torantulino enabled auto-merge February 4, 2026 17:59
@github-project-automation github-project-automation bot moved this from 🆕 Needs initial review to 👍🏼 Mergeable in AutoGPT development kanban Feb 4, 2026
@Torantulino Torantulino added this pull request to the merge queue Feb 4, 2026
Merged via the queue into dev with commit 4f908d5 Feb 4, 2026
25 checks passed
@Torantulino Torantulino deleted the otto/secrt-1880-improve-linear-search-block branch February 4, 2026 23:17
@github-project-automation github-project-automation bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation platform/blocks size/l

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants