What the agent does
The first turn reads config/routes.rb, the Sidekiq initializer, the ten classes in app/jobs and the schema, and writes no code. Sidekiq 8.1.7 deletes a job from Redis when it finishes and its metrics keep only per-class totals, so no finished run has a start time, duration or wait. It proposes a job_executions table filled by a global ActiveJob around_perform, one row per attempt, arguments redacted before storage and 7-day retention, then waits for approval.
A follow-up approved it as proposed. The second turn adds the JobExecution model, its migration, config/initializers/job_execution_recording.rb, Admin::SlowJobsController at /admin/slow_jobs, a Slim view and a prune task in lib/tasks/schedule.rake.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Build an administrator-only, read-only page listing the slowest background-job executions from the last day with safely displayed arguments. Inspect the Rails layout/auth, Sidekiq integration, job classes and schema first. Distinguish runtime from queue wait time. If completed execution timing is unavailable, propose the smallest existing-source integration or recording change, including retention, retry semantics and argument redaction, and end the turn awaiting a follow-up approval. Do not fabricate past history. After approval, implement the page with server-side admin authorization and tests for anonymous/non-admin refusal, time boundaries, duration ordering, empty history and redaction. Use synthetic jobs for screenshots; do not run real email or GitHub jobs. Run relevant tests, bin/rake test and repository lint checks where supported. Ask before adding dependencies and open a PR with evidence and remaining limits.",
"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
Tried on codetriage/CodeTriage at d1868f86: 12 files changed, 389 insertions(+), 1 deletion(-). bin/rake test went from 222 runs, 483 assertions, 0 failures, 0 errors, 0 skips to 238 runs, 530 assertions, 0 failures, 0 errors, 0 skips, and bundle exec standardrb exited 0 before and after, once standardrb --fix cleaned style in the new files. The sandbox had no Ruby, compiler or Postgres, so the run installed Ruby 4.0.5 with mise, a conda-forge GCC toolchain (symlinking ar, ld and the rest for native gems) and Postgres 16, and copied config/database.ci.yml to the git-ignored config/database.yml.
For the reviewer: nothing schedules rake schedule:prune_job_executions yet. Retries show no queue wait, a change from the proposal, because ActiveJob keeps the original enqueue time. Real Sidekiq and Redis were not exercised; the tests use the ActiveJob test adapter.
Run it on every job-visibility feature request
A teammate starts this prompt from the console in the app's Project. Its first turn ends on a design question, a new table and a global job callback; anyone in the org reads it, and the starter or an org admin replies with a follow-up, approving it or changing the retention, which starts the build.
The use case this job follows, with its automation and trigger: Steer a run as a team.
Why run it on Rush?
As asked, the page had nothing to show: Sidekiq keeps no record of finished jobs. The run said so, citing Sidekiq's own metrics/tracking.rb, and refused to invent history. After approval it reported where it departed from its proposal, and that db/structure.sql is stale, ending in 2015, so only db/schema.rb changed.
Frequently asked questions
What arguments does the page show?
Only ids and numbers. A record becomes Class#id, strings and unknown objects become [FILTERED], values under keys like email, token, password or key are filtered, and an argument list over 1,000 bytes is replaced entirely. Mail jobs keep their mailer class and action name.
Who can open /admin/slow_jobs?
Users with admin? set. Anonymous visitors go through the existing GitHub login redirect and a signed-in non-admin gets a 404. Tests cover both.
More Rails jobs
The same job on other stacks
- Build an Admin Page in a Django App (Django)
- Build an Admin Page in a Laravel App (Laravel)
- Build an Admin Page in a Phoenix App (Phoenix)