← Back to Blog

How I Built AI Bug Analyzer — From Test Failure to JIRA Bug in 60 Seconds

Every engineering team knows the ritual. A regression suite goes red on the QA pipeline, and someone has to stop what they’re doing, open the Jenkins build log, read through a wall of stack traces, cross-reference it against the source code, figure out whether it’s a real bug or a flaky test, and then hand-craft a JIRA ticket with all the right fields.

It takes 15–30 minutes per failure. On a bad build with five or ten reds, it swallows an entire morning — and the bugs that come out are often vaguely worded, misclassified, or missing the one detail that would actually help the developer fixing them.

So I built something to make that ritual disappear.

“60 seconds from failure to filed bug. 30× faster than manual triage. 108 hours saved per project per year.”

What AI Bug Analyzer Does

AI Bug Analyzer plugs into a Jenkins pipeline as a postStage hook. When an integration or regression stage fails, it springs into action — completely in the background, and without ever affecting the build result. Within about a minute it has:

  1. Collected the failures — pulls every failing test from the Jenkins Test Report API (JUnit / pytest results).
  2. Found the relevant source code — parses stack traces across Python, Java, JS/TS and Robot Framework, extracts keywords, and fetches the real application & test files from Bitbucket.
  3. Asked Claude to reason about it — sends the failure plus code context to Claude Opus 4.6 on Azure AI Foundry with a prompt that understands the bug-filing playbook.
  4. Got a precise diagnosis — root cause pinpointed to file:line, a suggested before/after code fix, severity, priority and a confidence score.
  5. Filed the JIRA bug — creates a fully-structured ticket with every required field — or, if a matching bug already exists, comments on it instead of creating a duplicate.

The result: instead of “investigate the failing test,” the developer opens a ticket that already says exactly which line is wrong and what the fix looks like.

The Hard Part: Giving the AI the Right Context

An LLM is only as good as the context it gets. Handing Claude a raw stack trace produces a generic guess. The real engineering challenge was building a smart code-fetching pipeline that finds the handful of files that actually matter — out of a repository with thousands.

The system uses a tiered discovery strategy and a strict token budget so it never overwhelms the model (or the bill):

Each tier gets its own character budget (roughly 60,000 characters total — about 12% of the 200K context window), with application code always prioritised over test code. That single design choice is what pushes the analysis from a “medium confidence” pattern-guess to a “high confidence” answer with real code evidence.

How It’s Built

The tech stack is deliberately lean:

Key Design Decisions

Onboarding a Project Takes One Line

Because the whole thing is driven by an external manifest, adding it to any Jenkins project is a single entry:

# manifest.yaml — postStage section
postStage:
  integrationTest:
    - userScript:
        name: ai_bug_analysis
        externalRepoUrl: https://.../ai-bug-analyzer.git

The Impact

Numbers tell the story best. Here’s the before-and-after for a single failing test:

At a typical rate of five failures a week, a single project loses about 108 hours a year to manual bug filing. Across ten projects that’s over a thousand engineering hours — roughly $100K+ of time — handed back to the people who should be building, not triaging.

What I Took Away from Building It

The interesting lesson wasn’t the model — it was the plumbing around it. A capable LLM like Claude Opus 4.6 will happily reason its way to the exact broken line if you do the unglamorous work of feeding it the right code, keeping secrets out, and structuring the output so a human (and JIRA) can trust it.

The AI is the easy 20%; the context engineering, security, and CI/CD integration are the 80% that make it production-ready.

“60 seconds, not 30 minutes. file:line, not ‘investigate further’. 100% compliant, not ‘mostly there’.”