Fix failing tests

Paste a test log or run the suite and have Autohand Code inspect the failing path, patch the cause, and rerun focused tests.

Debug the failure path instead of guessing

Testing Quality and review Verification Testing

autohand -p "Use this failing test output to find the regression and fix it"

A targeted patch and the exact tests that now pass.

Fix failing tests with Autohand Code is a debugging workflow that starts from a failing assertion or CI log, traces the failing code path, patches the cause, and reruns the narrowest useful test. ### At a glance | Question | Answer | | --- | --- | | Best for | local regressions, CI failures, dependency-update fallout, and tests that now fail after a merge | | Primary inputs | Exact test command and failure output; Whether the failure is local, CI-only, or flaky; Recent commits, dependency updates, or merge conflict context | | Autohand Code returns | A targeted patch and the exact tests that now pass. | | Avoid when | the test is flaky and there is no reproducible command or failure output | ### How Autohand Code handles this workflow 1. Reads the failing assertion, stack trace, and test setup. 2. Traces the production code path before deciding whether code or test is wrong. 3. Applies the smallest patch that explains the failure. 4. Reruns the focused test and names any broader suite still needed. ### Best inputs - Exact test command and failure output - Whether the failure is local, CI-only, or flaky - Recent commits, dependency updates, or merge conflict context ### Strong prompt autohand -p "Use this failing test output to find the regression and fix it" ### Autohand Code CLI options - Paste the log into `autohand -p "Use this failing test output to find the regression and fix it"` for a focused command-mode repair. - Pipe long logs with `cat test.log | autohand -p "Find the failing path, patch the cause, and rerun the narrow test"`. - Use `autohand --auto-mode "Fix the failing tests and stop when the focused suite passes" --max-iterations 8` when several repair attempts may be needed. ### Review before accepting The final answer should include the cause, the patch, the rerun command, and whether the test or implementation changed. ### Source and validation signals Autohand AI maintains this workflow as first-party product guidance for Autohand Code. Use the [Autohand CLI Playbook](https://github.com/autohandai/code-cli/blob/main/docs/AUTOHAND_PLAYBOOK.md), [CLI reference](/docs/working-with-autohand-code/cli-reference.html), and [configuration reference](https://github.com/autohandai/code-cli/blob/main/docs/config-reference.md) when choosing between interactive mode, command mode, auto-mode, feature-enabled /goal, /settings, skills, MCP, and permission settings. The related resources below link to product docs and tutorials for the workflow, and the final answer should name repository-specific files, commands, outputs, or docs that a reviewer can verify. ### Frequently asked questions ### What is Fix failing tests with Autohand Code? Fix failing tests with Autohand Code is a debugging workflow that starts from a failing assertion or CI log, traces the failing code path, patches the cause, and reruns the narrowest useful test. ### When should a team use Fix failing tests? Use it when the failure output contains enough signal to debug from evidence instead of guessing. ### What evidence should reviewers check for Fix failing tests? The final answer should include the cause, the patch, the rerun command, and whether the test or implementation changed.

Tutorial Fix Failing Tests with Debugging Agent Start from a failing assertion and trace the regression path. /docs/tutorials/fix-failing-tests-debugging.html Tutorial Build a Testing Agent Create an agent flow that runs tests, reads failures, and reports fixes. /docs/agent-sdk/tutorials/600-testing-agent.html Guide Troubleshooting Work through common setup and runtime failures. /docs/guides/troubleshooting.html