# Reproduce a Bug from a Linear Issue in a Rails App

An agent could not reproduce a dotted-name search bug in rubygems.org: every dotted query it indexed returned its gem, so it made no change.

[Run this on Rush](https://cloud.getrush.ai/run/reproduce-linear-bug/rails/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The issue was written for this trial and appended after the request: dotted gem names like `rack.session` return no results. The agent reads `SearchesController`, `Api::V1::SearchesController`, `lib/elastic_searcher.rb`, `lib/search_query_sanitizer.rb` and the mapping in `app/models/concerns/rubygem_searchable.rb`, whose `rubygem` pattern analyzer splits names on whitespace and `.-_`. The sanitizer never touches a dot.

The sandbox has no Ruby or services, so it builds Ruby 4.0.9, runs Postgres 15, Memcached and OpenSearch 2.13.0, and installs Playwright Chromium. It adds 4 GB of swap after OpenSearch died twice during `test:all` on the 4 GB machine, and builds Tailwind once after 1006 errors read `The asset 'tailwind.css' was not found`. It indexes gems with `SearchKickHelper` and queries the real index: `rack.session`, `net-http.persistent`, `jquery.rails`, partial, quoted and `name:` forms all returned their gem.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "The supplied Linear issue reports that searching for a gem name containing a dot returns no results. Read the current web/API search controllers, ElasticSearcher, SearchQuerySanitizer, index mappings and existing indexed search tests. Establish the exact query, expected gem, search surface and revision. Create indexed test data using the repository's real search test helpers, write a regression test and record it failing on unchanged code before fixing the cause. Preserve malformed-query and query-complexity protections; do not stub away OpenSearch. Run the targeted regression again with the fix, then bin/rails test:all with the documented Postgres, Memcached, OpenSearch and browser dependencies in the sandbox. Do not load or mutate production data. If the issue cannot be reproduced, report the actual checks and missing details without inventing a failure. For a verified fix, open a pull request linking the supplied Linear issue URL with before/after output.",
  "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

Tried on rubygems/rubygems.org at 96a4bd1f7: no code change, because the bug did not reproduce. The dotted-name regression tests the agent wrote for web and API search passed on unchanged code (`3 runs, 4 assertions, 0 failures, 0 errors, 0 skips`), so there was no failing run to fix against; it reverted them and saved them as an optional patch. The existing search tests ended `112 runs, 207 assertions, 0 failures, 0 errors, 0 skips`.

For the reviewer: send the real gem name, query, surface and revision, or close the issue as not reproducible on master. Nearby, with `rack-session` at 5,000,000 downloads, searching `rack.session` ranked the exact gem third; the run attributes that to `log1p(downloads)` outweighing the exact-name boost and changed nothing. No pull request was opened.

## Run it on every Linear issue labelled bug

An automation with a `linear` trigger on `linear.issue.labeled` and the label `bug` runs the recipe's prompt with the issue as its context. That prompt does the work and asks on the issue when the description is not enough; to get this trial's reproduce-first report, put this request's steps in the saved prompt.

## Why run it on Rush?

A report like this one invites a fix nobody needs, such as escaping dots. The run tested the claim against a real OpenSearch index instead, came back with no change, and named what was missing: the issue's examples were `rack.session` style, not a real gem and query.

## Frequently asked questions

### Why didn't the agent keep its regression tests?

They passed before any fix, so they prove nothing. The run copied them to `/workspace/.rush/artifacts/` as a `.patch`, which capture drops.

### Did the full suite pass on the clone?

The valid baseline ended `5959 runs, 19187 assertions, 1 failures, 0 errors, 221 skips`. The failure expects file mode 600 in `store_version_contents_job_test.rb`; the run suspects the sandbox's permissions but did not confirm it.

## More Rails jobs

- [Review Database Migrations in Rails Pull Requests](https://getrush.ai/run/review-database-migrations/rails/)
- [Review Pull Requests Automatically in a Rails App](https://getrush.ai/run/review-pull-requests/rails/)
- [Security Review Pull Requests on a Rails App](https://getrush.ai/run/security-review-pull-requests/rails/)

## The same job on other stacks

- [Reproduce a Bug from a Linear Issue in a Next.js App](https://getrush.ai/run/reproduce-linear-bug/nextjs/)
- [Reproduce a Bug from a Linear Issue in a Phoenix App](https://getrush.ai/run/reproduce-linear-bug/phoenix/)

## More jobs like this: Turn a Linear label into a PR

- [Save Scrapy Items to PostgreSQL](https://getrush.ai/run/save-items-to-postgres/scrapy/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
