Skip to content

Add an official Tailscale plugin that serves bb over Tailscale Serve - #7862

Merged
ymichael merged 10 commits into
mainfrom
bb/6748-ship-pr1-tailscale-server-access-plugin-thr_8yad4tec22
Nov 20, 2026
Merged

ymichael merged 10 commits into
mainfrom
bb/6748-ship-pr1-tailscale-server-access-plugin-thr_8yad4tec22

Conversation

@ymichael

@ymichael ymichael commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

To reach bb privately over a tailnet, users had to run tailscale serve --bg --https=443 http://127.0.0.1:38886 by hand and also set BB_APP_URL. Without BB_APP_URL, core's Host/Origin guards (browser-request-guard.ts) reject the *.ts.net host that Tailscale Serve forwards. Nothing in bb detected Tailscale, set Serve up, or offered the address to machines, so the Tailscale route was manual and undiscoverable. Part of #6748.

What changed

New official plugin plugins/tailscale (bb--tailscale). It ships in the app bundle and is listed in Plugins → Browse / bb plugin search, but is not installed by default (OFFICIAL_PLUGINS, autoInstall: false). Installing it is the opt-in. It registers the tailscale server access provider on today's one-provider model, so choosing Tailscale as the machine connection method enrolls new machines over https://<machine>.<tailnet>.ts.net. It does not depend on the multi-route work and declares no routeKind.

  • Reading Tailscale: runs the tailscale CLI by absolute path (macOS app/Homebrew, Linux, Windows Program Files; BB_TAILSCALE_CLI overrides) and reads status --json and serve status --json. Availability never waits on the HTTPS probe.
  • Setup: one click (Settings → Tailscale, RPC, bb tailscale setup) maps 443, or bb's own port (https://<machine>.<tailnet>.ts.net:<bb port>) when 443 is taken. A port counts as taken when Serve already maps it (foreground sessions included) or when something already listens on it at the machine's tailnet address. It never replaces another mapping. A hand-made mapping to bb is adopted unchanged.
  • Ownership: the plugin records the mapping it created, and teardown removes only that one. Serve changes only on explicit setup or teardown, never on stop or disable.
  • Settings page: one card per state with an action-phrased headline ("Install Tailscale", "Turn on MagicDNS", "Not set up", "Reachable on your tailnet"), a short explanation, and the one action that matters below it (Set up, Remove, or the admin-console link). The served address has a copy icon. A refresh icon in the corner checks again, and the page also re-reads Tailscale when bb's window regains focus. The HTTPS check reports ok, no-answer or other-server, so the page and CLI say "Set up, but not answering yet" or "Reaches a different bb server" instead of showing green, and a mapping with Funnel on is headlined "Public on the internet (Funnel is on)".
  • Surfaces: Settings section, bb tailscale status|setup|teardown [--json], skill, PLUGIN_OVERVIEW, README, and tests against an in-memory fake CLI.

Core (apps/server):

  • Host/Origin guards accept the origin of every server access provider that reports available with a serverUrl, so the ts.net address works without BB_APP_URL. Core refreshes the set when configuration is read, on experimental_serverAccess.recheck(), and when plugins change.
  • Restart safety: the admitted set is stored in app_settings_values (serverAccessOrigins, no migration) and restored in createApp before the listener starts. Without that, the first ~3 s after a restart returned 403 forbidden_host, which the host daemon treats as a fatal connect error.
  • Failure handling: a failed or timed-out availability check keeps the provider's address. A definite setup-required/unavailable answer drops it, and so does the provider being gone with its plugin disabled or removed.
  • Default provider: without a saved defaultMachineAccess, the default is now the provider of the earliest-installed plugin, not plugin load order. Load order is alphabetical at startup, so bb--tailscale would otherwise have silently replaced bb connect after a restart.
  • bb connect side effect: because the rule covers every ready provider, bb connect's getbb.app origin is also admitted while connect is ready. Pages on that origin already have same-origin API access through the gate, so this grants nothing new.

Docs: docs/multiple-devices.md now uses the plugin instead of the hand-run tailscale serve + BB_APP_URL steps. Also updated: docs/configuration.md (Tailscale section, BB_TAILSCALE_CLI, Host rule, default provider), the guide chapters (plugins, machines, customization), docs/official-plugin-release-process.md, the plugin-authoring backend-machines.md, and the experimental_serverAccess entries in docs/api_to_audit.md.

No server/daemon wire change, so no HOST_DAEMON_PROTOCOL_VERSION bump.

How you verified

Tests (turbo): typecheck lint lint:type-aware test prepare:bundled for bb-plugin-bb--tailscale, @bb/server, @bb/web, @bb/db, @bb/domain, @bb/templates, bb-plugin-bb-guide, @bb/cli, @bb/scripts. All pass except intermittent failures in test/app/install-machine-script.test.ts. That file doesn't touch this code: different tests fail on each full run, and it passes 54/54 when rerun alone.

New server tests in server-access.test.ts:

  • the guard admits an available provider's address and drops it when lost;
  • the default follows install order;
  • the address is admitted from the first request after a restart, before plugins load (a second createApp on the same DB);
  • a failed check keeps the address;
  • disabling the plugin drops it.

The restart, failed-check, guard and install-order tests fail on the code before their fix. Plugin tests cover:

  • each availability state;
  • setup on 443, and on bb's port when 443 is taken by another service, a foreground serve, or a listener on the tailnet address;
  • the conflict when both ports are taken;
  • adoption, and teardown refusing an adopted mapping;
  • teardown after someone re-pointed the mapping;
  • the operator-rights message;
  • availability not waiting on the probe;
  • the probe riding out a 403 until core admits the address;
  • the CLI output.

Live, on an isolated pnpm dev instance (fresh data dir, server port 22204). BB_TAILSCALE_CLI pointed at a wrapper that passed status --json through to the real Tailscale CLI, so the tailnet data was real, and recorded serve writes in a local file. No mutating command ran against the real tailnet.

  • Install: Plugins → Browse → "tailscale" showed Tailscale as BB Official. Install → confirm gave [email protected] running.

  • Status: bb tailscale status showed "not set up", machine mbp-m4.snake-fish.ts.net, forwards to http://127.0.0.1:22204. Default machine access stayed connect.

  • Setup: Settings → Tailscale → Set up recorded serve --bg --yes --https=8443 http://127.0.0.1:22204, because 443 already serves another bb on this machine (this run predates the switch from 8443 to bb's own port; see the real-Tailscale run below). Settings then showed "Reachable on your tailnet" at https://mbp-m4.snake-fish.ts.net:8443.

  • Guard (requests with the ts.net Host/Origin that Serve forwards):

    Request Before setup After setup
    /health 403 200
    /api/v1/threads 200
    app page / 200
    wrong-port Origin 403
    unrelated host 403
  • Machines: choosing Tailscale as the connection method showed "Ready https://mbp-m4.snake-fish.ts.net:8443". Add a machine generated curl … 'https://mbp-m4.snake-fish.ts.net:8443/install.sh' | sh.

  • Restart window: after setup I restarted the instance and probed with ts.net Host/Origin as the very first requests, with no client open.

    • Before the fix: health and app returned 403 for ~3 s after "Server listening" (11:55:17.3–11:55:20.1), then 200.
    • After the fix: the first request (12:00:06, before the plugin finished loading at 12:00:07) returned 200, and all 40 samples were health=200 app=200.
  • Remove / teardown: removed only 8443. The other mappings on that machine (443, 80, 21523, 22235, 22236) were untouched, the guard went back to 403, and the stored origin row became [].

  • Adoption: with a hand-made mapping to bb, status showed "(set up outside bb; adopted)", setup left it unchanged, and teardown refused with the tailscale serve --https=… off hint.

  • Disable/enable: disabling the plugin left the Serve mapping in place and the guard returned 403. Re-enabling restored 200, and ownership survived, so teardown still removed it.

  • Real Tailscale, end to end (by the reviewer): on a pnpm start:worktree instance using the real CLI, Set up served bb at https://mbp-m4.snake-fish.ts.net:22204 (443 is taken by another bb, and 38886 listens on the tailnet address), the page showed "Reachable on your tailnet", and after Remove the tailnet's other mappings (80, 443, 21523, 22235, 22236) were unchanged.

  • Every Settings state was captured from a throwaway server driven by a scriptable fake CLI: not installed, not running, disconnected, signed out, waiting for approval, MagicDNS off, HTTPS off, read error, not set up, ports in use, checking, reachable, not answering, different bb, Funnel on, adopted, and the setup/remove toasts. Check again (refresh icon) re-reads with no toast, and the copy icon turns into a check mark.

  • Real CLI, read-only: systemTailscale() found /Applications/Tailscale.app/Contents/MacOS/Tailscale (1.104.7). Targeting the existing bb on 38886, it adopted its 443 mapping (owner: "adopted"), and the HTTPS probe matched that server's launchId. Only status --json and serve status --json ran.

Part of #6748

AGENT GENERATED

ymichael and others added 10 commits November 19, 2026 14:11
…6748)

New official plugin plugins/tailscale (bb--tailscale), bundled with bb and
listed in Browse plugins but not installed by default; installing it is the
opt-in. It registers the `tailscale` server access provider on today's
one-provider-per-server model, so choosing Tailscale as the machine
connection method enrolls new machines over https://<machine>.<tailnet>.ts.net.

- Runs the tailscale CLI by absolute path (BB_TAILSCALE_CLI overrides) and
  reads `status --json` and `serve status --json`. Availability never waits
  for the HTTPS probe.
- One-click setup (Settings → Tailscale, RPC, `bb tailscale setup`) maps 443,
  or 8443 when 443 is taken (foreground Serve ports count as taken), and never
  replaces another mapping. A hand-made mapping to bb is adopted unchanged.
  The plugin records the mapping it created; teardown removes only that one.
  Serve changes only on explicit setup or teardown.
- Settings section, `bb tailscale status|setup|teardown [--json]`, skill,
  PLUGIN_OVERVIEW, README, tests against a fake CLI.

Core:
- Host and Origin guards admit the origin of every server access provider
  that reports `available` with a `serverUrl`, so the ts.net address works
  without BB_APP_URL. The set is refreshed when configuration is read, on
  `experimental_serverAccess.recheck()`, and when plugins change.
- Without a saved defaultMachineAccess, the default provider is the one from
  the earliest-installed plugin instead of plugin load order (alphabetical at
  startup), so installing Tailscale does not silently replace bb connect.

Docs: multiple-devices (plugin replaces the hand-run tailscale serve +
BB_APP_URL steps), configuration, guide chapters, official plugin list,
plugin-authoring reference, api_to_audit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Host/Origin allow-list for server access provider addresses was filled
only when configuration was read, on recheck(), or on plugin change. The
server listens before plugins load, so after a restart with Tailscale set up
the first ~3 s of requests over the ts.net address got 403 forbidden_host,
which a host daemon treats as a fatal connect error. A single timed-out
availability check also dropped the address until something re-read
configuration.

- Store the admitted set ({providerId, pluginId, origin}) in
  app_settings_values and restore it in createApp, before the listener.
- Keep a provider's address when its availability check fails or times out;
  drop it on a definite setup-required/unavailable answer, or when the
  provider is gone and its plugin is disabled or removed. A provider whose
  plugin is still loading keeps its address.

Live: with Tailscale set up through a fake CLI, the first requests after a
restart (health and the app page with the ts.net Host and Origin) went from
403 for ~3 s to 200 from the first one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
check:query-costs requires a case for every exported packages/db query
function; getServerAccessOrigins and setServerAccessOrigins had none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces the generic Lock icon with a single-color SVG of Tailscale's
3x3 dot mark (currentColor, faded corner dots), shipped under icons/ so
the first-party SVG validator covers it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Tailscale settings section showed a green "Reachable on your tailnet"
whenever Serve listed a mapping to bb, even when the HTTPS check of the
address failed. The headline now follows the check: "Checking the
address…" until it runs, amber "Set up, but not answering yet" with the
reason when it fails, green only when it passes. Setup shows a warning
toast instead of success when the address doesn't answer, the details line
is shorter, and bb tailscale status says "set up, but not answering".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tailscale setup now tries 443 (a URL with no port), then bb's own port, so
the fallback address is https://<machine>.<tailnet>.ts.net:<bb port>
instead of :8443. A port counts as taken when Tailscale Serve already uses
it, or, at setup time, when something already accepts connections on this
machine's tailnet address at that port. That keeps setup from shadowing a
bb bound to every interface on the same port.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each state now shows an action-phrased headline, the one action that
matters on the right, and a short explanation. "Check again" appears as a
link only where the user has to change something outside bb; in steady
states the page already updates live. The served address gets a Copy
link, ownership and target move to one details line, and the duplicate
section description is gone.

The HTTPS check now reports ok, no-answer, or other-server instead of a
boolean, so the page and CLI say "Reaches a different bb server" rather
than "not answering", and a mapping with Funnel on is headlined as
public instead of reachable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The one action for each state (Set up, Remove, or the admin-console link)
now sits under the explanation instead of beside the headline. "Check
again" is a refresh icon in the card's corner whose result arrives as a
toast, and the page re-reads Tailscale whenever bb's window regains
focus, which is when someone comes back from the Tailscale admin console.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Uses the shared CopyIconButton the git rows and diff headers use, which
turns into a check mark for two seconds after copying.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The refresh icon now just re-reads the status and the card updates in
place; a failed read shows in the section like any other load error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 1c30c06 into main Nov 20, 2026
55 checks passed
@ymichael
ymichael deleted the bb/6748-ship-pr1-tailscale-server-access-plugin-thr_8yad4tec22 branch November 20, 2026 18:41
ymichael added a commit that referenced this pull request Nov 23, 2026
…es experiment (#7864)

## Human comments

## What was wrong

Each machine knows its bb server by one URL, the one it was installed
with. When that route stops working (for example the home internet drops
for a bb connect-enrolled machine sitting on the server's own LAN, or a
tailnet goes down), the machine disconnects even though another route to
the same server would work. The server also had no stable identity a
client could check a route against, and server access was one
"connection method" per server (`defaultMachineAccess`) rather than a
set of routes.

## What changed

Server (behind the new early adopter experiment `serverRoutes`; while it
is off, the server advertises `routes: []`, the Local network route does
not exist, and daemons behave exactly as on main, including the
Tailscale plugin's address being admitted by the Host/Origin guards):

- Stable `serverId` (`srv_<hex>`, stored in bb.db so it survives
restarts and moves with `bb server move`), returned by `/health`, system
config, daemon session open, `bb status --json` and `bb server access
list --json`.
- Every set-up server access provider is a route; there is no per-route
on/off. `serverAccessOrder` replaces `defaultMachineAccess`, and
`localNetworkEnabled` (default off) adds the Local network route. Plugin
routes are routes while their plugin reports them available and are
turned off in the plugin's settings; Manual is a route while
`machineServerUrl` is set. Providers declare `routeKind` (`local-network
| private-overlay | relay | custom`) for default ranking; bb connect
declares `relay` and the Tailscale plugin (#7862) declares
`private-overlay`. Kind ranking applies only with `serverRoutes` on;
while it is off, providers rank by the user's order, then #7862's
earliest-installed-plugin order, then Manual, as the single default
route did on main. Providers of one kind keep #7862's
earliest-installed-plugin order, not load order. Plugin SDK 0.6.188.
`routeKind` is required in the SDK types; registration still accepts a
declaration without it, from a plugin built against an older SDK, and
treats it as `custom` (marketplace installs bundle with esbuild without
type-checking, so such plugins still install); documented under the
existing `bb.experimental_serverAccess.register` entry in
`docs/api_to_audit.md` and in the Plugin Guide surface.
- Per-host grants (`host_server_access_grants`); the install route stays
the host's anchor. Enrollment falls back to the next enabled route when
one needs setup.
- New machines install on the first working route in that order, with
Local network last (a laptop's install route should not be a LAN
address). A migrated Tailscale default keeps installing on Tailscale
even with bb connect on, and ordering alone puts Tailscale first with
the experiment on too.
- Core Local network provider: extra in-process listeners on the
machine's private LAN IPv4s (no restart). Removing it closes the
listeners and drops connections already upgraded over them.
- Routes appear in system config and the session-open response, and are
pushed live with a new `server-routes.replace` WS message. The daemon
reports its route with a new `session.route` message; each daemon
session stores it.
- The Host/Origin guards admit enabled routes' addresses. The admitted
set is persisted in `app_settings_values` (`serverAccessOrigins`) and
restored in `createApp` before the listener, so route hostnames work
from the first request after a restart. An address survives a failed or
timed-out availability check and is dropped on a definite answer, when
the route is turned off, or when its plugin is disabled or removed. This
replaces #7862's copy of the same mechanism. Plugin providers' addresses
(Tailscale, bb connect) are admitted whether or not `serverRoutes` is
on, as on main. Core's Local network and Manual addresses are admitted
only while it is on. `experimental_serverAccess.recheck()` still
refreshes the set directly, as #7862 does.
- UI and CLI: Settings → Machine access becomes "How devices reach this
server" (the routes that are set up, in order; Local network and Manual
have a menu with Remove, plugin routes link to their settings; **Add a
route** offers the rest), Settings → Machines shows "via <route>", `bb
server access list|add|remove|order` (`add`/`remove` cover
`local-network` and `direct`), and a Route column in `bb machine list`.
- Migration 0167 copies existing grants and `defaultMachineAccess` into
the new model but keeps `hosts.server_access_grant_id` and the old
setting row for one release, so going back a version works; the anchor
grant id is mirrored into the old column.

Host daemon:

- Candidates are the learned routes in server order plus the install
URL. Every dial probes `/health` plus a `serverId` check on all of them
in parallel (2 s timeout; route i may win after i × 500 ms), sending
each route only its own headers (the bb connect credential goes only to
bb connect).
- No mid-session switching: it stays on a working route until the
connection drops, then picks again. With `resumeDaemonSessions` it keeps
its session across the switch.
- Learned routes persist in `<data dir>/server-routes.json`, not
`config.json`, whose strict schema would make an older launcher refuse
the file after a rollback.
- Attachment and self-update downloads prefer an encrypted route; the bb
connect gate comes from the relay route; machine-auth-proxy follows the
active route.

Wire changes: `HOST_DAEMON_PROTOCOL_VERSION` 278 → 279 (`serverRoutes`
in session open, `route` in the session-open request,
`server-routes.replace`, `session.route`).

Docs: `docs/multiple-devices.md`, `docs/configuration.md`,
`docs/api_to_audit.md`, `bb guide machines`/`customization`, the bb-cli
command index, the plugin-authoring machines reference, and the
Tailscale plugin's skill and overview. These no longer say "choose
Tailscale as the connection method" or `defaultMachineAccess tailscale`.

Not in this PR: desktop and mobile route selection (later PRs), the
prototype's `x-bb-gate-*` peer-address strip (replaced by a separate
auth change), and the better-route check, flap holds and backoff (a
later shared-policy PR).

## How you verified

Tests added, each failing before its fix:

- `apps/host-daemon/src/server-routes.test.ts`: ranking with head start,
`serverId` mismatch rejected, per-route headers, failover and return on
redial, current route kept when nothing answers, no probing or saving
while the server advertises no routes, persistence outside
`config.json`.
- `apps/host-daemon/src/server-connection.test.ts`: stays on its working
route after learning better ones, then fails over and reports
`session.route` on each redial.
- `apps/server/test/services/machines/server-routes.test.ts`: experiment
off advertises nothing and acquires no grants; LAN advertised as soon as
it is added; LAN connections dropped when it is removed; new machines
install on Local network only when nothing else works; route addresses
admitted from the first request after a restart (fresh modules); address
kept through a failed check and dropped on a definite answer; Manual's
address refused once its URL is cleared; with the experiment off a
plugin route's address stays admitted and Manual's is dropped.
- `apps/server/test/services/machines/server-access.test.ts`: a
declaration without `routeKind` (an older plugin) registers on the real
and fake hosts and ranks as `custom` (fails without the registration
default); install route prefers relay/custom over
private-overlay/local-network with the experiment on; with it off, the
user's first route and then the first registered plugin win over the
relay (fails without the gate: a Tailscale-first order installed on the
relay). #7862's tests stay as they were (address admitted until lost,
kept across a restart and a failed check, dropped on plugin disable).
Its "defaults to the earliest-installed plugin" test now checks route
order and the install route instead of the removed `defaultProviderId`.
- `packages/db/test/migrate.test.ts`: migration copies grants and the
default without dropping the old column or row.

Commands (all green): `pnpm exec turbo run typecheck lint
--filter='...[origin/main]'`; `pnpm exec turbo run test` for every
changed package (app, cli, demo-server, host-daemon, server, db, domain,
host-daemon-contract, plugin-sdk, sdk, server-contract, templates,
test-helpers, bb-guide, connect, environment-modal-sandbox,
plugin-api-docs); `pnpm exec turbo run test
--filter=@bb/integration-tests --force`. Counts below.

After rebasing onto main at 76d4358:

- typecheck + lint: 167/167 turbo tasks.
- Package tests: 33/33 turbo tasks across the changed packages, which
now include the Tailscale plugin (server 4,432). Three server tests
failed once under full parallel load and passed when rerun: two in
`install-machine-script.test.ts` and `plugin-install.test.ts`'s git
fallback. db, server and host-daemon were rerun after the final rebase
onto #7934, which moves server SQL into `@bb/db` data modules (13/13
tasks). Following #7934, `server-access.ts` writes host columns through
`setHostColumns`, and `sql-in-data-modules.test.ts` passes.
- After the final rebase onto 76d4358: 21 test tasks for db, server,
host-daemon, host-daemon-contract, plugin-sdk, cli, app, Plugin Guide,
bb connect, Tailscale and bb-guide. All passed except one plugin-sdk
process-kill test that timed out under load and passes alone.
- Integration (`--force`, not a cache replay): 31/31 files, 80/80 tests.
- `pnpm exec turbo run check:query-costs --filter=@bb/db`: passes under
#7923's stricter growth check; cases added for every new query function
(`getOrCreateServerId`, `get/setServerAccessOrigins`, the grants table
functions, `recordSessionRoute`); no growth warnings from them.
- `plugin-instance-lifecycle.test.ts` "runs a provider callback only on
the instance that registered it" now tolerates the background
availability refresh on plugin change; it still asserts the stale record
never reaches the old instance (same adjustment as the Tailscale plugin
PR).

Live, on an isolated `pnpm start:worktree` instance with a second
enrolled daemon ("Client A") and a TCP relay standing in for a breakable
Manual route ordered first, Local network second:

- Experiment off: Client A connected on its install URL, learned no
routes, wrote no `server-routes.json`; Local network was not offered.
- Experiment on: Client A learned all three routes live through
`server-routes.replace` and stayed on its working route. After a restart
it dialed the saved top route (Manual) in 15 ms; `bb machine list`
showed Route "Manual".
- Relay down at 19:47:26.094, connected via Local network at
19:47:27.605 (about 1.5 s). Settings showed "Client A · via Local
network". After the relay came back it stayed on Local network for 75
s+.
- Turning Local network off with the Settings toggle moved Client A back
to Manual; with `resumeDaemonSessions` on, session `hses_5zcdm8va5c`
resumed across the switch. Turning Local network on from Settings
reached the connected daemon at once.
- Turning the experiment off: the daemon learned `routes: []` and
deleted its routes file, Local network disappeared, and the LAN
listeners closed.
- Restart window (fix for persisted route addresses): with a Manual
route on a hostname (`http://127.0.0.1.sslip.io:25900`), the first
requests after a server restart returned `403 forbidden_host` on
`/health` and `/api/v1/system/config` before the fix, and `200` on the
very first request after it.
- Install route: with Local network ordered first and Manual enabled, a
new manual machine was installed on Manual (`direct`), not Local
network.

Re-run after the rebase (it changed the daemon dial path: per-route
headers now go through main's compressed WebSocket constructor and send
queue), on the same setup:

- Client A enrolled on Manual (`http://127.0.0.1.sslip.io:25900`) and
learned Manual + 2 Local network routes.
- Relay down at 23:29:48.528; connected via Local network at
23:29:50.354 (about 1.8 s). It stayed on Local network for 60 s after
the relay came back.
- With `resumeDaemonSessions` on, session `hses_bmjc944x9h` resumed
across a Manual → Local network switch, and its row recorded
`local-network`. Turning Local network off moved it back to Manual.
Turning it on reached the connected daemon live.
- Experiment off while connected on Manual: the daemon learned `routes:
[]` and deleted `server-routes.json`, Local network disappeared, and the
LAN listeners refused connections.
- Restart window: the first request after a server restart to the Manual
hostname returned 200 for `/health` and `/api/v1/system/config`.

Known limit, unchanged by the rebase: if a daemon was *installed* on a
Manual hostname while the experiment was on, it cannot reconnect after
the experiment is turned off. The hostname gets `403 forbidden_host`
again, which is main's behaviour for a hostname without `BB_APP_URL`. It
recovered as soon as the experiment was turned back on.

Not exercised live: a real bb connect route (the dev server was
unpaired) or a real Tailscale route (unit tests cover its admission with
the experiment off).

Part of #6748

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> 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