Skip to content

feat(knowledge): connect GitHub repositories through a GitHub App - #13

Merged
TahubCS merged 1 commit into
mainfrom
feat/github-app-knowledge
Oct 15, 2026
Merged

TahubCS merged 1 commit into
mainfrom
feat/github-app-knowledge

Conversation

@TahubCS

@TahubCS TahubCS commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces pasting a public GitHub URL with a read-only GitHub App, so the support assistant can use private repositories and stays current on push. Unchanged documents now reuse their stored embeddings, so a sync only re-embeds what changed. This applies to every source type.

What changed

Connecting

  • In Knowledge → Add source → GitHub, users click Connect GitHub, install the app, and get back a searchable repository picker. "Link existing installation" covers apps that were installed elsewhere. Adding a public repo by URL still works as a fallback.
  • An installation is linked to a workspace only after /user/installations confirms that the installing GitHub user can access it, so a forged installation_id in the callback URL is rejected.
  • The connect state is HMAC-signed, expires after 30 minutes and is bound to the Supo user who started it.

Indexing (src/lib/knowledge/github.ts)

  • One recursive git tree request instead of walking folders. README, changelog and docs are picked up at any depth (Markdown, MDX, rst, AsciiDoc), up to 400 files.
  • Source code, tests, dependencies, .github and licence files are skipped.
  • Per-source options: branch, include/skip folders, release notes (on by default) and the 200 most recently updated issues (opt-in).
  • Front matter titles are used, and MDX imports are dropped.
  • Private repositories never expose file links in customer-facing citations.

Updates (/api/webhooks/github)

  • The signature is verified (X-Hub-Signature-256) before the body is parsed.
  • Push to the tracked branch, releases and issue changes queue a sync.
  • Uninstall, suspend or removed repo access takes the source out of retrieval. Revisions are bumped so in-flight jobs can't undo it. Restored access re-indexes the source.
  • Renames and visibility changes are followed.

Embedding reuse (ingest.ts)

  • Each chunk stores a document key (content or git blob SHA, plus title, URL and a chunking version).
  • Re-indexing copies the embeddings of unchanged documents and embeds only the rest. If the product's embedding model changed, everything is rebuilt.

Database

drizzle/0028_github_app.sql adds a github_installation table and two columns on knowledge_source: github_installation_id and github_repo_id, indexed. It is additive and idempotent. Run bun run db:migrate on production before deploying.

Configuration

Optional env vars: GITHUB_APP_ID, GITHUB_APP_SLUG, GITHUB_APP_CLIENT_ID, GITHUB_APP_CLIENT_SECRET, GITHUB_APP_PRIVATE_KEY, GITHUB_APP_WEBHOOK_SECRET. These are documented in the README and .env.example. Without them, the GitHub tab falls back to adding a public repository by URL.

Testing

  • tsc, eslint and next build pass.
  • All 189 tests pass with TEST_DATABASE_URL set (Postgres 16 + pgvector).
  • New tests cover:
    • app JWT signing, webhook signature checks, and connect-state tampering and expiry
    • doc file selection, path filters and Markdown cleanup
    • the repository loader against a stubbed GitHub API, including that private repos produce no links
    • webhook handling: push to the right branch, release and issue opt-ins, uninstall and removed access, rename
    • embedding reuse: unchanged documents aren't re-embedded, and only the changed file is
  • The existing mid-ingest edit race test now edits content before the stale run, so the run still embeds and the race is still exercised.

Not yet tested against a live GitHub App.


Generated by Claude Code

Replaces pasting a public repository URL with a read-only GitHub App, so
private repositories work and the knowledge base stays current on push.

- Install/authorize flow with a signed, expiring state; installations are
  linked only after the installing GitHub user is verified through OAuth
- Repository picker with branch, include/skip folders, release notes and
  optional issues
- Indexes README, changelog and docs at any depth via the git tree API;
  source code, tests and dependencies are skipped
- Signed webhook re-syncs on push, release and issue changes, and takes
  sources out of retrieval when access is removed
- Private repositories never expose file links to customers
- Unchanged documents reuse their stored embeddings, so a sync only
  re-embeds what changed (all source types)
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
supo Ready Ready Preview Oct 15, 2026 11:13am UTC

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-15T11:12:45.183471Z 2e9db0f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 05e1f013-6f03-44e8-b495-a437138ebf82
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@TahubCS
TahubCS merged commit 26cca5a into main Oct 15, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 2e9db0fb Deployed Oct 15, 2026 by vercel[bot]
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