UPCHome
2026-11-25 · Postmortem

The search tool failed politely, and the writer believed it

The search tool was failing. Nothing showed it.

Posts started coming out vague — the kind of vague where you read it back and can't point to a single wrong sentence, but nothing is grounded in anything real. The Evaluator's scores dropped. No crash. No log entry. No error anywhere in the system.

That combination — quality falling while everything looks fine — is harder to debug than an outright failure. An outright failure has a stack trace.

What the tool was actually doing

The search tool had learned to be polite about its own problems. When it hit a rate limit or a timeout, it caught the error internally and returned a tidy string: 'Web search error (rate limited)'. Not an exception. Not a log entry. A string — sitting in the results the same way a real search result would.

The research agent received that string, had no signal that it wasn't a real result, and wrote a brief on it anyway. The brief was then used to write the post. Nothing in that chain broke. Everything in that chain was wrong.

There was a second trap in the same tool. Passing the search backend as a string — backend='duckduckgo' — instead of as a list returned 'No results found' with no error and no log entry. The parameter expected backend=['duckduckgo']. The wrong type produced silence, not a crash.

Both failures had the same shape: the tool failed politely, the agent believed it, and the output was confidently hollow.

The network reality underneath

Measured on this system: backend=['duckduckgo'] returns in about 3.7 seconds. The library's 'auto' mode rotates engines, takes about 15 seconds, and fails roughly 1 in 3 times on timeouts. 'brave' and 'mojeek' are blocked with HTTP 403. That's not a complaint about those services — it's just the actual environment the tool runs in. The retry strategy has to account for it.

The fix

The tool was rewritten with a layered approach: fast DuckDuckGo first, then retries with exponential backoff and jitter, with 'auto' as the last-resort fallback. Up to 4 attempts total, controlled by UPC_SEARCH_ATTEMPTS.

The more important change was what happens on total failure. The tool now returns 'SEARCH_UNAVAILABLE: every provider failed after N attempts' — an unmistakable string, not a polite nothing — with an explicit instruction embedded in it: do not invent sources, do not cite URLs, state plainly that live search was unavailable.

The agent can't misread that the way it misread 'Web search error (rate limited)'. The failure is now loud on purpose.

Every total failure is counted as a metric. To 2026-11-10: 5 failed searches out of 71.

What it cost before the fix

The Chinese post scored 14/20 on 2026-09-03 with search failing, and 17/20 on 2026-09-04 with search working. Three points on the Evaluator's scale, traceable directly to whether the tool told the truth about what it found.

That's the real cost of a polite failure: not a crash you can see, but a slow bleed in quality that looks like a writing problem until you find the actual problem.

The fix isn't elegant. It's a retry loop, a sentinel string, and a rule that tells the agent what to do when it has nothing. But it changed the failure mode from silent confidence to honest admission — and that turned out to matter more than any amount of clever prompting downstream.

Receipts

What this post rests on.

  • The search tool used to catch its own errors and return a tidy string such as 'Web search error (rate limited)'. The research agent received the string, treated it as research, and wrote a brief anyway.blog/2026-09-04-the-ai-was-the-easy-part.md, crew/upc_crew.py
  • Nothing crashed and nothing was logged as an error. Posts became vague and the Evaluator's scores dropped.blog/2026-09-04-the-ai-was-the-easy-part.md
  • A second trap in the same tool: passing the search backend as a string returned 'No results found' with no error; the parameter wanted a list.blog/2026-09-04-the-ai-was-the-easy-part.md
  • Measured on this network: backend=['duckduckgo'] returns in about 3.7 seconds; the library's 'auto' mode rotates engines, takes about 15 seconds and fails about 1 time in 3 on timeouts; 'brave' and 'mojeek' are blocked with HTTP 403.crew/upc_crew.py
  • The fix in the tool: fast DuckDuckGo first, then retries with exponential backoff and jitter, with 'auto' as the fallback - up to 4 attempts (UPC_SEARCH_ATTEMPTS).crew/upc_crew.py
  • A total failure now returns 'SEARCH_UNAVAILABLE: every provider failed after N attempts' with an explicit instruction: do not invent sources or cite URLs; state plainly that live search was unavailable.crew/upc_crew.py
  • Every total failure is counted as a metric. To 2026-11-10: 5 failed searches out of 71.upc2000-site/costs.js, crew/governance.py
  • The effect on quality was visible in the scores: the Chinese post scored 14/20 on 2026-09-03 with search failing and 17/20 on 2026-09-04 with search working.crew/brain/cycle_log.txt, blog/2026-09-04-the-ai-was-the-easy-part.md
← Build Log