feat(selfhost): add Gittensory Orb outcome signal collector (#1219) - #1224
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1224 +/- ##
==========================================
+ Coverage 94.92% 94.94% +0.02%
==========================================
Files 173 176 +3
Lines 19616 19708 +92
Branches 7050 7085 +35
==========================================
+ Hits 18620 18712 +92
Misses 396 396
Partials 600 600
🚀 New features to boost your workflow:
|
JSONbored
force-pushed
the
feat/gittensory-orb
branch
from
June 24, 2026 11:00
da41ff3 to
3219c7f
Compare
Gittensory Orb is a separate, lightweight GitHub App (pull_requests:read + metadata:read) that records gate verdict + PR outcome (merged/closed) locally for calibration and optional aggregate telemetry. Nothing is sent without explicit ORB_ENABLED=true. - Setup wizard at GET /orb/setup — one-click GitHub App manifest flow creates the Orb App and writes credentials to /data/gittensory-orb.env - /orb/webhook handler — HMAC-SHA256 verified; handles pull_request.closed (records outcome + gate verdict from review_targets) and installation events (tracks which repos have the Orb App installed) - orb-collector.ts — local DB store (orb_events) + hourly export batch with HMAC-signed payload; ORB_ANONYMIZE=true (default) HMAC-hashes repo names; ORB_AIR_GAP=true keeps all data local - Migrations 0056 (orb_events) + 0057 (orb_installations) with UNIQUE constraints for idempotent event recording - Hourly export cron wired into server.ts; also flushes on startup - Grafana Orb row: recorded/exported/error/installs stats + event rate + pending vs exported timeseries (dashboard v3) - 56 tests across orb-collector, orb-setup, orb-webhook modules
…w selfhost modules - Fix TS2352 in selfhost-qdrant-vectorize.test.ts: all mock.calls[0] casts now use `as unknown as [...]` to satisfy the strict mock type - orb-collector: cover both sides of `GITHUB_WEBHOOK_SECRET ?? ""` (delete env var to trigger empty-string fallback) and `ORB_ANONYMIZE ?? "true"` (unset → defaults to anonymize=true) - orb-webhook: cover timingSafeEqual throw path (malformed hex sig → catch returns false), null closed_at/created_at (time_to_close_ms = null), repositories_removed ?? [] fallback, repositories ?? [] fallback on deleted event, and if(repos.length) false branch when install list is empty All five new src/selfhost modules now at 100% statements, branches, functions and lines.
8 tasks
…nt Host-header redirect attack Same class of vulnerability as the main setup wizard fix: the Orb wizard derived the manifest origin from PUBLIC_API_ORIGIN ?? request.url.origin, allowing an attacker to spoof the Host header and redirect the App-creation callback to an attacker-controlled domain to steal the Orb App credentials. Remove the request.url fallback from both setup wizards; return 400 when PUBLIC_API_ORIGIN is unset.
JSONbored
force-pushed
the
feat/gittensory-orb
branch
from
June 24, 2026 11:11
04fd4d0 to
7d692b7
Compare
…rop AUTOINCREMENT from Orb migrations Use the Orb-specific env vars (ORB_WEBHOOK_SECRET, ORB_APP_ID) in exportOrbBatch and instanceId() instead of the main app's GITHUB_WEBHOOK_SECRET/GITHUB_APP_ID — prevents empty-string HMAC signing when only the Orb secret is set. Drop AUTOINCREMENT from orb_events/orb_installations DDL so the Postgres migration adapter accepts both tables (it translates INTEGER PRIMARY KEY but not AUTOINCREMENT).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
The pg-dialect translator handles CURRENT_TIMESTAMP and strftime('%f') variants
but not strftime('%S', ...) — the Orb migrations used the latter, breaking the
Postgres integration test. Align with the existing migration convention.
13 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
Adds Gittensory Orb — a separate, lightweight GitHub App (read-only:
pull_requests:read+metadata:read) that records gate verdict + PR outcome locally for self-hosted calibration and opt-in aggregate telemetry. Completely off by default (ORB_ENABLED=false). Nothing leaves the instance without explicit opt-in.Architecture (inspired by entrius/das-github-mirror):
GET /orb/setupvia GitHub App manifest flowPOST /orb/webhookUNIQUE (repo, pr_number, head_sha)→INSERT OR IGNORE)ORB_ANONYMIZE=trueby default)ORB_AIR_GAP=truekeeps all data strictly localNew files:
src/selfhost/orb-setup.ts— manifest builder, setup page, credential exchange, env serializersrc/selfhost/orb-webhook.ts— signature verify, gate verdict lookup, PR close + installation handlerssrc/selfhost/orb-collector.ts— local DB store + hourly batch export with signing + HMAC anonymizationmigrations/0056_orb_events.sql+migrations/0057_orb_installations.sqlModified files:
src/server.ts— Orb imports,/orb/setupwizard,/orb/webhookendpoint, pre-init counters, hourly export crongrafana/dashboards/gittensory.json— Orb row (recorded/exported/errors/installs + rate timeseries, dashboard v3).env.example— Orb env block with all config variablesDepends on: #1157 (Docker/Redis/Qdrant — must merge first)
Scope
src/changestest/changes (56 new unit tests)migrations/changes (0056, 0057)apps/gittensory-ui/changeswrangler.jsonc/cf-typegenchangesValidation
npx vitest run test/unit/selfhost-orb-collector.test.ts test/unit/selfhost-orb-setup.test.ts test/unit/selfhost-orb-webhook.test.ts— 56/56 passednpx tsc --noEmit— clean (no errors in Orb modules)npm run test:cipending CISafety
ORB_ENABLED=falseby default), HMAC-signed, and anonymizabletimingSafeEqual)ORB_AIR_GAP=true) keeps everything strictly local