codna_fix
Find and fix bugs by analyzing repository state, determining root cause and confidence, and optionally opening a pull request.
Instructions
Find and fix a bug. Runs the full Codna agent + engine + risk simulation.
Requires the one-time free codna login device authorization (free community
license) plus a provider key (BYOK — e.g. ANTHROPIC_API_KEY or codna key set anthropic). Offline truth: planning calls the provider API (network), and only
open_pr=true writes to GitHub — codna_triage, codna_secure and codna_recall are
the fully-offline tools.
Returns the root cause, confidence, model, and (when open_pr) the pull_request_url. Failures come back as 'codna_fix error: ...' text — the tool never raises.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag, or commit to analyze: the planner's repository snapshot is taken at this ref (registration forwards it to create_repository_snapshot). Default '': the repo's current state — the checkout as-is for a local path, the default branch for a git URL. | |
| repo | No | A local path or a git URL. open_pr=true requires a git URL (a local checkout has no remote to push to). Default '.': the current directory, or the server default set by `codna mcp start --repo` (env CODNA_MCP_DEFAULT_REPO). | . |
| issue | No | What's broken — e.g. the failing test or the observed behavior. Required when open_pr=true; otherwise optional but strongly recommended (an empty issue yields a generic repo-wide plan). | |
| model | No | Provider-qualified planner model, e.g. openai/gpt-5. Default 'repository.verified_agentic_v1' (codna's verified agentic runtime). | repository.verified_agentic_v1 |
| open_pr | No | false (default): READ-ONLY plan — returns root cause, confidence and a patch reference, and changes nothing. true: pushes a fix branch and OPENS A PULL REQUEST — needs a git URL for repo and GITHUB_TOKEN (or CODNA_GITHUB_TOKEN) with write access; returns pull_request_url. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |