DEV Community

Cover image for AI Software Development Cut Our Sprint Time 30%. It Also Added New Bugs
Elsie Rainee for WPWeb Infotech

Posted on Edited on

AI Software Development Cut Our Sprint Time 30%. It Also Added New Bugs

A few weeks after we gave the whole team AI coding assistants, sprint planning looked great. Tickets that used to take days were closing faster, and velocity was up roughly 30%. I may have said "this is working" out loud in a standup.

Then I looked at the bug tracker. The number of bugs hadn't increased, but the bugs had. They were much harder to spot in review; they were hiding longer, and a couple actually made it into production because the code behind them was quite good.

If you're looking at AI software development services or indeed the option of building it in-house yourself, this is the bit that the pitch decks invariably omit: the speedup is very real, and the bill that comes afterward is very real too.

Where the speedup came from

The wins were all in the realm of work that had a known shape: CRUD endpoints, test scaffolding, simple schema migrations, refactors with good coverage and documentation. A correct answer to each of those already exists in the code the model has seen and can be checked very quickly. The assistant saved a massive amount of time on typing and context switching, which is something developers spend a huge amount of time on.

We saw almost no gain on anything that depended on our own domain rules, such as pricing logic, permission edge cases, or any problem whose right answer lives in someone's head or a three-year-old Slack thread.

Where the saved time went

The 30% was real at the ticket level, but time doesn't disappear; it just gets shifted. Reviews took longer because the diffs were getting bigger, and the person reviewing often didn't know the code very well. A bug that had slipped through review would show up in QA a sprint later under a different ticket. Debugging code you didn't write line by line is of course a lot slower than debugging code you did.

That is why our velocity chart misled us. The sprint that introduced a problem got credit for the speed, and the sprint that fixed it took the blame.

What the new bugs looked like

Human bugs look like human bugs: a typo, a forgotten null check, a copy-paste slip. You learn to spot them. AI-assisted code failed differently.

Plausible code that fails quietly

The most common problem was error handling that looks careful and hides failure. Here is a simplified example of the pattern:

async function getUserCredits(userId: string): Promise<number> {
  try {
    const res = await api.get(`/credits/${userId}`);
    return res.data.credits;
  } catch {
    return 0;
  }
}
Enter fullscreen mode Exit fullscreen mode

It reads as defensive. When the credits service has a bad five minutes, though, every user appears to have zero credits and everything downstream treats them as such. The function turns an outage into wrong data, and the logs are completely silent on the matter.

The fix is boring: let the error propagate, or return a result type that separates "zero credits" from "couldn't find out."

Confident use of APIs that don't quite work that way

We also hit calls to real libraries which were built on slightly incorrect assumptions (a parameter that only exists in the newer version of the library,ry for instance). The default had changed; a method did something somewhat different from what you'd expect from its name. The code compiled and the happy path passed. It would fail on certain inputs.

Missing edge cases

Generated code invariably dealt with the case in the prompt and nothing else. We saw pagination that would only retrieve page one, date logic that completely ignored time zones, and a retry loop with no upper bound. An experienced developer would have those checks in there as scar tissue. A model will only add those checks if the prompt or surrounding code already indicates they're required.

Why review got harder

I thought clean-looking code would be easier to review. It wasn't. Messy human code sends all sorts of signals: odd naming, a comment half written, a function that's just too long to be sensible. Those are the things that tell you where to slow down. AI code is uniformly clean, looks like it's complete, and we just went with that. We approved the diffs much quicker at the very point where we should have been reading them more slowly.

Reviewers use style as a proxy for care. When style stops carrying information, you have to review intent and behavior directly.

What we changed

We kept the tools and changed the rules around them.

  1. Every pull request includes a short note on what the change should do, what it assumes, and what failure looks like. If the author can't write it, the code isn't ready, however good it looks.
  2. For anything touching business rules, a person writes the test cases before the implementation is generated. The assistant fills in code against a spec instead of writing both the answer and the exam.
  3. We capped how much generated code goes into one pull request, because review attention collapses on large AI-written diffs.
  4. Authentication, payments, data migrations, and anything irreversible stay hand-written or get a second dedicated reviewer.
  5. We tag AI-assisted changes so we can see which kinds of work produce which defects. Tagging can create stigma, so we look at the data by team, never by person.

Did the 30% hold up?

Not at that number. The 30% was a sprint-planning figure that counted the work as done before the rework. With the bug fix and review time reinstated, the net gain is considerably less. I can't give you a clean % as the cost was spread across several sprints and our tracking wasn't good enough to attribute it. The gain was still positive, and it increased once we added the rules above.

What I'd tell a team starting out

Measure bugs and review time from day one rather than just ticket throughput (otherwise you'll be celebrating the wrong number). Start with low-ambiguity work and gradually increase the ambiguity as your review habits settle. Treat the generated code as a draft from a very fast, very confident junior developer who has never seen your codebase.

If setting up these rules is more than your team can absorb, a short AI consulting engagement to audit your workflow and review process can cost less than learning the same lessons from production incidents.

Where we are now

Writing code got faster. Knowing whether the code is right hasn't gotten faster, and that is now the bottleneck, so we spend as much effort on review, tests, and clear specs as we do on the assistant. If your team has rolled these tools out, what did your bug patterns look like afterward?

FAQs

Does AI-assisted coding really make development faster?

Yes,s for the very clear-cut, low ambiguity stuff (boilerplate, CRUD endpoints, test scaffolding, simple refactors). Some of the time saved filters into code review, QA, and debugging, so the net gain is typically less than the ticket-level figures would indicate.

What kinds of bugs does AI-generated code introduce most often?

The most common patterns we saw were error handling that simply hides the failure, library calls that are based on incorrect assumptions about what the library will do, and then, of course, the missing edge cases (pagination, time zones, unbounded retries, etc.).

Why is AI-generated code harder to review?

It's properly formatted and sensibly named, so it looks complete. Reviewers tend to interpret messy style as a signal to slow down, and that signal simply isn't there. Reviewing intent and behavior directly resolves most of it.

Which tasks should stay human-written?

Auth, payments, data migrations, and anything else that's hard to reverse. A small mistake in any of those areas is the most expensive to fix, so those areas should be hand-coded or have an additional reviewer.

How do I know if AI tools are helping my team?

Track more than just ticket throughput (i.e., velocity) and look at defect rates, review time per PR, and rework in later sprints. If velocity goes up while those three metrics go down, then the increase in velocity is being borrowed from the future.

Top comments (12)

Collapse
 
dosaygo profile image
dosaygo •

How does your team check that an agent follows the written failure semantics, especially distinguishing a real zero from an unavailable credits service?

Collapse
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

Good question, and it's the exact failure the getUserCredits example was meant to show. Honestly, we don't trust the agent to follow written semantics on its own. We check it in three places.

1. The PR note makes the author state failure behavior: Every PR has to say what "failure" looks like for the change. For something like credits, the note has to say what happens when the service is down and what the caller sees. If the author can't answer that, the diff isn't ready, however clean it looks.

2. Humans write the failure tests first: For business-rule code, a person writes the cases before the implementation is generated. For this case that means two separate tests:

  • The service returns a real 0, so the caller gets a zero balance
  • The service times out or returns a 5xx, so the caller gets an explicit error or "unknown" result, never a number

The assistant has to write code that passes both. A catch-all that returns 0 fails the second test immediately.

3. The types make the distinction hard to skip: We lean on a result type (something like { ok: true, credits } | { ok: false, reason }) instead of a bare number. The caller can't use the value without handling the unavailable branch, so a silent fallback becomes a compile error rather than something a reviewer has to notice.

We also look for the pattern in review. A bare catch that returns a default value gets flagged on sight, especially in anything touching payments or balances, which we keep hand-written or give a second reviewer.

The gap is that this only covers the failure modes we thought to write down. Partial failures, like a stale cache or a degraded response that returns a plausible but wrong number, are harder, and I wouldn't claim we've fully solved them. How do you handle that on your side?

Collapse
 
dosaygo profile image
dosaygo •

Your three checks all work on failures that announce themselves: a timeout, a 5xx, a thrown error. A stale cache never announces itself, so no catch rule, no error-path test and no result type sees it. The type says ok: true and the number is wrong.

Put the age in the value. A balance comes back as { credits, asOf, source }, never a bare number inside the ok branch, and the code that spends credits states how old a reading it accepts. A cached 40 from six minutes ago is then a different value from a live 40, and a caller that ignores asOf fails to compile for the same reason your unavailable branch does. Degraded responses get stopped where they enter: validate shape and range at the boundary and turn anything that fails into ok: false right there, before a plausible number starts travelling.

A fresh, well-formed, wrong number from upstream stays unsolved. Types and tests do not catch it. Reconciling against the ledger does, after the fact.

The rules you enforce by hand in review are the part an agent can be given up front. AI Lint is doctrine and reject lists the coding agent reads before it writes, and its JavaScript doctrine opens with your case: empty catch and silent defaults are rejected. Your reviewers then see fewer catch-alls that return 0. Company licence: ai-lint.dosaygo.com/go/forum-20261...

Thread Thread
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

You're right, and that's a sharper distinction than the one I drew. All three of my checks only catch failures that announce themselves. A stale cache returns ok: true with a wrong number, and nothing on my list sees it.

Putting asOf and source inside the value is the part I'm taking. It turns "how fresh is this?" into something the spending code has to answer at compile time, instead of something a reviewer has to remember to ask. Validating shape and range at the boundary and converting failures to ok: false right there also makes sense, since it stops a plausible-but-wrong number before it starts travelling.

Agreed that a fresh, well-formed, wrong number from upstream isn't solved by types or tests. Ledger reconciliation after the fact is the only thing that catches it, and for balances I'd treat it as required, not optional.

On giving the agent the rules up front: fair point. Our reject list currently lives in review rather than in the agent's context. I haven't used AI Lint, so I can't speak to it, but I'd start by writing our own rules into the agent's instructions and see how many catch-all-returns-0 cases that removes.

Thread Thread
 
dosaygo profile image
dosaygo •

Start with three rules, not your whole review list. An agent holds on to a short reject list and skims a long one.

Write each as the pattern, why you bounce it, and what to write instead, and lift the example from a PR you actually sent back. "Don't swallow errors" changes nothing. Your own catch block returning 0 with "reject: return ok: false with the cause" next to it does.

Count before you change anything. Two weeks of catch-all flags in review as the baseline, two weeks with the rules in the agent's instructions after. Expect the count to fall and not reach zero: instructions lose their grip late in a long session, and that is where the survivors will come from. The review flag stays.

Thread Thread
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

Three rules is a good limit. My instinct was to dump the whole review list into the agent's instructions, and I'd probably have ended up with something it skims.

I'll start with the failures we flag most often in review:

  • A bare catch that returns a default value
  • A service result used as a bare number, with no ok check
  • Cached or degraded data passed on without asOf or source

For each one I'll write the pattern, why we bounce it, and what to write instead. I'll take the examples from PRs we actually sent back, so the catch block returning 0 sits right next to "reject: return ok: false with the cause."

Counting first also makes sense. Without a baseline I'd have no way to tell whether the rules did anything or I just got a quieter two weeks. I'll tally catch-all flags in review for two weeks, then add the rules and count again.

I won't expect zero, and I'll keep the review flag. If the survivors cluster late in long sessions, that tells me the instructions aren't enough on their own and the check has to stay at the PR.

I'll report back with the numbers if I get through both windows.

Thread Thread
 
dosaygo profile image
dosaygo •

Two of your three don't belong in the instructions for long.

"Service result used as a bare number" and "cached data with no asOf or source" are type problems. Once the service returns { ok, value, asOf, source } and nothing else, the bare number stops type-checking and there is nothing left for the agent to remember. Write the rule now, and treat every time it fires as a vote for changing the return type.

The bare catch is the one that stays a rule, because a catch that returns 0 is legal code everywhere.

On the count: tally per PR, not per fortnight. Two weeks with half the PRs will look like the rules worked. And mark each flag as agent-written or hand-written when you log it, since the rules can only move the first kind.

Thread Thread
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

That's a useful split. I was treating all three as the same kind of rule, and they aren't. A bare catch returning 0 compiles everywhere, so only a rule or a reviewer will stop it. The other two are things the compiler can enforce once the return type changes.

So the plan changes. The bare-catch rule goes into the agent's instructions as a real rule. The other two I'll write for now, but each time one fires in review I'll log it as a case for changing the service's return type to { ok, value, asOf, source }. Once that's in place, the rules can come out of the instructions, because the bare number won't type-check anymore.

The counting point is a better one than mine. Per fortnight, a quiet stretch with fewer or smaller PRs would look like the rules working. I'll log per PR instead, as flags per PR, and mark each flag as agent-written or hand-written. The rules can only change the agent-written ones, so mixing the two would blur the result.

Collapse
 
mayur-upadhyay profile image
Mayur Upadhyay •

The point about velocity charts crediting the sprint that introduced the problem and blaming the one that fixed it is the part most teams miss. The speedup is easy to measure. The cost shows up a sprint later under a different ticket, so nobody connects the two.

To answer your question about bug patterns, the one I've hit most is the swallowed error, like your getUserCredits example. A catch that returns a default value looks tidy in review, then hides an outage until someone asks why every number is zero. I now check every new catch block in a generated diff before I read anything else.

The "clean code makes review faster when it should make it slower" point also matches my experience. Messy human code makes me slow down, and polished generated code doesn't. Writing the test cases for business rules before generating anything has worked best for me, because it forces me to decide what correct means first.

Did tagging AI-assisted PRs show you which kinds of changes produced the most defects, or was the sample too small to tell?

Collapse
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

Checking every new catch block before reading anything else is a habit I'm going to steal. The swallowed error is also the one that did the most damage for us, because it turns an outage into plausible data instead of an error.

Writing the business-rule tests first is the change that made the biggest difference for us too. If you have to define "correct" before the model generates anything, you can't let it grade its own work.

To answer your question: honestly, it was directional at best. Tagging gave us a rough sense that changes touching domain rules and error handling produced more rework than boilerplate or test scaffolding. But the sample was small and our tracking wasn't clean enough to put real numbers on it, so I wouldn't claim more than that. It's also why I didn't give a precise net figure in the post. If I were starting again, I'd tag from day one and record the defect category at triage, not reconstruct it later.

Has your catch-block check been catching things consistently, or does it mostly flag the same few patterns?

Collapse
 
the_daily_flare profile image
The daily flare •

The getUserCredits example stayed with me because a catch that returns 0 makes every user look broke during a bad five minutes.

Collapse
 
elsie-rainee profile image
Elsie Rainee WPWeb Infotech •

Exactly. The worst part is that 0 is a valid answer, so nothing downstream can tell "this user has no credits" from "we couldn't find out." Support tickets said "my credits vanished" while the service was fine and the cache was fine. For five minutes the app was just confidently wrong. We now return an explicit unknown state and show a "can't load credits right now" message instead of a number.