---
id: 18866
lang: en
title: "The AI bot reported success, but search missed 6 out of 6: 27 defects across 8 projects"
published_at: "2026-12-01 20:25:45"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1114734/?utm_campaign=1114734&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18866"
categories: ["llm", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# The AI bot reported success, but search missed 6 out of 6: 27 defects across 8 projects

> **Краткая суть (BLUF):** A legal bot built on RAG (it answers from a database of laws) reported "upload completed successfully," but on six control questions it never returned the correct article among the top five results: hit@5 was 0 out of 6. The author accepted eight projects assembled by AI agents and logged 27 defects, two of them critical. The tests were nearly all green, which is why AI-written code should be judged by how the system behaves, not by the agent's report.  • The index held only 1,266 unique vectors for 4,937 records • Of the 27 defects, 21 were found by hand and 6 by automation • After fixes, search hits the target 6 out of 6, and the test count rose to 141

Imagine this: a reindexing script prints "UPLOAD COMPLETED SUCCESSFULLY," 4,937 text chunks have landed in the database, the README promises a working RAG (a bot that answers from the documents you load), and the answers look real: with links, article numbers, and a tidy template of "answer — quoted norm — advice." But for six control questions, the correct article appears in none of the results. The hit@5 metric here simply means: did the correct document make it into the top five retrieved results? The result was 0 out of 6. This case is one of 27 defects the author logged while accepting eight projects assembled by AI agents.

## What broke in the legal bot

For the question "what is a gift (donation)?", the bot returned articles 1455, 1305, 1280, 449.1, and 1270. For a question about the statute of limitations, it returned 1280, 709, 860.13, 862, and 860.8. Article 1280 appeared in all four answers that were checked, and in one of them it came up twice. The correct articles, 572, 196, 620, and 807, never appeared at all.

The cause was in the index. Of 4,937 records, only 1,266 were unique vectors: 3,671 records duplicated other records' vectors. For articles 52, 84, 123.16, and 123.18, the cosine similarity between the stored vectors was exactly 1.000000, meaning different texts were stored as the same thing. The Chroma vector database does not verify a vector against its text and does not throw an error: it honestly returns the nearest match among what it has.

The stack is standard: aiogram, Chroma, gpt-4o-mini for answers, and text-embedding-3-small for embeddings. The breakage was in the data, not the model.

The tests did not catch it. In the submitted commit, there was not a single test file: 46 tests existed in the working copy, and a .gitignore rule was hiding them. The pytest command on the submitted version collected 0 tests, even though the README promised three commands.

## What acceptance review found, and how

The review ran from October 30 to November 28, 2026, using a 40-item checklist and 13 reference questions drawn from the document corpus. The review produced 27 cards: 2 at level P0 (not working or dangerous), 11 at level P1 (working incorrectly), and 14 at level P2 (getting in the way, but not lying). Humans found 21 of them and automation found six. But half of those six came from checks the author had written personally during the review: two projects had no tests at all.

Of the defects, 22 were fixed and re-verified, three remain open, and two were closed partially. Reference answers rose from 7 to 13 out of 13, hit@5 went from 0 to 6 out of 6, and tests went from 46 passed / 1 failed to 141 / 0. Search was repaired in three steps: reindexing restored the match between vectors and texts, the route stopped crashing on an empty None value, and the validator stopped rejecting legal questions. Of the 40 checklist items, 37 pass.

There are also honest caveats. The full acceptance cycle was completed only for the legal bot. The other projects were checked to the extent possible: the order agent was run against a mock provider without a live model, and the market monitor had no tests at all, even though the README listed three pytest commands. The 6 out of 6 figure refers to six questions with a single correct document, not an evaluation of search on a real query stream. In addition, the reference set checked whether the correct article was named, not whether the consultation was complete: on the statute of limitations, the bot cited paragraph 1 of article 196 of the Civil Code of the Russian Federation, but did not mention paragraph 2 of article 196 or article 197.

## What to do when accepting AI-written code

External data cited by the author points the same way: according to Veracode, 45% of AI-generated code contained a vulnerability; according to METR, experienced developers using AI worked 19% slower, even though they expected a 24% speedup; and in a Stanford RegLab study, legal RAG products hallucinated 17–33% of the time. These numbers cannot be stacked into a single proof, but as base rates they show that defects are common and that getting a system to production is hard.

Practical rules:

- Accept work based on how the system behaves, not on the agent's report: the evidence is a command that reproduces the same number when you run it again.
- For RAG, add a check that each stored vector matches one recomputed from its text, plus a small set of questions with an unambiguous correct document.
- Make sure the tests are in the repository, not hidden under .gitignore.
- For each reference question, define a list of required points the answer must cover; otherwise completeness cannot be measured.
- Distinguish "37 of 40 passed" from "everything is fine": these are different claims.

The acceptance log, with cards, runs, and raw answers, is open on GitHub, so the methodology can be repeated on your own projects.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1114734/?utm_campaign=1114734&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18866
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
