Inspiration

Pipeline failures are the ultimate developer productivity killer. Developers spend nearly a quarter of their time reading raw logs, tracing stack lines, identifying code owners, and writing boilerplate fixes. I was inspired to create an autonomous agent that could handle this entire lifecycle headlesslytransforming a broken build into a self-healing loop.

What it does

When a GitLab CI/CD pipeline fails, the Pipeline Auto-Healer automatically:

  1. Intercepts the failure event instantly via GitLab webhooks.
  2. Analyzes raw job logs to isolate the stack trace and extract error details.
  3. Queries GitLab Orbit to map codebase dependencies, locate the exact file context, and resolve the team member responsible for the module.
  4. Calls Google Gemini to generate a precise, minimal patch.
  5. Clones the repository in a sandbox to verify that tests pass before pushing any code.
  6. Opens a verified Merge Request complete with a beautiful, interactive diagnostic report.

How I built it

  • Core Orchestrator: Written in TypeScript running on Express to handle webhook routing.
  • GitLab Integration: Built with the GitLab REST API and simple-git to automate branch creation, commits, and MR submissions.
  • GitLab Orbit GraphQL: Traverses the graph representation to resolve ownership and callers.
  • AI Engine: Uses the Google GenAI SDK to interface with Gemini.
  • Sandbox Validation: Spawns isolated local directories to run unit tests programmatically before pushing.
  • Duo Integration: Fully configured with agent-config.yml and custom flow manifests to publish the agent to the GitLab AI Catalog.

Challenges I ran into

  • Context Limits & Noise: Raw pipeline trace logs can be huge and full of container setup noise. I had to build custom regex parsers for Python, JS/TS, and Go to cleanly isolate the stack trace before sending it to the LLM.
  • Sandbox Security & Reliability: Ensuring that running test suites locally in a temporary directory did not pollute the main host system required careful filesystem management and timeout boundaries.

Accomplishments that I'm proud of

  • Getting the end-to-end self-healing loop running: seeing a pipeline fail, watching the agent intercept it, and seeing a working Merge Request appear automatically inside GitLab is like magic.
  • Developing robust log parsing that auto-detects programming languages (Python, JS/TS, Go) and cleans paths.
  • Successfully publishing the agent custom flow to the GitLab AI Catalog!

What I learned

  • I learned how to model codebase dependencies using graph-based APIs like GitLab Orbit, which provides much richer context than standard source code lookups.
  • I gained deep experience in structuring reliable, multi-step agentic workflows where AI output is verified programmatically before taking action in production repositories.

What's next for Pipeline Auto-Healer

  • Add native support for Docker-in-Docker sandboxing to completely isolate the test verification stage.
  • Enhance the AI agent to support multi-file modifications and automated dependency upgrades.
  • Integrate with GitLab Duo Chat so developers can interactively discuss and refine the auto-healer's proposed patches directly in the IDE.

Built With

Share this project:

Updates