Inspiration

With the rapid adoption of autonomous AI coding assistants, production codebases are expanding faster than human engineering teams can manually review them. While these tools excel at isolated feature completion, they lack macro-architectural awareness. It is incredibly easy for an automated assistant (or a developer under a tight deadline) to inject a direct database model import straight into a frontend UI component, completely bypassing API abstraction layers. This causes rapid design decay and tightly coupled systems. We built OrbitGuard to serve as an automated, graph-aware governance gatekeeper that solves this problem at the root.

What it does

OrbitGuard is an AI-native code compliance engine built for the GitLab Duo Agent Platform. The moment a Merge Request is initialized, OrbitGuard intercepts the workflow and analyzes the structural relationships of the modified Abstract Syntax Tree (AST) using the GitLab Orbit Knowledge Graph. It checks the code layers against a centralized, human-readable policy matrix. If an illegal boundary crossing is detected (such as our sandbox demonstration of a frontend UI module directly coupling with a database backend schema), OrbitGuard fails the validation pipeline, blocks merge readiness, and communicates the explicit violation criteria to the developer.

How we built it

The platform was engineered to be 100% cloud-native, developed entirely inside the GitLab cloud environment and verified using automated container pipelines:

  • FastAPI Framework: An asynchronous Python API layer routes incoming webhook payloads and leverages strict Pydantic schemas to validate data integrity.
  • Deterministic Engine: The core processing script translates source file directories and evaluates path layouts using robust regex pattern matching.
  • Automated Test Matrix: Implemented a comprehensive verification layer using pytest to assert behavior-driven client responses during simulated merge regressions.
  • Optimized CI/CD: Configured a rapid container execution layout inside .gitlab-ci.yml that handles dependency installation and complete system testing in under 50 seconds.

Challenges we ran into

One of our primary engineering hurdles was structuring a clean continuous integration workflow within isolated runner environments without relying on persistent local configurations. We hit syntax validation roadlocks with strict YAML parsing parameters and ran into initial module loading exceptions when managing container test execution. We resolved these systematically by standardizing our key-value spacing patterns and mapping our testing framework packages directly into our environment requirements manifest.

Accomplishments that we're proud of

We are incredibly proud of building a fully functional, highly decoupled architectural guardrail that runs entirely in the cloud with zero third-party platform overhead. Achieving sub-50 second execution speeds for an isolated compilation and verification runtime ensures that developers receive instantaneous architectural feedback loops without slowing down deployment velocity.

What we learned

This project provided massive insights into mapping static dependencies across microservices and complex monolith structures. We gained a deeper understanding of traversing graph-based architectural representations of code syntax and learned how to safely decouple corporate engineering governance compliance rules from underlying application routing code.

What's next for OrbitGuard

The next step for OrbitGuard is moving beyond blocking validation gates and introducing autonomous remediation. We plan to integrate directly with live GitLab Duo Agent execution flows to allow OrbitGuard to automatically generate and suggest a clean, compliant refactored code layer (such as refactoring a direct database pull into a standardized API controller call) directly inside the active Merge Request discussion panel.

Built With

  • fastapi
  • gitlab-ci/cd
  • pytest
  • python
  • yaml
Share this project:

Updates