fix(orb): make fleet telemetry work + non-optional in broker mode - #1434
Merged
Conversation
A brokered self-host (ORB_ENROLLMENT_SECRET set) relies on the central Orb for GitHub tokens + webhook relay, so fleet telemetry is part of the self-hosting contract. But the exporter gated on a local GITHUB_APP_PRIVATE_KEY — which a brokered instance never holds — so broker-mode telemetry never ran at all, and ORB_AIR_GAP could suppress it. Also, brokered instances share no Orb/App id, so they collided on the 'unknown' instanceId fallback. - Gate export on the enrollment OR a local App key (brokered = configured). - Air-gap suppresses export only for a self-managed (non-brokered) instance; a brokered instance always exports. - Derive instanceId from the enrollment secret when no Orb/App id is present (hashed — the high-entropy secret never leaks; unique + stable per install).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1434 +/- ##
=======================================
Coverage 95.40% 95.40%
=======================================
Files 193 193
Lines 20971 20973 +2
Branches 7580 7581 +1
=======================================
+ Hits 20008 20010 +2
Misses 383 383
Partials 580 580
🚀 New features to boost your workflow:
|
5 tasks
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.
Summary
Makes the Orb fleet-telemetry exporter actually work and be non-optional in broker mode — the
canonical self-host path where the instance relies on the central Orb for GitHub tokens + webhook relay.
Three issues, all in orb-collector.ts:
GITHUB_APP_PRIVATE_KEY, which abrokered instance never holds (the Orb mints tokens), so an enrolled self-host exported nothing —
defeating the "rely on our Orb for insights" model. Now gated on the enrollment OR a local App key.
ORB_AIR_GAPcould opt a brokered instance out. Telemetry is the fleet-telemetry contract forbrokered self-hosts; air-gap now suppresses export only for a self-managed (non-brokered) instance.
"unknown"instanceIdfallback (colliding cursors + collector dedup). Now derived from the enrollmentsecret when no Orb/App id is present — hashed, so the high-entropy secret never leaks, and unique +
stable per install.
Scope
src/selfhost/**+ its test only; no behavior change for the hosted worker or self-managed instances.Validation
npm run typechecknpm run test:coverage— full suite green; 100% of changed lines and branches covered (new test: brokered mode exports despite air-gap + no App key, and uses the enrollment-derived instance id).Advances the self-host Orb-broker model (follow-up to #1433).