Skip to content

Start the relay connector only after a phone is enrolled - #6765

Merged
hurttlocker merged 1 commit into
mainfrom
fix/relay-connector-on-enroll
Nov 24, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
fix/relay-connector-on-enroll

Conversation

@hurttlocker

Copy link
Copy Markdown
Collaborator

What changes

The off-network relay connector now runs only while at least one phone is enrolled.

  • At boot the server starts the connector only if a phone is enrolled, phone-home is allowed, the plan is entitled, the toggle is on and a license token is cached. Before this change the first of those two conditions was not checked.
  • The enroll route tells the server through a new internal endpoint (/internal/mobile-devices-changed, operator bearer only), and the first enroll starts the connector. The revoke route does the same, and the last revoke stops it.
  • Every dial checks for an enrolled phone again, so a missed notice cannot keep it dialing.
  • O8_NO_PHONE_HOME=1 keeps the connector off.
  • docs/user/product-telemetry-privacy.md now lists exactly what O8_NO_PHONE_HOME=1 turns off: automatic update install, crash-log upload, crash and error reports, usage analytics, the launcher's update check and the hosted relay connection. It also adds O8_RELAY_CONNECTOR=off to the per-setting table.

At rest

On a paid plan with no phone, the connector held an outbound socket open and ran two timers:

  • relay-keepalive, every 20 s;
  • relay-heartbeat, every 25 s.

That is about 5.4 timer runs a minute, roughly 7,800 a day, plus the live socket. Both timers are classed always, so the idle gate never paused them. With no phone enrolled, none of this runs now. The park check also stops reporting "phone relay on" as a reason Node cannot be parked. With a phone paired, behaviour is unchanged.

Tests

  • tests/relay-connector-enrolled-real-path.test.ts (new), against a local relay fixture and the real enroll and revoke routes:
    • with no phone there is no dial;
    • the first enroll dials, and revoking the phone closes the socket;
    • with O8_NO_PHONE_HOME=1 the connector stops even with a phone enrolled.
  • src/lib/mobile/relay-connector.test.ts: the existing 36 connector tests now enroll a fixture phone first.
  • npm run typecheck:fast, npm run verify:ci.

🤖 Generated with Claude Code

The off-network relay connector dialed the hosted relay on every paid
plan, even with no phone paired. It now starts only while at least one
phone is enrolled and stops when the last one is revoked. The enroll and
revoke routes tell the server through an internal endpoint, and each dial
checks again. O8_NO_PHONE_HOME=1 now keeps it off too, and the privacy
doc lists what that variable covers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/M Pull request with M diff size label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

🔍 PR Review Bot

Metric Value
Files changed 10
Additions +230
Deletions -15
New files 2

Automated review — CI workflow

@hurttlocker
hurttlocker added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit c1cc37d Nov 24, 2026
34 checks passed
@hurttlocker
hurttlocker deleted the fix/relay-connector-on-enroll branch November 24, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Pull request with M diff size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant