What the agent does
The agent first establishes why the package is stuck. In an app like the-road-to-learn-react/hackernews-client, package.json asks for axios ^0.18.0 and the lockfile holds 0.18.0. A caret range on a 0.x version does not cross the minor, so no routine npm update has ever moved it, and npm ci prints a deprecation notice for that exact version: a critical security vulnerability fixed in 0.21.1. The agent quotes the notice, then lists the call sites. There is one, in fetchSearchTopStories in src/App.js: axios(url) with the URL as the only argument, result.data read in then, and a catch that stores the error in state.
It upgrades to the current 1.x release and runs everything, and the first surprise is in the tests. The application code is compatible, but two of the nine tests fail with TypeError: (0 , _axios.default) is not a function. The cause is in the tooling. The package's main field now points at ./dist/node/axios.cjs. The Jest configuration inside react-scripts 3.1.0 sends every file whose extension is not js, jsx, ts, tsx, css or json through config/jest/fileTransform.js, which replaces the module with its file name. So require('axios') returns a string. The agent proves this with a three-line test that prints typeof require('axios') before it proposes a fix.
Two fixes work, and the agent tests both. A jest.moduleNameMapper entry in package.json that maps ^axios$ to axios/dist/axios.js, the UMD bundle, makes all nine tests pass on the old toolchain. Upgrading react-scripts to 5.0.1 also does, since its file pattern includes cjs. The agent picks the mapper for this pull request, because it is one line and the larger upgrade deserves its own review, and it leaves a comment in the description pointing at that line as something to delete later. It then runs the production build with the new version to confirm webpack 4 accepts the package's browser build, and reports the size of the vendor chunk before and after.
Last, it checks behaviour at the edges the code touches. It calls the same endpoint with both versions from a script: a successful response has the same shape, and a 404 rejects in both, but 0.18.0 rejects with a plain Error that has no code, while 1.x rejects with an AxiosError whose code is ERR_BAD_REQUEST and which axios.isAxiosError recognises. This app only checks whether an error exists, so nothing changes for it. The agent also notes that the first test mounts App with no mock, so the suite sends a real request to the search API, and it flags that as a separate problem.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Upgrade axios in this repository from 0.x to the latest 1.x release. Start with the facts: the declared range and locked version, why npm update has not moved it, any deprecation or audit message npm prints for the locked version, and every call site with the arguments it passes, the response fields it reads and how it handles errors (interceptors, transformRequest, cancel tokens, paramsSerializer, error.response checks). Run the tests and the production build before changing anything and keep the output; if the build fails for a reason unrelated to axios, say so and use the smallest workaround for the comparison only. Upgrade, then run the tests and the build again. If a test fails because the test runner cannot load the package, find out exactly what require('axios') returns under the runner and why, fix it in the runner's configuration with the smallest change that works, and name the larger upgrade that would make the workaround unnecessary. Write a short script that calls one of the app's real endpoints with the old and new version, for a success and a 404, and compare the response shape and the error's name, code and response. Change application code only where the comparison or the tests show it is needed. Report the bundle size before and after. Flag any test that sends a real network request, but do not rewrite the tests. Open a pull request with the output of every command.",
"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
A pull request that changes the axios range in package.json, updates package-lock.json, and adds one moduleNameMapper entry under a jest key. No file in src changes when the call sites are as plain as the one here, and the description says so explicitly along with how that was checked. It lists the call site inventory, the npm deprecation notice for the old version, and the test and build summaries before and after.
The explanation of the test failure gets its own section, because the error message points at application code that is not at fault. It shows the probe output, the line of the Jest configuration responsible, and both fixes with their results. It also shows the comparison script's output for the success and the 404, and the gzip size of the vendor chunk under each version, which grows with 1.x.
A reviewer confirms that the mapper targets a file that exists in the installed package, that the only error handling in the app does not depend on the error's class, and that the build used for the size comparison was made the same way both times. If the app has interceptors or reads error.response in many places, the reviewer reads the per-call-site notes; a larger codebase gets a longer inventory, not a different method.
Run it on every Monday morning
The jump from 0.x to 1.x is made once. Staying current afterwards is a weekly job. Create an automation in the Project that holds the repository with a schedule trigger, a weekly cron and your team's timezone, and a saved prompt that runs npm outdated axios, ends with one line when nothing is newer, and otherwise upgrades, runs the tests and build, and opens a pull request with the output. The saved prompt is the only instruction, so it names the package, the commands and what the pull request must show.
To cover several repositories from one place, a script on your server sends the body to POST /o/{org}/sessions once for each repository, with a request_id that is a UUID v5 of the repository name and the ISO week, so running the script twice in a week starts nothing twice. The key's webhook_url receives run.completed for each run that key started, with the session URL to read the pull request from.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
This upgrade fails in a place nobody looks. The breaking-change list for the library is about error handling and defaults, and the thing that actually breaks here is a file extension the test runner does not recognise. That is only found by installing the new version and running the suite, and only explained by printing what the runner loaded. The agent does both in its own sandbox and keeps the output in the transcript at GET /o/{org}/sessions/{id}/messages, so the diagnosis in the pull request is a recorded observation.
The run also compares real responses from both versions, which a version bump alone never does. It makes the calls, prints the error objects side by side and attaches the output. For one repository that is a small convenience. For a team with the same old pin in a dozen front ends, it is a dozen identical investigations done at once, each returning a pull request with its own evidence.
Frequently asked questions
Why does Jest say axios is not a function after the upgrade?
On an old Create React App, Jest treats any file with an unknown extension as a static asset and substitutes its file name. The 1.x package's entry point is a .cjs file, so the import yields a string. Mapping axios to the UMD bundle in moduleNameMapper, or upgrading react-scripts to a version whose patterns include cjs, restores the real module.
Do I need to change my axios calls?
Often not. axios(url), axios.get, response.data and promise rejection on error statuses behave the same for ordinary requests. Code that inspects errors by shape, uses interceptors to swallow failures, or relies on custom serializers needs a closer look, which is why the agent inventories those patterns before upgrading and tests the ones it finds.
Is going to 0.21.1 enough to clear the security warning?
It clears the notice npm prints for 0.18.0, since that notice names 0.21.1 as the fixed version. It also leaves you on a 0.x line where a caret range still cannot pick up later releases automatically. The request targets 1.x so that ordinary updates start working again.
Does the bundle get bigger?
Yes. On the fixture this page was written against, the gzip size of the vendor chunk grew when 1.x replaced 0.18.0 under the same build. The agent reports both numbers from real builds so you can decide whether that matters for your app, and whether a move to the platform's fetch is worth a separate task.