Sulat.com / Writing on AISaturday, December 5, 2026
Enter →
Agents/5 December 2026

SWE-2.1 on a real multi-tenant Laravel app

SWE-2.1 took on four enterprise-style jobs in a multi-tenant Laravel app: invoicing, a cache leak between customers, tenant-aware queues and per-plan limits. Each ended with a green test suite.

Glass tenant boxes with code screens and database icons beside a 3D Devin logo, Laravel multi-tenant app
Illustration: Sulat featuring the Devin logo

At a glance

  • On a multi-tenant Laravel app with a database per customer, SWE-2.1 delivered four enterprise-style jobs, and each ended with the whole Pest suite green.
  • It handled the parts that usually bite in multi-tenancy: tenant isolation in invoicing, a cache leak between customers, queue jobs that run in the right tenant and per-plan limits.
  • Unprompted, it found queued jobs being stored where no worker would look, and moved them to the central database.
  • SWE-2.1 is free in Devin CLI and Desktop through 8 December, then discounted until 30 January.

I gave Devin’s SWE-2.1 four jobs on a multi-tenant Laravel app, the kind of work a SaaS team does every week: billing, a data leak between customers, background jobs and plan limits. Enterprise apps are hard on coding agents, because one slip can show a customer someone else’s data. SWE-2.1 got through all four jobs with the whole Pest suite green, and every run is recorded below, prompt included.

SWE-2.1 is Cognition’s in-house coding model, and it’s free in Devin CLI and Desktop through 8 December. I covered the launch in Cognition releases SWE-2.1. This time I wanted to see it do real work on a codebase with the awkward parts built in: separate databases per customer, queues, caches and roles.

The app

It’s a Laravel 13 project tracker with three customers: Acme on the enterprise plan, Globex on business and Initech on starter. Each customer gets its own database, picked by the domain the request arrives on, using stancl/tenancy. Users have roles, time entries roll up into project budgets, and the tests run on Pest.

Diagram: central database points to acme, globex and initech tenant databases, the domain picks the database
The domain picks the database. Illustration: Sulat

Multi-tenancy is where Laravel apps go wrong quietly, so it’s a fair test. stancl/tenancy is the package that gives each customer a database of their own. Spatie’s laravel-multitenancy is the other widely used option, and it supports both single and multiple databases. Whichever you pick, the same traps turn up: caches, queues and jobs that don’t know which customer they belong to.

The repo’s AGENTS.md tells agents to install Laravel Boost before they start. Devin read it and did exactly that, then worked from the Laravel and testing guidelines Boost put in the project. All four runs were hands-off: I gave Devin permission to read, edit and run shell commands up front, typed the prompt and left it alone. The box was 4 cores, 16 GB RAM, Ubuntu 24.

The app, running

The app is API-only, so to watch it work I wrote a small viewer page that calls the app’s real endpoints in a browser and shows what comes back. SWE-2.1 didn’t write the viewer, and every number on screen comes from the running app. The browser clips below all use it, with each tenant on its own domain.

Acme and Globex side by side in the running app. Recording: Sulat
Two browser windows: Acme with unlimited projects and Globex with 7 left of 10, one call-out on the plan limit
Each tenant gets its own plan limit. Screenshot: Sulat

Invoicing from one prompt

The first job is the biggest: a whole feature, from migration to policy to endpoint to tests, in one go. The prompt, verbatim:

Code
Add invoicing to this multi-tenant app. Tenants bill clients from a project's unbilled billable time entries. Add a tenant migration for invoices and invoice_lines (status draft, sent or paid; an invoice number unique per tenant like INV-0001; totals in cents), the models and an InvoiceStatus enum, an InvoicePolicy where owners and admins can create and send invoices and members can only view them, a POST /api/projects/{project}/invoices endpoint that snapshots the unbilled billable time entries into lines and marks them as invoiced so they can never be billed twice, and a GET /api/invoices endpoint. Write Pest tests, including one proving tenant A can never see tenant B's invoices, and keep going until the whole suite is green.
Invoicing from one prompt. The last frames show the invoice the app produced. Recording: Sulat

SWE-2.1 finished in about two and a half minutes with ten tests passing, seven of them new. It covered the double-billing rule, numbering that increments per tenant (INV-0001, then INV-0002), 403s for members who try to create invoices, and tenant isolation checked both over HTTP and directly against each tenant’s database. At Medium this full prompt ran past the ten minutes I allow for a recording, so this run is at Low, and Low was plenty.

Here’s the same job in the browser. Billing a project creates INV-0001 with its two billable lines, $300 in total. A second click on the same project is refused with a 422, and Globex gets its own INV-0001 in its own database.

Creating an invoice, then trying to bill the same time twice. Recording: Sulat
Acme invoicing screen showing a 422 refusal on the second click, next to Globex with its own INV-0001
The second click is refused, so time is never billed twice. Screenshot: Sulat
Devin CLI summary: invoicing tests including tenant isolation, with one call-out on tenant isolation
Each tenant only sees its own invoices. Screenshot: Sulat

The dashboard that showed the wrong company

For the second job I planted a bug on purpose. The dashboard caches its summary for five minutes, but under one shared key, so whichever customer opens it first fills the cache for everyone. It’s a classic multi-tenant leak, and it only shows up when two customers hit the dashboard close together. I told Devin the symptom and nothing else:

Code
Customers at two different tenants report that the dashboard at /api/dashboard sometimes shows another company's numbers. Reproduce it with a failing Pest test first, find the root cause, fix it properly without just turning the cache off, and make sure the new test and the rest of the suite pass.
A failing test first, then the fix. The last frames show both companies’ dashboards before and after. Recording: Sulat

It did it in the order I asked. SWE-2.1 wrote a regression test with two signed-in tenants and confirmed it failed, with Globex receiving Acme’s cached numbers. It named the root cause, the shared dashboard.summary key, and fixed it by putting the tenant’s key into the cache key while keeping the five-minute cache. The full suite ended at five tests passing. The run took about five and a half minutes at Medium.

In the browser, the same two page loads show the difference. Before the fix, opening Globex’s dashboard after Acme’s shows Acme’s numbers under Globex’s name. After it, Globex sees its own.

The same two page loads before and after SWE-2.1’s fix. Recording: Sulat
Globex dashboard before the fix showing Acme's numbers in red, and after the fix showing its own, with one call-out
Before the fix, Globex sees Acme’s numbers. After it, Globex sees its own. Screenshot: Sulat
Before and after diagram: shared dashboard cache key leaks Acme numbers to Globex, one key per tenant fixes it
One cache key per tenant fixes the leak. Illustration: Sulat
Devin CLI summary of the cache leak fix with the full Pest suite passing, one call-out on the result
The whole suite is green after the fix. Screenshot: Sulat

Queued reminders that run in the right tenant

Queues are the other classic trap. A job picked up by a worker has no web request to tell it which customer it belongs to. I started from the app as the invoicing run left it and asked for overdue-invoice reminders:

Code
Add a queued SendInvoiceReminder job and an artisan command invoices:remind that finds every tenant's sent invoices older than 14 days and queues one reminder per invoice. The job must run inside the correct tenant when a queue worker picks it up, and log the reminder through the Log facade. Write a Pest test that proves the job runs in the right tenant and never touches another tenant's data, then run the suite until it is green.
Queued reminders that run in the right tenant. The last frames show a queue worker sending them. Recording: Sulat

This one took about eight and a half minutes at Medium and ended at twelve tests passing. SWE-2.1 added the job and the command, then tested the part that matters with a real queue:work --once run, which confirmed the worker initialises the correct tenant. It also tested invoices with colliding IDs in two tenants, so a reminder for Acme’s invoice 1 can’t read Globex’s invoice 1.

The unexpected part: SWE-2.1 noticed that jobs dispatched inside a tenant’s context were being stored in that tenant’s database, where no worker would ever look. It changed the database queue to use the central connection. I hadn’t asked for that, and it’s a genuine fix. The longer version of this prompt, which also scheduled the command daily, ran past my ten-minute limit, so this is the trimmed one.

In the browser, I added three overdue sent invoices to the test data, two for Acme and one for Globex, then clicked once. The reminders command and a queue worker ran, and all three reminders went out, each logged against its own tenant.

A queue worker sends overdue-invoice reminders for two tenants. Recording: Sulat
Reminder log: acme INV-0001 and INV-0002, globex INV-0001 each sent, with one call-out on tenant correctness
Each reminder ran in its own tenant. Screenshot: Sulat
Devin CLI summary of queued invoice reminders: twelve tests passing, queue worker runs in the right tenant
The queue worker runs in the right tenant. Screenshot: Sulat

Per-plan limits

The last job is the kind of product rule every SaaS ends up needing: limits that depend on the customer’s plan. I started from the app as the cache fix left it.

Code
Add per-plan limits: starter tenants may have at most 3 active projects, business tenants 10 and enterprise tenants unlimited. Enforce it in a way that is easy to extend (a PlanLimits class or an enum-backed config), return a 422 with a clear message when the limit is hit, include the remaining project allowance on the dashboard, and add an artisan command tenants:usage that prints a table of every tenant's plan, active projects and limit. Write Pest tests for each plan and run the whole suite until it is green.
Plan limits, a 422 and a usage table. The last frames show them working in the app. Recording: Sulat

SWE-2.1 took about five and a half minutes at Medium and finished with twelve tests passing. It built an enum-backed plan config with a small PlanLimits class, so adding a plan means adding one entry. Creating a fourth project on a starter plan now returns a 422 with a plain message, the dashboard reports how many projects each customer has left, and tenants:usage prints the table. It also decided on its own that archived projects shouldn’t count towards the limit, and tested that.

In the browser, Initech on the starter plan is refused a fourth project with a 422 and a plain message, while Globex on the business plan adds one and sees 6 of 10 left.

A starter tenant hits its limit while a business tenant adds a project. Recording: Sulat
Initech starter tenant refused a fourth project with a 422, beside Globex adding one with 6 left of 10
The starter plan stops at three projects. Screenshot: Sulat
Devin CLI summary of per-plan limits: twelve tests passing across starter, business and enterprise
Every plan limit is tested, and the suite is green. Screenshot: Sulat

The four runs side by side

JobLevelTimeTests passing at the end
Tenant invoicingLowAbout 2.5 minutes10
Dashboard cache leakMediumAbout 5.5 minutes5
Queued remindersMediumAbout 8.5 minutes12
Plan limitsMediumAbout 5.5 minutes12
Time runs from pressing enter on the prompt to Devin’s final summary. The invoicing and cache runs started from the original app, so they have fewer tests than the later ones.

What stood out is how little steering any of it needed. Each run read the repo’s rules, planned its steps in a checklist, wrote tests before and after changing code, and kept going until the suite was green. It picked the right tool for the stack each time: Pest conventions, tenant-aware queue handling, policies for roles. On an enterprise codebase, that’s what counts. It respected the tenant boundary in every job, tested the risky paths and finished with the suite green.

Where SWE-2.1 sits in Devin

Cognition trained SWE-2.1 with reinforcement learning on top of Kimi K3, and it’s the model behind Devin CLI, Devin Desktop and Devin in the cloud. On Cognition’s own numbers it scores 41.3 on FrontierCode 2.0, up from 24.1 for SWE-2, and 50.0 on Terminal-Bench 4.1, up from 24.2. The full benchmark table is in my launch write-up and in Cognition’s post.

In the CLI, pick it with /model or start Devin with --model swe-2-1. It comes in five reasoning levels from Low to Max, and all five show as free in the CLI’s model list. The faster Lightning versions are priced per token. I used Low and Medium here, and plain swe-2-1 gives you Medium.

Infographic: SWE-2.1 free in Devin CLI and Desktop until 8 December, then discounted until 30 January
Free on Devin CLI and Desktop until 8 December. Illustration: Sulat

Cognition’s launch post says SWE-2.1 is free through 8 December on Desktop and the CLI, then available in Desktop, Cloud and the CLI at a discounted price until 30 January. Plans and prices are on Devin’s pricing page. If you’ve got a Laravel app and a few days left, this is a cheap way to find out what an agent does with your own codebase. It also sits alongside Devin’s Laravel migration credits.

Sources

Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador.