Inspiration
Most AI coding assistants stop the moment code is written into an editor. But in modern software engineering, writing code is only 20% of the battle. The remaining 80% is the post-code DevSecOps lifecycle: triaging complex issues, diagnosing failing CI/CD builds, analyzing scanner vulnerabilities, coordinating deployment gates, verifying production health, and maintaining audit compliance.
At the same time, giving autonomous agents unrestricted write access, commit keys, or direct deployment permissions introduces severe risks-hallucinated patches, broken builds, security regressions, and zero accountability.
We built PatchPilot AI with a clear guiding thesis: DevSecOps with a human in the loop. By pairing the GitLab Duo Agent Platform with an Autonomy Level 1 (Assisted) governance architecture, we wanted an intelligent orchestration layer where agents act as world-class diagnostic analysts and patch synthesizers across all nine DevSecOps stages-while human maintainers remain the authoritative gatekeepers.
What it does
PatchPilot AI is a GitLab-native assisted DevSecOps automation platform that connects directly to GitLab projects and provides end-to-end lifecycle automation:
- Nine-Stage DevSecOps Orchestration: Meaningfully covers all nine lifecycle stages—Plan, Create, Verify, Package, Secure, Release, Configure, Monitor, and Govern—with verifiable execution evidence, status tracking (passed, failed, blocked, skipped), and mandatory quality gates.
- Specialized GitLab Duo Agent Platform Workflows: Leverages specialized AI agents for:
- Plan: Issue requirement analysis, ambiguity detection, and task breakdown.
- Create: Contextual code review, risk evaluation, and unified diff synthesis.
- Verify: CI/CD runner failure triage and build remediation recommendations.
- Test: Automated test case and regression gap generation.
- Secure: SAST, Secret Detection, and Dependency Scanning finding triage (e.g., CVE remediation).
- Release: Semantic changelog generation and breaking change warnings.
- Cryptographic Approval Binding (SHA-256): Every agent recommendation produces a structured proposal bound to a canonical SHA-256 hash. If the diff, files, or parameters are altered in the slightest, any previous approval signature is instantly invalidated.
- Zero Agent Self-Elevation: Agents cannot autonomously commit code, merge merge requests, deploy to environments, or alter policies. All consequential steps require role-based human sign-off (Maintainer or Security Lead).
- Verified Target Environment Health Gates: A deployment is never marked successful simply because a script ran; PatchPilot actively probes target environments (e.g., HTTP 200 health check) before confirming rollout.
- End-to-End Task Traceability: Persistent correlation IDs connect every lifecycle artifact into a single audit waterfall—from the initial GitLab issue to agent reasoning logs, maintainer signature, pipeline evidence, staging rollout, and append-only governance logs.
How I built it
PatchPilot AI was built from the ground up as a modern, type-safe, cloud-native monorepo:
- Frontend Application: Next.js App Router (React 19), TypeScript, Tailwind CSS, and Lucide icons. Features 10 synchronized workspace views, live timeline streaming, interactive diff reviewers, and a cross-stage trace inspector modal.
- Backend Service: Python 3.12+, FastAPI, and Pydantic v2 for strict schema validation, cryptographic proposal hashing, and role-based authorization gates.
- GitLab Duo Agent Platform Adapter: Communicates with native GitLab Duo Workflow and REST/GraphQL interfaces, featuring a clean diagnostic fallback boundary that inspects platform prerequisites (GitLab Ultimate tier, Duo Enterprise add-on, Workflow Service availability) without failing silently.
- Persistence & Governance: PostgreSQL 16 with SQLAlchemy 2 ORM and Alembic migrations. Employs append-only audit log tables and database statement timeouts.
Testing & Verification:
- Backend: pytest with 41 unit and API integration tests covering failure propagation, HMAC webhooks, and unauthorized action blocking.
- Frontend: Vitest unit tests and Playwright end-to-end tests for complete browser workflow validation.
- Quality checks: ruff formatting/linting and strict mypy type checking across all 15 backend source modules; ESLint and tsc on the frontend.
Packaging & Cloud Deployment: Docker multi-stage builds deployed to Google Cloud Run connected to Cloud SQL (PostgreSQL) and Google Secret Manager, fulfilling the Google Cloud Run hackathon bonus.
## Challenges I ran into
- Enforcing Strict Proposal Immutability: A key challenge was guaranteeing that a human reviewer couldn't approve one diff while a slightly modified diff was executed. We solved this by designing a canonical SHA-256 serialization algorithm that signs the normalized fields (title, finding, rationale, affected_files, proposed_diff, tests_required). Any tampering returns an immediate HTTP 409 Conflict.
- Honest GitLab Duo Platform Prerequisite Handling: Many hackathon projects fabricate mock responses or crash when Duo Enterprise services or Ultimate tiers aren't active in a local test environment. We built a resilient adapter boundary that actively verifies official platform prerequisites (tier checks, group AI feature flags, workflow endpoints) and provides transparent diagnostic guidance while preserving 100% of the structured proposal validation.
- Decoupling Real Target Verification from Pipeline Scripts: Standard CI/CD pipelines often log "deployment succeeded" when docker run exits 0, even if the application crashes 3 seconds later. We implemented an active health probing engine that polls the target container's /health endpoint and records response latency, status code, and payload before promoting deployment status to VERIFIED.
- Maintaining Full Traceability Across Distributed Events: Correlating asynchronous GitLab webhooks, agent background sessions, human decisions, and multi-stage pipeline executions required embedding an immutable correlation_id across every database entity and API payload.
Accomplishments that I'm proud of
- 100% Verified Quality and Test Pass Rate: 41 backend pytest tests and 5 frontend vitest tests pass with 0 warnings, backed by zero type errors in mypy and tsc.
- Zero Self-Elevation Security Guarantee: Built a concrete implementation of Autonomy Level 1 where agents are genuinely useful without ever holding dangerous autonomous permissions. 100% of unauthorized deployment and sign-off attempts are blocked at the server boundary.
- All 9 DevSecOps Stages Meaningfully Covered: Rather than just displaying mock dashboard cards, every stage is mapped to actual execution handlers, failure propagation rules, and real evidence data.
- One-Click End-to-End Sample Task: Implemented POST /api/demo/seed, allowing any reviewer to instantly inspect a realistic, verifiable lifecycle trace (GitLab Issue #101 → Duo Security Agent analysis → Maintainer cryptographic approval → 9-stage pipeline execution → Staging health verification → Immutable audit log).
- Google Cloud Run Production Architecture: Fully containerized and optimized for serverless scalability with Google Cloud Run, Cloud SQL, and Secret Manager.
What I learned
- The Power of the Duo Agent Platform in the Post-Code Phase: Exploring the GitLab Duo Agent Platform demonstrated that AI's highest leverage point in enterprise development isn't just auto-completing code—it's contextual synthesis during build failures, vulnerability remediation, and release readiness.
- Designing for Fail-Safe Autonomy: We learned that security and AI velocity don't have to be opposing forces. By treating AI output as structured proposals bound to cryptographic hashes, engineering teams can safely adopt agentic workflows with complete confidence and compliance.
- Strict Data Contracts Prevent Flakiness: Adopting strict Pydantic models and TypeScript shared interfaces early made building a 10-view dashboard seamless and eliminated entire classes of integration bugs.
What's next for Patchpilot.ai
- Two-Person Integrity (Four-Eyes Approval): Extend the approval queue to support dual-maintainer consensus policies for high-blast-radius production environments.
- Autonomous Rollback on Anomaly Detection: Integrate with GitLab Incident Management and Prometheus/Datadog to automatically trigger pre-approved deployment rollbacks when runtime error rates spike post-deployment.
- Multi-Repository Dependency Graph Awareness: Expand the Duo Agent analysis scope to trace breaking API changes across microservice boundaries and cross-project Merge Requests.
- GitLab Duo Workflow Studio Native UI Extension: Package PatchPilot's proposal review and cryptographic signing interface directly into the GitLab Web IDE and VS Code GitLab Workflow extension.
Built With
- css
- fastapi
- next.js
- postgresql
- pydantic
- python
- tailwind
- typescript