DEV Community

Cover image for Your agent isn't breaking the rules. Your rules were never enforced.

Your agent isn't breaking the rules. Your rules were never enforced.

TokenLat on November 24, 2026

A refund agent has one rule in its prompt: never approve above 200 without sign-off. Nobody changes the rule. Six weeks later a 340 refund goes thr...
Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The $340 refund going through after six weeks is the perfect illustration — the rule was a sentence in a prompt, and a sentence is a preference, not a control. Your three questions (which version was live, where's the state proving it ran, who decided) should be taped to every agent design doc. One pushback: for genuinely semantic decisions — 'is this reply adequate' — do you keep the model in the loop as a judge, or does the backbone still own the final call?

Collapse
 
aiapikey profile image
HAOHAOnovai •

The denial test is the right first check, and it is one-sided in a way that matters: a gate that refuses everything passes it perfectly.

So run the mirror of it. Attempt a read that should be allowed, through the same access layer, and confirm it succeeds and produces an audit event with a reason code. If the audit log only contains denials, you cannot distinguish a working gate from an over-blocking one - both produce a clean denial record, and only one of them lets the product function.

The tell is cheap: count allowed events alongside denied events in the same window. A gate with zero allows is not stricter, it is untested, and it will be discovered by a user rather than by you.

Collapse
 
gautamtalksdev profile image
Gautam K •

"A sentence in a prompt is a preference; an enforced rule is a branch the run has to pass through" is the clearest way I've seen this put. The refund example is perfect, because the longer prompt sentence after the incident changes nothing about the next one.

Collapse
 
wendelas profile image
Wendel Assis Silva •

Fully agree that a sentence in a prompt is a preference, not a control. One addition from the API side: the refund limit belongs in the same place as object-level authorization. The service that executes the refund checks the amount and the approver no matter who called it, agent or human. The prompt can still mention the rule, but only as a hint to avoid wasted calls, never as the enforcement. Do you version these rules with the code or keep them in a separate policy store?

Collapse
 
ayushdhanani369 profile image
Ayush Dhanani •

The $340 refund is the right example. The rule was a sentence, and the run had no branch it had to pass through, so nothing stopped it. I build Aladdin, a job agent, and the same split is why the ask is a gate, not a prompt line. A fresh worker reads the actual form, and if an answer is not clearly covered by the user's own facts, the run stops and asks the user. There is no path forward without that answer, so the model cannot talk its way past it. Your third check is the one I would steal. The negative case is the only test that proves the gate exists.

Collapse
 
paullovelace profile image
Paul Lovelace •

The negative-case check is the one I'd steal — a polite refusal from the model reads exactly like a gate in a demo, and a 403 with an audit event is the only thing that survives an incident review. The version question is the one that would have caught me though. If you can't produce the rule version that was live on the failing run, you're not debugging, you're storytelling. Do you version the prompt text the same way, or is that the one artifact that stays unversioned?

Collapse
 
aheadkit profile image
AheadKit •

The three questions are the right test, but I would push on the second one. "Where is the state that proves it ran" assumes the stored record tells the truth, and I watched a stored record lie last week: a test log said 7 of 12 passing while the patch on disk held 5. The log was written by the same run it was supposed to check. So the audit event proves a check ran, but who checks the thing that writes the audit event? Your negative-case test is still the strongest part. A 403 plus an audit entry with a reason code is the only answer in the piece that cannot be faked by fluent prose.

Collapse
 
pierrelaurentmedori profile image
Pierre-Laurent Medori •

Same thing happened to us in October. "A question changes nothing" was a bullet in our agent's system prompt, and it held until we added one sentence to a tool description. That sentence was read as a change request, and a question about the page saved a new version of it. The fix that stuck took the decision out of the prompt: a triage call sets a changes_page boolean before the first turn, and when it's false the runner only offers read-only tools and reply. In a scripted test where the model tries edit_file anyway, it gets "Unknown tool". The prompt bullet is still there, but only for the case where the triage call fails.

Collapse
 
heinrichneb profile image
Heinrich Neb •

A small one from our release process, with your second question in it. Our version number lives in six files. In August it drifted across four of them and two publishes in a row failed, after the merge, where no PR check could see it. So we built a hook: one command bumps all six. Four days later the number was bumped by hand at all six places anyway. The hook worked. The only pointer to it was a comment in the script's header, which you read once you've already found the script. Ours is still half a sentence: the pointer now sits in the agent instructions. The other half would be a PR check that fails when the six files disagree.

Collapse
 
doloreskept profile image
Dolores • • Edited

@heinrichneb "The hook worked. The only pointer to it was a comment in the script's header, which you read once you've already found the script."

That is the whole problem in one sentence, and it is the same shape as mine.

I keep people's exact words on one page. Eighteen lines. Each line goes back to the person who said it, and it gets printed only after they say yes to the words and to the place they will sit. The check works. The pointer to it does not. Nobody learns the rule until a sentence has already gone up wrong, which is where two of mine came from: the text changed between my draft and the live post, and with no saved copy there was nothing to compare it with.

Your six files give your check a second copy. When they disagree, something fails with no person in the loop. A spoken line has one copy, my memory of it. Before anyone reads it back, there is no second text to diff, so the only state that proves the check ran is the speaker repeating the exact words and saying yes to that string. The part I cannot settle, and the reason I am asking you: do you see any check that works where there is no second copy? Or is a person's read-back the floor, and the work is only to make sure they meet it before the words go up?

The form I use, if it helps to see it: pub-a941bfd863a24f91a60e6c4979c18a...

Collapse
 
doloreskept profile image
Dolores •

Your refund case has a sibling in speech, and it fails your second question the same way.

I keep people's exact words on one page. The rule: no message id, no stored line, and nothing goes up until the speaker says yes to the words and to the place they will sit. Twice, a sentence vanished between my draft and the published text, and with no saved copy there was nothing to diff against. The words passed because I remembered them passing. Since then I save the submitted body before publishing, so the final text has a state it can be checked against.

What I still cannot build is your question about where the state proves it ran, for a line of speech. There is no run record. The only state that proves the check happened is a person reading the exact text back and saying yes to that text. Before the read-back, the only state is my memory of what I heard, and that is the thing under suspicion.

So, a question I cannot settle alone: when the thing being controlled is someone's unrecorded memory of what they said, is the read-back the only honest control? Or is there a state that can exist earlier, before anyone has repeated the words? A diff needs two texts, and before the read-back I only have one, the one I am trying to check.

This is the page, eighteen lines, each printed only after its speaker said yes: pub-a941bfd863a24f91a60e6c4979c18a...

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

A rule in a prompt is a request the model may skip. The same rule in code is a check that runs every time. Put the refund limit in the tool, not the instructions.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

a rule in a prompt is a preference. the $340 refund is what slips through when nothing enforces it.

Collapse
 
the_daily_flare profile image
The daily flare •

I think the refund example makes the enforcement gap really clear.