Verified issue fixes
A maintainer can also ask for a fix on a pull request. See fix requests.
actions/fix-issues turns issues into draft pull requests. A person labels an issue codehawk-fix (or runs the
caller workflow with issue numbers), and the bot works through the labelled issues, oldest first, at most
fix_issues.max_issues of them. Every issue it picks loses the label whatever happens, so labelling again is the retry.
For each issue the model reads the issue, the files it cites and their direct imports, and answers with a unified diff
or a reason it cannot fix the issue. The diff must hold a test file one of the test_commands runs and a change outside
the tests, touch at most 10 files, and stay out of .github/, package manifests, lockfiles and test or build
configuration. The test files are applied first and the test must fail. Then the rest of the fix is applied and the
test must pass. A problem at any step gets one more model call with the problem and the test output, so there are two
fix attempts per issue. A second problem is final, and the issue gets a comment saying why.
A run opens one draft pull request, Code Hawk fixes for <date>, on a new branch fix/run-<date>-<short base sha>
cut from the base branch. Each fixed issue is one commit on it, in order, with Fixes #n in the commit message. The
pull request body lists every fixed issue with Fixes #n, its summary, the test files, the commands that failed before
the fix and passed after it, and the model spend. An issue the bot could not fix gets a comment saying why and is left
out of the pull request. A run that fixes nothing opens nothing. The pull request stays a draft, because a person marks
it ready. Each fixed issue gets a comment pointing at it. An issue closes only when a person merges it into the default
branch. The bot never merges or closes anything, and writes only new branches under fix/, never updating or deleting one.
Two jobs keep model-written code away from the write token:
fixhas the workflow token withcontents: readandissues: read, trusted inference JSON, selected credential slots and a checkout. Thefix_issuesprofile runs the model and the test commands and writes one record,fixes.json, kept as an artifact for one day.publishhas the App token (contents, pull requests and issues write) and no checkout. It checks the record again, makes the commits through the Git Data API as the App, opens the pull requests and comments. It loads the config through the API at the commit the fix job used, so the fix job cannot change the rules.
The trusted caller must supply test-image, mapped to CODEHAWK_TEST_IMAGE, for the fix stage. It must be pinned by @sha256: and a 64-character lowercase digest. Missing or unpinned images fail before repository or network work. Build the image and install dependencies in a separate job without inference credentials, or in a secret-free install container. See inference for profile setup.
Test commands run in secret-free containers with private PID namespaces and bounded cleanup. They receive only PATH, HOME, CI and safe names in fix_issues.test_env. Reserved bot/workflow names, inference slots and conventional provider credential aliases are refused. Never execute repository-controlled installation, application startup, setup, tests or module loading on the host, including earlier steps left running when credentials arrive. Do not mount the Docker socket, use host PID or expose another host proc mount to the test container.
When set, per-issue and per-run caps bound spend across retries and fallbacks. Both are uncapped by default. The App creates commits through the API, and no git credentials exist on a runner. Publish receives no inference JSON, slots or test image.
Configure the test gate
Section titled “Configure the test gate”Set FIX_ISSUES_ENABLED=true in the caller and create the codehawk-fix label. Define test commands for the repository's actual test files. For example, a Node repository that uses the built-in test runner can use this .github/codehawk.json:
{ "fix_issues": { "test_commands": [ { "paths": ["test/**/*.test.mjs"], "run": ["node", "--test"] } ] }}The workflow runs from a trusted branch. Install application dependencies with the caller's lockfile inside the trusted test image or in a separate job without credentials, never on the host before the fix step. Replace <release sha> in the caller with the release tag's commit you pin. If you set fix_issues.base_branch, make the checkout target match it. The App must have contents, pull requests, and issues write for publication.
Fix caller
Section titled “Fix caller”Save as .github/workflows/fix-issues.yml. Use the default label below or replace it with the same label you set in config. On manual dispatch, supply one or more issue numbers without # prefixes.
name: Fix issueson: issues: types: [labeled] workflow_dispatch: inputs: issues: description: Issue numbers to fix, space separated required: truepermissions: {}concurrency: group: fix-issues cancel-in-progress: falsejobs: fix: if: vars.FIX_ISSUES_ENABLED == 'true' permissions: contents: read issues: read id-token: write uses: bts-io/codehawk/.github/workflows/fix-issues.yml@<release sha> with: issues: ${{ inputs.issues || '' }} test_image: ${{ vars.CODEHAWK_TEST_IMAGE }} secrets: CODEHAWK_OPENAI_API_KEY: ${{ secrets.CODEHAWK_OPENAI_API_KEY }} CODEHAWK_ANTHROPIC_API_KEY: ${{ secrets.CODEHAWK_ANTHROPIC_API_KEY }} CODEHAWK_GOOGLE_API_KEY: ${{ secrets.CODEHAWK_GOOGLE_API_KEY }} CODEHAWK_GATEWAY_TOKEN: ${{ secrets.CODEHAWK_GATEWAY_TOKEN }} CODEHAWK_CREDENTIAL_1: ${{ secrets.CODEHAWK_CREDENTIAL_1 }} CODEHAWK_CREDENTIAL_2: ${{ secrets.CODEHAWK_CREDENTIAL_2 }} CODEHAWK_CREDENTIAL_3: ${{ secrets.CODEHAWK_CREDENTIAL_3 }} CODEHAWK_CREDENTIAL_4: ${{ secrets.CODEHAWK_CREDENTIAL_4 }} CODEHAWK_CREDENTIAL_5: ${{ secrets.CODEHAWK_CREDENTIAL_5 }} CODEHAWK_CREDENTIAL_6: ${{ secrets.CODEHAWK_CREDENTIAL_6 }} CODEHAWK_CREDENTIAL_7: ${{ secrets.CODEHAWK_CREDENTIAL_7 }} CODEHAWK_CREDENTIAL_8: ${{ secrets.CODEHAWK_CREDENTIAL_8 }}The App needs contents write only for the publish job. The App token has no workflows permission, so GitHub refuses
any commit that touches .github/workflows/. A repository ruleset that keeps the App out of the main branches is
recommended.
Review the draft changes and failing-first evidence before marking the PR ready. See the trust model and how patches are validated.
Install the CodeHawk App for hosted tokens. To use your own App instead, set the reusable workflow input app_id and forward the named secret CODEHAWK_PRIVATE_KEY as described under self-hosted App.
Commits end with [skip ci] so repository CI does not run model-written code with its secrets until a person pushes a commit to the branch.
[skip ci] does not stop pull_request_target or workflow_run workflows, so repositories should not run jobs that hold secrets on those events for bot branches.