Overview
pdd fix resolves test failures and code errors. It supports three modes:
- Agentic E2E fix (default when passed a GitHub issue URL) — orchestrates a 10-step iterative workflow across multiple dev units, including post-push CI validation.
- User story fix — applies a single story to prompts and re-validates it.
- Manual fix — single dev-unit fixing with explicit file arguments.
Usage
- Agentic (GitHub issue)
- Manual
- User story
Common options
Use manual mode with explicit file arguments. Required for single dev-unit fixing.
When enabled, prevents the LLM from modifying test files. The LLM treats tests as read-only specifications and only fixes code. Especially useful when tests were created by
pdd bug and are known to be correct.Agentic E2E fix options
Additional seconds to add to each step’s timeout.
Maximum number of outer loop cycles before giving up.
Resume from saved state if available. Use
--no-resume to start fresh.Override the branch mismatch safety check. By default, the command aborts if the current git branch does not match the expected branch from the issue.
Disable GitHub issue comment-based state persistence. By default, state is stored in a hidden comment for cross-machine resume.
Maximum number of post-push CI fix attempts.
Skip post-push CI validation entirely.
Manual mode options
Where to save the fixed unit test file. Defaults to
test_<basename>_fixed.<extension>. When multiple test files are provided, only the last processed file is written to this location.Where to save the fixed code file. Defaults to
<basename>_fixed.<extension>, or to PDD_FIX_CODE_OUTPUT_PATH if set.Where to save the fix results log. Defaults to
<basename>_fix_results.log, or to PDD_FIX_RESULTS_OUTPUT_PATH if set.Enable the iterative fixing loop. The command attempts repeated fixes until tests pass, the budget is exhausted, or
--max-attempts is reached.Path to a verification program used with
--loop to confirm the code still runs correctly after each fix attempt.Maximum number of fix attempts in
--loop mode.Maximum cost in USD allowed for the fixing process.
Automatically submit the example to PDD Cloud if all unit tests pass during the fix loop.
Enable agentic fallback in
--loop mode. If the standard fix loop fails after all attempts, a project-aware CLI agent (Claude, Gemini, or Codex) is invoked with broader context to attempt a fix.Agentic E2E fix workflow (10 steps)
When passed a GitHub issue URL,fix orchestrates the following workflow:
Root cause analysis
Analyze failures against documentation to determine if issues are in code, tests, or both.
pdd fix. Use --no-github-state to disable.
Prerequisites:
ghCLI must be installed and authenticated.- At least one supported agent CLI (Claude, Gemini, or Codex) with API key configured.
- For CI validation, the current branch must have an open PR on GitHub.
Agentic fallback (manual loop mode)
When--loop is enabled in manual mode and the standard iterative fix process fails all attempts, the agentic fallback invokes a project-aware CLI agent. Agents are tried in this order:
- Anthropic Claude — requires
claudeCLI in PATH andANTHROPIC_API_KEY. - Google Gemini — requires
geminiCLI in PATH andGOOGLE_API_KEYorGEMINI_API_KEY. - OpenAI Codex — requires
codexCLI in PATH andOPENAI_API_KEY.
Relationship with pdd bug
pdd fix and pdd bug work together:
pdd bug <issue_url>analyzes the bug, reproduces it, and generates failing unit tests.pdd fix <issue_url>iteratively fixes the failing tests across all affected dev units.
pdd bug created the tests and they are known to be correct, use --protect-tests to prevent pdd fix from modifying them: