Repository navigation
connect-next 5/5: machine port shares on the next address (host daemon protocol 247) - #6051
Merged
Merged
Conversation
SawyerHood
force-pushed
the
connect-next/5-machine-tunnels
branch
from
October 21, 2026 16:50
eafc4e0 to
0e4bafe
Compare
SawyerHood
force-pushed
the
connect-next/5-machine-tunnels
branch
from
October 21, 2026 16:53
0e4bafe to
c09c4a6
Compare
SawyerHood
force-pushed
the
connect-next/5-machine-tunnels
branch
from
October 21, 2026 17:03
c09c4a6 to
dddddbc
Compare
…address Host daemons run frpc for their shares at <machine-label>--<port>.<next domain> with their machine credential. HOST_DAEMON_PROTOCOL_VERSION 247 adds connectNext to the session-open response and connect-next.replace / connect-next.status messages; the server still accepts protocol 246 and never sends it next fields. bb.hosts.internal_DO_NOT_USE_setNextTunnels, nextTunnelStatuses and onNextTunnelStatusChange; the gate relays machine labels. A machine enrolled through the next address lists its share URL once.
SawyerHood
force-pushed
the
connect-next/5-machine-tunnels
branch
from
October 21, 2026 17:13
dddddbc to
fb429db
Compare
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 21, 2026
Main moved the SDK to 0.6.67 (get-bb#6048, get-bb#6051), so this branch's own type changes need the next version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
After PR 4 only the server machine's own ports answer on the next address. Every other enrolled machine shares ports at
https://<machine-label>--<port>.getbb.appthrough its host daemon's Cloudflare tunnel, and has no way onto the Fly gate. Two bugs from the live staging test are fixed here too.PR 5 of 5 (stack: account API → server ingress → gate → plugin → machine tunnels). Based on #6050.
What changed
HOST_DAEMON_PROTOCOL_VERSION246 → 247. The session-open response carriesconnectNext: { generation, config }; the server pushes{ type: "connect-next.replace", generation, config }to each connected daemon with a bb connect machine credential; the daemon answers{ type: "connect-next.status", status }. Compatibility with the previously shipped daemon is kept deliberately and tested:HOST_DAEMON_COMPATIBLE_PROTOCOL_VERSIONS = [246, 247]; a 246 daemon gets the old session-open response and noconnect-next.*message, so its Cloudflare machine tunnel works as before (hostDaemonSupportsConnectNext). (On the old branch this was 244 → 245; main moved to 246 meanwhile, so ours is 247 and 246 is the accepted previous version.)apps/host-daemon/src/connect-next: runs anFrpcSupervisorfrom@bb/frp-clientwith one proxy per declared shared port at<machine-label>--<port>.<domain>, using the machine credential; refuses a config whose domain is not its enrollment's base domain ornext.<base domain>, whose tunnel host is nottunnel.<domain>, or that is notwssfor an https enrollment; stops after 30 s without a server session (a next-joined machine cannot hearnullonce next is off).apps/server:host-shared-ports.tskeeps one next-tunnel config owned by a plugin and sends it;bb.hosts.internal_DO_NOT_USE_setNextTunnels,internal_DO_NOT_USE_nextTunnelStatuses,internal_DO_NOT_USE_onNextTunnelStatusChange(SDK types, fake host,docs/api_to_audit.mdentry namingconnect-nextas the only caller).PLUGIN_SDK_VERSION0.6.66 → 0.6.67;connect-nextrequires it.apps/connect-next: the gate relaysPOST /api/connect/machine-label(machine credential) to the account API so a machine enrolled through the next address learns its label; a label is held while any of its proxies is open (machine presence, peer routing); a proxy its still-connected client removed answers 503 at once.apps/host-daemon/src/connect-tunnel: machines enrolled through a next address skip the Cloudflare dial.plugins/connect-next: turns machine tunnels on with the plugin, shows each machine's tunnel and shares in settings, status and CLI.plugins/connect: other machines' listings getnextUrl.https://<label>--<port>.next.<domain>as bothurlandnextUrl, sobb connect expose … --host <machine>printed it twice. Its listing now has onlyurl(the next address) and nonextUrl; documented inplugins/connect/README.md, the share-server-links skill anddocs/connect-next.md.next.getbb.app.127.0.0.1through a wrapped supervisor (Windows frpc cannot resolve*.localhost) and still asserts the runner preparedtunnel.next.bb.localhost;e2e-local.tstakes the live-test provider from@bb/test-helpers(LIVE_TEST_PROVIDER_ID) so core gains no provider-id literal (provider-literal ratchet).packages/host-daemon-contracttest: addedidleProviderSessionTimeoutMinutes, which main made required, to the new session-open case.How you verified
apps/connect-next/scripts/e2e-local.shwithBB_E2E_PLAYWRIGHT_DIR(browser + MCP OAuth) andBB_E2E_OLD_DAEMON_REPO(a checkout of main9fad6b6255, protocol 246): single gate 94/94,--two-gates96/96, nothing skipped. Covers the next-joined machine (join through the gate, a real codex turn, shares, HMR, unexpose, off/on), a Cloudflare-joined machine (share on both addresses, next off stops its frpc), and the 246 daemon (opens a session with protocol 246, its Cloudflare share answers, it gets no next tunnel).pnpm exec turbo run typecheck --filter='...[connect-next/4-plugin]': all tasks pass.pnpm exec turbo run test --filter='[connect-next/4-plugin]':@bb/host-daemon-contract74/74 (incl. 246/247 compatibility),@bb/host-daemon806 passed / 7 skipped (the twocommand-discoveryfailures are the stray/tmp/.giton bee; 28/28 withTMPDIRoutside/tmp),@bb/server3,646 passed / 1 skipped (incl. a protocol-246 daemon getting its Cloudflare shares and never a next message),@bb/connect-next90/90,bb-plugin-bb--connect-next28/28,bb-plugin-connect143/143 (the new next-enrolled listing test fails before the fix withnextUrlpresent),@get-bb/plugin-sdk390/390.oxfmt --check,pnpm lint: clean.CIworkflow was dispatched on this branch (the stack's top), since stacked PRs not based on main only get the base checks.