Skip to content

Agent window is closed entirely on task completion, destroying user-created tabs opened inside it |Agent 窗口在任务结束时被整体关闭,导致用户在窗口内自建的标签页丢失 #57

Description

@iAstro

Environment / 环境信息

  • BrowserSkill CLI version: 0.1.8
  • BrowserSkill extension: connected (Chrome)
  • OS: macOS (Apple Silicon)

BrowserSkill CLI 版本 0.1.8;浏览器扩展已连接(Chrome);操作系统 macOS Apple Silicon

Summary / 问题描述

When the user opens their own additional tab(s) inside the BrowserSkill-controlled Agent Window during an agent task, BrowserSkill closes the entire Agent Window after the task completes, terminating those user-created tabs.

当用户在 Agent 任务进行期间,于 BrowserSkill 控制的 Agent 窗口中自行打开额外的标签页后,任务结束时代理会关闭整个 Agent 窗口,导致这些用户自建的标签页被一并终止。

BrowserSkill correctly returns borrowed tabs (tabs the user lent to the agent) to the user's window, but tabs the user creates themselves inside the Agent Window are treated as Agent-Window content and are destroyed together with the window.

BrowserSkill 会正确地将"借出"给代理的标签页(用户主动出借给代理的 tab)归还到用户窗口,但用户在 Agent 窗口内自行创建的标签页被视为窗口内容,会随窗口一同被销毁。

Steps to Reproduce / 复现步骤

  1. Start an agent task that uses BrowserSkill (e.g., open a page / navigate).
  1. 启动一个使用 BrowserSkill 的代理任务(例如打开页面或导航)。
  1. In the Agent Window that BrowserSkill opened, manually open a new tab (Cmd/Ctrl+T) and browse to a page you want to keep.
  1. 在 BrowserSkill 打开的 Agent 窗口中,手动新建一个标签页(Cmd/Ctrl+T)并浏览你想保留的页面。
  1. Let the agent task complete, or end the session.
  1. 等待代理任务完成,或主动结束会话。
  1. Observe that the entire Agent Window — including your self-opened tab — is closed.
  1. 观察发现整个 Agent 窗口(含你自建的标签页)被关闭。

Expected Behavior / 预期行为

On task completion, BrowserSkill should close only the tab(s) it borrowed/created for the task. If the Agent Window still contains any user-created tab, the window should be kept open (or those user tabs moved to a normal user window) so the user's browsing is not lost.

任务结束时,BrowserSkill 应仅关闭其为任务借出/创建的标签页。若 Agent 窗口中仍包含任何用户自建的标签页,则应保留该窗口(或将这些用户标签页移至普通用户窗口),以免用户的浏览内容丢失。

Actual Behavior / 实际行为

BrowserSkill closes the entire Agent Window regardless of whether the user has opened their own tabs inside it, destroying all user-created tabs in that window.

无论用户是否在 Agent 窗口内打开了自建标签页,BrowserSkill 都会关闭整个窗口,从而销毁窗口内所有用户自建的标签页。

Impact / 影响

Users who keep reference pages, docs, or other tabs open inside the Agent Window lose their browsing context unexpectedly after every task. This erodes trust in the project's "leave the rest of your browser alone" guarantee.

在 Agent 窗口中保留参考页、文档或其他标签页的用户,会在每次任务结束后意外丢失其浏览上下文。这削弱了产品"不干扰你其余浏览器"的承诺。

Suggested Fix / 建议修复方向

When tearing down a session, distinguish borrowed/agent-owned tabs from user-created tabs:

会话清理时,应区分"代理借用/创建的标签页"与"用户自建的标签页":

  • Before closing the Agent Window, scan its tabs; move any user-created tab to the user's last-focused (non-agent) window.
  • 关闭 Agent 窗口前先扫描其标签页;将任何用户自建标签页移至用户最近聚焦的(非 Agent)窗口。
  • Only close the window if no user-created tabs remain; otherwise keep it open.
  • 仅当不存在用户自建标签页时才关闭窗口,否则保留窗口。

Related / 相关

  • fix(runtime): clean up sessions on disconnect #17 fix(runtime): clean up sessions on disconnect returns borrowed tabs and keeps the window open only when a return fails; it does not cover user-created tabs inside the Agent Window on normal task completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions