AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Autonomously Reproduce Customer Bugs, Generate Failing Tests, and Verify Patches with Devin

江野雄太 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

For software engineering and support teams, reproducing customer-reported bugs is often far more expensive than writing the actual fix. Tracking down intermittent state bugs, configuring obscure local databases, interpreting noisy telemetry, and clicking through complex frontend workflows consume hours of senior developer focus. Devin transforms this reactive drain by acting as an autonomous triage and remediation engineer operating inside an isolated, full-stack sandbox.

At 365Finds, our operational benchmark is clear: never allow an autonomous agent to touch application code before it produces an isolated, failing regression test. Handing an agent a bug description and asking for an immediate fix encourages shallow pattern-matching and subtle hallucinated patches. When structured around a strict "Red-to-Green Assertion Gate," Devin autonomously digests telemetry from Sentry, boots containerized dependencies in its cloud sandbox, replicates the user journey via its built-in browser or terminal, writes a deterministic regression test, and proves its patch works with recorded visual evidence.


The Autonomous Bug Lifecycle: The Red-to-Green Closed Loop

Most teams fail with autonomous bug resolution because they treat the AI agent as a code synthesizer rather than an end-to-end verification agent. Devin succeeds because it possesses an operating-system-level sandbox with persistent shell tooling, an interactive browser, and VS Code IDE execution capabilities.

+-----------------------------------------------------------------------------------+
| 1. Ingestion & Triage                                                             |
|    Customer Ticket / Sentry Alert -> Devin Oncall / MCP Pulls Trace & Breadcrumbs |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 2. Isolated Sandbox Provisioning                                                  |
|    Devin spins up Devbox -> Checks out commit -> Starts mock DB & services        |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 3. Autonomous Reproduction (Terminal & Headless Browser)                          |
|    Replays API calls or browser clicks -> Confirms exact unhandled failure        |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 4. The Assertion Gate: Failing Regression Test ("RED")                            |
|    Synthesizes unit/integration/E2E test -> Asserts failure -> Verifies non-zero  |
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 5. Root Cause Patching & Verification ("GREEN")                                    |
|    Edits code -> Re-runs regression test (PASS) -> Runs full regression test suite|
+-----------------------------------------------------------------------------------+
                                         |
                                         v
+-----------------------------------------------------------------------------------+
| 6. PR Delivery & Visual Audit                                                     |
|    Generates PR -> Attaches annotated browser recording -> Ready for human merge  |
+-----------------------------------------------------------------------------------+

Step 1: Connect Observability with the Sentry MCP Integration

Reproducing production bugs requires accurate runtime context rather than user speculation. By connecting Devin to Sentry via the Model Context Protocol (MCP), Devin queries live error payloads directly.

  1. Enable Sentry MCP: In Devin’s settings under Customize -> MCPs, configure the official Sentry integration via OAuth.
  2. Ingest Rich Diagnostics: When an alert fires or a bug is assigned, instruct Devin to query the Sentry event ID. Devin retrieves:
    • The exact release tag and Git commit hash where the error occurred.
    • The full stack trace across client and server boundaries.
    • Breadcrumbs containing the prior UI actions, network fetch requests, and console warnings.
    • User environment metadata (browser version, OS, viewport, and feature flags).

This eliminates the usual "cannot reproduce on my machine" back-and-forth between customer support and core engineering.


Step 2: Establish Sandboxed Environment Blueprints and Skills

Devin runs inside a dedicated cloud Linux VM. To ensure Devin can spin up complex distributed applications without exhausting compute units (ACUs) on repeated setup attempts, configure repository skills under .agents/skills/.

Create a dedicated reproduction skill at .agents/skills/reproduce-issue/SKILL.md:

---
name: reproduce-issue
description: Standard operating procedure for reproducing customer bugs and generating regression tests.
allowed-tools: Shell, Read, Edit, Browser, Grep
---

## Phase 1: Environment Readiness
1. Check out the target commit matching the reported release.
2. Spin up local mock dependencies: `docker-compose -f docker-compose.test.yml up -d`.
3. Run database migrations and seed baseline fixture data: `npm run db:seed:minimal`.
4. Start development and mock API servers, verifying ports 3000 and 8080 are responsive.

## Phase 2: The Red-to-Green Assertion Gate
1. Isolate the failure using the provided Sentry trace or reproduction steps.
2. Write a minimal regression test under `tests/regression/`.
3. Execute the test: confirm that it FAILS with the exact error reported in production.
4. DO NOT modify application code until the failing test is verified and saved.

## Phase 3: Patching and Verification
1. Inspect the root cause in the affected modules.
2. Apply the minimal patch that resolves the issue without architectural side effects.
3. Re-run the regression test: verify it now PASSES.
4. Execute the broader test suite: `npm test` to ensure zero regressions.

By institutionalizing this procedure as a Git-committed skill, every Devin session—whether triggered manually or through Devin Oncall—follows identical, reliable verification hygiene.


Step 3: Dispatching the Reproduction Task

When kicking off a session in Devin Cloud, Devin CLI, or via Slack automations, provide a structured prompt that mandates the failing test constraint:

Investigate and resolve customer bug report: "Cart checkout crashes on applying multi-currency coupon"
Sentry Issue ID: PROD-FRONTEND-8492
Target Branch: release/2026.10

Execute the @skills:reproduce-issue workflow:
1. Pull the release/2026.10 branch and seed test accounts using fixture data.
2. In the sandbox terminal and interactive browser, recreate the currency conversion step.
3. Write an automated regression test in `tests/e2e/checkout-currency.spec.ts` reproducing the crash.
4. Execute the test to verify it fails with: `TypeError: Cannot read properties of undefined (reading 'exchange_rate')`.
5. Once confirmed failing, implement the fix in `src/services/currency.ts` and `src/components/CheckoutModal.tsx`.
6. Confirm the regression test passes, run the full test suite, and record browser verification.

Step 4: Autonomous Execution in the Sandbox

With the instructions loaded, Devin executes the workflow autonomously inside its devbox:

1. Terminal and Service Bootstrap

Devin opens its sandboxed shell, clones the specified branch, installs lockfile dependencies, and executes background test containers. If a dependency or environment secret is missing, Devin pauses and requests it, saving it to encrypted workspace secrets for future sessions.

2. Browser-Driven Reproduction

If the defect requires frontend state manipulation, Devin uses its built-in interactive browser. It navigates to the local preview URL, seeds local storage or session cookies, and executes the exact series of clicks and inputs identified in the Sentry breadcrumbs. Devin watches its internal browser console and network inspector to capture the unhandled runtime exception.

3. Writing the Failing Regression Test

Devin drafts a focused test case using your project's framework (such as Jest, Pytest, or Playwright). It runs the command via shell:

npx playwright test tests/e2e/checkout-currency.spec.ts

Devin parses the terminal output, verifying that the exit code is non-zero and that the assertion failure matches the customer incident report. This guarantees the bug is genuinely captured.

4. Code Remediation and Test Turn-Green

Devin navigates to the root cause files using its IDE tool, analyzes the logic flaw, and implements defensive handling, proper type narrowing, or state fallback logic. It reruns the specific regression test in the shell. Once the test turns green, Devin executes the global unit and integration test suite to catch secondary breakage.


Step 5: Visual Verification and Pull Request Handoff

Once the code passes all checks, Devin enters testing mode. It initiates an annotated screen recording in its sandbox desktop environment, repeats the customer workflow in the browser, and highlights key milestones:

Devin then opens a Pull Request that includes:


365Finds Comparison: Traditional Triage vs. Devin Autonomous Pipeline

Evaluation CriteriaTraditional Human Engineering TriageCopilot / Cursor Code AssistantsDevin Autonomous Sandbox Pipeline
Environment Spin-upManual; developer pulls branches and configures local Docker/DBNot supported; assumes developer environment is already configuredAutonomous; boots sandboxed devbox and runs containerized fixtures
Reproduction ReliabilityHigh, but consumes hours of senior engineer sprint timeLow; relies on developer copying code snippets without runtime contextHigh; autonomous exploration via sandboxed terminal and browser
Regression Test SynthesisFrequently skipped under pressure to ship quick fixesDeveloper must prompt and manually place generated test codeMandatory; synthesizes failing test before applying source fix
Verification GateManual local run and CI pipeline wait timeNone; cannot execute or verify code changes independentlyNative; verifies red-to-green test transition plus video capture
Mean Time to Resolution (MTTR)4 to 24 hours depending on on-call engineer queue2 to 6 hours (assists typing, not verification)20 to 45 minutes of autonomous cloud VM execution

Strategic Recommendations from 365Finds

  1. Enforce the Red-to-Green Rule in Repository Instructions: Place an explicit requirement in your repository AGENTS.md and Skills: A bug fix PR without an accompanying failing-to-passing regression test will be rejected. This single operational constraint prevents Devin from submitting cosmetic or superficial fixes.
  2. Standardize Test Fixture Seeding: Autonomous agents fail when test data is non-deterministic or hidden behind manual staging credentials. Maintain a lightweight Docker Compose profile and a deterministic mock seeding script (db:seed:mock) so Devin can instantly recreate customer account shapes.
  3. Use Devin Oncall for High-Volume Ingestion: Rather than manually triggering sessions for every customer ticket, configure Devin Oncall responders watching your #eng-bugs Slack channel or PagerDuty alerts. Allow Devin to automatically triage, attempt sandbox reproduction, and post back either a verified PR with a passing regression test or a diagnostic report outlining missing reproduction steps.
  4. Isolate Sandbox Secrets and Network Outbounds: Bug reports often contain sensitive customer payloads. Enforce Devin Security Profiles with network egress filtering and ensure your sandbox uses sanitized test tokens rather than live production credentials.

By shifting bug reproduction and regression testing to Devin's autonomous sandbox, engineering teams eliminate the most tedious phase of the software maintenance lifecycle while continuously expanding their automated test coverage.


References