---
title: "Build a coding-agent fix and retest loop with agent-qa"
description: "Keep failed run evidence, diagnose the earliest mismatch, repair the relevant code or test, and rerun the same acceptance contract with agent-qa."
canonical_url: "https://vostride.com/agent-library/software-factory/build-fix-retest-loop.md"
md_url: "https://vostride.com/agent-library/software-factory/build-fix-retest-loop.md"
content_kind: "guide"
topic: "software-factory"
---

# Build a coding-agent fix and retest loop with agent-qa

A repair loop needs a stable question: did the application satisfy the approved expected outcome? Preserve that question while the coding agent investigates. Changing an assertion from “the new owner can edit” to “the owner page loads” makes a rerun easier without resolving the original failure.

## Retain the failing observation

Record the run identifier, failed step, application revision, target configuration and relevant screenshot or log. Identify the earliest mismatch rather than assuming the final timeout is the cause. A missing record at the end might originate in a failed fixture setup or a save action several steps earlier.

The local MCP workflow can retrieve run details and classify failures. Its classification is a hypothesis to inspect, not proof. See the [coding-agent workflow](/docs/agent-qa/guides/coding-agent-workflow.md) and [MCP reference](/docs/agent-qa/mcp.md) for the supported execution and artifact interfaces.

## Choose the repair from evidence

- If the application rejected valid input, inspect the changed validation or persistence code.
- If the fixture is missing, restore the required initial state and report the setup failure separately.
- If the test names an obsolete label but still expresses the right behavior, update the navigation instruction while retaining the outcome.
- If the model or device cannot operate the target, resolve the environment prerequisite before attributing the result to product behavior.

Do not delete screenshots, disable assertions or treat an unexecuted branch as a pass. Keep changes scoped to what the evidence supports.

## Rerun the contract

Validate changed test definitions, rebuild or restart the application when necessary, reset the fixture and run the affected test again. Retain both run identifiers. If a new failure occurs, compare its first mismatch with the original; a different symptom may show progress but does not establish completion.

Report the implementation change, why it addresses the observed cause, the completed rerun result and any remaining unverified outcomes. The [release evidence contract](/agent-library/software-factory/release-evidence-contract.md) provides a compact report structure.
