Skip to content

Session does not auto-disconnect and cannot reuse an already-open tab/window | session 不会自动断开,且不能复用已打开页签 #279

Description

@xiaoyangxiaolei214

Problem

There are two related usability problems in the current session model:

1. An existing tab/window cannot be reused in place

bsk session start always creates a new browser window with its own about:blank tab. It cannot attach to the user’s current window or directly reuse an already-open tab.

The current tab list and tab borrow flow does not solve this: borrowing physically moves the user tab into the newly created Agent Window. It is not an in-place shared session, and the user still gets an extra browser window. This makes normal agent work feel like every request opens another window/tab.

2. Sessions are not automatically disconnected or cleaned up

bsk session stop is mandatory for cleanup. If the agent turn is interrupted, the CLI/client exits unexpectedly, the connection is lost, or the agent forgets the stop call, the session and Agent Window remain open. The current idle timeout is only a delayed safety net, not lifecycle-bound cleanup.

Interrupted session start can also leave an orphan Agent Window that is not registered to the caller and cannot be cleaned up through the normal plugin/session path.

From the user’s perspective, multiple old sessions and windows accumulate and must be found and closed manually.

Request

  • Support reusing the current browser window and/or an already-open tab without creating a new Agent Window. This could be an owner-scoped session or a tab-group-based session instead of a window-bound session.
  • Automatically stop the session when the owning agent/client disconnects, the task turn ends, or the start/operation is cancelled. Cleanup should return borrowed tabs, close agent-created tabs, close the Agent Window when appropriate, and remove the session record.
  • Consider an explicit --ephemeral/--auto-stop-on-disconnect mode if automatic cleanup cannot be the default, and recover orphan sessions on the next startup or first CLI call.
  • Make session list expose enough ownership/lifecycle information for stale-session diagnosis.

This behavior would remove the need for local session-mapping/reuse workarounds in agent harnesses such as Codex and make multi-session use predictable.

Related


中文摘要: 当前 bsk session start 总会新建一个 Agent Window,不能直接复用用户当前窗口或已经打开的页签;tab borrow 只是把页签移动进新窗口,仍然会产生额外窗口。另一个问题是 session 依赖显式 session stop,任务中断、连接断开或调用方退出时不会自动清理,容易残留 session 和窗口。希望支持复用现有窗口/页签,并在调用方断开、任务结束或启动取消时自动完成 session 清理和孤儿回收。

Activity

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

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