What the agent does
The agent clones the repository into its own cloud sandbox and reads how tests run today before it changes the workflow. In a CLI like muesli/duf, go.mod declares Go 1.23 with spf13/pflag, jedib0t/go-pretty and muesli/termenv, and the only test file is mounts_linux_test.go, a table test for getFields over /proc/self/mountinfo lines, behind a //go:build linux constraint. .github/workflows/build.yml runs on every push and pull request with a matrix of Go ~1.23 and ^1 across ubuntu-latest, macos-latest and windows-latest, and its steps are go mod download, go build -v ./... and a plain go test ./.... lint.yml and lint-soft.yml run golangci-lint with .golangci.yml, which sets run.tests: false, goreleaser.yml builds a snapshot, manpage.yml regenerates duf.1 on master, and dependabot.yml covers Go modules and actions daily. No step produces a coverage profile.
Because the one test is Linux-only, a coverage flag on the whole matrix would produce an empty profile on macOS and Windows, where go test reports no test files. The agent leaves the matrix's test step as it is and adds a coverage job to build.yml on ubuntu-latest with the stable toolchain that runs go test -coverprofile=coverage.out -covermode=atomic -coverpkg=./... ./..., so files with no test at all still appear in the report at zero rather than being left out.
The job then runs go tool cover -func=coverage.out and appends its per-function table and the total line to $GITHUB_STEP_SUMMARY, so the number is on the workflow run page without a third-party service, and uploads coverage.out and an HTML report from go tool cover -html as artifacts with a short retention. It adds a concurrency group so a second push cancels the previous run, keeps permissions at contents: read, and pins the new actions/upload-artifact step to a major version to match the existing actions/checkout@v5 and actions/setup-go steps.
In the sandbox, which runs Linux, the agent runs the same coverage command and go tool cover -func to see the table the job will print, runs go vet ./... and actionlint on the edited workflow, and checks that .golangci.yml with run.tests: false still lints the same files. It then opens the pull request, whose own checks are the first real run of the job.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add test coverage reporting to the GitHub Actions workflow of this Go CLI. Read go.mod, every _test.go file and its build constraints, and the workflows under .github/workflows first. Keep the existing build and test matrix unchanged and add a coverage job on Linux with the stable Go toolchain that runs go test with an atomic coverage profile across all packages, writes the per-function table and the total from go tool cover to the job summary, and uploads the profile and an HTML report as artifacts. Add a concurrency group and read-only permissions. Run the coverage command, go vet and actionlint in your sandbox, then open a pull request that pastes the coverage table.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request on its own branch that changes .github/workflows/build.yml and nothing else. The description explains why the coverage job runs only on Linux, shows the go tool cover -func table and total from the sandbox, and pastes the go vet and actionlint output.
The pull request's own checks are the proof: the new job runs on it, writes its summary, and a reviewer opens the run page to read the same table the description shows. The run's record keeps the sandbox commands with their output beside the diff.
Before merging, a reviewer decides whether the total is a number worth enforcing with a threshold step, whether a hosted coverage service should receive coverage.out as well, and whether the first new tests should target main.go or the platform-specific mount readers.
Run it on every new Go repository
Start one run per repository from your own server: POST /o/{org}/sessions with this prompt and that repository in resources, one call each. GET /o/{org}/github lists every repository the Rush GitHub App installation reaches, so a script can pick the Go modules whose workflows run go test without -coverprofile and start a run for each, in its own sandbox and on its own branch.
Give the key a webhook_url and each run posts run.completed with its session_url when the turn finishes, so the pull request links collect on your side without polling. A key runs up to max_concurrent sessions at the same moment, 4 by default and as many as 100, so a script over many Go modules can post every request in one pass: those over the limit answer 202 with status: "queued" and start, oldest first, when a slot frees.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Coverage in a cross-platform matrix is easy to get subtly wrong: a profile flag on every OS yields empty files where the tests are constrained out, -coverpkg left off hides untested packages, and a summary step with the wrong quoting prints nothing. The agent reads the build constraints and the matrix, puts the job where the tests actually run, and runs the exact commands in its own sandbox before the pull request exists.
The sandbox keeps every command and its output in the run's record, so the reviewer reads the real coverage table, not an estimate. Several repositories can get the same job at once in separate sandboxes, each ending in its own pull request.
Frequently asked questions
Why does the coverage job run only on Linux?
The repository's only test is behind a linux build constraint, so go test on macOS and Windows compiles no tests and a coverage profile there is empty. One Linux job gives one truthful number; the matrix keeps proving the build on every platform.
Does it need Codecov or another service?
No. go tool cover -func produces the table and total, the job writes them to the run's summary, and the profile is an artifact anyone can download. If you want trends and pull request comments, a service upload step can read the same coverage.out, and the pull request's description shows where it goes.
Will it fail the build when coverage is low?
Not in this pull request. The job reports; it does not enforce. Once the team has seen the number for a few weeks, a threshold step that compares the total against a floor is a one-line addition the description points at.
Does the linter configuration change?
No. .golangci.yml keeps run.tests: false, so the linters still skip test files, and the two lint workflows are untouched. The coverage job only adds flags to go test.