Conversation
|
Thanks for adding native tab-group support. This looks useful for organizing multi-tab tasks and making the results easier for users to review and take over. There are a few issues that need to be addressed before merging:
Please also update the branch against the latest main and resolve the The feature is worth continuing. These authorization, recovery, cancellation, and type-checking issues should be resolved before merge. |
…ndow
Adds `bsk tab group create|update|list|ungroup`, backed by chrome.tabGroups,
following the same Agent Window sandbox rule as `tab close` / `tab select`:
every tab (and, for `update`/`ungroup`, the group itself) must already live
in the requesting session's Agent Window.
- bsk-protocol: TabGroupColor + TabGroupCreate/Update/List/Ungroup
params/results, four new Method variants classified for the
pending-interrupt gate (create/update/ungroup mutate, list is a
passive read).
- CLI: `bsk tab group {create,update,list,ungroup}` subcommands with
--json and human table output.
- daemon: forwards the four new tool.* methods like the existing tab.*
ones (no new daemon-side logic needed).
- extension: handlers using chrome.tabs.group/ungroup and
chrome.tabGroups.{get,query,update,move}, gated through the existing
session/sandbox checks (authoriseAgentTab/authoriseAgentGroup).
Real-browser testing (not just mocks) surfaced that a freshly created
group can land outside the target window on some Chromium builds/hosts
(most reliably reproduced with `session start --no-focus`, though the
underlying trigger turned out to be a stale unpacked-extension reload
during iteration, not focus itself). handleTabGroupCreate now verifies
placement after creation and falls back from a group-level move to
per-tab moves; if neither lands the tabs in the Agent Window, it
ungroups them and returns a clear error instead of a hollow success
with an empty tab_ids. Covered by new unit tests, including both
fallback paths.
Also documents (skill/references/tabs-and-profiles.md) that --title
should come from what the grouped tabs are actually about, not a
placeholder — read tab titles/URLs first, then name the group.
Testing:
- cargo test -p bsk-protocol / -p bsk --lib: all pass (162 + 361 tests)
- pnpm vitest run (apps/extension): all pass (150 files / 2297 tests,
76 in tabs.test.ts covering the new handlers)
- cargo clippy / cargo fmt --check: clean (pre-existing warnings only)
- Manual end-to-end dogfooding against a real, isolated Edge profile
(bsk CLI -> daemon -> unpacked extension -> real chrome.tabGroups):
create/list/update/ungroup all verified against real tabs, in both
focused and unfocused Agent Windows, plus the sandbox rejection path
for a tab outside the Agent Window.
Known scope limit: DSH plugin native tools (packages/dsh-plugin-browserskill)
are not updated — this PR covers the bsk CLI only.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review follow-up on Tencent#339 (Zhang GH): - Register `group_window_mismatch` in `RpcErrorReason` and fix the three potentially-undefined tab IDs in the test helper, so `tsc --noEmit` passes. - Authorise every affected tab with the direct-control rules, not just the group's window: adding to an existing group, `update` and `ungroup` now validate all current members via `authoriseAgentTab`, so an unowned or borrowed tab can no longer be affected through group operations while `tab_select` would reject controlling it directly. - Rebuild the cross-window recovery as a bounded ladder (group move, then per-tab moves plus an in-place group recreation), re-verifying placement from browser state at every step: per-tab moves across windows drop group membership and destroy the group in real Chromium, so the old group ID is no longer trusted. Failures report which tabs did not land and carry an honest `cleanup_state` instead of swallowing cleanup errors; the test double now models the membership loss. - Check cancellation after each async stage of group creation and before subsequent mutations, recovering stranded memberships before stopping. - Rebase onto latest main; resolve the tabs-and-profiles.md conflict preserving the shared-login-state guidance. Co-Authored-By: Claude Code <noreply@anthropic.com>
4a4ae06 to
00dbd3c
Compare
|
Thanks for the careful review — all four points are addressed in the new commits on the branch, which is also rebased onto latest main with the 1. TypeScript errors — 2. Authorization for all affected members — added 3. Cross-window recovery — rebuilt as a bounded ladder in Reproduction details for the original placement issue: I re-ran the flow end-to-end against a real Edge 153.0.4234.48 (Chromium 153) on Windows 11 with an unpacked MV3 extension and 4. Cancellation — group creation checks the abort signal after each asynchronous stage and before each subsequent mutation: after Happy to iterate further on any of this. |
|
Thanks for the review — all four points are addressed in |
Summary
Adds
bsk tab group create|update|list|ungroup, backed bychrome.tabGroups,following the same Agent Window sandbox rule as
tab close/tab select:every tab (and, for
update/ungroup, the group itself) must already live inthe requesting session's Agent Window.
What changed
TabGroupColor+TabGroupCreate/Update/List/Ungroupparams/results, four new
Methodvariants classified for thepending-interrupt gate (create/update/ungroup mutate, list is a passive
read).
bsk tab group {create,update,list,ungroup}subcommands with--jsonand human table output.tool.*methods the same way theexisting
tab.*ones are forwarded — no new daemon-side logic needed.chrome.tabs.group/ungroupandchrome.tabGroups.{get,query,update,move}, gated through the existingsession/sandbox checks (
authoriseAgentTab/newauthoriseAgentGroup).tabs-and-profiles.mddocuments the commands, and isexplicit that
--titleshould come from what the grouped tabs areactually about (read
tab list --scope agentfirst), not a placeholderlike "Group 1".
A real bug this surfaced
Manual end-to-end testing against a real, isolated Edge profile (not just
mocks) found that a freshly created group can land outside the target
window on some Chromium builds/hosts — most reliably reproduced here with
session start --no-focus.handleTabGroupCreatenow:createProperties.windowIdon create.chrome.tabGroups.move.chrome.tabs.move(the mechanism that's reliably worked for every othertab-management tool in this sandbox model, focused or not).
returns a clear
cdp_failed/group_window_mismatcherror instead of ahollow "success" with an empty
tab_ids.Covered by new unit tests for both fallback paths, including the
all-attempts-failed → error + cleanup case.
Testing
cargo test -p bsk-protocol/-p bsk --lib: all pass (162 + 361 tests).pnpm vitest run(apps/extension): all pass (150 files / 2297 tests; 76in
tabs.test.ts, 11 new, covering the handlers including both fallbackpaths above).
cargo clippy/cargo fmt --check: clean (pre-existing warnings only,unrelated to this change).
from this branch, loaded it into a throwaway Edge profile against an
isolated
bskdaemon, and drove realchrome.tabGroupsstate — verifiedcreate/list/update/ungroupagainst real tabs in both a focused andan unfocused Agent Window, plus the sandbox-rejection path for a tab
outside the Agent Window.
sandboxed shell I had available (named-pipe/Job-Object restrictions
unrelated to this change — same failures reproduce on a fresh,
unmodified checkout in that same shell); the manual dogfooding above was
the substitute for that coverage.
Known scope limit
DSH plugin native tools (
packages/dsh-plugin-browserskill) are notupdated — this PR covers the
bskCLI only. Happy to follow up if that'swanted.