Skip to content

feat(orb): auto-register the brokered self-host's relay URL on boot - #1355

Merged
JSONbored merged 1 commit into
mainfrom
feat/orb-relay-boot-register
Jun 25, 2026
Merged

feat(orb): auto-register the brokered self-host's relay URL on boot#1355
JSONbored merged 1 commit into
mainfrom
feat/orb-relay-boot-register

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Closes the brokered self-host loop (#1255). The container now self-registers its public relay URL with the central Orb on startup — no manual curl — so the Orb forwards this install's events to it. The container computes its relay URL from PUBLIC_API_ORIGIN + /v1/orb/relay and POSTs it to the broker with its enrollment secret.

registerOrbRelayTarget (src/orb/broker-client.ts) is best-effort + fire-and-forget: skipped unless broker mode + PUBLIC_API_ORIGIN are set, and any failure (Orb down, install not registered yet, non-public origin rejected by the Orb's SSRF check) just means no relay until the next boot — it never throws or blocks startup. Wired into the selfhost boot alongside the orb-export hook (server.ts, the codecov-ignored process entry).

The brokered self-host is now end-to-end

install Orb App → self-enroll (admin-verified, #1348) → broker tokens (#1341) → boot auto-registers relay (this) → Orb forwards events (#1352) → relay receiver verifies + enqueues (#1354) → review + act. Setup-wizard recognizes brokered mode (#1346). All flag-gated; byte-identical for cloud + non-brokered self-hosts.

Validation

  • npm run test:ci green; 100% branch coverage on broker-client.ts diff — skip arms (not broker mode / no origin), the POST (URL + relayUrl + Bearer, trailing-slash strip), default broker base, failed (non-ok + thrown). The server.ts boot wiring is in the codecov-ignored entry (exercised by the Docker boot smoke test).

Advances #1255.

Closes the brokered self-host loop (#1255): the container now self-registers its public relay URL with the
central Orb on startup, so the Orb forwards this install's events to it — no manual curl. The container computes
its relay URL from PUBLIC_API_ORIGIN + /v1/orb/relay and POSTs it to the broker with its enrollment secret.

registerOrbRelayTarget (src/orb/broker-client.ts) is BEST-EFFORT + fire-and-forget: skipped unless broker mode +
PUBLIC_API_ORIGIN are set, and any failure (Orb down, install not registered yet, non-public origin rejected by
the Orb's SSRF check) just means no relay until the next boot — it never throws or blocks startup. Wired into the
selfhost boot alongside the orb-export hook (server.ts, the codecov-ignored process entry).

End-to-end now: install Orb App → self-enroll (admin-verified, #1348) → broker tokens (#1341) → boot
auto-registers relay (this) → Orb forwards events (#1352) → relay receiver verifies + enqueues (#1354) → review +
act. Advances #1255.
@dosubot dosubot Bot added the size:M label Jun 25, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.31%. Comparing base (18881ba) to head (8cc920f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1355   +/-   ##
=======================================
  Coverage   95.31%   95.31%           
=======================================
  Files         189      189           
  Lines       20491    20499    +8     
  Branches     7394     7398    +4     
=======================================
+ Hits        19530    19538    +8     
  Misses        378      378           
  Partials      583      583           
Files with missing lines Coverage Δ
src/orb/broker-client.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 497dc7e into main Jun 25, 2026
19 checks passed
@JSONbored
JSONbored deleted the feat/orb-relay-boot-register branch June 25, 2026 10:36
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