Skip to content

Autonomous Bugfix

The autonomous bugfix is Eiryx’s core capability. An AI agent is deployed in an isolated Docker sandbox to fix production bugs without human intervention.

Creating a Bugfix Task

Go to AI Tasks → New Task and select Bugfix. You need:

  • Repository — Select from your connected repos
  • Bug description — Describe what’s wrong. Include stack traces, error messages, and expected behavior. The more detail, the better.
  • Reference files (optional) — List specific files the agent should study first
  • Context notes (optional) — Performance constraints, security concerns, architectural rules

What the Agent Does

Phase 1: Fault Localization

Before exploring the codebase, the fault_localization module pre-processes your description with regex to extract:

  • File paths mentioned in the text or stack trace
  • Error types (TypeError, ValueError, etc.)
  • Line numbers from stack frames
  • Function/class names referenced in the error

These signals are injected into the agent’s prompt so it knows where to look first.

Phase 2: Structured Exploration

The agent doesn’t read entire files. It uses two AST-based tools:

  • explore_file — Shows the skeleton of a file: imports, class signatures, function signatures. Costs minimal tokens.
  • read_symbol — Reads the full body of a specific function or class. Only what’s needed.

This approach means the agent can navigate a 100K-line codebase without exhausting the context window.

Phase 3: Minimal Fix

The agent writes the smallest possible change to fix the bug. It uses:

  • edit_symbol — Replaces an entire function body (for code files)
  • edit_file — For config files, HTML, CSS, JSON, YAML

The key word is minimal. The agent is instructed to not refactor, not improve, not add features. Only fix the specific bug.

Phase 4: Execution-Based Verification

  1. The Docker container is reset to the original repo state
  2. The agent’s fix is applied as a git diff patch
  3. The full test suite runs (from commands.test in .ai-agent.yml)
  4. Exit code 0 = success. Any non-zero = the agent retries.

If the fix passes all tests, the agent creates a branch and opens a Pull Request.

Phase 5: Iteration

If tests fail, the agent reads the test output, revises its approach, and tries again. The Smart Router may escalate to a more capable model if the current tier fails repeatedly.

The iteration budget is controlled by:

  • max_iterations in the task configuration (user-configurable)
  • max_cost_per_fix per plan tier (hard limit)
  • security.max_iterations in .ai-agent.yml (repo-level cap)

The Pull Request

A successful bugfix PR includes:

  • Title: 🤖 AI Bugfix: <concise description>
  • Root cause analysis: What caused the bug (extracted from agent’s reasoning)
  • Files modified: List with change summary
  • Test results: Which tests ran, how many passed
  • Cost breakdown: Model used, iterations, total cost in USD

Real-Time Telemetry

While the agent works, you can watch progress in the Task Detail page via Server-Sent Events (SSE):

  • Current iteration number and model
  • Tool calls in real time (which file is being read, what command is running)
  • Cost accumulation
  • Test results as they happen

Cross-Repo Bugfix

If the agent determines the bug’s root cause is in a dependency (not the current repo), it can use pivot_to_dependency to switch its workspace. The dependency repo becomes writable and the original repo becomes read-only. This requires the dependency to be configured in the .ai-agent.yml dependencies section.

Cost

Cost depends on the model and number of iterations:

DifficultyTypical ModelIterationsCost Range
Simple (typo, missing import)Gemini Flash5-15$0.01 - $0.05
Moderate (logic bug, validation)Claude Sonnet15-30$0.30 - $1.00
Complex (multi-file, architecture)Claude Opus30-50$1.00 - $5.00

All costs are borne by the user’s API key (BYOK model).