Product
Platform Agentic Code Scanner Unified Runner Tomosu Agents Indexes Solutions
Get Started
Scan your repo VS Code plugin Tomosu MCP GitHub App CodeRabbit FAQ
Resources
Case Studies Governance Impact TCO Calculator Download / Free Trial
Pricing
Plans and pricing
Company
About Blog News Contact Request Demo → Try Free Log in GitHub
Learn · Reliability

The bug your load test finds at 3,000 users was readable in the code

··9 min read·

Two open-source projects, one 3-line cleanup bug, one 8-year-old memory leak, and what happens when you scan before users do.

Most reliability bugs are not exotic. They are ordinary code that works on a laptop and fails politely at scale. The usual way to find them is to ship, wait, get paged, and write a postmortem. Tomosu is built around a different loop: scan the code (and every PR) for the missing reliability rule before anyone is on call.

That is a claim, so here is the evidence. Tomosu published two case studies where they rewound open-source repos to the code as it stood before the fix, handed Tomosu a single file with no bug report, and checked whether it named the real defect.

3 linesof cleanup code behind the ContextForge outage
8+ yearsCelery leak, report to merged fix
1 filescanned blind in each case
2 / 2named the same invariant as the real fix
Quick answer

Both bugs were readable in the source long before production exposed them. In two blind scans, with the bug report and the fix withheld, Tomosu named the real defect from a single pre-fix file.

Case 1: IBM ContextForge and the finally that was not

ContextForge is an open-source AI gateway for MCP, A2A, REST and gRPC. Every request opens a database session from a finite PostgreSQL pool. In a January 2026 load test with 3,000 concurrent users, between 42 and 81 connections sat “idle in transaction”, each held for up to 120 seconds, until the pool ran dry.

HOW THREE LINES BECOME POOL EXHAUSTION 3,000 users arrive at once Each takes a DB connection commit() fails, close() skipped 42–81 stuck up to 120 s each Pool dry latency, errors Every step is ordinary. The amplification is not.
Fig 1. How three lines become pool exhaustion.

The bug, in mcpgateway/middleware/token_scoping.py:

mcpgateway/middleware/token_scoping.pybefore · issue #1885
# before (issue #1885)
finally:
    db.commit()   # can raise
    db.close()    # never reached if commit raises
mcpgateway/middleware/token_scoping.pyafter · PR #1886
# after (PR #1886)
finally:
    try:
        db.commit()
    finally:
        db.close()   # always runs

Reads like a punchline: a finally block that is not guaranteed to finish. It is not a stupid mistake either; the intent is obviously right and a reviewer skimming the diff would nod it through. After the fix, under the same load, stuck connections went to zero.

Same 3,000-user load, before and after PR #1886 Stuck connections (peak) 81 0 after fix Time a connection is held up to 120 s 1–2 s after fix Source: Tomosu ContextForge case study. Peak bar uses the top of the reported 42–81 range; time bars drawn to scale (120 s vs ~2 s).
Fig 2. Before and after. Source: Tomosu ContextForge case study. The peak bar uses the top of the reported 42–81 range.

The blind scan

Tomosu checked out commit cf5adcd5d, gave the scanner that one 755-line file, and nothing else. Result: PRI 27/100, Critical, with a finding describing an unsafe session lifecycle where an operation before close() can fail and leave the connection unreleased. The rule underneath, in Tomosu’s words: if you acquire a finite production resource, its release must survive every relevant failure path. Read the full ContextForge case study.

Case 2: the Celery leak that took eight years

In June 2018 a user reported that Celery’s event monitor “unboundedly leaks memory” (issue #4832). The culprit was a plain dict, State._tasks_to_resolve, which remembers child tasks whose parents were never seen. Nothing ever removed those entries. The fix, merged August 31, 2026 (PR #10534), was one line: swap the dict for an LRUCache(max_tasks_in_memory).

USER-FOUND, USER-REPORTED, USER-WAITED Jun 2018 user reports leak issue #4832 2019 – 2025 issue stays open Aug 2026 PR #10534 merged one-line fix 8+ years from report to fix
Fig 3. User-found, user-reported, user-waited.

Blind scan of the pre-fix file (730 lines, one file): PRI 30/100, Critical, 7 findings. Finding #7 said events referencing never-seen parents “can accumulate indefinitely” and recommended bounding the index with max_tasks_in_memory. Mechanism, consequence and invariant, all named. Same idea as the eventual fix, different implementation. Read the full Celery case study.

The reusable lesson fits on a sticky note. For every long-lived collection ask: what inserts, what removes, is the removal guaranteed on failure, and what is the hard bound? If the last two answers are “no” and “none”, production owns the risk.

Blind-scan Production Reliability Index (0–100) IBM ContextForge 27 Celery 30 0 100 Both rated Critical by Tomosu. Higher is better; each score is for a single file, not the whole repository.
Fig 4. Both single files scored Critical. Higher is better; each score is for a single file, not the whole repository.

What it looks like inside one repo: five days

Tomosu’s own walkthrough follows a single repo through its first week. Numbers are from their published demo.

PRI across five days in one repo 100 75 50 25 22 82 63 80 Day 1 After fixes Day 4 Day 5 first scan, 97 findings 97/97 accepted (+60) +842% traffic (−19) PR #21 fix, one file
Fig 5. 302 files scanned in 1m 41s. Day 4 production: 48,736 req/min, 68.3% retry rate.

The honest takeaway is the dip. Clearing every finding got the repo to 82, and production traffic still knocked it to 63. A scan finds what the code says; production finds what the traffic does. Tomosu’s pitch is that the same system reads both, and the Day 5 fix landed as a one-file PR.

A scan finds (in the code)
  • Cleanup that can be skipped
  • State with no bound
  • Missing retries, timeouts
  • Weak failure paths

Cost: a PR comment

Production finds (in the traffic)
  • Pool exhaustion at 3,000 users
  • Retry storms (68.3% retries)
  • Drift after a traffic spike
  • Slow leaks, found years later

Cost: an incident

Fig 6. Same bugs, different price tag.

Try it on your own repo

Repo scantomosu.ai/start, read-only PRI report, about 5 minutes.
VS Code extensionFree edition, also works in Cursor, about 2 minutes.
GitHub AppA PRI delta comment on each PR, about 3 minutes.

Suggested first experiment: scan one service you already know is fragile and see whether the top finding matches your scar tissue. If it does, that is your use case. If it does not, you have lost five minutes.

What to take with a grain of salt

Scan a repo free → Read the case studies →

Free, no card. The scan is read-only and returns a PRI with findings by category.

Parsa Mohammadi, Technical Marketing Lead at Tomosu AI
About the author

Parsa Mohammadi

Technical Marketing Lead at Tomosu AI

Parsa writes about production reliability, pre-merge risk, and how engineering teams govern AI-generated code. He works with the founding team at Tomosu AI on what the platform measures and how teams put it to use.

Connect on LinkedIn →

A load test tells you the system broke at 3,000 users. A reliability scan tells you which three lines were going to break it. Scan a repo free →

Request Demo →