All jobs

Add Error Boundaries to a SolidJS App

Yes. An agent wraps each route of your SolidJS app in Solid's ErrorBoundary with a retry fallback, makes failed API calls throw instead of returning, and opens a PR.

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 how errors travel today. In an app like solidjs/solid-realworld, src/store/createAgent.js wraps every request in one send() that catches a failed fetch, calls actions.logout() on a 401 it can never see on a network error, and then returns the error object as if it were data. src/store/createArticles.js feeds that into createResource, so a failed article load resolves to an error value, src/pages/Article/Article.js renders <h1>{article()?.title}</h1> with nothing in it, and the user sees an empty page with no message. src/App.js already has one <Suspense fallback={<div class="container">Loading...</div>}> around the <Switch> of routes, but no ErrorBoundary anywhere, so an exception thrown while rendering a page unmounts the whole app.

It then adds boundaries where Solid expects them. ErrorBoundary ships in solid-js, the one runtime dependency in package.json, so no package is added. The agent wraps the <Switch> inside the existing <Suspense> in src/App.js with an ErrorBoundary whose fallback receives (err, reset) and renders a page in the app's own Bootstrap classes with the message and a Try again button that calls reset. Because the store's createRouteHandler changes the location signal on every hashchange, the agent also keys the boundary on the route so that navigating away from a failed page clears the error without a full reload, and the NavBar above the boundary keeps working while a page is broken.

Boundaries only help if failures actually throw, so the agent changes send() in createAgent.js to throw on a non-OK response and on a network error, after preserving the one behaviour the app relies on: src/pages/Auth.js, src/pages/Settings.js and src/pages/Editor/Editor.js expect a rejected promise whose errors object feeds src/components/ListErrors.js, so a 422 from the API still rejects with that shape and those forms keep showing field errors inline rather than tripping the boundary. A thrown error inside createResource surfaces through Suspense to the nearest boundary, which is the behaviour the new fallback renders.

The check is in the browser. The agent runs npm install and npm run build (rollup -c --environment production from rollup.config.js, with the Babel preset for Solid), serves public/, opens #/article/does-not-exist against the public API at https://api.realworld.io/api and shows the fallback with its message, then clicks the site name in the navbar to show the home page recovers. There is no test runner in the repository ("test": "test"), so the pull request carries screenshots of the fallback and the recovery instead.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Add error boundaries to this SolidJS app. Read src/index.js, src/App.js, src/store/index.js, src/store/createAgent.js, src/store/createArticles.js, src/store/createRouteHandler.js, src/components/ListErrors.js and every file under src/pages first. Wrap the route Switch in App.js with Solid's ErrorBoundary, inside the existing Suspense, with a fallback that shows the error message and a Try again button that calls reset, and clear the error when the route changes. Change send() in createAgent.js to throw on a failed fetch or a non-OK response, while keeping a 422 rejecting with the errors object that ListErrors expects in Auth, Settings and Editor. Add no dependency. Run npm install and npm run build, serve public, open an article route for a slug that does not exist and show the fallback, then show the home page recovers, and open a pull request with screenshots.",
  "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

What comes back is a pull request on its own branch that changes src/App.js (the boundary and its fallback component), src/store/createAgent.js (send() now throws, with the 422 path kept for the forms) and, if a shared fallback is extracted, one new file under src/components/. The pages themselves, the route handler, rollup.config.js and package.json are unchanged, and no dependency is added because ErrorBoundary comes with solid-js.

The description carries a screenshot of the fallback for an article that does not exist, a screenshot of the home page after Try again or a navbar click, and the production build output. The transcript at GET /o/{org}/sessions/{id}/messages holds each command and each page the agent opened beside its result.

Before merging, a reviewer checks that the sign-in, settings and editor forms still show their inline field errors on a 422, decides whether the fallback should offer a link home as well as Try again, and whether a boundary per page is wanted later. A follow-up message to the same session can log boundary errors to the browser console with the route name, or add a second boundary around the comments list so a failed comment fetch does not blank the article.

Run it on every Linear issue labelled frontend

A team that triages front-end bugs in Linear starts one run per issue from an automation with a linear trigger on the frontend label, in the Project that holds this repository. The automation adds the issue after this prompt, so an issue that names the route where users saw a blank page, or asks for a particular fallback wording, is what the agent reads.

Each run works in its own sandbox and opens its own pull request that links the issue, and an automation run has its own max_runs_per_hour cap. The pull request's screenshots let a reviewer judge the fallback without checking the branch out.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

A blank page is the worst kind of error: nothing in the console points at send() returning an error object as data, and the fix touches the API layer, three forms that depend on its rejection shape, and the app shell. The agent reads all of those files, keeps the one behaviour the forms rely on, and proves the fallback in a real browser against the real API, with the lockfile's packages in a sandbox of its own.

The pull request carries screenshots of the failure and the recovery and the full build output, so the review is a read of one boundary and one function. Several apps built on the same RealWorld pattern can be handled at once, each in its own sandbox with its own pull request.

Frequently asked questions

Why change createAgent.js at all?

Because today a failed request never throws. send() catches the error and returns it as if it were the response, so the article page renders an empty title and no boundary can fire. Making a failed fetch or a non-OK status throw is what lets Suspense hand the error to the boundary.

Will the login and settings forms still show field errors?

Yes. Those forms catch a rejected promise and pass its errors object to ListErrors.js, which lists each key and message. The agent keeps a 422 rejecting with that exact shape, so validation errors stay inline and only unexpected failures reach the boundary.

What happens when the user navigates away from a broken page?

The error clears. The boundary is keyed on the route from createRouteHandler.js, so a hashchange to another page remounts it in a clean state, and the navbar, which sits above the boundary in App.js, stays clickable the whole time.

Why one boundary around the routes rather than one per page?

One boundary inside the existing Suspense covers every page with one fallback and no change to the pages. The pull request notes where a second boundary would help, around the comments list on the article page for instance, and a follow-up message can add it.

More SolidJS jobs

The same job on other stacks

Keep reading