Skip to content

fix: tabs group survives a slow Chrome (session busy, not gone; title/color kept) - #87

Open
colevels wants to merge 2 commits into
developfrom
fix/group-timeout-86
Open

colevels wants to merge 2 commits into
developfrom
fix/group-timeout-86

Conversation

@colevels

Copy link
Copy Markdown
Owner

What

Refs #86. Fixes the two CLI bugs from that issue. Why Chrome takes over 10s is still unconfirmed; see the investigation comment.

  • fix(session): a page still working on a timed-out call is busy, not gone. When a claimed call timed out, the server dropped it immediately, even though the page was still inside chrome.tabs.group and not polling. The next command found no page and failed with no_panel ("nothing is connected; run tabbrew session open"). Now the call stays claimed until its late result arrives, or for at most LATE_RESULT_MS (60s) if the page closed while working. The next command queues behind it. A late result gets 200 instead of 404 unknown_request; the SDK ignores that response either way.
  • fix(tabs): keep --title/--color when group creation times out. On a groupTabs timeout, tabs group reads a fresh snapshot. Because of the first fix, that read is served once the page has finished. If every requested tab is in one group, it applies the title, colour and collapse, then exits 0. For --window that group must be new and in the requested window; for --to it must be the named group. Otherwise the original timeout error is reported. The check is findGrouped in src/core/tabs/group.ts.

The 10s operator timeout is unchanged on purpose: with both fixes a slow regroup completes correctly, it just takes longer.

Verified

  • bun run typecheck, bun run check, bun test: 415 pass, 14 skip, 0 fail.
  • New tests:
    • server.test.ts: a late result is accepted; a page still working on a timed-out call counts as busy, and the next call is served after it; a page that never answers is forgotten after lateResultMs.
    • core/tabs/group.test.ts: findGrouped covers a new group, joining a group, partial grouping, a pre-existing group, the wrong window, and a missing tab.
    • tabs.test.ts: end to end with a fake panel that answers after the timeout. Title and colour are still applied when Chrome did group the tabs; the timeout is reported when it didn't. The suite now runs with a 1.5s operator timeout so the slow cases stay short.
  • Reverting either fix alone makes the end-to-end recovery test fail.
  • Not verified against real Chrome with a 300+ tab window.

Not in this PR

  • The cause of the slowness. The investigation comment has a DevTools measurement (side panel open vs closed) that tells Chrome apart from the page. Depending on the result, the follow-up is either a handleMoveTab debounce in tabbrew-extension or a longer timeout for batch operators.
  • The same recovery for other batch commands (tabs move, tabs close). They now leave the session usable after a timeout, but don't re-check what happened.

Checklist

  • Browser-facing change ships its extension half in extension/ and an e2e case in src/e2e/: no extension or SDK change; the session and CLI are covered with a fake panel instead of e2e.
  • README command reference is current: no flags or output changed.

🤖 Generated with Claude Code

colevels and others added 2 commits September 24, 2026 16:21
A claimed call that timed out was dropped at once, while its page was
still inside the Chrome call and not polling. The next command then
found nobody and failed as no_panel ("nothing is connected"), though the
page would have come back on its own.

The call now stays claimed until its late result arrives, or for
LATE_RESULT_MS (60s) should the page have closed mid-call. The next
command queues behind it instead.

Refs #86

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Chrome can finish grouping after groupTabs timed out, and the follow-up
updateGroup was then skipped, leaving an untitled grey group. On a
timeout, `tabs group` reads a fresh snapshot (served once the page is
done) and, if every tab is in one group that was not there before (or
the --to group), applies the title, color and collapse after all.
Otherwise the timeout is reported as before.

Refs #86

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ e2e against a real Chrome

14 passed, 0 failed

Test Time
✅ session start opens the connection page and gets connected 2.49s
✅ tabs list sees the connection page 0.07s
✅ windows create opens five pages and tabs list reports each of them 1.56s
✅ tabs group joins two tabs and tabs list shows only them in the group 1.24s
✅ groups collapse and uncollapse toggle the group 0.32s
✅ tabs move places a tab after another and tabs list shows the new order 1.15s
✅ tabs discard unloads a background tab and keeps it in its group 1.14s
✅ tabs reload loads a discarded tab back in place, under the same id 1.21s
✅ groups close removes the group and its tabs without leaving a window behind 1.57s
✅ tabs ungroup frees grouped tabs and drops the emptied group 1.39s
✅ tabs create opens a background tab after an anchor 1.16s
✅ tabs focus activates a background tab and raises its window 1.23s
✅ the harness adds its own commands under tabbrew plugin 0.54s
✅ session stop ends the session 0.19s
Chrome state after each step

After tabbrew session start

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness

After tabbrew windows create with five pages

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  5     0       -        127.0.0.1  Inbox

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -      active  127.0.0.1                         Inbox
1322898534  B       -      -       127.0.0.1                         Pull Request #42
1322898535  B       -      -       127.0.0.1                         Docs
1322898536  B       -      -       127.0.0.1                         Dashboard
1322898537  B       -      -       127.0.0.1                         Notes

After tabbrew tabs group on two tabs

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  5     1       -        127.0.0.1  Inbox

tabbrew groups list

GROUP      WINDOW  TABS  COLOR  FLAGS  TITLE
621557844  B       2     blue   -      ci

tabbrew tabs list

TAB         WINDOW  GROUP      FLAGS   URL                               TITLE
1322898531  A       -          active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -          active  127.0.0.1                         Inbox
1322898534  B       621557844  -       127.0.0.1                         Pull Request #42
1322898535  B       621557844  -       127.0.0.1                         Docs
1322898536  B       -          -       127.0.0.1                         Dashboard
1322898537  B       -          -       127.0.0.1                         Notes

After tabbrew tabs move of the first tab behind the group

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  5     1       -        127.0.0.1  Inbox

tabbrew groups list

GROUP      WINDOW  TABS  COLOR  FLAGS  TITLE
621557844  B       2     blue   -      ci

tabbrew tabs list

TAB         WINDOW  GROUP      FLAGS   URL                               TITLE
1322898531  A       -          active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898534  B       621557844  -       127.0.0.1                         Pull Request #42
1322898535  B       621557844  -       127.0.0.1                         Docs
1322898533  B       -          active  127.0.0.1                         Inbox
1322898536  B       -          -       127.0.0.1                         Dashboard
1322898537  B       -          -       127.0.0.1                         Notes

After tabbrew tabs discard of a grouped background tab

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  5     1       -        127.0.0.1  Inbox

tabbrew groups list

GROUP      WINDOW  TABS  COLOR  FLAGS  TITLE
621557844  B       2     blue   -      ci

tabbrew tabs list

TAB         WINDOW  GROUP      FLAGS      URL                               TITLE
1322898531  A       -          active     panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898534  B       621557844  discarded  127.0.0.1                         Pull Request #42
1322898535  B       621557844  -          127.0.0.1                         Docs
1322898533  B       -          active     127.0.0.1                         Inbox
1322898536  B       -          -          127.0.0.1                         Dashboard
1322898537  B       -          -          127.0.0.1                         Notes

After tabbrew tabs reload --hard of the discarded tab

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  5     1       -        127.0.0.1  Inbox

tabbrew groups list

GROUP      WINDOW  TABS  COLOR  FLAGS  TITLE
621557844  B       2     blue   -      ci

tabbrew tabs list

TAB         WINDOW  GROUP      FLAGS   URL                               TITLE
1322898531  A       -          active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898534  B       621557844  -       127.0.0.1                         Pull Request #42
1322898535  B       621557844  -       127.0.0.1                         Docs
1322898533  B       -          active  127.0.0.1                         Inbox
1322898536  B       -          -       127.0.0.1                         Dashboard
1322898537  B       -          -       127.0.0.1                         Notes

After tabbrew groups close

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  3     0       -        127.0.0.1  Inbox

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -      active  127.0.0.1                         Inbox
1322898536  B       -      -       127.0.0.1                         Dashboard
1322898537  B       -      -       127.0.0.1                         Notes

After tabbrew tabs ungroup on a fresh group of two tabs

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  3     0       -        127.0.0.1  Inbox

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -      active  127.0.0.1                         Inbox
1322898536  B       -      -       127.0.0.1                         Dashboard
1322898537  B       -      -       127.0.0.1                         Notes

After tabbrew tabs create behind the first tab

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       focused  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  4     0       -        127.0.0.1  Inbox

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -      active  127.0.0.1                         Inbox
1322898545  B       -      -       127.0.0.1                         Pull Request #42
1322898536  B       -      -       127.0.0.1                         Dashboard
1322898537  B       -      -       127.0.0.1                         Notes

After tabbrew tabs focus on a background tab

tabbrew windows list

WINDOW  ID          TABS  GROUPS  FLAGS    ACTIVE
A       1322898530  1     0       -        panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
B       1322898532  4     0       focused  127.0.0.1  Dashboard

tabbrew groups list

GROUP  WINDOW  TABS  COLOR  FLAGS  TITLE

tabbrew tabs list

TAB         WINDOW  GROUP  FLAGS   URL                               TITLE
1322898531  A       -      active  panbkjjmbjicmlfjeofgkhljfhlbemmb  TabBrew CLI Harness
1322898533  B       -      -       127.0.0.1                         Inbox
1322898545  B       -      -       127.0.0.1                         Pull Request #42
1322898536  B       -      active  127.0.0.1                         Dashboard
1322898537  B       -      -       127.0.0.1                         Notes

Screenshots of the Xvfb screen, in the e2e-chrome artifact:

  • 01-after-tabbrew-session-start.png
  • 02-after-tabbrew-windows-create-with-five-pages.png
  • 03-after-tabbrew-tabs-group-on-two-tabs.png
  • 04-after-tabbrew-tabs-move-of-the-first-tab-behind-the-group.png
  • 05-after-tabbrew-tabs-discard-of-a-grouped-background-tab.png
  • 06-after-tabbrew-tabs-reload-hard-of-the-discarded-tab.png
  • 07-after-tabbrew-groups-close.png
  • 08-after-tabbrew-tabs-ungroup-on-a-fresh-group-of-two-tabs.png
  • 09-after-tabbrew-tabs-create-behind-the-first-tab.png
  • 10-after-tabbrew-tabs-focus-on-a-background-tab.png
Screenshots at 215f131

01-after-tabbrew-session-start.png

01-after-tabbrew-session-start.png

02-after-tabbrew-windows-create-with-five-pages.png

02-after-tabbrew-windows-create-with-five-pages.png

03-after-tabbrew-tabs-group-on-two-tabs.png

03-after-tabbrew-tabs-group-on-two-tabs.png

04-after-tabbrew-tabs-move-of-the-first-tab-behind-the-group.png

04-after-tabbrew-tabs-move-of-the-first-tab-behind-the-group.png

05-after-tabbrew-tabs-discard-of-a-grouped-background-tab.png

05-after-tabbrew-tabs-discard-of-a-grouped-background-tab.png

06-after-tabbrew-tabs-reload-hard-of-the-discarded-tab.png

06-after-tabbrew-tabs-reload-hard-of-the-discarded-tab.png

07-after-tabbrew-groups-close.png

07-after-tabbrew-groups-close.png

08-after-tabbrew-tabs-ungroup-on-a-fresh-group-of-two-tabs.png

08-after-tabbrew-tabs-ungroup-on-a-fresh-group-of-two-tabs.png

09-after-tabbrew-tabs-create-behind-the-first-tab.png

09-after-tabbrew-tabs-create-behind-the-first-tab.png

10-after-tabbrew-tabs-focus-on-a-background-tab.png

10-after-tabbrew-tabs-focus-on-a-background-tab.png

github-actions Bot pushed a commit that referenced this pull request Sep 24, 2026
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