You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to #1176, #1177, #1178.Deferred / optional — do not implement until latency is a proven complaint. Filed for tracking (issue-first), not scheduled.
#1175–#1178 deliver full automatic sync via a pull-based scheduled poller (sourceSyncScheduler), which is the correct baseline because Ornn links to arbitrary public repos the skill author usually does not administer — and both GitHub Apps and per-repo webhooks require repo-admin. The poller's only weakness is latency: a change is picked up on the next cron tick, not instantly.
This issue is the optional push-based accelerator for the minority of repos whose author can install an Ornn GitHub App: receive push webhook events and trigger an immediate re-check, with the #1176 poll retained as the reconciliation backstop.
Verified facts (GitHub docs): a GitHub App gives one centralized webhook endpoint across all installed repos (no per-repo wiring). Delivery is at-least-once with no automatic redelivery; if the endpoint doesn't ack within 10s the delivery is marked failed. So the handler must ack fast, dedupe, and rely on the poll as a safety net.
Purpose
Cut auto-sync latency from "next poll" to near-instant for authors who opt in by installing the Ornn GitHub App on their source repo — without changing the guarantee for everyone else (polling still covers 100%).
Affected Files
ornn-api/src/domains/skills/sourceWebhook/routes.ts — new: POST /webhooks/github/source — HMAC-verify, ack 202 within 10s, enqueue.
ornn-api/src/domains/skills/sourceWebhook/verify.ts — new: HMAC-SHA256 signature verification against a configured webhook secret (from settings/env, never hardcoded).
ornn-api/src/domains/settings/sections/sourceSync.ts — modify: add githubAppId, githubAppInstallation* (if using an App) and/or webhookSecret (encrypted at rest + masked).
ornn-api/src/bootstrap.ts — modify: mount the webhook route.
Colocated tests: verify.test.ts, routes.test.ts.
.changeset/*.md — new changeset.
Implementation Instructions
Endpoint: POST /webhooks/github/source parses the push event, verifies the X-Hub-Signature-256 HMAC against the configured secret (constant-time compare), and responds 202 immediately after pushing { deliveryId, repo, ref, headSha } onto an Agenda queue. Do all real work async (GitHub's 10s ack rule).
Security: reject unsigned/mis-signed requests with 401; the secret is loaded from settings/env only; never log the raw payload or secret. Rate-limit / size-cap the endpoint (GitHub payloads up to 25 MB).
Every step in Implementation Instructions is implemented (no partial scope)
Behavior exercised locally: send a signed sample push payload → 202 within 10s → the affected skill re-checks and (if drifted + version bumped) auto-publishes; an unsigned payload → 401
Redelivery/dedupe verified: same delivery id twice → single publish
Poller backstop still runs and catches a simulated dropped delivery
Secret + payload never logged in plaintext
Tests run locally and green: cd ornn-api && bun test src/domains/skills/sourceWebhook
bun run typecheck and bun run lint clean
Docs updated (webhook setup + the App install steps)
Background
Related to #1176, #1177, #1178.Deferred / optional — do not implement until latency is a proven complaint. Filed for tracking (issue-first), not scheduled.#1175–#1178 deliver full automatic sync via a pull-based scheduled poller (
sourceSyncScheduler), which is the correct baseline because Ornn links to arbitrary public repos the skill author usually does not administer — and both GitHub Apps and per-repo webhooks require repo-admin. The poller's only weakness is latency: a change is picked up on the next cron tick, not instantly.This issue is the optional push-based accelerator for the minority of repos whose author can install an Ornn GitHub App: receive
pushwebhook events and trigger an immediate re-check, with the #1176 poll retained as the reconciliation backstop.Verified facts (GitHub docs): a GitHub App gives one centralized webhook endpoint across all installed repos (no per-repo wiring). Delivery is at-least-once with no automatic redelivery; if the endpoint doesn't ack within 10s the delivery is marked failed. So the handler must ack fast, dedupe, and rely on the poll as a safety net.
Purpose
Cut auto-sync latency from "next poll" to near-instant for authors who opt in by installing the Ornn GitHub App on their source repo — without changing the guarantee for everyone else (polling still covers 100%).
Affected Files
ornn-api/src/domains/skills/sourceWebhook/routes.ts— new:POST /webhooks/github/source— HMAC-verify, ack202within 10s, enqueue.ornn-api/src/domains/skills/sourceWebhook/verify.ts— new: HMAC-SHA256 signature verification against a configured webhook secret (from settings/env, never hardcoded).ornn-api/src/domains/skills/crud/sourceSyncScheduler.ts— modify: add an Agenda queue/job to process a webhook-triggered re-check for the affected(repo, ref)(reuse the drift+auto-publish path from [Feature] Scheduled GitHub source drift-check job (auto-detect upstream changes) #1176/[Feature] Unattended auto-publish of drifted GitHub-sourced skills #1177).ornn-api/src/domains/settings/sections/sourceSync.ts— modify: addgithubAppId,githubAppInstallation*(if using an App) and/orwebhookSecret(encrypted at rest + masked).ornn-api/src/bootstrap.ts— modify: mount the webhook route.verify.test.ts,routes.test.ts..changeset/*.md— new changeset.Implementation Instructions
POST /webhooks/github/sourceparses thepushevent, verifies theX-Hub-Signature-256HMAC against the configured secret (constant-time compare), and responds202immediately after pushing{ deliveryId, repo, ref, headSha }onto an Agenda queue. Do all real work async (GitHub's 10s ack rule).X-GitHub-Delivery(delivery id) and on(repo, ref, headSha)so at-least-once redelivery does not double-publish. Reuse the [Feature] Unattended auto-publish of drifted GitHub-sourced skills #1177 re-read + sha-compare guard.(repo, ref)to all skills whosesourcematches and run the [Feature] Scheduled GitHub source drift-check job (auto-detect upstream changes) #1176checkSourceDrift→ [Feature] Unattended auto-publish of drifted GitHub-sourced skills #1177autoPublishFromSourcepath for each. Ignore pushes to refs no skill tracks.401; the secret is loaded from settings/env only; never log the raw payload or secret. Rate-limit / size-cap the endpoint (GitHub payloads up to 25 MB).Definition of Done
pushpayload →202within 10s → the affected skill re-checks and (if drifted + version bumped) auto-publishes; an unsigned payload →401cd ornn-api && bun test src/domains/skills/sourceWebhookbun run typecheckandbun run lintcleanCo-Authored-Bylines in any commitdevelop-auto; CI 100% greenPriority
P3 — deferred; build only if latency becomes a real complaint.
Size
L