Skip to content

Conversation

@theUpsider
Copy link

This pull request introduces new tab group management capabilities to the browser agent, allowing users to create, list, and organize tabs into groups. The changes include three new tools for tab group operations, updates to the agent's tool registration and prompt documentation, and a minor version bump in the manifest. These improvements make it easier to automate and structure browser workflows involving multiple tabs.

Addresses browseros-ai/BrowserOS#200

Tab Group Management Tools:

  • Added CreateTabGroupTool, enabling creation of tab groups with specified names and colors, and optional immediate tab assignment.
  • Added ListTabGroupsTool, which lists all existing tab groups with their IDs, names, colors, and tab counts.
  • Added AddTabToGroupTool, allowing a specific tab to be moved into an existing tab group by ID.

Integration and Registration:

  • Registered the new tab group tools in BrowserAgent.ts, ensuring they are available for use and included in dynamic tool descriptions. [1] [2] [3] [4]

Prompt and Documentation Updates:

  • Updated BrowserAgent.prompt.ts to document the new tab group operations, including examples and tool descriptions for improved agent guidance. [1] [2] [3] [4]

Miscellaneous:

  • Bumped the extension version in manifest.json from 50.1.0.2 to 50.1.1.0.

Video:
Screencast from 2025-11-13 23-47-55.webm

Image
image

@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

CLA Assistant Lite bot ✅ All contributors have signed the CLA. Thank you for helping make BrowserOS better!
Posted by the CLA Assistant Lite bot.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 13, 2025

Greptile Overview

Greptile Summary

Adds three new tools (create_tab_group, list_tab_groups, add_tab_to_group) to enable automated tab organization through the browser agent, with proper integration into BrowserAgent and comprehensive prompt documentation.

Key Changes:

  • Implemented CreateTabGroupTool to create named, colored tab groups with optional tab assignment
  • Implemented ListTabGroupsTool to query existing groups with metadata and tab counts
  • Implemented AddTabToGroupTool to move tabs into existing groups
  • Registered all three tools in BrowserAgent.ts and updated to use dynamic tool descriptions from ToolManager
  • Updated agent prompt with tool signatures, examples, and best practices for tab organization workflows
  • Version bumped to 50.1.1.0

Issues Found:

  • Critical bug in CreateTabGroupTool.ts:35 where chrome.tabs.getCurrent() will return undefined in extension contexts, causing incorrect fallback behavior

Confidence Score: 3/5

  • This PR has one critical bug that will cause incorrect behavior but is otherwise well-implemented
  • The implementation follows established patterns and includes proper validation, error handling, and documentation. However, CreateTabGroupTool uses chrome.tabs.getCurrent() which returns undefined in extension contexts (background scripts, side panels), causing the fallback logic to execute every time even when tabIds are provided. This is a critical bug that will affect the tool's primary use case. The other two tools are solid implementations.
  • src/lib/tools/CreateTabGroupTool.ts requires fixing the chrome.tabs.getCurrent() call on line 35

Important Files Changed

File Analysis

Filename Score Overview
src/lib/tools/CreateTabGroupTool.ts 3/5 Added new tool to create tab groups with name and color; has critical bug with chrome.tabs.getCurrent() that will cause fallback logic to execute incorrectly
src/lib/tools/ListTabGroupsTool.ts 5/5 Added tool to list all tab groups with their metadata; implementation is clean and handles errors gracefully
src/lib/tools/AddTabToGroupTool.ts 5/5 Added tool to add tabs to existing groups; includes proper validation of both tab and group existence
src/lib/agent/BrowserAgent.ts 5/5 Registered three new tab group tools and switched to dynamic tool descriptions from ToolManager

Sequence Diagram

sequenceDiagram
    participant User
    participant Agent as BrowserAgent
    participant LTG as ListTabGroupsTool
    participant CTG as CreateTabGroupTool
    participant ATG as AddTabToGroupTool
    participant Chrome as Chrome API

    User->>Agent: "Organize my tabs"
    Agent->>LTG: list_tab_groups()
    LTG->>Chrome: chrome.tabGroups.query({})
    Chrome-->>LTG: existing groups[]
    LTG->>Chrome: chrome.tabs.query({groupId})
    Chrome-->>LTG: tabs in each group
    LTG-->>Agent: groups with tab counts

    Agent->>CTG: create_tab_group(name, color, tabIds?)
    CTG->>Chrome: chrome.tabs.query({})
    Chrome-->>CTG: validate tabIds exist
    CTG->>Chrome: chrome.tabs.group({tabIds})
    Chrome-->>CTG: groupId
    CTG->>Chrome: chrome.tabGroups.update(groupId, {title, color})
    Chrome-->>CTG: success
    CTG-->>Agent: group created with ID

    Agent->>ATG: add_tab_to_group(tabId, groupId)
    ATG->>Chrome: chrome.tabs.get(tabId)
    Chrome-->>ATG: tab details
    ATG->>Chrome: chrome.tabGroups.query({})
    Chrome-->>ATG: validate groupId exists
    ATG->>Chrome: chrome.tabs.group({groupId, tabIds})
    Chrome-->>ATG: success
    ATG-->>Agent: tab added to group

    Agent-->>User: "Tabs organized into groups"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@theUpsider
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

… group tools

chrome.tabs.getCurrent() returns undefined in extension contexts like
background scripts and side panels. Using chrome.tabs.query() with
active: true and currentWindow: true properly retrieves the current
active tab in these contexts.

Fixes bug reported in PR browseros-ai#198 review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant