Skip to content

πŸ› fix: fixed the agent group builder tools excaution edge case crash#11735

Merged
ONLY-yours merged 1 commit intonextfrom
fix/GroupBuilderCrash
Jan 23, 2026
Merged

πŸ› fix: fixed the agent group builder tools excaution edge case crash#11735
ONLY-yours merged 1 commit intonextfrom
fix/GroupBuilderCrash

Conversation

@ONLY-yours
Copy link
Copy Markdown
Member

@ONLY-yours ONLY-yours commented Jan 23, 2026

πŸ’» Change Type

fix: LOBE-3482

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ‘· build
  • ⚑️ perf
  • βœ… test
  • πŸ“ docs
  • πŸ”¨ chore

πŸ”— Related Issue

πŸ”€ Description of Change

πŸ§ͺ How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

πŸ“Έ Screenshots / Videos

Before After
... ...

πŸ“ Additional Information

Summary by Sourcery

Handle optional council member and agent lists to prevent runtime crashes when these arrays are undefined.

Bug Fixes:

  • Guard council member rendering and divider logic against undefined member arrays in the conversation council list.
  • Guard batch agent avatar rendering against undefined display agent arrays in the agent builder inspector.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
lobehub Building Building Preview, Comment Jan 23, 2026 9:28am

Request Review

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 23, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Jan 23, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Guards two list-rendering components against undefined array values by adding optional chaining to map and length access, preventing runtime crashes when agent/member collections are missing.

Flow diagram for safeguarded list rendering in CouncilList and BatchCreateAgentsInspector

flowchart TD
  A[Render_CouncilList] --> B{members_is_defined?}
  B -- Yes --> C[Iterate_members_with_members_map]
  B -- No --> D[Skip_members_iteration]
  C --> E{member_is_truthy?}
  E -- Yes --> F[Render_CouncilMember_and_Divider]
  E -- No --> G[Return_null_for_this_entry]
  F --> H[CouncilList_render_complete]
  D --> H

  subgraph BatchCreateAgentsInspector_flow
    I[Render_BatchCreateAgentsInspector] --> J{displayInfo_is_defined?}
    J -- Yes --> K{displayAgents_is_defined?}
    K -- Yes --> L[Iterate_agents_with_displayAgents_map]
    K -- No --> M[Skip_agent_avatars]
    L --> N[Render_Avatar_for_each_agent]
    N --> O[BatchCreateAgentsInspector_render_complete]
    M --> O
    J -- No --> P[Skip_avatarGroup_section]
    P --> O
  end
Loading

File-Level Changes

Change Details Files
Prevent CouncilList from crashing when members is undefined or transiently missing.
  • Wrap members array access in optional chaining for map iteration to safely skip rendering when members is undefined.
  • Use optional chaining when comparing the current index against members length for rendering dividers, avoiding length access on an undefined array.
src/features/Conversation/Messages/AgentCouncil/components/CouncilList.tsx
Prevent BatchCreateAgents inspector from crashing when displayAgents is undefined.
  • Add optional chaining to displayAgents map call so rendering safely no-ops when displayAgents is absent.
packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ONLY-yours ONLY-yours merged commit 5de4742 into next Jan 23, 2026
17 of 20 checks passed
@ONLY-yours ONLY-yours deleted the fix/GroupBuilderCrash branch January 23, 2026 09:28
@dosubot dosubot bot added the πŸ› Bug label Jan 23, 2026
@gru-agent
Copy link
Copy Markdown
Contributor

gru-agent bot commented Jan 23, 2026

⏳ Processing in progress

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • If members can be undefined, the minWidth calculation (members.length) above the map should also be guarded or given a safe default (e.g. members?.length ?? 0) to avoid the same crash in a different spot.
  • Rather than sprinkling optional chaining (members?.map, members?.length) in the render, consider normalizing members to an empty array at the top of the component or in the props default to keep the render logic simpler and more predictable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `members` can be undefined, the `minWidth` calculation (`members.length`) above the map should also be guarded or given a safe default (e.g. `members?.length ?? 0`) to avoid the same crash in a different spot.
- Rather than sprinkling optional chaining (`members?.map`, `members?.length`) in the render, consider normalizing `members` to an empty array at the top of the component or in the props default to keep the render logic simpler and more predictable.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

@lobehubbot
Copy link
Copy Markdown
Member

❀️ Great PR @ONLY-yours ❀️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

lobehubbot pushed a commit that referenced this pull request Jan 23, 2026
## [Version 2.0.0-next.348](v2.0.0-next.347...v2.0.0-next.348)
<sup>Released on **2026-01-23**</sup>

#### πŸ› Bug Fixes

- **copilot**: History popover not refreshing when agentId changes.
- **misc**: Fixed the agent group builder tools excaution edge case crash, fixed the group topic copy not right.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **copilot**: History popover not refreshing when agentId changes, closes [#11731](#11731) ([64f39e7](64f39e7))
* **misc**: Fixed the agent group builder tools excaution edge case crash, closes [#11735](#11735) ([5de4742](5de4742))
* **misc**: Fixed the group topic copy not right, closes [#11730](#11730) ([282c1fb](282c1fb))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Copy Markdown
Member

πŸŽ‰ This PR is included in version 2.0.0-next.348 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

JamieStivala pushed a commit to jaworldwideorg/OneJA-Bot that referenced this pull request Jan 23, 2026
## [Version&nbsp;1.154.0](v1.153.1...v1.154.0)
<sup>Released on **2026-01-23**</sup>

#### β™» Code Refactoring

- **misc**: Migrate AI Rules to Claude Code Skills.

#### ✨ Features

- **database**: Extended async task with metadata and parent id, added index.
- **misc**: Remove NextAuth.

#### πŸ› Bug Fixes

- **copilot**: History popover not refreshing when agentId changes.
- **editor**: Prevent crash when toggling enableInputMarkdown setting.
- **home**: Use correct CreateGroupModal for session group creation.
- **model-runtime**: Handle null content in anthropic message builder.
- **ModelSelect**: Resolve tooltip hover causing popup to close.
- **pdf**: Ensure worker config before Document render.
- **store**: Delete message before regeneration.
- **misc**: Fix auto scroll, fix favorite refresh bug and group topic refresh issue, fixed the agent group builder tools excaution edge case crash, page content switch mismatch, when use market group, the group sys role was not used.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **misc**: Migrate AI Rules to Claude Code Skills, closes [lobehub#11737](https://github.com/jaworldwideorg/OneJA-Bot/issues/11737) ([346fc46](346fc46))

#### What's improved

* **database**: Extended async task with metadata and parent id, added index, closes [lobehub#11712](https://github.com/jaworldwideorg/OneJA-Bot/issues/11712) ([31d2f26](31d2f26))
* **misc**: Remove NextAuth, closes [lobehub#11732](https://github.com/jaworldwideorg/OneJA-Bot/issues/11732) ([1eff864](1eff864))

#### What's fixed

* **copilot**: History popover not refreshing when agentId changes, closes [lobehub#11731](https://github.com/jaworldwideorg/OneJA-Bot/issues/11731) ([64f39e7](64f39e7))
* **editor**: Prevent crash when toggling enableInputMarkdown setting, closes [lobehub#11755](https://github.com/jaworldwideorg/OneJA-Bot/issues/11755) ([ea5eed8](ea5eed8))
* **home**: Use correct CreateGroupModal for session group creation, closes [lobehub#11752](https://github.com/jaworldwideorg/OneJA-Bot/issues/11752) ([36bcc50](36bcc50))
* **model-runtime**: Handle null content in anthropic message builder, closes [lobehub#11756](https://github.com/jaworldwideorg/OneJA-Bot/issues/11756) ([539753a](539753a))
* **ModelSelect**: Resolve tooltip hover causing popup to close, closes [lobehub#11742](https://github.com/jaworldwideorg/OneJA-Bot/issues/11742) ([1b73f14](1b73f14))
* **pdf**: Ensure worker config before Document render, closes [lobehub#11746](https://github.com/jaworldwideorg/OneJA-Bot/issues/11746) ([ad34072](ad34072))
* **store**: Delete message before regeneration, closes [lobehub#11760](https://github.com/jaworldwideorg/OneJA-Bot/issues/11760) ([a8a6300](a8a6300))
* **misc**: Fix auto scroll, closes [lobehub#11734](https://github.com/jaworldwideorg/OneJA-Bot/issues/11734) ([892fa9f](892fa9f))
* **misc**: Fix favorite refresh bug and group topic refresh issue, closes [lobehub#11745](https://github.com/jaworldwideorg/OneJA-Bot/issues/11745) ([5d115ef](5d115ef))
* **misc**: Fixed the agent group builder tools excaution edge case crash, closes [lobehub#11735](https://github.com/jaworldwideorg/OneJA-Bot/issues/11735) ([5de4742](5de4742))
* **misc**: Page content switch mismatch, closes [lobehub#11758](https://github.com/jaworldwideorg/OneJA-Bot/issues/11758) ([fdc8f95](fdc8f95))
* **misc**: When use market group, the group sys role was not used, closes [lobehub#11739](https://github.com/jaworldwideorg/OneJA-Bot/issues/11739) ([afc76f9](afc76f9))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

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

Labels

πŸ› Bug released on @next size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants