Second Look

Documentation

Second Look is a self-hosted GitHub App. It runs as two processes, a web service that receives GitHub webhooks and serves the dashboard, and workers that review pull requests and run tests in a sandbox. Both share one Postgres database.

Install

There are two ways to run Second Look. Pick one.

Deploy to Fly.io in one command

You need a Fly.io account with flyctl installed and logged in, and an OpenRouter API key.

git clone https://github.com/kaushik-3009/SecondLook && cd SecondLook
./deploy/fly-deploy.sh my-second-look

The script creates the app, a Postgres database, storage for the test sandbox and the secrets, deploys a web machine and a worker, and prints a link. It asks for your OpenRouter key and takes a few minutes.

Connect it to GitHub

  1. Open the link the script printed: https://my-second-look.fly.dev/setup?token=…
  2. Click Create GitHub App and confirm on GitHub. The App is created with the right permissions and its webhook pointing at your server; its credentials go straight into your database.
  3. Click Install on repositories, pick repositories, and open a pull request. A Second Look check appears within seconds.

The dashboard is at https://my-second-look.fly.dev/?token=… with the same token.

Any other server

Anything that runs Docker works. GitHub has to reach the server, so give it a public address (a domain, or a tunnel such as cloudflared tunnel).

cp .env.example .env     # set OPENROUTER_API_KEY, DASHBOARD_TOKEN and PUBLIC_URL
docker compose up -d --build
# then open $PUBLIC_URL/setup?token=$DASHBOARD_TOKEN
Use a GitHub App you created yourself

Create it under Settings → Developer settings → GitHub Apps with webhook URL https://<your-host>/webhooks/github and a webhook secret; permissions Contents read and write (only used to add a test on request), Metadata read, Pull requests read and write, Checks read and write, Issues read; events Pull request, Issue comment, Pull request review comment. Then set GITHUB_APP_ID, GITHUB_PRIVATE_KEY and GITHUB_WEBHOOK_SECRET instead of using /setup.

Comment @second-look review on any pull request to request a fresh review. Reply @second-look add test to a confirmed comment and Second Look commits the test that proved the bug to the branch. Both commands are for owners, members and collaborators; tests are never pushed to forks.

GitHub Action

Prefer not to run a server? Add one workflow file. Second Look runs inside your pull request's checks, posts the same comments as the app, and edits them on later pushes instead of posting new ones.

on: pull_request
permissions: { contents: read, pull-requests: write }
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: kaushik-3009/SecondLook@v0
        with:
          openrouter-api-key: ${{ secrets.OPENROUTER_API_KEY }}
          min-tier: confirmed
          fail-on: none    # or confirmed, to block merging

Configuration

Add .secondlook.yml to the root of a repository. It is read from the pull request's base branch, so a pull request can't change the rules that review it. To set defaults for every repository in an organization, put the file in the organization's .github repository.

enabled: true
severity_threshold: medium     # low | medium | high | critical
min_tier: plausible           # confirmed = only post execution-proven bugs
max_comments: 5
ignore_paths: ["migrations/**", "**/*_pb2.py"]
suggestions: true
deep_review: false            # a second, recall-focused pass
show_unproven: true           # list held-back suspicions in the summary
static_checks: true           # broken files and undefined names, no model
existing_tests: true          # your own nearby tests, on both branches
double_check_refutations: false # a second test before dropping a suspicion
explore: false                # probe the code before writing the test
ignore_categories: []           # kinds of comment never to post
learn_from_feedback: true     # go quiet on kinds your team dismisses
skip_drafts: true
conventions: |
  Errors are returned, never panicked, outside main packages.
rules:
  - id: no-print
    description: Library code uses logging, never print().
    severity: low
    paths: ["src/**"]
sandbox:
  setup: "pip install -e .[test]"  # runs with network, cached per lockfile
  timeout: 180                     # seconds per test run, no network
  env: { DATABASE_URL: postgres://postgres:test@db/postgres }
  services:                        # reachable by name, never the internet
    - { name: db, image: postgres:16, env: { POSTGRES_PASSWORD: test }, ready: pg_isready -U postgres }

Confidence tiers

Problems in the file never stop a review; they're listed in the review summary instead.

Sandbox services from docker-compose.yml

If the repository already has a docker-compose.yml, you don't have to write the sandbox section yourself. secondlook suggest-config . prints one: database, cache and queue services with readiness checks, and the environment variables your app uses to reach them. Add --write to save it as .secondlook.yml. When tests come back inconclusive and services are missing, the review summary suggests it.

Models and providers

The default is z-ai/glm-5.3-flash through OpenRouter (uses OPENROUTER_API_KEY). Set SECONDLOOK_MODEL to any other OpenRouter model id, or to a Claude model such as claude-opus-5-5 (uses ANTHROPIC_API_KEY).

Provider order

With OpenRouter you can pin providers in order of preference. Second Look tries them strictly in that order and moves on when one is rate-limited, down or returns an unusable answer. No other provider is used.

OPENROUTER_PROVIDERS=wafer/us,tenstorrent/fp8,darkbloom/fp4,wafer/nvfp4,makora/fp4
OPENROUTER_RPM=20             # requests per minute, shared by all workers in a process
OPENROUTER_BUDGET_USD=5       # hard stop for a process
INSTALLATION_MONTHLY_BUDGET_USD=20

Providers that can't enforce structured output are still usable: their replies are validated against the expected format, and an invalid reply moves on to the next provider.

Running in production

Plans and quotas (hosted)

Each installation has a plan. The free plan includes a monthly allowance of private-repository reviews; public repositories are never limited. When an installation reaches its allowance, the pull request gets a neutral check explaining why, and no model is called. Set STRIPE_SECRET_KEY, STRIPE_PRICE_TEAM and STRIPE_WEBHOOK_SECRET to let users upgrade from the dashboard; point a Stripe webhook at /billing/stripe.

Security

Pull request code is untrusted. It only ever runs inside the sandbox: a throw-away container with no network, all Linux capabilities dropped, no privilege escalation, memory, CPU and process limits and a timeout. Installing dependencies is the only step with network access, and it never sees credentials: GitHub tokens are passed to git as a transient header and are never written to the checkout. Files in a pull request are never read through symbolic links, so a pull request can't make the reviewer read files from the host.

Keep the GitHub private key, webhook secret, model keys and database URL in your platform's secret store, and set a dashboard token.

FAQ

Does my code leave my infrastructure?

Only the parts of the pull request needed for review are sent to the model provider you choose. Everything else, including test execution, runs on your own machines.

What if my tests need a database or another service?

Declare it under sandbox.services. Each test run gets fresh service containers on a private network: your tests reach them by name, and nothing can reach the internet. Bugs that need a service you haven't declared can't be proven, so they're posted only when the model is at least 85% confident. If your repository has a docker-compose.yml, secondlook suggest-config writes the services section for you.

Which languages are supported?

Python, JavaScript, TypeScript, Go and Java (Maven or Gradle) have built-in sandbox setups. Other languages are reviewed, and can be executed if you set sandbox.setup and an image.

How much does it cost?

With GLM-5.3-Flash, a typical review costs about $0.0023 in model fees. Use the monthly budget to cap spend per installation.