This document explains the runtime logic from webhook ingest to GitHub output.
Core backend components:
FastAPIAPI serverwebhooksrouter (signature verification + idempotent ingest)- in-memory task queue (current default)
- webhook processor worker
- services:
- GitHub API service
- LLM service abstraction
- review orchestration service
- SQLite metadata database
- optional Qdrant (RAG path)
flowchart TD
A[GitHub Event] --> B[POST /webhooks/github]
B --> C[Verify X-Hub-Signature-256]
C --> D[Normalize Event]
D --> E[Persist webhook_events + delivery_logs]
E --> F[Enqueue process_delivery_log]
F --> G[Worker picks job]
G --> H[Run event-specific automation]
H --> I[Persist review_runs/findings/scores]
I --> J[Write back to GitHub comments/labels/checks]
- Summarize issue text with provider.
- Suggest labels (heuristics + LLM candidate labels).
- Apply labels through GitHub API.
- Post issue summary comment with suggested labels.
- Persist result metadata in
review_runs.
- Detect onboarding intent phrases.
- Generate onboarding response.
- Post onboarding comment.
- Persist onboarding run result.
- Fetch changed files from GitHub API.
- Build PR summary + file summaries.
- Generate review suggestions (experimental).
- Compute advisory score card.
- Persist run, findings, and score rows.
- Upsert PR review comment.
- Create Check Run (if app has
Checks: Read and write).
Each webhook is assigned an idempotency key:
platform:delivery_id:event_type:action
If a duplicate delivery key is seen, FOSSMate returns accepted response without reprocessing.
Key tables used by runtime:
webhook_events: raw payload storagedelivery_logs: normalized delivery state (queued,processing,done,failed)review_runs: run-level result metadatareview_findings: suggestion rows for PR reviewsscore_cards: advisory score dimensionsinstallation_settings: feature flags and per-installation settingsdeveloper_metrics: developer-level aggregates (for reporting)
Provider is selected by LLM_PROVIDER.
Supported adapters:
ollama(default OSS path)geminiopenaiopenroutercustom(OpenAI-compatible)azure_openaideepseekdeepseek_r1
Fallback path:
- If
LLM_FALLBACK_PROVIDERis set,FallbackLLMProviderretries on failure.
GitHub App auth path:
- Build app JWT from
GITHUB_APP_ID+ private key. - Exchange JWT for installation token.
- Use installation token for repository operations.
Private key sources:
GITHUB_PRIVATE_KEY(inline)GITHUB_PRIVATE_KEY_PATH(recommended)
Fallback behavior:
- If placeholder key is present and
GITHUB_TOKENexists, code can fall back to PAT. - This is for local troubleshooting only, not production.
403 on comments/labels:
- app not installed on repo
- missing Issues/Pull requests write permissions
- PAT fallback token missing required scopes
403 on check-runs:
- missing
Checks: Read and writepermission
401 webhook signature:
- secret mismatch between GitHub App and backend env
To make this run "on its own" in production:
- host backend on stable HTTPS domain
- point GitHub App webhook URL to production endpoint
- use app private key auth (not PAT fallback)
- ensure required permissions/events are configured
- use persistent DB and monitoring
- add queue retries/dead-letter for reliability