💡 Inspiration

Every software engineering team dreads 2 AM production alerts: unhandled exceptions, calculation regressions, and broken CI/CD pipelines. Today, Mean Time to Resolution (MTTR) averages over 3 hours of manual log parsing, stressful debugging, and repeated runner compute storms.

We asked: What if GitLab Duo could act as an autonomous, multi-agent SRE team that diagnoses, safely tests, and merges verified code fixes in under 60 seconds — before a human developer is even paged?

That vision led us to build GitLab Duo SRE: Autonomous Incident Resolver — a self-healing DevSecOps system running serverless on Google Cloud Run.


🚀 What It Does

When an incident is reported via a GitLab Issue or a failed pipeline, our event-driven multi-agent platform kicks off an autonomous 9-stage DevSecOps loop:

  1. Plan (Triage & Recall): IncidentParserAgent extracts stack traces and affected microservices. KnowledgeRetrieverAgent queries Neo4j AuraDB GraphRAG memory to recall prior resolution patterns.
  2. Secure (The Adversarial Gate): Before any code is touched, CriticReflectorAgent enforces strict negative constraints (e.g., zero schema changes, zero network calls, fail-closed authorization).
  3. Create (AST Synthesis): CodebaseAnalystAgent and FixPlannerAgent traverse the Abstract Syntax Tree (AST) to generate minimal, surgical patches.
  4. Verify (Sandbox Red/Green Runner): The patch is mounted into an isolated Linux sandbox where ValidationAgent verifies the Red-to-Green transition using pytest.
  5. Secure (SAST Scan): SecurityValidator inspects the diff for secrets, injection vulnerabilities, and security regressions.
  6. Govern (Risk & Blast Radius): RiskScorerAgent deterministically scores the blast radius into Low Risk (pre-cleared for auto-merge), Medium Risk (requires developer review), or High Risk (read-only diagnostic report).
  7. Release (Automated MR): SynthesisAgent opens a GitLab Merge Request with comprehensive test proof, executive summaries, and auto-merges low-risk fixes.
  8. Configure & Deploy: DeploymentService validates staging and rolls out the verified container revision to Google Cloud Run.
  9. Monitor & Govern: SustainabilityAgent audits Software Carbon Intensity (SCI v1.0), and KGBuilderAgent stores the learned pattern back into Neo4j graph memory.

🛠️ How We Built It

  • GitLab Duo Native Reasoning: Native Duo AI Gateway and specialist Claude 3.5 Sonnet agent models coordinate through the Model Context Protocol (MCP).
  • Backend Orchestrator: Built with FastAPI and Python 3.10, containerized on Docker, and deployed serverless on Google Cloud Run (us-central1).
  • GraphRAG Long-Term Memory: Neo4j AuraDB graph database maps past (:Incident)-[:RESOLVED_BY]->(:Patch) nodes, enabling instant knowledge recall.
  • Mission Control Frontend: A glassmorphic React interface with Server-Sent Events (SSE) that visualizes the active agent DAG, cognitive reasoning streams, live execution terminals, and interactive AST diffs.
  • Isolated Sandbox: Micro-sandboxes execute red/green reproduction cycles and pytest suites with sub-second isolation.

🧗 Challenges We Faced

  1. Recursive Webhook Loops: When our bot pushed remediation branches (fix/inc-...), CI pipelines ran and initially triggered secondary pipeline failure webhooks. We engineered strict loop-prevention filters in WebhookService to ensure only failures on main are remediated.
  2. Adversarial Safety Gates: LLMs often generate overly broad fixes that can introduce side effects. Implementing CriticReflectorAgent as a strict pre-patch adversarial evaluator was essential to lock negative constraints before code generation.
  3. State Persistence Across Serverless Cold Starts: On Cloud Run, instances scale to zero when idle. We designed a dual SSE streaming and JSON persistence mechanism to ensure completed incident audits are preserved across container instances.

🏆 Accomplishments We're Proud Of

  • Sub-60s MTTR: Slashed incident resolution time from an industry baseline of 180 minutes to under 60 seconds.
  • Zero Third-Party Model Lock-In: Built 100% native to GitLab Duo and MCP.
  • Green Software Impact (SCI v1.0): Saved ~74 grams of CO2e per incident and achieved an 18x to 76x sustainability efficiency ratio by preventing CI retry compute storms.
  • Enterprise-Grade Governance: Strict three-tier risk scoring ensures no high-risk patch ever auto-merges without human approval.

📚 What We Learned

  • Specialized Multi-Agent DAGs Beat Monolithic Prompts: Splitting duties into distinct agents (Critic, Analyst, Planner, Validator) drastically increases patch reliability and eliminates hallucinations.
  • Graph Memory Supercharges Triage: Connecting prior resolutions via Neo4j GraphRAG enables instant recognition of recurring error signatures.

🔮 What's Next

  • Multi-Repo Dependency Graphs: Expanding blast-radius analysis across distributed microservice architectures.
  • Canary Rollback Watchdogs: Automated integration with GitLab Prometheus / OpenTelemetry alerts to automatically roll back revisions if latency spikes.

Built With

  • devsecops
  • docker
  • fastapi
  • framer-motion
  • gitlab-duo
  • google-cloud-run
  • graphrag
  • mcp
  • neo4j
  • pytest
  • python
  • react
  • serverless
  • tailwindcss
Share this project:

Updates

Submission history