failgate
Provides tools for reproducing issues, running sealed acceptance tests, and verifying fixes on GitHub repositories, issues, and pull requests, including commands like reproduce_issue, run_acceptance_test, verify_fix, and get_fix_task.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@failgateverify PR #42 fixes issue #15 using the sealed acceptance test"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π€ Why
Coding agents now open pull requests at scale β about 17 million a month on GitHub by March 2026. Writing the fix is no longer the hard part. Knowing whether it is right is.
π§ͺ Tests written after the fix grade themselves. When an agent sees a failing test, editing the test is the cheapest way to make it pass β ImpossibleBench caught GPT-5 doing exactly that in 76% of impossible tasks.
π³οΈ "Tests pass" is a weak signal. UTBoost found that 15.7% of the patches counted as resolved on SWE-bench Verified are actually wrong β the tests were too weak to notice.
π Reproduction bots stop too early. Several tools now turn an issue into a failing test. Very few keep that test honest when a PR arrives: was it edited? skipped? does it still fail the same way? did something else break?
FailGate is the acceptance layer: it writes the exam before the fix exists, locks it, and grades every claimed fix β from a maintainer, a contributor, Claude Code, Codex, Copilot, or its own fixer agent β the same way.
Related MCP server: Claude Code Bridge
π§ How it works
Step | What happens | Why it's trustworthy |
β Write the exam | An agent reads the source in a Docker sandbox and writes a pytest test into the repo's own test directory, on the code as it was when the issue was opened. | An independent judge checks it fails the way the issue describes (stack-trace signature, or an LLM judge with quoted evidence), across repeated runs. |
β‘ Seal it | The test is stored with a sha256 and a JSON evidence receipt (code, environment, command, every run's result). Append-only. | Verification always runs the sealed copy. Changing the test in a PR is itself a red flag. |
β’ Grade any fix | For a PR that says | Every run happens in a fresh sandbox (no network, non-root, read-only root fs). The verdict comes with a receipt anyone can re-hash. |
+ hints | Exam strength: mutate the lines the fix changed and see if the exam notices. Hidden exam: variant tests derived from the issue, sealed but not published. | Both only annotate the verdict β they never flip it. |
Wording matters: a pass means "passes the acceptance test + no tampering found + no new regressions", not "the fix is correct".
π Results
Datasets are small and every number has known limits (see What FailGate does not claim); the human-style reviews were done by Claude, not by the projects' maintainers.
What was measured | Result | Details |
Generated exams that fail before and pass after the upstream fix (strict FB/PA), 4 real repos | 32 / 36 | black 9/11 Β· pylint 10/10 Β· packaging 6/6 Β· astroid 7/9 |
Correct verdicts on real upstream fixes + 4 kinds of cheating PRs (test-only, | 125 / 125 | black 45 Β· pylint 50 Β· packaging 30 |
Regressions injected outside the exam's reach, caught by layer β’ | 18 / 21 | pylint went 4/8 β 8/8 after adding "always-run" tests |
LangChain monorepo ( | exams 6 / 6 Β· strict FB/PA 4 / 5 Β· verdicts 22 / 23 | real fixes 4/4 Β· cheating 16/16 Β· injected regressions 2/3 (the miss: no existing test reaches that function) |
Fix-agent patches that passed the exam but were actually wrong | 7 β 3 after full verification | giving the agent the exam did not raise its fix rate (13/24 both arms) β the value is in the gate |
Full loop on GitHub: | 5 / 5 issues | |
Claude Code using FailGate over MCP: write test β fix β verify | 2 min 16 s | Claude Code (Sonnet 5.5) on demo issue #1, 9 tool calls |
β‘ Try it in a minute
Needs Python 3.11+, Docker, and a GitHub token (read-only is enough). No LLM key needed β the demo exams are already sealed.
git clone https://github.com/san086041-glitch/FailGate && cd FailGate
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\Activate.ps1
pip install -e .
export GITHUB_TOKEN=$(gh auth token)
python scripts/media/demo_exams.py import # the demo repo's public sealed exams β your local DB
failgate verify san086041-glitch/failgate-demo#5 # a PR that only edits the test β refuted
failgate verify san086041-glitch/failgate-demo#16 # a real fix β accepted, with exam strengthThen type failgate for the home screen and interactive shell, or failgate doctor to check your setup.
Just the CLI, without the demo data, is on PyPI:
pip install failgate
failgate --version
failgate doctor # what is configured and what is missingπ§© Three ways to use it
π GitHub App
Install on a repo. New issues get triage, dedup, and β for bugs β a sealed failing test. PRs that say Fixes #N get a verification report.
Maintainer commands: /failgate verify, /failgate reseal, /failgate fix.
New repos start in shadow mode: every write is logged, nothing is posted.
β¨οΈ CLI
failgate verify owner/repo#123
failgate checkup owner/repo
failgate upcheckup runs the whole evaluation on any public repo and writes a plain-language report. up starts the service + webhook tunnel with a live status board.
failgate --help lists every command.
π€ MCP (local, stdio)
Let Claude Code or Cursor use FailGate as their acceptance gate:
claude mcp add failgate -- \
python -m failgate mcpTools: reproduce_issue, run_acceptance_test, verify_fix, get_fix_task. Nothing is written into your repo.
Long-running deployment: docker compose up -d --build brings up the API, a sandbox worker, PostgreSQL and Redis β see docs/deploy.md.
π End to end: from issue to merged fix
One real run on the demo repo (issue #21 β PR #22). The only human actions were opening the issue, commenting /failgate fix, and clicking merge.
Time (UTC) | What happened | By |
10:01:08 | Issue #21 opened: | maintainer |
10:01:13 β 10:03:20 | Triage β dedup (related: #19) β reproduced in the sandbox β failing test sealed | FailGate |
10:05:48 |
| maintainer |
10:06:44 | Fixer agent's patch passed the sealed test in a fresh workspace β PR #22 opened by the Fixer App | FailGate |
10:08:25 | PR #22 verified: fails before / passes after, no tampering, no new failures, exam strength medium (7/9) | FailGate |
10:10:54 | Squash-merged β issue #21 closed automatically | maintainer |
About 10 minutes end to end, $0.013 in LLM calls. Here is the same run from the operator's side β failgate up keeps the service and webhook tunnel running and shows every state change:
π§ Under the hood
Explicit state machine, not a free-running agent. Each issue / PR is a
Case; agents run inside bounded steps with budgets.One door for side effects. Every GitHub write goes through
PolicyGate: idempotency keys, shadow mode, secret scanning, label policy.Separated roles. The exam writer, the fixer and the grader have different permissions: the fixer cannot touch tests or test config (enforced in the tool layer), and pushes through a separate GitHub App.
Sandbox. Two phases: install through an egress allow-list proxy, run with no network, non-root, all capabilities dropped, read-only root, pid / memory / CPU limits.
Platform. Two queue lanes so sandbox jobs never block triage (fast-event p95 448 s β 22 s), Redis + arq with crash redelivery, PostgreSQL + Alembic, OpenTelemetry traces to Langfuse.
Measure first. Every component has an offline replay on real repo history ("time travel" to the commit before the fix), and every design decision is written down (what was tried, what failed and why) before the code changes.
Stack: Python 3.11 Β· FastAPI Β· SQLAlchemy 2 (async) Β· PostgreSQL / SQLite Β· Redis + arq Β· Docker SDK Β· LangGraph (fixer agent) Β· cosmic-ray (mutation) Β· bm25s + bge-m3 (retrieval) Β· OpenTelemetry Β· MCP Python SDK Β· Typer + Rich + prompt_toolkit.
π« What FailGate does not claim
"Verified" β correct. A weak exam lets a wrong fix through β that's why strength and hidden exams exist, and why they are shown, not hidden.
Small, honest samples. 4 Python repos, 12 sampled issues each, one run each; human-style review was done by Claude with a "GitHub evidence required" rule.
Python + pytest only, for now. Packages that need system libraries may not install in the sandbox. Monorepos work when the package under test lives in one subdirectory (
--subdir libs/core, e.g. LangChain). More languages are on the roadmap.Exam strength is a hint. It reacts to stronger tests (10 up / 0 down on SWE-bench + UTBoost, p = 0.002) but can't by itself tell a weak exam from a good one (p = 0.41).
πΊοΈ Roadmap
More languages. FailGate works on Python + pytest today. The exam β seal β grade design does not depend on the language; what is Python-specific is four adapters β sandbox install, test runner, failure signatures and mutation testing. Next up: JavaScript / TypeScript (Jest, Vitest), then Go and Java.
More platforms. Gitee, alongside GitHub.
A v0.1 release with a recorded walkthrough.
π Docs
Set up the Fixer App (only needed for
/failgate fix)
This server cannot be deployed
Maintenance
Related MCP Connectors
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Hand tasks, bugs and finished work to AI coding agents, and get back a write-up with evidence.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceActs as a local stdio MCP service that lets Codex delegate implementation tasks to Antigravity CLI while conserving tokens; it returns compact review packets with changed files, diff stats, and run history for Codex to review and iterate.-
- FlicenseNot gradedqualityBmaintenanceEnables Claude conversations to send tasks to a local Claude Code CLI instance and retrieve results, bridging chat to laptop-based builds via stdio or HTTPS/tunnel modes.0-
- AlicenseNot gradedqualityBmaintenanceEnables an external AI agent to delegate tasks to a local Claude Code installation and receive structured reports, with code modifications governed by a plan-approval-execution workflow and direct file and git operations available outside that loop.MIT
- AlicenseNot gradedqualityBmaintenanceExposes code-review and issue-triage tools to AI assistants over stdio, letting them evaluate unified pull-request diffs for maintainer remarks, slice diffs into categorized AST hunks, and classify GitHub issues by priority while synthesizing minimal reproduction stubs.1Apache 2.0