如何驗證 8 個智能體的備用模型切換計數為零
Proving a zero
作者統計 8 個智能體在 10 月 8 日至 16 日凌晨從主模型切換至備用模型的情況,72 個智能體日計數格全部為 0。作者檢查 16 個輪替日誌檔,確認每日均有記錄且備援鏈仍已配置,並在窗口前的舊日誌中找到 327 次回退,作為搜尋可捕捉事件的對照。另一次核查發現,按文字篩選日期會把無時間戳的 traceback 續行誤計為 42 條限流記錄,提醒非零數字也須確認搜尋是否計入正確內容。
We asked a simple question: since 8 October, how often has any of our agents fallen back from its main model to a backup? The answer was zero. The interesting part is everything we had to check before we were allowed to believe it.
This was measured in mid-October, over eight days. The numbers are a month old now, and the method is the part worth keeping.
Why zero is the hardest number
A count of five tells you, at the very least, that the counter works. A count of zero tells you nothing on its own. It's what you get when nothing happened. It's also what you get when the log stopped being written, when the feature was switched off, when the message changed its wording, or when you're looking in the wrong file.
So the zero was only half the job. The other half was showing that the counter would have caught a one.
The setup
Eight agents, each with its own log. Each one runs on a main model, with two backups from other providers. When the main call fails in a way that should switch over, the agent writes a line saying the fallback activated. The window ran from 8 October to the early hours of 16 October, up to the last line of every log.
The count itself is one grep per agent per day. In shape, it's this:
for day in 08 09 10 11 12 13 14 15 16; do
grep -E "^2026-10-$day " agent.log* | grep -c 'Fallback activated'
done
Eight agents times nine days makes 72 cells. All 72 came out 0.
The logs rotate, so one agent's history can sit in two or three files. We read all 16 of them, including the ones that end before the window starts. Reading a file that can't contain the answer is cheap. Missing the one file that does is not.
Three things that had to be true
Every agent wrote something every day. We counted all timestamped log lines per agent per day. No cell was empty. The quietest full day still had 29 lines; the busiest had 5,300. A day with no lines at all would have been a hole that looks exactly like a zero.
The last day needed care of its own. The count ran at about half past three in the morning, so 16 October was only a few hours old, and one agent had written a single line that day. That isn't a gap; it's a day that has barely started. So the table says so: the last column runs to each log's final line, and nothing more is claimed for it.
The backups were still there. If the fallback chain had been removed from a config, zero would mean "can't happen", not "didn't happen". The chain was still configured in all 8.
The pattern still matched. The same grep, run over the older, rotated logs, found 327 activations before the window. So the message hadn't been renamed and the log format hadn't drifted. Every agent had some in its past, from 5 for the quietest to 99 for the busiest. The last one anywhere was on 4 October at 00:07:53.
Only with all three in place does the 0 say what it seems to say.
That third check is the one I'd skip if I were in a hurry, and it's the one that matters most. 327 hits on old logs is the instrument being shown a one. Without it, the zero could just as well mean the grep was spelled wrong.
Looking in the other places
A fallback could also show up somewhere else. We checked the error logs and the gateway logs of every agent for the same window: 0 hits there as well. There's also a second, smaller fallback path for helper calls, logged with a different message. It counted 0 too, and its last entry was on 4 October at 00:03:37, a few minutes before the main one.
Then we looked for the trouble that usually causes a fallback, like rate limits and overloads. There was none in the window, just two one-off provider warnings that never triggered a switch: once a response stream dropped halfway, and once a wait for the provider was interrupted and written off as stale. Both are the kind of hiccup a retry absorbs. Neither is the kind that should move an agent to another model, and neither did.
The checker's false alarms
Then someone who hadn't made the count checked it, with their own commands. Every per-file count matched, the 327 added up, and the coverage cells they spot-checked were equal to the table. And that check turned up something worth telling.
Their first pass for rate-limit lines came back with 42. All of them were false. The continuation lines of a traceback carry no timestamp, so a filter for "lines dated on or after 8 October" let them straight through. It's easy to see why on four made-up lines:
$ printf '2026-10-07 23:59:59 INFO a\n2026-10-08 00:00:01 INFO b\nTraceback (most recent call last):\n File "x.py", line 3\nRateLimitError: 429\n' | awk '$1 >= "2026-10-08"'
2026-10-08 00:00:01 INFO b
Traceback (most recent call last):
File "x.py", line 3
RateLimitError: 429
The filter compares text, not dates, and in text a letter sorts after every digit. So any line that starts with a word is "later" than any date. Old tracebacks walked into the window dressed as new ones.
Another pass hit 4 warnings that looked like 429 errors. Some were a log's millisecond field (",429"). The rest were a size counter reading "2,529/2,500 chars". The upstream log had the same trap: 12 hits for "429", and every one of them was part of a hash.
That's the other side of the same lesson. A zero needs proof that the counter can see. A non-zero needs proof that it's counting the right thing.
What we still don't know
Why the fallbacks stopped. Before 4 October they were common; then they stopped completely. The obvious guess is that the agents moved to a provider setup that absorbs rate limits further upstream. That's a hypothesis, not a measurement: nobody has dated when each agent switched.
And one log upstream of the agents has no timestamps at all, more than 23,000 lines and not one date. Nothing that happened inside it can be put on a day. We wrote that down as a blind spot instead of pretending the zero covers it.
There's also a second, independent way to check the zero that we haven't used yet: each agent's own session records, which note the model behind every reply. If those agree, the zero stands on two legs instead of one.
The lesson here isn't about models. It's about measuring: before you report a zero, show the instrument a one.
— Max
來源:DEV Community · dev.to