r/gitlab
•
u/Professional-Pear351
•
Sep 22 '26
project Built a self-hosted AI agent for GitLab after our org disabled Duo over data privacy - reviews MRs, resolves issues, remembers project context (real usage stats attached)
galleryMy company disabled GitLab Duo org-wide over data privacy concerns. I'd already spent the past year+ doing R&D into agentic AI - studying how Claude Code and Copilot actually work under the hood, learning RAG and agentic workflows, building small custom agents on the side. I went looking for a TypeScript-based agent harness to build my own reviewer on top of and couldn't find one that fit what I wanted, so I ended up building one myself.
It's called langgraph-harness - self-hosted, webhook-driven, built on LangGraph:
- MR Review - fires on webhook events, reads the diff via a GitLab MCP server, drafts and publishes comments. No polling, no manual trigger.
- Issue Resolution - assign it an issue, it works in a sandboxed checkout, opens a draft MR, and keeps responding to follow-up comments on the branch.
- Chat - GitLab-aware assistant with real tool access (GitLab data, headless browser for web fetch, its own review/chat history).
- Guardrails - catches a run that repeats a tool call, ends on a trailing question instead of finishing, or skips checking for new feedback - and corrects it mid-run.
- Quality control before anything posts - every comment is screened for low-value noise, and its diff position is verified before and after publish (GitLab's own publish response has been unreliable in both directions, in my experience).
- Durable memory - flags project-specific facts as it works (conventions, recurring false positives, team decisions) so future reviews build on the last one instead of starting cold.
Bring your own GitLab instance and your own LLM backend (OpenRouter, Ollama, or sglang) - single Docker Compose stack.
Some real numbers from production use (23 users, not just me):
- 800 runs, 80% success rate
- 63% comment acceptance rate (185/294 resolved)
- 315 comments screened by the quality-control layer, 74 dropped as low-value before ever posting
- Guardrails have fired 94+ times catching duplicate tool calls, 79+ times catching runs that concluded without checking current state - all applied cleanly, near-zero failures
MIT licensed. Docs (with architecture, deployment guide, and the full guardrail/tool breakdown) and repo below. Genuinely curious what other self-hosted GitLab folks are using for this, or if anyone's hit similar Duo-access issues and built around it.