All jobs

Upgrade Cargo Dependencies Weekly for a Tokio Service

Yes. Each week the agent refreshes Cargo.lock, takes each breaking crate as its own commit, builds and tests with every feature, and opens one PR or says why not.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the manifest and the lock file as two different facts. In a Tokio service like tokio-rs/mini-redis, Cargo.toml asks for tokio = "1" with the full feature, bytes = "1", clap 4.2.7 with derive, atoi 2.0.0, tracing and tracing-subscriber, and four optional crates behind an otel feature: opentelemetry 0.20.0, tracing-opentelemetry 0.21.0, opentelemetry-aws 0.8.0 and opentelemetry-otlp 0.13.0. Cargo.lock is where the age shows: it resolves tokio to 1.32.0, clap to 4.4.2 and bytes to 1.5.0, and through the otel feature it carries tonic 0.9.2, hyper 0.14.27 and h2 0.3.21. The package is on edition 2018 and declares no rust-version, and .github/workflows/ci.yml installs no particular toolchain, so nothing in the repository says which compiler the code promises to support.

The first commit is the safe sweep. cargo update moves every crate to the newest release its range allows and touches only Cargo.lock; on this manifest that carries tokio, bytes, clap, tokio-stream and both tracing crates forward without a line of source changing. After it the agent runs exactly what CI runs on three operating systems: cargo build, cargo build --features otel, cargo test, cargo test --features otel and cargo fmt --all --check. It also notes the compiler floor the sweep implies, because current tokio and clap releases each declare a minimum Rust version in their manifests, and a team that builds with an older pinned toolchain needs to hear that before the lock file moves.

Breaking bumps come next, one commit each. Cargo treats a 0.x minor as breaking, so the four telemetry crates do not move with cargo update, and atoi has a new major. The agent raises one range, reads that crate's changelog, compiles, and fixes what the compiler reports. For atoi that means checking its three calls, one in get_decimal in src/frame.rs and two in next_int in src/parse.rs. For the telemetry group it is a rewrite of one function: set_up_logging in src/bin/server.rs imports opentelemetry::sdk::trace, builds its tracer with opentelemetry_otlp::new_pipeline() and new_exporter().tonic(), and neither function exists in the current opentelemetry-otlp source, which builds an exporter with SpanExporter::builder().with_tonic() and takes the SDK from the separate opentelemetry_sdk crate. The four crates have to move together, since tracing-opentelemetry and opentelemetry-aws each pin the opentelemetry minor they were built against.

A group that does not come back green is dropped, not forced. If the telemetry rewrite compiles but the X-Ray id generator or propagator has moved somewhere the agent cannot confirm from the crate's own docs, it reverts that commit, leaves the otel ranges where they were, and reports the exact compiler error or the open question. Then it runs cargo tree --duplicates to show whether the lock file still carries two versions of socket2, syn or regex-syntax as it does today, and opens one pull request.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Upgrade this Tokio service's Cargo dependencies. Read Cargo.toml, Cargo.lock, .github/workflows/ci.yml, README.md and every file that uses an optional dependency, starting with src/bin/server.rs, first. Commit one: run cargo update for everything the current ranges allow, changing only Cargo.lock. Then take each breaking bump as its own commit: raise the range, read the crate's changelog, and make the code change it requires. Move opentelemetry, opentelemetry-otlp, opentelemetry-aws and tracing-opentelemetry together as one group and rewrite set_up_logging for the current API, keeping the X-Ray propagator and id generator; if you cannot confirm where one of them now lives, drop the group and say so. After every commit run cargo build, cargo build --features otel, cargo test, cargo test --features otel and cargo fmt --all --check, and drop any group that fails with the error quoted. Report the minimum Rust version the new lock file needs, from the rust-version of the crates in it, and the output of cargo tree --duplicates before and after. Open one pull request listing every crate's old and new version and the commit that carries it. If nothing passes, open no pull request and say why.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. 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.
  2. 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.
  3. 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

One pull request on its own branch. The first commit changes Cargo.lock alone. Each later commit changes Cargo.toml, the lock file and the source a breaking bump touched: src/frame.rs and src/parse.rs if the atoi calls needed it, src/bin/server.rs and the otel feature list for the telemetry group. The description is a table of crate, old version, new version and commit, then the crates held back with the reason for each, the five CI commands with their result after every commit, the minimum Rust version the new lock file implies, and the duplicate-crate list before and after.

A reviewer reads the telemetry commit more closely than the rest. The tests do not start a collector, so cargo test --features otel proves the code compiles and the server still serves, not that spans arrive anywhere. The pull request says this in plain words and gives the command from the README to check it by hand, RUST_LOG=debug cargo run --bin mini-redis-server --features otel, against a collector the team runs. Because each group is one commit, declining the telemetry bump for now is a revert of that commit while the lock file sweep still merges.

Run it on every Monday morning

Create an automation in the Project with this prompt and a schedule trigger whose cron is 0 9 * * 1 in your timezone. The first run does the catching up described above. After that a typical week is a lock file sweep and nothing else, and a week where nothing moved opens no pull request and says so in its result.

To get the link pushed to your own systems, start the weekly run from your scheduler with POST /o/{org}/sessions and an API key that has a webhook URL. Rush then sends run.completed with the session_url when the turn ends, and a handler on your side posts the pull request where the service's owners read.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

A lock file that has fallen this far behind is rarely a decision; it is the cost of the afternoon nobody has. The safe half is one command, but the other half is reading four changelogs, rewriting a tracing setup against an API that moved, and building twice per step because the code behind --features otel only compiles when asked. The agent does all of it in its own sandbox with a current toolchain, keeps every cargo invocation and its output in the run's record, and leaves a branch where each risk is a separate commit.

It also answers the question a version table cannot: what does the new lock file demand of the compiler. Reading the rust-version of the crates it resolved and stating the floor is the difference between a pull request that merges and one that breaks a pinned build image a week later. Run it across every service the team owns and each gets its own sandbox, its own pull request and its own list of what was held back.

Frequently asked questions

Will cargo update break my build?

It stays inside the ranges Cargo.toml already allows, so by semver it should not, and the agent proves it by running the build, the tests and the format check with and without optional features afterwards. The one thing it can change silently is the minimum compiler version, which is why the pull request states it.

Why are the OpenTelemetry crates upgraded as a group?

They are released against each other. tracing-opentelemetry, opentelemetry-otlp and opentelemetry-aws each depend on a specific opentelemetry minor, and mixing them gives two copies of the API crate whose types do not match. Moving all four in one commit keeps the tree to a single version.

Does it need cargo-edit or cargo-outdated installed?

No. It edits Cargo.toml directly and uses cargo update, cargo tree and the registry's own metadata. If the repository already uses a tool such as cargo-deny in CI, the agent runs that too, since it reads the workflow files before it starts.

What if I already use Dependabot or Renovate?

Keep it for the routine bumps. This run is for the ones a bot opens and nobody merges: a breaking release that needs code changed, or a group of crates that only build when moved together. The prompt can name just those crates.

More Tokio jobs

The same job on other stacks

Keep reading