What the agent does
The agent reads the build before it writes a workflow. In an app laid out like TatriX/realworld-rust-rocket, Cargo.toml names the realworld crate at 0.6.0 on edition 2021 with rocket 0.5.0-rc.1 (json feature only), rocket_cors 0.6.0-alpha1, rocket_sync_db_pools 0.1.0-rc.1 with diesel_postgres_pool, diesel 1.4.8 with postgres and chrono, scrypt, jsonwebtoken 7.2, validator 0.14, dotenv and a random-suffix default feature; Cargo.lock is committed. A rust-toolchain file says nightly, and src/lib.rs opens with #![feature(proc_macro_hygiene, decl_macro)], so stable is not an option. src/config.rs builds Rocket's figment from DATABASE_URL, PORT and SECRET_KEY, and .env carries postgres://realworld:realworld@localhost/realworld. init.sql creates that role and database, migrations/ holds six Diesel migrations, and tests/ has users.rs, articles.rs, profiles.rs and tags.rs driving a rocket::local::blocking::Client from common.rs against the real database, plus a Postman collection with test.sh for newman. The only CI is .travis.yml: Ubuntu Xenial, Rust nightly, a postgresql service, psql -U postgres -f init.sql, cargo install diesel_cli, diesel migration run, cargo test, and tarpaulin with Codecov on success. README.md shows the Travis and Codecov badges.
The workflow the agent writes, .github/workflows/ci.yml, runs on push and pull_request with one test job on ubuntu-latest. A postgres service container (postgres:16, POSTGRES_PASSWORD set, port 5432 published, a pg_isready health check so steps wait for it) stands in for Travis's service. Steps: actions/checkout, dtolnay/rust-toolchain@nightly (the rust-toolchain file would select nightly anyway, so the action mainly makes the toolchain explicit in the log), Swatinem/rust-cache@v2 for the registry and target/, apt-get install libpq-dev for the Diesel Postgres backend, psql -h localhost -U postgres -f init.sql with PGPASSWORD in the environment, cargo install diesel_cli --no-default-features --features postgres --locked as the README prescribes, diesel migration run (which reads DATABASE_URL from .env), and cargo test --locked. SECRET_KEY is not needed because config.rs falls back to a built-in key in debug builds.
Nightly is the risk, and the agent handles it in the sandbox rather than in the pull request's first CI run. It builds the crate with current nightly first; rocket 0.5.0-rc.1 and diesel 1.4.8 are several years old, and if the build breaks on a newer compiler, the agent pins a dated toolchain in rust-toolchain (nightly-YYYY-MM-DD) that compiles the locked dependencies and says so in the pull request, so the workflow goes green on its first run instead of failing on a toolchain the repository never chose.
It deletes .travis.yml, replaces the Travis badge in README.md with the Actions badge for the new workflow, and leaves the Codecov badge with a note: the tarpaulin upload needs a CODECOV_TOKEN secret the agent cannot create, so it ships that as a commented second job rather than a failing one. cargo fmt --check is added as a separate job only if the tree is already formatted; otherwise the pull request says so and leaves formatting for a later change.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Replace the Travis CI configuration of this Rocket application with a GitHub Actions workflow. Read Cargo.toml, Cargo.lock, rust-toolchain, .travis.yml, .env, init.sql, the migrations directory, src/lib.rs, src/config.rs, tests/common.rs and README.md first. Write .github/workflows/ci.yml that runs on push and pull_request with a postgres service container and a health check, installs the nightly toolchain and a Rust cache, installs libpq-dev, creates the role and database from init.sql, installs diesel_cli with only the postgres feature, runs the migrations, and runs cargo test --locked. Build and test in the sandbox first; if the locked dependencies do not compile on current nightly, pin a dated nightly in rust-toolchain and explain it. Remove .travis.yml, swap the Travis badge for the Actions badge, keep coverage as a commented job that needs a CODECOV_TOKEN secret, add a cargo fmt check only if the tree already passes it, and open a pull request that quotes the cargo test summary from the sandbox.",
"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
The pull request adds .github/workflows/ci.yml, deletes .travis.yml, changes the badge line in README.md, and changes rust-toolchain only if a dated nightly was needed. Its description quotes the cargo test summary from the sandbox, names the toolchain that produced it, and lists what the workflow installs and why each step exists.
A reviewer checks that the workflow's database setup matches .env (role, password, database name), that diesel_cli is installed with the same feature the README gives so the build does not pull in MySQL or SQLite client libraries, and whether a pinned nightly is acceptable or whether they would rather update Rocket. The first Actions run on the pull request branch is the final check, and it runs on the same steps the sandbox already passed.
From then on every push and pull request gets the integration tests against a real Postgres, with the cache keeping repeat runs short.
Run it on every repository still on Travis
A team migrating several services sends this body once per repository from its own server, each a POST /o/{org}/sessions with that repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own .travis.yml: a service that needs Redis gets a second container, one that runs newman gets a job that starts the server and runs tests/test.sh, and one already on stable skips the toolchain pinning.
Give the key a webhook_url and Rush POSTs run.completed to it when each turn ends, signed per Standard Webhooks, with data.session_url to read the pull request from. A follow-up on POST /o/{org}/sessions/{id}/messages, once the turn has finished, wakes the same sandbox to add the coverage job once the Codecov secret exists.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A CI migration is only done when the new workflow is green, and for a nightly Rocket app with Diesel that means a Postgres, the migrations, the right diesel_cli features and a toolchain the locked crates still compile on. The agent works through all of that in its own sandbox before the pull request opens, so the first Actions run is a confirmation rather than a debugging session.
The steps are the same across a fleet of Rust services with small differences in services and features, and each run reads its own repository to find them. A team starts the request against every repository still on Travis at once and reviews a set of uniform pull requests.
Frequently asked questions
Why nightly, and what if it does not compile?
The crate uses proc_macro_hygiene and decl_macro, both still unstable, and rust-toolchain already says nightly. Rocket 0.5.0-rc.1 and Diesel 1.4.8 may not build on today's nightly, so the agent tries in the sandbox first and, if needed, pins a dated nightly that compiles the lockfile. Updating to Rocket 0.5 stable and Diesel 2 would remove the need, and the pull request notes that as a separate change.
How does the workflow get a database?
A postgres:16 service container with a pg_isready health check, then psql -f init.sql against it to create the realworld role and database the way the README does locally, then diesel migration run, which reads DATABASE_URL from the committed .env. The tests use that same URL through config.rs.
What happened to coverage and Codecov?
Travis ran tarpaulin and uploaded to Codecov after a green build. The upload needs a CODECOV_TOKEN repository secret that only a maintainer can add, so the agent includes the job commented out with the action and command ready, and the badge stays until the job is enabled.
Does the Postman collection run in CI?
Not by default. tests/test.sh runs newman against a live server on port 8000, which needs a second job that builds, starts the binary and waits for it. The prompt can ask for that job, and a follow-up message adds it to the same branch.
More Rocket jobs
The same job on other stacks
- Add GitHub Actions CI to a Sequelize App (Sequelize)
- Add GitHub Actions CI and Deploy for a Serverless Framework Service (Serverless Framework)
- Set Up GitHub Actions CI for a Slack Bolt App (Slack Bolt)