Key takeaways
- ✓A search index can be wrong while the model is fine, and the system can look at it three ways without knowing the right answers: freshness (each article's fingerprint vs. the index's copy), probe searches (questions written from the index's own paragraphs: does each find its paragraph?), and symptoms (how often the assistant says “I don't know”). Each one is blind to something.
- ✓On each problem's first day: freshness caught the two new articles and the revised one, exactly, and nothing else. Probe searches caught the corrupted vectors (69% found, against 100% healthy) and a settings change (93%), not missing articles. The “I don't know” alarm fired on none: with fewer than 30 answers a day, 12 of 28 against about 7 normal happens by chance about 1 day in 40, and the alarm waits for 1 in 100.
- ✓The revised article had no symptom at all. The stale index answered from the old text (“thousands of high-quality labeled examples”, where the article now says a few hundred), cited and confident: 13 wrong answers while stale, against 5 with the new text. Only freshness saw it.
- ✓Four repair policies, replayed hour by hour: doing nothing never heals (+41 bad answers from the new articles alone); a nightly rebuild fixed what a rebuild can fix 14 to 18 hours late; rebuilding on symptoms was only as fast as its alarm (the revision after 74 hours, by luck). Diagnosing first fixed each of the three index problems within the hour with no extra bad answers.
- ✓Two problems weren't the index. A settings change (search returning 1 passage instead of 3) and a topic no article covers (MCP) can't be fixed by a rebuild: the nightly policy rebuilt 12 times for nothing. Diagnose-first called the on-call engineer within the hour, and the docs team daily from day 37, with the learners' own questions.
- ✓A repair is a deploy. A rebuild broken on purpose (3 in 10 vectors wrong) found 68% on the probes, against 99% for a correct one. Swapped in unchecked, it served worse answers for 6 hours (+6 bad answers); checked on the probes first, it was rejected at once, the old index stayed, and a person was called (+0).
Our course assistant answers learners' questions from short articles, and its search index can now repair itself. In a test week, two new articles came out and the system noticed within the hour and rebuilt the index on its own. But in another run, the rebuild was broken on purpose, and the broken index went straight into service for six hours. This chapter shows how a system can watch its own search index without knowing the right answers, what it should repair on its own, when it should call a person instead, and the one check that would have stopped the broken repair.
The source is Lab 18 (Autonomous Systems), script 04_self_repair.py with its repair.py and corpus.py, recorded in October 2026. The video replays the lab's recorded run from its caches, no new calls, and its numbers match the lab's result files. The course site, Quill Academy (the same assistant as the observability chapters 40–43), is made up; the six weeks of learner messages are simulated; the five problems and the broken rebuild were planted on purpose; every answer is a real recorded model call. When a person is called, the replay assumes they fix it 2 hours later. This is the fourth of five chapters on self-improving systems: chapter 59 watched a test suite for quality drops; this one watches the search index.
The search index, and five problems
The assistant works in two steps: it searches the articles for the best three passages, then a model writes an answer from them. The search uses an index: every paragraph stored as a list of numbers, a vector, where paragraphs that mean similar things get similar numbers. Think of it as a library's catalog. When the catalog is wrong, the answers go wrong, even if the model is fine (chapters 9–12 build this kind of RAG system).
To test a self-repairing index, the lab replays six weeks of learner messages, and plants five problems:
| Problem | What happened |
|---|---|
| New articles | Two articles published on day 21; the index doesn't have them |
| A revision | The fine-tuning article revised on day 28; the index keeps the old text |
| Corrupted vectors | A bad update overwrote 3 in 10 stored vectors with other paragraphs' vectors |
| A settings change | Search returns 1 passage instead of 3 (k = 1) |
| A content gap | From day 30, learners ask about MCP, a tool standard no article covers |
Three ways to look, without the right answers
The system can't grade every answer: it doesn't know the right ones. It has three ways to look anyway:
- Freshness: compare fingerprints. Like checking the catalog against the shelf. Each published article gets a fingerprint, a short code computed from its text (here the first 16 characters of its SHA-256 hash); change one word and the code changes. The system compares each article's code with the index's copy. It's the same idea as the page fingerprints in chapter 52.
- Probe searches: does it find its own text? For every paragraph in the index, a model (
gpt-5.4-mini) writes two questions that paragraph answers: 56 test searches on the original index, 72 after the new articles. On a healthy index, each search finds its own paragraph. The share that do is the probe recall. - Symptoms: more “I don't know”? Normally about one answer in four (24%, weeks 1–3) is “I don't know”, mostly to questions the articles don't answer. An alarm fires when the last 24 hours' share is clearly higher.
Pick a problem and see what each one saw on its first day:
The fine-tuning article was revised on day 28; the index kept the old text.
Freshness
sees itfine_tuning: index 57135ac8e9f7, published d86e27a1c2d5. Different, so stale. The other 6 match.
Probe searches
looks fineFound their own paragraph: 99% (healthy: 100%).
Within 5 points of normal.
Symptoms
no alarmFirst 24 hours: 6 of 29 answers said “I don't know” (21%); about 7 would be normal.
Chance alone gives that many or more most days. The alarm waits for 1 in 100.
Bad = wrong, or “I don't know” to a question the articles answer. Of those, wrong: 13 broken vs. 5 healthy.
No symptom: a learner asks “fine tuning most valuable for”
Stale index: Fine-tuning is most valuable when you need the model to adopt a specific style or tone consistently, when you have thousands of high-quality labeled examples, or when the task requires domain vocabulary not well-represented in pre-training data. [fine_tuning]
New text: Fine-tuning is most valuable when you need the model to adopt a specific style or tone consistently. It’s also most valuable when you have a few hundred carefully checked examples (about 200–500 is usually enough) and when the task requires domain vocabulary not well represented in the model’s pre-training data. [fine_tuning]
Cited, confident, and wrong. “I don't know” stayed normal; only freshness saw it.
| Problem | Freshness | Probe recall | “I don't know”, first 24 h | Bad answers while broken | Healthy index, same questions |
|---|---|---|---|---|---|
| New articles | 2 new articles | 100% | 11 of 29 (38%) | 47 of 158 | 6 |
| A revision | fine_tuning changed |
99% | 6 of 29 (21%) | 21 of 188 (13 wrong) | 10 (5 wrong) |
| Corrupted vectors | all match | 69% | 12 of 28 (43%) | 16 of 73 | 3 |
| A settings change | all match | 93% | 10 of 23 (43%) | 6 of 49 | 2 |
| MCP | all match | 99% | 41 of 162, first week (25%) | 16 of 278 | 16 |
A bad answer is a wrong one, or “I don't know” to a question the articles do answer.
Each one is blind to something. Freshness caught the new articles and the revision, exactly, and nothing else. Probe searches caught the broken vectors and the settings change, and missed almost a third of their paragraphs on the corrupted index. But they found 100% while two articles were missing: the probes are written from the index's own text, so they can't miss what it never had.
Why no alarm went off
On the first day of every problem, the “I don't know” alarm stayed quiet. Not one.
Take the corrupted vectors' first day: 12 of 28 answers said “I don't know”. About 7 would be normal (28 × 24%), so that's more than usual. But with so few answers, chance alone gives 12 or more about 1 day in 40 (p = 0.023). The alarm waits for 1 in 100 (p < 0.01), so it doesn't go off for nothing. It stayed quiet.
That's the catch with a symptom alarm on a small site: fewer than 30 answers a day. In chapter 39, a search broken on purpose made the assistant say “I don't know” 51 times out of 56, an obvious jump. Here the problems were partial, and the counts were small. A looser bar would fire sooner, and more often for nothing (chapter 41 weighs exactly that).
The problem with no symptom
The revision was the worst kind of problem. The fine-tuning article changed two facts on day 28: a few hundred carefully checked examples are usually enough (it used to say thousands), and LoRA now goes on all the model's linear layers (it used to say the attention layers). A learner asked what fine-tuning is most valuable for:
| The answer | |
|---|---|
| Stale index | “…when you have thousands of high-quality labeled examples, or when the task requires domain vocabulary… [fine_tuning]” |
| What the article now says | “…when you have a few hundred carefully checked examples (with current base models, 200 to 500 good examples are usually enough…)” |
Cited, and confident. And nothing looked wrong: “I don't know” stayed normal (6 of 29), the search scores were ordinary. While the index was stale, it gave 13 wrong answers; with the new text, 5. Only freshness saw it, because it compares the text itself.
Four ways to repair
So what should the system do when something looks off? The lab replays each problem hour by hour under four policies:
- Do nothing. Never touches the index.
- Rebuild every night, at 3 a.m., whatever happened.
- Rebuild on symptoms: whenever the “I don't know” alarm fires (at most every 6 hours).
- Diagnose first: work out what kind of problem it is before fixing anything. Is the index stale? Rebuild what changed. Is search broken (probes more than 5 points below normal)? Rebuild, and if a rebuild can't restore it, call the on-call engineer. Fresh and healthy, but learners are getting “I don't know” about something new? Call the docs team. Every rebuild is checked before it's used (more on that below).
Two new articles published on day 21; the index doesn't have them. The replay runs 158 hours from when it started.
Do nothing · Never touches the index.
never fixed · +41 bad · 0 rebuilds
Rebuild every night · At 3 a.m., whatever happened.
fixed after 18 h · +4 bad · 6 rebuilds
Rebuild on symptoms · When the “I don't know” alarm fires (at most every 6 h).
fixed after 30 h · +9 bad · 3 rebuilds
Diagnose first · Stale: rebuild. Search broken: rebuild, check, or call on-call. Content gap: call the docs team.
fixed after 1 h · +0 bad · 1 rebuild
+N bad = extra bad answers compared with a healthy index on the same questions.
Extra bad answers compared with a healthy index on the same questions, and how long until it was fixed:
| Problem | Do nothing | Every night | On symptoms | Diagnose first |
|---|---|---|---|---|
| New articles | +41, never fixed | +4, after 18 h | +9, 30 h | +0, 1 h |
| A revision | +11, never | +1, 18 h | +2, 74 h (by luck) | +0, 1 h |
| Corrupted vectors | +13, never | +2, 14 h | +12, 31 h | +0, 1 h |
| A settings change | +4, never | +4, never (2 rebuilds) | +4, never | +1, 2 h (called on-call) |
| MCP | nobody told | nobody told (12 rebuilds) | nobody told | docs team called from day 37 |
- Doing nothing never heals. The new articles alone cost 41 extra bad answers.
- Every night fixes what a rebuild can fix, but 14 to 18 hours late: the problems start at 10 a.m., 11 a.m. or 2 p.m., and wait for 3 a.m.
- On symptoms is only as fast as its alarm. It fixed the revision only by luck: after 74 hours, the MCP questions set off the alarm, and that rebuild fixed the revision too. Against the corrupted vectors it was barely better than doing nothing (+12 against +13).
- Diagnose first fixed each of the three index problems within the hour, with no extra bad answers.
When to call a person
Two problems weren't the index at all, and a rebuild can't fix them.
The settings change. Probe recall dropped to 93%, and a rebuild keeps the same setting, so it wouldn't bring them back. The diagnose-first system didn't swap anything in. It called the on-call engineer within the hour: “probe recall 93% and a rebuild doesn't restore it”. In the replay, a person reverts the setting two hours later (an assumption): +1 bad answer. The nightly rebuild ran twice and never fixed it.
The MCP questions. There was nothing to repair: no article covers MCP, the index was fresh and its probes healthy. The nightly rebuild ran 12 times, for nothing. The diagnose-first system called the docs team instead, every day from day 37, with the learners' own questions: “hey how do i lock down an mcp server”. What found it wasn't the “I don't know” rate, which never alarmed, but a fourth check: once a day, group the week's “I don't know” questions that are unlike anything refused in weeks 1–3 and like each other. It found 21 MCP questions in week 6.
So: rebuilding, checking, and keeping the old index are safe to automate. Settings and missing content are a person's call; the system's job is to call them, with examples. Lab 17's registry has an "acts" column for exactly this decision (chapter 53).
Check the repair
Now, back to the broken repair from the start. In the new-articles problem, the lab makes the rebuild write 3 in 10 of its vectors wrong. It still picks up the new articles, and nothing errors.
The missing check comes before the swap: run the same kind of probe searches on the new index, before it serves anyone. A correct rebuild finds almost all of its paragraphs: 99% (71 of 72). This broken one found 68% (49 of 72). The rule: if the new index is more than 2 points below normal, reject it, keep the old one, and call a person.
One probe search, written by a model from the fine-tuning paragraph
“What is fine-tuning in machine learning?”
Healthy index: finds its paragraph ✓
Fine-tuning is the process of continuing to train a pre-trained model on a smaller, task-specific dataset. The base model has already learned general language patterns from massive pre-training corpora. Fine-tuning adapts those general representations toward a specific domain, style, or task without training from scratch.
Corrupted index: top result is about AI agents ✗
The ReAct pattern (Reasoning + Acting) is the most common agent architecture. The model is prompted to alternate between producing a thought (reasoning about the current state) and an action (calling a tool or producing a response). This explicit reasoning trace improves reliability on multi-step tasks and makes agent behaviour easier to debug.
Two new articles arrive, and the system rebuilds within the hour. But this rebuild is broken on purpose: it writes 3 in 10 of its vectors wrong. On the probe searches, a correct rebuild finds 99%; this one finds 68%.
Swapped straight in. For 6 hours it served learners worse answers and nobody was called; the system waits 6 hours between repairs. Then it called on-call, and the fix came 8 hours in.
| Swapped in unchecked | Checked first | |
|---|---|---|
| What happened | Served for 6 hours (the system waits 6 hours between repairs), then on-call was called | Rejected at once; the old index stayed; on-call called |
| Extra bad answers | +6 | +0 |
| Fixed | 8 hours in | 2 hours in (with the person's assumed fix) |
An automatic repair is a deploy. It replaces a production component, so it needs the same checks: test the new version before it serves anyone, and keep the old one ready.
Also in the lab
These details are from the lab's README and code, not the video:
- A second symptom. Besides “I don't know”, the lab watches the share of questions whose best passage matched poorly (below the 5th percentile of weeks 1–3). It ran 3–7% of answers on the problems' first days and didn't alarm either.
- Mistakes made while building the replay. The first version started every problem at midnight, so "rebuild nightly at 3 a.m." looked like a 4-hour fix; problems now start during the day. A failed rebuild retried every hour (168 rebuilds in a week); it now retries a day later. And the content gap was invisible to every 24-hour rate until the daily new-topic check was added.
- Calls at most once a day. The system calls each person (on-call or the docs team) at most once a day, so it doesn't flood them.
- Cost. The script costs about 15 cents the first time (the answers under the broken indexes, and the probe questions), then nothing: reruns use its caches.
What to do
- Watch three ways: fingerprints for freshness, probe searches for broken search, symptoms for what users feel. Each one is blind to something.
- Diagnose before fixing. Stale: rebuild what changed. Search broken: rebuild, if a rebuild can fix it. Otherwise, call the right person.
- Check every repair before it serves anyone, on the same probes, and keep the old index.
- Call a person for what a rebuild can't fix: a setting is the on-call engineer's, a content gap the docs team's. Send the evidence: the probe recall, the learners' questions.
- Rate-limit repairs: a failed rebuild retries a day later, and each person is called at most once a day.
- Don't trust a symptom alarm alone on a small site. With fewer than 30 answers a day, it stayed quiet on every problem's first day.
Caveats
- A made-up site, simulated learners. The articles, the messages and the five problems are the lab's; the answers are real recorded calls. A real index has more paragraphs, more traffic and messier problems.
- The person's fix time is assumed. The replay says a called engineer fixes a setting in 2 hours. At 3 a.m., maybe not.
- Small counts. 158, 188, 73, 49 and 278 answers per problem window; the extra-bad-answer counts are single replays, not averages.
- Probes test what the index holds. They miss articles it never had, and a paragraph that's wrong but findable. Content review is still a person's job.
- Planted problems are cleaner than real ones. Each started at one known hour, one at a time.
The checklist
- Fingerprint every article, and store the fingerprints the index was built from.
- Generate probe searches from the index's own paragraphs, and record the healthy probe recall.
- Alert on symptoms with a test that knows how few answers you have, not a fixed percentage.
- Write the diagnose steps down: what's rebuilt automatically, and who's called for what.
- Check every rebuild on the probes before the swap, and keep the old index to fall back on.
- Rate-limit repairs and calls.
- Add a check for new topics among the “I don't know” questions, and route them to whoever writes the content.
Practice: the checks behind a self-repairing index
Write the freshness comparison, the “I don't know” alarm, the check before the swap, and the diagnose-first decision. The tests use the articles' real fingerprints, the normal “I don't know” share (24%) and each problem's first 24 hours, and expect the lab's results: freshness names the two new articles and then fine_tuning, no alarm on any first day (12 of 28 is p ≈ 0.023), the 68% rebuild is rejected, and diagnose calls on-call for k = 1 and the docs team for MCP.
Quiz
1.The system can't know the right answer to every learner question. How can it still tell its search index is wrong?
2.On the corrupted vectors' first day, 12 of 28 answers said “I don't know”, against about 7 normally. Why didn't the alarm fire?
3.Which problem showed no symptom at all, and which check saw it?
4.The probe searches found 100% of their paragraphs on the index that was missing two new articles. Why?
5.Search started returning 1 passage instead of 3. What should a self-repairing system do?
6.A rebuild picked up the new articles but wrote 3 in 10 vectors wrong. What stopped it from serving learners?
Check your understanding
Try each question before opening its answer.
Name three ways a system can check its search index without knowing the right answers, and what each one misses.
Freshness (fingerprints vs. the index's copy) sees stale text exactly, and nothing else. Probe searches (questions written from the index's own paragraphs) see broken search, but not articles the index never had. Symptoms (the “I don't know” rate) show what users feel, from any cause, but with fewer than 30 answers a day they didn't alarm on any problem's first day, and a stale revision raised none at all.
12 of 28 answers said “I don't know”, against about 7 normally. Is that an alarm?
Not at a 1-in-100 bar. With 28 answers, chance alone gives 12 or more about 1 day in 40 (p = 0.023). The alarm waits for p < 0.01, so it doesn't go off for nothing. More traffic, or a longer window, would make the same rise significant.
Why was the revised article the hardest problem to notice?
It had no symptom. The stale index gave confident, cited answers from the old text (“thousands of examples”), the “I don't know” rate stayed normal, and search scores were ordinary. Only comparing the article's fingerprint with the index's copy showed it: 13 wrong answers while stale, against 5 with the new text.
Why did diagnosing first beat rebuilding every night?
It acts on what it sees, within the hour: a stale index is rebuilt at once instead of waiting for 3 a.m. (14 to 18 hours later), and problems a rebuild can't fix get a person instead of 12 useless rebuilds. Every one of its rebuilds is also checked before it's swapped in.
When should a self-repairing system call a person instead of repairing itself?
When its repair can't fix the cause, or when it can't confirm its repair worked. A settings change (k = 1) goes to the on-call engineer, a topic no article covers to the docs team, and a rebuild that fails the probe check to on-call, with the old index kept. Send the evidence: the probe recall, the learners' questions.
What one check would have stopped the broken rebuild, and what did it change?
Running the probe searches on the new index before the swap: it found 68%, against 99% for a correct rebuild, so it was rejected, the old index stayed, and on-call was called. That's +0 extra bad answers instead of +6 over 6 hours. An automatic repair is a deploy, and needs the same check.
Next up: Chapter 61 closes the Self-improving systems section with a loop that improves the assistant on its own, and what it learns from the wrong reward.