AutoFixTaskExecutionConfigData.json JSON
{
  "commands": [
    {
      "command": ["./gradlew", "test"],
      "workingDir": "services/api"
    }
  ],
  "task_description": "Run API tests and fix failures"
}
Session UI / Transcript RENDERED
# Self-Healing Task Execution
✖ Command Failed: ./gradlew test
Analyzing stack trace...
ℹ Applying Patch to UserAuth.kt:142
✔ Retrying... Success.
View Full Report (Markdown) →

Live Results Showcase

Explore actual artifacts, logs, and generated patches from the AutoFixTask test workspace.

Execution Configuration

Field Type Description
commands * MutableList<CommandWithWorkingDir> A list of commands to execute. Each contains a command (List of strings) and an optional workingDir.
task_description String Human-readable description of the intent of this execution.
task_dependencies List<String> IDs of tasks that must complete before this one starts.

CommandWithWorkingDir

Field Type Description
command *MutableList<String>The command and its arguments (e.g. ["npm", "install"]).
workingDirString?Relative path of the working directory.

Type Configuration

Field Type Default
model ApiChatModel null (Uses system default smart model)
promptTemplate String The system prompt used to guide the self-healing logic.

Task Lifecycle

  1. Initialization: Resolves tool executables from UserSettings and validates the working directories.
  2. Execution: Launches CmdPatchApp to run the specified shell commands.
  3. Monitoring: Captures STDOUT/STDERR and streams it to a multi-format transcript (MD, HTML, PDF).
  4. Self-Healing: If a command returns a non-zero exit code, the task invokes the LLM with the error context to generate and apply source code patches.
  5. Verification: Re-runs the command to verify the fix.
  6. Completion: Finalizes the report and updates the session state. Supports interactive approval if autoFix is disabled.

Embedded Usage (UnifiedHarness)

Use the UnifiedHarness to run AutoFix as a headless agent in CI/CD pipelines or Gradle tasks.

// 1. Define the Execution Configuration
val executionConfig = AutoFixTaskExecutionConfigData(
    commands = mutableListOf(
        CommandWithWorkingDir(
            command = mutableListOf("./gradlew", "test"),
            workingDir = "services/api"
        )
    ),
    task_description = "Run API tests and fix failures"
)

// 2. Run via Harness
harness.runTask(
    taskType = AutoFixTask.AutoFix,
    executionConfig = executionConfig,
    workspace = File("./project-root"),
    autoFix = true // Enable autonomous repair
)

Direct Task Instantiation

val task = AutoFixTask(
    orchestrationConfig = orchestrationConfig,
    planTask = AutoFixTaskExecutionConfigData(
        commands = mutableListOf(
            CommandWithWorkingDir(
                command = mutableListOf("npm", "run", "build"),
                workingDir = "frontend"
            )
        )
    )
)

Prompt Segment

The following instructions are injected into the LLM context during healing:

SelfHealing - Run a command and automatically fix any issues that arise
* Specify the commands to be executed along with their working directories
* Each command's working directory should be specified relative to the root directory
* Provide the commands and their arguments in the 'commands' field
* Each command should be a list of strings
* Available commands:
{executables}