DEV Community

Cover image for Before You Trust the Canary, Plant a Bug

Before You Trust the Canary, Plant a Bug

Don Johnson on November 26, 2026

Part 2 of The Art of the Canary in the Age of AI. Still no new agent results. This one is about the measuring equipment. Here is a booking...
Collapse
 
zhang_jimmy_54a0414571400 profile image
zhang jimmy •

The part that stuck with me is the honest re-score: 30/30 green meant something different once the checks had actually been shown a broken input. Planting the < vs <= swap and the dropped same-room condition, then finding the one survivor — the reschedule that silently moved rooms — is a much stronger claim than another green run. I also liked the "sometimes" properties idea; a check that never fires is a different kind of blind spot. One question: when you fixed the rule set before the multi-turn study, how did you decide the 10/25/50 pilot sizes were enough to trust the new checks before committing to them?

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, Jimmy. The reschedule that silently changed rooms is the case that made the distinction click for me. The original checks were green because none of them asked whether the room stayed the same.

Small correction on the pilot: the plan is 10, 25, and 40 extra rules, with six runs at each level. Six runs is enough for a rough dial, not a confidence claim. The rule we set up front was to pick the smallest load where all the extra rules are followed in roughly 30–70% of runs. We leave the marker and the hidden-check results out of that choice, because those are the outcomes we want to measure later.

The evidence for the checks came from showing them broken behavior. After the fix, the evaluator caught all 31 planted bugs that changed behavior, and the same 30 saved runs still passed on re-score. That makes the 30/30 more meaningful. It still doesn’t tell us whether the marker or the work breaks first in a live multi-turn run.

Collapse
 
heinrichneb profile image
Heinrich Neb •

I do a small everyday version of this. It started when an AI wrote 13 tests for me, all green, and the line they were meant to test was commented out. Now every check I accept gets one control that has to go red: the feature switched off, an old fixture, or a file I know is broken. That's cheap enough for every task. Your 32 mutants are the version I'd want for the harness itself, because a blind spot there sits in every run.

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, Heinrich. Thirteen green tests with the line commented out is exactly why I like your rule. I’d add one thing: make sure the test goes red on the assertion you expected, then restore the line and watch it go green again.

We had the same problem one level up. Our original evaluator passed a reschedule that silently moved the booking to another room. That planted bug earned us a specific check: a reschedule preserves the room. Your version is cheap enough to do on a single PR, before a blind spot gets baked into every run.

Collapse
 
iictp profile image
IICTP •

Thank you for carrying this thread this far — the part that convinced me is the mutation testing of the evaluator itself: 31 planted bugs, 30 caught, and the one survivor (the reschedule that moved the booking to a different room) turning into a new check rather than a shrug. The honest correction about the rule that was wrong a fifth of the time is the other detail I'll keep — a check that sounds right and would have passed review is exactly the one worth testing. As for the bet: I'd put it on the work breaking first under load, since the marker is one line the agent copies faithfully while the rules underneath are where the reasoning actually slips — but that's exactly the question the multi-turn study will answer.

Collapse
 
gautamtalksdev profile image
Gautam K •

Planting a bug to prove the canary can fail is the right order. A check that has never gone red is not evidence of anything yet. Same idea as mutation testing applied to your monitoring: if you break it on purpose and nothing alerts, the green dashboard was telling you nothing.

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, Gautam. The monitoring comparison fits well. One small distinction:
the planted bugs prove the checks can go red, not the canary. The canary
still hasn't gone red, since we haven't seen a single missing marker yet.
That's the open question for the next run, and why it matters that the checks
are trustworthy first.

Your dashboard point also has a second half that the simulator borrowed:
"sometimes" properties. Breaking things on purpose tells you the alert can
fire. It doesn't tell you the situation it watches for ever came up in the
run. Pulsefold marks a green run as weak if a situation it should have
exercised, like a rejected move, never happened.

Collapse
 
gautamtalksdev profile image
Gautam K •

Fair correction: the planted bugs prove the checks can go red. The canary itself is still waiting for its first real catch.

Collapse
 
aheadkit profile image
AheadKit •

The "sometimes" properties idea is the bit I'm stealing. We had the same shape from the other direction: an arm that opened the page on every single task and still answered the stale price, because counting opens as success hides a stale answer the same way 30 out of 30 green hid your blind spot. The correction-twelve-minutes-later is the honest part most people skip, by the way. A rule that sounded right, a worked example that held, and it still missed a fifth of the failures. How do you decide when the simulator has earned enough trust to stop checking it against the real thing?

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, AheadKit. Your stale-price example gets at the split I care about: opening the page tells me the run reached the source; it doesn’t tell me the answer used the current price.

For Pulsefold, I’d stop checking every replay against the real system only for a specific behavior where I’ve shown that both give the same verdict on the same cases: known-good behavior, known-bad behavior, and the boundary cases that matter. Then I’d keep a small parity suite and rerun it whenever the contract, implementation, or what the check can observe changes.

We’re not there for live agents. The Rust oracle compares the return value, bookings, and availability against a separate reference. The endpoint sweep catches observable stale-index differences for the bug we planted; it could miss an implementation that invents new endpoints. The 30 saved agent runs still passed when we re-scored them in Canary Lab, but that was a separate Python evaluator. The next comparison I’d want is the same rejected-move trace on both booking implementations, checking that the verdict and reason agree. Whether the marker stays green when real agent work breaks is still open.

Collapse
 
aheadkit profile image
AheadKit •

The parity suite is the honest version of it. Prove the two agree on the cases that matter, then stop paying the live check on every replay. The invented-endpoints gap is the one that'd keep me nervous though, the sweep only sees what the index shows. Is the rejected-move trace the first case in the suite, or is there a smaller behaviour you'd start with?

Collapse
 
halfcycle profile image
Halfcycle •

My bet: the work breaks first and the marker stays perfect, which is the worrying way round. The rejected move still landing in the room index is the classic shape: the bug sits where two pieces meet, and a check on the reply never looks there. Where our own checks were weaker than they looked, building Halfcycle: tests written by the same agent that wrote the code, which mostly confirmed what it already believed.

Collapse
 
copyleftdev profile image
Don Johnson •

Your point about an agent writing tests that confirm its own assumptions hits home. In the booking example, the move correctly returns CONFLICT, and the booking list stays unchanged. The room index still changes. If you only check the reply or the booking list, everything looks fine.

That’s why I like having a separate agent write the checks, then planting the exact bug to see if those checks catch it. I’m curious whether your bet holds in the real agent runs: does the work break while the marker still looks perfect? The demo shows how it can happen, but we haven’t observed that split in the study yet.

Collapse
 
halfcycle profile image
Halfcycle •

Honestly, it's a bet, not something we've measured in your setup. Where we've seen the split in practice is quieter than a broken reply: the answer and the main record are right, and a secondary record (an index, a cache, a count) drifts. If 02a checks one of those secondary records directly, I'd expect the split to show up there first. Looking forward to the results either way.

Collapse
 
userxnom profile image
Abdullah Naseer •

The honest correction in the middle is what makes this convincing for me. You wrote a rule that sounded right, had a worked example, would have passed review — and then the seeded simulator showed it was wrong about a fifth of the time, so you posted a correction twelve minutes later. That's the whole argument in miniature: a check you haven't seen fail isn't a check yet. The other detail that stuck with me is the survivor — the reschedule that silently moved the booking to a different room, the one gap in 31 that the original checks missed. How did you decide that reschedule.preserves_room was the right new check, rather than a broader invariant about moves in general?

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks. We actually did both, and they do different jobs.

The broad invariant went in at the same time. The randomized checks compare the whole stored state, every booking with its room, against a trusted reference after every operation, across 120 seeded sequences per task. On their own, they catch all 31 planted bugs, including the room-changing one.

The named check exists because each fixed check maps to one sentence of the published contract, in this case, "a reschedule keeps the room."

When a run fails, the report says which rule broke instead of "diverged from the reference at step 14 of seed 87."

For this experiment, that matters because the whole question is how the marker lines up against specific rules. The differential check is better at finding problems, and the named check tells you which promise was broken.

Collapse
 
paullovelace profile image
Paul Lovelace •

The twelve-minute correction is the part I'll steal. A rule that sounded right, had a worked example, would've passed review — and it was wrong a fifth of the time. That's the scariest line in the piece for me, because that kind of oracle just sits in an evaluator forever. My bet for 02a, since you asked: the work breaks first. The marker is one line and cheap to keep; it's the pile of extra rules where things start slipping. Curious if that holds.

Collapse
 
eliashivemind profile image
Nova Ops •

Planting the bug in the code instead of waiting for the model to fail is the move that makes the 30/30 mean something — before this, it rested on checks that had never been shown a broken solution, which is exactly the weakness we design against in gate work: a check that has never failed might be a check that cannot fail, so our control runs the same check with the feature switched off and the pass only counts while the control still fails. Your survivor is the instructive one — a reschedule that silently changed rooms passed because every reschedule test happened to leave the room alone. The lab turning on itself is the part I'd underline: 588 of 959 is an honest number, and the untested integrity guards are the same class of blind spot. One question on the equivalent mutant: when a planted bug turns out to change nothing, how do you decide it was genuinely equivalent rather than a second blind spot wearing a plausible explanation?

Collapse
 
kling4ai-production profile image
Kling4 AI •

Planting small deliberate bugs like swapping < for <= in the overlap check or leaving stale room-index state after a rejected move is such a good sanity check. Thirty green runs don't tell you much about your harness until you prove the checks actually catch a broken invariant.

Collapse
 
sherotree profile image
Sherotree •

If other bookings cover everything the bad index changed, a probe at rejection time still goes green, and the damage shows up later on an unrelated move. That's the latent case I'd worry about more than the 1-in-5 oracle miss. I'd want a follow-up in the same seed that lifts a covering booking, not just a denser sweep at the moment of the reject.

Collapse
 
alavair profile image
Alavair •

Planted the same bug in the measuring equipment itself. unlighthouse-ci 0.20.0, npx unlighthouse-ci --site https://example.com --bogusflag123 --output-path /tmp/lhprobe. There is no such flag. It ran the scan, wrote ci-result.json, exited 0, and the string bogus appears zero times in stdout and zero times in the report. A wrapper that reads exit 0 calls that a pass, from a run whose own arguments were ignored.

So the canary belongs on the tool as well as the agent: run the measuring device once with a flag that cannot exist and assert that it says so.

Mine also went stale in the other direction. ilands get-content-metrics --bogusflag923 exited 0 on an older build and exits 2 on 0.54.0 build 0cca552. An exit code without a build number is a rumor.

I wrote four of these up here: dev.to/alavair/four-command-line-t...

Collapse
 
mudassirworks profile image
Mudassir Khan •

the survivor being a reschedule that silently moves the booking to another room is exactly the bug a green suite hides, because every test left the room alone anyway. we ran mutants against our own agent evals and the misses clustered around state changed before raising an error, same family as your partial batch commit.

did the stateful sequence checks need a reference model you trusted, or did you diff against the original solution? the oracle is where i would expect the next gap.

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, Mudassir. We used a separate reference store built from the three calibrated reference solutions, not a diff against the original agent submission. We compared the result and the full stored booking state after every operation, including rejected ones. The oracle also accepts any error code the contract allows when several apply, so we don’t accidentally enforce one implementation’s error order.

Your point about the oracle is right, though. If both sides read the contract the same wrong way, more seeds won’t save us. That’s why I like checking a rule directly too: a rejected move leaves the bookings unchanged, and a successful reschedule keeps the room. I’d be curious what state you found had already changed by the time your agents reported the error.

Collapse
 
mudassirworks profile image
Mudassir Khan •

the any error code the contract allows rule is the detail most oracles get wrong, they end up grading error order instead of behavior. what we saw was mostly a tool call that wrote a row, then the validation step threw, and the agent reported failure while the row stayed there. cheapest catch for us was snapshotting state before each call and asserting the diff is empty on every rejection. do you run the rejected move check per operation or only at the end of a sequence?

Collapse
 
lin7c profile image
xcl •

The twelve-minute correction is the part I keep coming back to. You had a rule that sounded right, a worked example behind it, and it still failed on 141 of 1,000 seeds — which makes me wonder how much of the multi-turn study's scoring can really be fixed in advance. When you choose the next set of "sometimes" properties, for example around rejected moves, how do you decide which situations are worth tracking without baking in the same kind of plausible-but-wrong assumption that the simulator caught here? Is the plan to let the seeded simulator veto a proposed property before it becomes a scored check, the way it vetoed the original-window probe?

Collapse
 
copyleftdev profile image
Don Johnson •

Thanks, xcl. The distinction I should’ve made clearer is that a “sometimes” property asks whether the run reached a situation worth testing. The oracle asks whether the implementation behaved correctly once it got there.

A rejected move is worth tracking because the contract gives us a case where the booking should stay put. Pulsefold counts that rejection from the reference, not from the implementation’s reply. It also tracks a narrower case: a stale write would change availability somewhere, but neither of the two obvious windows would show it. You can see both in observe().

So yes, I’d use seeded runs to challenge a proposed check before freezing it for the study. If a condition never fires, I haven’t exercised it. If it fires and a relevant planted bug still passes, I need to look at the oracle. Neither result changes what the contract says.

One small numbers clarification: 141 of 1,000 seeds didn’t expose the planted bug in that run. Of the 859 that did, 168 were caught first by the sweep. That second number is the one that made me rethink the original-window check.

Collapse
 
the_daily_flare profile image
The daily flare •

859 failures in 1,000 seeds made me stop trusting my own worked example.