All jobs

Review Pull Requests That Change Sidekiq Jobs in Rails

Yes. An agent checks out the pull request, runs standardrb and the job tests, checks queues, arguments and retries against the Procfile, and posts one review.

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 pull request beside the files that decide how jobs run. In a Rails app like codetriage/CodeTriage those are config/application.rb, which sets config.active_job.queue_adapter = :sidekiq, config/initializers/sidekiq.rb, app/jobs/application_job.rb with queue_as :default, the base classes RepoBasedJob and UserBasedJob, and the two files that start workers, Procfile and Procfile.concurrency, both running sidekiq -q default -q mailers. It also reads lib/tasks/schedule.rake, since most jobs in this app are enqueued from there in bulk.

Then it runs what CI runs. It installs the Ruby in .ruby-version and PostgreSQL, copies config/database.ci.yml as .github/workflows/main.yml does, loads the schema, and runs bundle exec standardrb and bin/rails test for the test files the pull request touches, then the whole suite if the change is in a base class or an initializer. If a changed job has no test in test/jobs, it writes a short one in the sandbox to confirm a suspected problem, without adding it to the branch.

The review is a checklist built from this codebase. A new queue_as with a name the Procfile does not list means the job is enqueued and never run. A job that takes a record instead of an id goes through GlobalID, so it raises ActiveJob::DeserializationError if the row is deleted first; the base classes accept either, and schedule.rake passes ids with select(:id), which the agent treats as the house style. A side effect followed by a database write, the shape of SendDailyTriageEmailJob#send_email, repeats the side effect on Sidekiq's default retries. A new scheduled task that walks a table without find_each and a batch_size, or enqueues one job per row without filtering first, gets flagged with the number of rows it would enqueue left as a question rather than a guess.

A few changes get a closer look whatever the diff says. A perform_later inside a transaction block can run before the commit and miss its record. Any edit to config/routes.rb near mount Sidekiq::Web must keep it inside authenticate :user, lambda { |u| u.admin? }. A change to the Redis settings in config/initializers/sidekiq.rb, which today passes verify_mode: OpenSSL::SSL::VERIFY_NONE, gets a note on why that setting exists and whether the new code copies it somewhere it is not needed. The agent pushes nothing.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Review this pull request on a Rails app that runs Active Job on Sidekiq. Check it out, install the Ruby in .ruby-version and Postgres, set up the database as .github/workflows/main.yml does, and run bundle exec standardrb and bin/rails test. Read the diff with config/application.rb, config/initializers/sidekiq.rb, app/jobs, lib/tasks/schedule.rake, Procfile and Procfile.concurrency beside it. Look for a queue the Procfile does not process, a job that takes a record where an id would survive deletion, a side effect that a retry would repeat, perform_later inside a transaction, a scheduled task that enqueues one job per row without batching, and any change to the Sidekiq::Web mount or Redis settings. Confirm findings with a test in the sandbox where you can, but do not add it to the branch. Post one GitHub review with the check output and each finding's file and line, blocking issues first. Do not push commits.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app/pull/42"
    }
  ]
}
  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 one review on the pull request. Its summary quotes the standardrb result and the bin/rails test totals from the sandbox, says which test files ran and why, and lists the findings with file and line, blocking issues first. A finding about a queue name quotes the Procfile line that leaves it unprocessed; one about a record argument names the deletion path that would raise and the id-based form the base classes already support.

Where the agent confirmed a finding with a test, the review includes the test's code and its failing output, so the author can paste it into test/jobs if they agree. Findings it could not confirm are marked as questions. Nothing is pushed to the branch, and the run's record keeps every command it ran.

The author or a maintainer still decides: whether a blocking finding is a real risk for their data, and whether a suggestion such as moving mail to its own queue belongs in this pull request or a later one.

Run it on every pull request that touches app/jobs

Create an automation in the Project with a github trigger on pull_request.opened and pull_request.synchronize, limited to the branch the app merges to, and this prompt made general. The trigger adds the pull request after the prompt, so each one gets its own sandbox, its own test run and its own review. To review only job changes, the prompt tells the agent to post a one-line note and stop when the diff touches nothing under app/jobs, lib/tasks, the Procfiles or the Sidekiq initializer.

The automation runs as the member who last changed it, and only pull requests by an owner, member or collaborator fire it. Its max_runs_per_hour cap keeps a morning of dependency bumps from starting a review for each at once.

The use case this job follows, with its automation and trigger: Review every pull request.

Why run it on Rush?

Most mistakes in background jobs are invisible in a diff: a queue name that no worker reads, a retry that sends an email twice, a record that is gone by the time the job runs. Catching them means reading the job next to the Procfile, the base classes and the rake tasks, and running the tests against a real Postgres. The sandbox does both for each pull request, and the review quotes the output it produced.

A review from a run is consistent: the same checklist on every pull request, with evidence attached, and no push to the author's branch. Several pull requests opened in the same hour each get their own sandbox and their own review, so none waits for another.

Frequently asked questions

Will the agent push fixes to my branch?

No. The prompt says not to push, and the review is the only thing the run writes to GitHub. A test it wrote to confirm a finding is quoted in the review for the author to add if they want it.

Why flag a new queue name?

Sidekiq only reads the queues it is started with, and this app's Procfile starts it with -q default -q mailers. A job declared with queue_as :imports would be enqueued and sit in Redis until someone adds the queue to every Procfile that starts a worker.

Does it check Sidekiq Enterprise or Pro features?

It reviews what the repository uses. This app's Gemfile has the open source sidekiq gem, so the review does not suggest features from paid editions unless the Gemfile already includes them.

What if our jobs include Sidekiq::Job directly instead of Active Job?

The checklist changes slightly: arguments must be JSON types with string keys, and retries are set with sidekiq_options. The agent reads which style the repository uses and reviews against it.

More Sidekiq jobs

The same job on other stacks

Keep reading