Skip to content

Architecture#

MergeMonkey runs every pull request through a layered, isolated pipeline. Your source code is never written to a shared disk, never visible outside an ephemeral sandbox, and never persisted after the review is posted. This page walks through the full system.

MergeMonkey system architecture

The request lifecycle#

  1. Webhook arrives

    GitHub or GitLab delivers a pull_request / merge_request event to Ingress at app.mergemonkey.dev. Ingress verifies the signature against your per-install webhook secret and rejects anything that doesn't match.

  2. Job enqueued

    Valid events are serialized and pushed onto a Redis / BullMQ queue. No code is fetched yet — only the event metadata.

  3. Worker dequeues and spawns a sandbox

    The Worker supervisor pops the job and spawns a new Sandbox — an ephemeral process with its own PID namespace and private /tmp filesystem. Circuit breakers throttle spawn rate if upstream APIs misbehave.

  4. Container clones and analyzes

    Inside the sandbox, a short-lived container runs Clone & AST (27 languages, 44 framework support layers, 500+ detection patterns) followed by Lite + Agent — the AI review pass. The container can reach only the LLM provider; no other network access is permitted.

  5. Results flow back

    Findings travel out of the isolated network into the API, which posts inline review comments back to GitHub / GitLab and persists review metadata (not source) to Postgres (encrypted at rest).

  6. Sandbox destroyed

    The moment results are written, the sandbox process exits and its filesystem is destroyed. No data from your repo survives outside the sandbox's lifetime.

Trust boundaries#

Two nested isolation zones protect your source code.

Crossing either boundary requires going through a policy-enforcing component (Ingress inbound, API outbound). There is no shared filesystem between your repo's clone and any persistent storage.

Isolation guarantees#

Three invariants hold for every review:

  • No secrets in runtime — provider OAuth tokens, webhook secrets, and LLM API keys never appear in the sandbox's environment. The sandbox calls the API for what it needs, never reads secrets directly.
  • Network isolation — the sandbox can reach the LLM provider only. Outbound traffic to any other host is dropped at the network layer.
  • Zero persistence — your repo is cloned into the sandbox's private /tmp, analyzed, and destroyed. The only thing that survives is the review comment posted back to GitHub / GitLab and the review metadata (PR ID, timestamps, finding counts) stored in Postgres.

Data handling#

What runs where#

ComponentPurposeNetwork zone
IngressWebhook validation, token issuancePrivate
Redis / BullMQJob queuePrivate
WorkerSupervisor, spawns sandboxes, enforces circuit breakersPrivate
SandboxEphemeral process wrapping each review jobIsolated
ContainerClone, AST analysis, AI review passesIsolated
LLM ProviderExternal reasoning model (per-user API keys)External (sandbox egress only)
APIPosts results to VCS, manages databasePrivate
PostgresReview metadata, encrypted at restPrivate

Self-hosted deployments#

If you run MergeMonkey on your own infrastructure, the same architecture ships intact — every component is deployed inside your network, and the isolated sandbox zone can be restricted further (e.g. to a self-hosted LLM). See the GitHub Enterprise and GitLab Self-Managed setup guides.

Next#