Inspiration

Modern CI/CD pipelines fail for boring, repetitive reasons: broken YAML, misconfigured Dockerfiles, missing files, and runtime errors that could be fixed automatically if someone just read the logs carefully. We were frustrated by how much human time is wasted on mechanical debugging and PR back-and-forth.

At the same time, Gemini’s reasoning models showed strong potential for structured code understanding, not just chat. This inspired us to build an autonomous CI/CD repair agent that can reason over configs, logs, and runtime failures—and fix them end-to-end without human intervention.


What it does

gemini-auto-fixer is a Dockerized AI agent that:

  • Automatically validates and repairs YAML files
  • Builds Docker images and repairs Dockerfiles on failure
  • Runs containers and analyzes runtime logs
  • Fixes application code based on errors (syntax, missing imports, logic issues)
  • Creates a new Git branch, commits changes, and opens a Pull Request automatically
  • Runs completely hands-free after initial inputs

In short:

Give it a broken repo → get a working PR.


How we built it

  • Python as the core orchestration language
  • Gemini 3 (reasoning models) for:

    • YAML validation and correction
    • Dockerfile repair
    • Code reasoning from runtime logs
  • Docker CLI to build, run, and manage containers

  • GitPython + GitHub REST API to:

    • Create branches
    • Commit fixes
    • Open pull requests automatically
  • ruamel.yaml for strict YAML parsing and validation

  • Regex + log analysis to map runtime errors back to source files

The agent follows a deterministic pipeline:

  1. Clone repository
  2. Validate & auto-fix YAML
  3. Build Docker image (repair Dockerfile if needed)
  4. Run container and capture logs
  5. Reason over errors using Gemini
  6. Apply fixes
  7. Commit → Push → Open PR

Challenges we ran into

  • Containers exiting immediately → Learned that a container stops if PID 1 exits (no long-running process).

  • Dockerfiles referencing missing paths → Required contextual reasoning, not static rules.

  • YAML “almost valid” edge cases → ruamel.yaml helped catch issues most linters miss.

  • Balancing autonomy vs safety → We limited fixes to only files implicated by logs or configs.

  • Avoiding infinite repair loops → Added retry limits and clear failure states.


Accomplishments that we're proud of

  • Fully autonomous CI/CD repair loop
  • Zero manual Docker or Git steps once started
  • Real PRs generated with meaningful fixes
  • Works across unknown repositories
  • Demonstrates Gemini’s reasoning ability, not just generation

This is not a chatbot—it’s an agent.


What we learned

  • Reasoning models are far more powerful when paired with real execution feedback
  • Logs are an underrated source of structured truth
  • Most CI/CD failures are deterministic and automatable
  • AI agents need tight guardrails, not more prompts

Inline math example: The agent minimizes human intervention cost (H) while maximizing automation coverage (A):

[ \text{Goal} = \max(A) - \min(H) ]


What's next for gemini-auto-fixer

  • VS Code extension for one-click auto-fix PRs
  • GitHub Action integration
  • Support for:

    • Kubernetes manifests
    • Terraform
    • GitHub Actions YAML
  • Smarter container lifecycle handling (health checks, ports, services)

  • Multi-repo batch fixing


Built With

Share this project:

Updates