Skip to content

Preserve tunnel return grace during reconnects - #6246

Merged
ymichael merged 1 commit into
mainfrom
bb/ci-reliability-20261024
Oct 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/ci-reliability-20261024

Conversation

@ymichael

@ymichael ymichael commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The dropped-tunnel recovery test on main run 40131112983 received 503 instead of 200. A real gate race ended the return grace early: the delayed CloseProxy callback treated server addresses as removable shares, and a newly connected client could trigger that callback before its replacement route was ready. Share routes already accepted by NewProxy could also be interrupted during their routing settle period.

What changed

Production change: keep server addresses within the normal tunnel-return grace, and remove a share early only when no replacement proxy for that subdomain is registered. Add deterministic regressions through the real hook HTTP server and directory, including a check that explicit share removal still ends its wait.

No daemon wire, public API, CLI, CI selection, cache, shard, timeout, or coverage reductions. The separate Windows runtime shutdown failure remains under investigation; this PR does not claim to resolve it.

How you verified

  • Both new regression cases fail on the original implementation because their pending request is settled at the 500 ms removal deadline, before reconnect can finish; both pass with the fix.
  • VITEST_MAX_WORKERS=2 pnpm exec turbo run test typecheck --filter=@bb/connect-next: all 92 tests pass, including real FRP single-region and multi-region end-to-end tests; typecheck passes.
  • Formatting and git diff --check pass. This package has no lint task. Reviewed against docs/CODE_REVIEW.md and the deslop guidance.
  • Final-head CI 40138038987 passes on b9751506cb, including Linux packages-other, Windows packages-other, Windows host packages, lint/typecheck, and checks.

AGENT GENERATED

@ymichael
ymichael merged commit 6114cfc into main Oct 25, 2026
22 checks passed
@ymichael
ymichael deleted the bb/ci-reliability-20261024 branch October 25, 2026 02:53
ymichael added a commit that referenced this pull request Oct 26, 2026
## Human comments

## What was wrong

The sidebar's multi-select menu (`sidebarMultiSelect` experiment) was a
hardcoded component in the thread-list plugin. Plugin thread actions
such as push-notifications' Notifications could not appear in it, and it
had no Delete. Its Archive called `sdk.threads.archive` directly for
each thread. That skipped core's archive flow, so selecting a parent
archived all of its children without the child-thread confirmation, even
with that setting on, and it never ran core's pane cleanup and route
repair. Separately, the single-thread delete dialog counted only direct
children, although delete removes the whole tree.

## What changed

- **Plugin SDK (0.6.81 → 0.6.82):**
- Thread action registrations can add `experimental_bulkItem({ threads,
data, sdk, navigate })`.
- `experimental_ThreadActionsContextMenu` takes
`experimental_bulkThreads` and `onEscapeKeyDown`. With 2+ threads it
shows a "N threads selected" bulk menu; otherwise it shows the normal
menu. A row keeps a single Radix menu, so joining or leaving a selection
doesn't remount it.
- The registration collector keeps and validates
`experimental_bulkItem`.
  - The test fake takes `threadBulkActions`.
- **Core actions:**
- Mark read/unread, Pin/Unpin, Archive (Unarchive when every selected
thread is archived) and Delete have bulk items.
- Archive and Delete go through new `requestArchiveThreads` /
`requestDeleteThreads` in `ThreadActionsProvider`, which single-thread
archive and delete also use.
- Each asks once per selection, acts on the topmost selected threads
only, and cleans up panes and routes once. Single and bulk archive use
the same planner, confirmation, and executor; only toast presentation
varies for a single thread. Archive shares pane cleanup, route repair,
and sequential parent-first Undo with environment-group archive. The
single-thread toast retains its clickable title.
- Child checks finish before archive starts, so rows stay visible while
planning. The mutation no longer has a separate
child-summary/confirmation exception path.
- **Counting what goes with a thread:** new `POST /threads/cascade` /
`sdk.threads.experimental_listCascade({ threadIds, action })` returns
the visible threads that archiving or deleting each thread would also
affect. It's built on the same helpers as `archive-all` and `delete`, so
single-thread and bulk dialogs count the same way, lifecycle-owned
threads included. Single-thread delete now counts the whole tree instead
of direct children.
- **Plugins:**
- thread-list's Move to section and push-notifications' Notifications
have bulk items.
- The thread list passes its selection to the host menu with a Clear
selection item.
- Threads that disappear from the sidebar are dropped from the
selection. Clicking empty sidebar space also clears selection; thread
rows and menus preserve it.
- **Docs:** `docs/api_to_audit.md` (bulk items,
`experimental_listCascade`), `docs/configuration.md`, the
plugin-authoring guide (bulk docs live in
`frontend-sidebar-navigation.md` because `frontend-registration.md` is
at its 500-line cap), and the Plugin Guide surface.
- **Unchanged:** no server/daemon wire change and no
`HOST_DAEMON_PROTOCOL_VERSION` bump; the new route is additive. No CLI
change: per-thread `bb thread archive`/`delete` and `bb
push-notifications thread` already cover these actions.

## How you verified

- CI exposed Pin mock state leaking between menu tests; reset mock
implementations between tests and give the bulk-action test its own Pin
response. All 59 menu tests pass (1 skipped), with lint and typecheck
passing.

- Archive consolidation (`bdccf5e15b`): all 6,336 app tests, lint, and
typecheck pass via `pnpm exec turbo run test typecheck --filter=@bb/app`
plus the lint task in the same run. Shared single/multiple/environment
Undo coverage proves parents finish restoring before descendants; the
single-thread case fails on the previous implementation. Browser checks
on the rebuilt preview confirmed single-parent and bulk archive dialogs,
affected IDs, complete Undo restoration, and return navigation.
Production code shrank by 127 lines.

- Empty-sidebar follow-up (`78bc4b82b6`): the regression fails before
the fix; all 474 thread-list tests, lint, and typecheck pass afterward.
Rebuilt the worktree preview and verified with real browser clicks that
two selected rows become zero after clicking empty sidebar space.

- [CI on the rebased
commit](https://github.com/get-bb/bb/actions/runs/40364925516)
(`824968a715`): 47 checks pass, 4 intentionally skipped, no failures or
pending checks.

Rebased onto `origin/main` (`e85d817479`), with Plugin SDK `0.6.82` and
the matching thread-list minimum. The previous Connect recovery failure
is covered by the upstream fix in #6246; all 92 Connect tests pass
locally after rebasing.

- `pnpm exec turbo run typecheck lint test` for `@bb/server`,
`@bb/server-contract`, `@bb/sdk`, `@bb/app`, `@get-bb/plugin-sdk`,
`bb-plugin-thread-list`, `bb-plugin-push-notifications`,
`bb-plugin-plugin-api-docs`, `bb-plugin-bb-guide`, `@bb/connect-next`:
all 34 Turbo tasks pass after rebasing (server 3,690, app 6,333, Connect
92). `oxfmt --check` is clean.
- New tests:
- The server cascade route matches `child-summary`, what `archive-all`
archives, and what delete removes.
  - Bulk menu contract on desktop and compact.
  - Provider bulk and single archive/delete flows.
- Collector keeps `experimental_bulkItem`; this test fails without the
fix.
- Two-row `ThreadRow` bulk menu; this test fails with a stale prop name.
  - Bulk Move and Notifications.
- Ran `pnpm start:worktree` with a seeded fixture and drove it with real
browser input plus the `bb` CLI: 17/17 checks pass. Each bulk action was
clicked in the UI and its effect read back through the CLI/API: read,
pin, notifications, move, archive with one confirmation and Undo, delete
cancel and confirm.
- Before/after screenshots against the base commit using the same
fixture. Running the app caught three bugs that unit tests missed, all
fixed with regression tests: nested context-menu trigger props being
dropped, the collector stripping the new field, and a stale prop behind
an untyped spread.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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