GitHub Action
Install the Codai Resolve action — label an issue codai-fix and get a PR with a verified fix and a public attestation. Inputs, outputs, secrets, permissions and example workflows.
The action lives at dragoscv/resolve-action. It runs on an issues event, submits the issue to Resolve, accepts the quote if your workflow allows it, waits for the verdict, and on success pushes a codai-fix/issue-<N> branch and opens a pull request that links the public attestation. On decline or failure it comments the reason on the issue. Nothing is billed unless a fix was verified.
Usage
name: codai-fix
on:
issues:
types: [labeled]
permissions:
contents: write
pull-requests: write
issues: write
jobs:
resolve:
if: github.event.label.name == 'codai-fix'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dragoscv/resolve-action@v1
with:
codai-api-key: ${{ secrets.CODAI_API_KEY }}
# Optional — auto-pay flat quotes up to a tier ($7 / $19 / $49):
# auto-accept: 'true'
# max-tier: 't19'Add the secret
Create a key at hub.codai.ro → Keys and store it as the repository secret CODAI_API_KEY (Settings → Secrets and variables → Actions). Keys look like codai_xxxxxxxx.
Create the label
Add a label named exactly codai-fix to the repository. The workflow's if: guard means other labels never start a job.
Label an issue
Apply codai-fix to an issue with a clear description of the bug. The action comments within a minute with the triage result; a verified fix arrives as a PR, typically in 5–20 minutes.
Inputs
Prop
Type
Outputs
Prop
Type
Permissions
The workflow needs three write scopes on the default GITHUB_TOKEN:
| Scope | Used for |
|---|---|
contents: write | Push the codai-fix/issue-<N> branch with the patch. |
pull-requests: write | Open the PR against the default branch. |
issues: write | Comment the quote, the decline reason or the failure reason on the issue. |
If your organisation restricts the default token to read-only, either enable Read and write permissions under Settings → Actions → General → Workflow permissions, or pass a fine-grained PAT as github-token.
actions/checkout with fetch-depth: 0 matters: the action commits the patch on top of the checked-out history and needs the full clone to push a branch.
What the action does, step by step
- Reads
issue.title+issue.bodyfrom the event payload (first 50 000 characters) andPOSTs them withrepo_url: https://github.com/<owner>/<repo>to/v1/resolve/jobs. - Declined → comments Codai Resolve declined this issue (nothing billed) with the reason;
status=declined. - Quoted → if
auto-acceptis off, or the tier is abovemax-tier, comments the price and how to enable it;status=quoted, nothing runs. OtherwisePOST …/accept. - Polls
GET /v1/resolve/jobs/{id}every 15 seconds for up to 25 minutes. - Resolved → fetches the attestation, applies
patchon a new branchcodai-fix/issue-<N>, pushes it, opens the PR (body links the attestation and quotes the repro test), comments on the issue; setspr-urlandattestation-url. - Failed / error → comments Codai Resolve could not verify a fix (nothing billed) with
fail_reason.
Example workflows
Pay up to $19 automatically
name: codai-fix
on:
issues:
types: [labeled]
permissions:
contents: write
pull-requests: write
issues: write
jobs:
resolve:
if: github.event.label.name == 'codai-fix'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: dragoscv/resolve-action@v1
with:
codai-api-key: ${{ secrets.CODAI_API_KEY }}
auto-accept: 'true'
max-tier: 't19'Run on a failing CI job
The action reads the issue from the event payload, so the trigger must be an issues event. To react to a red CI run, have the failing workflow open (or label) an issue, and let the codai-fix workflow above pick it up:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pnpm install --frozen-lockfile
- id: tests
run: pnpm test
- name: Ask Resolve to fix it
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue create \
--title "CI failed on ${GITHUB_REF_NAME} (${GITHUB_SHA::7})" \
--body "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
Job \`test\` failed. Please reproduce and fix." \
--label codai-fixGive this job issues: write too. Paste the relevant test output into the body when you can — triage quotes from the text it sees, and a precise failure gets a cheaper tier.
Manual dispatch
workflow_dispatch carries no issue, so the action cannot run under it directly. Wrap it: take an issue number as input and re-label the issue, which fires the issues: labeled workflow.
name: codai-fix (manual)
on:
workflow_dispatch:
inputs:
issue:
description: Issue number to send to Resolve
required: true
permissions:
issues: write
jobs:
relabel:
runs-on: ubuntu-latest
steps:
- env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue edit ${{ inputs.issue }} --remove-label codai-fix || true
gh issue edit ${{ inputs.issue }} --add-label codai-fixUse the outputs
- id: fix
uses: dragoscv/resolve-action@v1
with:
codai-api-key: ${{ secrets.CODAI_API_KEY }}
- if: steps.fix.outputs.status == 'resolved'
run: echo "PR ${{ steps.fix.outputs['pr-url'] }} — proof ${{ steps.fix.outputs['attestation-url'] }}"Runner time counts against your GitHub Actions minutes while the action polls (up to 25 minutes on a slow job). Resolve itself bills only on a verified fix.
Resolve
Execution-verified bug fixes: point Resolve at a public GitHub repo and an issue, get back a patch proven by tests and a public attestation. No fix, no fee.
How it works
The Resolve job lifecycle from triage to attestation, what the public proof document actually proves, and what the sandboxed runner will and will not touch.