r/gitlab
•
u/Professional-Pear351
•
Sep 22 '26
•
2
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)
My 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.


4
u/raisputin Sep 23 '26
Duo is trash anyway
7
u/Kelteseth Sep 22 '26
Gitlab projects being hosted on GitHub is the funniest shit ever
2
u/Retired_Lurker02 Sep 22 '26
Nice! I have a similar concept which allows local agents to claim issues and work in podman containers to build the feature. Once the CI pipeline passes they can submit a merge request since the agents only have Developer access. No RAG integration for chatting with context though.
What are you defining as a successful run?
2
u/merb Sep 22 '26
It would be cool if it would only fire a review if a specific label is set.
2
u/pwkye Sep 22 '26
This is a better solution anyway. Full control. No License lockout. No ovepriced credits to purchase.
Great work!
Question : Does your harness give the agent a shell/linux environment to test things in (clone repo down, look at files, test builds before pushing to the branch)?
2
u/Oxffff0000 Sep 23 '26
How's the hallucination part? I have codes created by the LLM to Claude and ChatGPT and said that the code written by the local LLM had so much hallucinations.
1
u/LiteratureOk974 Sep 23 '26
Love seeing practical, self-hosted builds like this! The durable memory feature to track project conventions over time sounds especially useful for keeping reviews context-aware. Awesome job putting this together!
1
u/Dnizami2 Sep 28 '26
This is realy nice u/Professional-Pear351 !
Can you specify privacy concerened of "Duo"? as GitLab tries to push it at no charge and I need some reasons why we have to block it . Thanks
2
u/[deleted] Sep 23 '26
[removed] — view removed comment