mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
tool.tab_create increments pendingAgentTabCount *before* chrome.tabs.create so the onCreated listener can tell an agent tab from a user-opened tab. When the create failed, no onCreated event arrived and the counter leaked, so the next tab the user opened was misclassified as agent-created — the exact confusion the counter exists to prevent, a variant of issue #57. handleTabCreate now releases the slot on failure via SessionManager.releaseAgentTabPending. An abort (cancelled) is excluded: the tab did open (and was cleaned up), so its onCreated still consumes the slot. Added a regression test asserting that after a failed tab_create, a user-opened tab is still classified as 'user' (not 'agent').