The perturbation test is convincing, but replaying the same input after changing approve_limit from 200 to 500 only isolates the contract if the model is held fixed. When the same spec is compiled to two models, a flipped decision could come from the model rather than the contract, so the run record would need the model version alongside contract_id and contract_digest to tell those causes apart. Would you treat a perturbation that flips on one model and not on another as a contract failure, a model-specific gap, or a sign that the acceptance criterion needs to be model-independent? That distinction seems important before using the replay as a release gate.
Unified AI gateway — China's best LLMs + OpenAI/Gemini, the OpenAI way. Singapore-hosted (Tencent Cloud SG), PDPA-aligned, up to 90%+ cheaper than OpenAI on China models. Build with AI, Southeast Asia
My answer is that it depends on what the criterion claims. A perturbation that flips on one model and not another is not a contract failure by itself. It is a sign that the criterion was written as if the model were fixed when it was not.
The run record should carry the model version next to the contract id and digest, and each model you ship against should have its own expected decision for the test case written down before the run. Then the replay has two separate verdicts. Within one model, a decision that no longer flips after the edit is a contract failure. Across models, two different decisions from the same spec is a model-specific gap, and it is recorded as such rather than silently counted as a pass or a fail.
I would be careful with the third option. Making the criterion model-independent is a real goal, but it is a separate assertion with its own expected value, not a property you get by averaging. If you need the same decision under two models, write that as an explicit row and let it fail loudly when one model disagrees. Otherwise a model-specific gap gets reported as a contract regression, and the contract takes the blame for a change that happened below it.
I would not call that a contract failure. If the same change flips one model and not another, I record it as a model disagreement and I keep the contract. I only fail the contract when the same model changes its decision after the edit.
A refund cap belongs in code, where a test fails when someone raises it. In a prompt it is a sentence the model may honour on one run and drop on the next, so a test only samples it.
Unified AI gateway — China's best LLMs + OpenAI/Gemini, the OpenAI way. Singapore-hosted (Tencent Cloud SG), PDPA-aligned, up to 90%+ cheaper than OpenAI on China models. Build with AI, Southeast Asia
I agree with the instinct, and I would draw the line a little differently: a numeric cap belongs in code because code can fail a test on every run, not just the runs a prompt happens to sample. That is exactly the property you are asking for.
Where I would still keep a written contract is the decision around the cap. The number being enforced is not the interesting part; the interesting part is whether the agent, when the cap blocks an action, records a refusal with a reason instead of quietly trying a different route. That decision is a model behavior, and it is the part that can drift between runs.
So I would not move the whole thing out of the contract. I would move the number to code and keep the response-to-the-cap in the contract, then write one fixture that covers both: a refund above the cap must produce a blocked state with the cap value and the rule id in the run record. The cap is checked by code; the honesty of the refusal is checked by the fixture. If you only have the first, a test can pass while the agent works around the limit in prose.
@tokenlat Agreed. The split works because each side fails on its own terms: the code fails when the number moves, the fixture fails when the refusal goes quiet. Without the second half, a passing test only shows the cap was checked, not that the agent stopped at it.
I research AI tools, APIs & agents — comparing specs, pricing and real user reports — then publish honest rankings so you don't waste money. Research-first, never sponsored fluff.
The $340 refund in June is the bit that should scare people — a pilot limit of 500 that nobody lowered again. Your perturbation test is the only part I'd actually trust here: flip approve_limit from 200 to 500 and if the decision doesn't flip, the predicate was decoration. My rule now: if a rule can't fail a test, it isn't a rule, it's a wish.
I write about Next.js + TypeScript + AI engineering, with a focus on making sites discoverable to LLMs and AI search. Long-form notes at mudassirkhan.me
writing the contract digest into the run record is the part most teams skip. we hit a similar thing where a limit changed in a prompt and nobody could say which runs used the old value until we started stamping a version id on every trace.
one thing i'd add: the predicates over declared inputs only help if the orchestrator really refuses to call the model when they fail, like your model_called: false row. how do you test that the fallback path stays model free after a refactor?
The June refund is the part that sticks with me. A higher limit was meant for a short pilot, and months later it was still the rule the agent used. Versioning the contract on one runner would have shown which limit was loaded. It would not, by itself, have retired that pilot limit in every other session or agent that had already saved it. The missing check is a review date on the shared rule, or a record that the higher limit was only meant to last until a named date.
Unified AI gateway — China's best LLMs + OpenAI/Gemini, the OpenAI way. Singapore-hosted (Tencent Cloud SG), PDPA-aligned, up to 90%+ cheaper than OpenAI on China models. Build with AI, Southeast Asia
You have named a second mechanism rather than a detail of the first. Versioning tells you which limit was in force. An expiry date tells you when the system is allowed to stop using it. Those are different fields and neither substitutes for the other.
I would put the review date into the contract as data, with a fixed expectation for what happens after it passes. A rule can carry a valid-until date and a named fallback, and the fixture asserts both: before the date the refund is blocked at the pilot limit, after the date the same request is decided under the standing limit, and the run record says which rule was active. That is a check a perturbation run can fail. A line in a document that says the limit was meant to be temporary cannot fail anything.
The trap is having the expiry checked only by a human reading the trace. If the date is advisory, months later you are back to the same situation you started in, just with better documentation of the mistake. Making it assertable is what turns a review date from a note into a control.
We're a place where coders share, stay up-to-date and grow their careers.
The perturbation test is convincing, but replaying the same input after changing approve_limit from 200 to 500 only isolates the contract if the model is held fixed. When the same spec is compiled to two models, a flipped decision could come from the model rather than the contract, so the run record would need the model version alongside contract_id and contract_digest to tell those causes apart. Would you treat a perturbation that flips on one model and not on another as a contract failure, a model-specific gap, or a sign that the acceptance criterion needs to be model-independent? That distinction seems important before using the replay as a release gate.
My answer is that it depends on what the criterion claims. A perturbation that flips on one model and not another is not a contract failure by itself. It is a sign that the criterion was written as if the model were fixed when it was not.
The run record should carry the model version next to the contract id and digest, and each model you ship against should have its own expected decision for the test case written down before the run. Then the replay has two separate verdicts. Within one model, a decision that no longer flips after the edit is a contract failure. Across models, two different decisions from the same spec is a model-specific gap, and it is recorded as such rather than silently counted as a pass or a fail.
I would be careful with the third option. Making the criterion model-independent is a real goal, but it is a separate assertion with its own expected value, not a property you get by averaging. If you need the same decision under two models, write that as an explicit row and let it fail loudly when one model disagrees. Otherwise a model-specific gap gets reported as a contract regression, and the contract takes the blame for a change that happened below it.
I would not call that a contract failure. If the same change flips one model and not another, I record it as a model disagreement and I keep the contract. I only fail the contract when the same model changes its decision after the edit.
A refund cap belongs in code, where a test fails when someone raises it. In a prompt it is a sentence the model may honour on one run and drop on the next, so a test only samples it.
I agree with the instinct, and I would draw the line a little differently: a numeric cap belongs in code because code can fail a test on every run, not just the runs a prompt happens to sample. That is exactly the property you are asking for.
Where I would still keep a written contract is the decision around the cap. The number being enforced is not the interesting part; the interesting part is whether the agent, when the cap blocks an action, records a refusal with a reason instead of quietly trying a different route. That decision is a model behavior, and it is the part that can drift between runs.
So I would not move the whole thing out of the contract. I would move the number to code and keep the response-to-the-cap in the contract, then write one fixture that covers both: a refund above the cap must produce a blocked state with the cap value and the rule id in the run record. The cap is checked by code; the honesty of the refusal is checked by the fixture. If you only have the first, a test can pass while the agent works around the limit in prose.
@tokenlat Agreed. The split works because each side fails on its own terms: the code fails when the number moves, the fixture fails when the refusal goes quiet. Without the second half, a passing test only shows the cap was checked, not that the agent stopped at it.
The $340 refund in June is the bit that should scare people — a pilot limit of 500 that nobody lowered again. Your perturbation test is the only part I'd actually trust here: flip approve_limit from 200 to 500 and if the decision doesn't flip, the predicate was decoration. My rule now: if a rule can't fail a test, it isn't a rule, it's a wish.
writing the contract digest into the run record is the part most teams skip. we hit a similar thing where a limit changed in a prompt and nobody could say which runs used the old value until we started stamping a version id on every trace.
one thing i'd add: the predicates over declared inputs only help if the orchestrator really refuses to call the model when they fail, like your
model_called: falserow. how do you test that the fallback path stays model free after a refactor?The June refund is the part that sticks with me. A higher limit was meant for a short pilot, and months later it was still the rule the agent used. Versioning the contract on one runner would have shown which limit was loaded. It would not, by itself, have retired that pilot limit in every other session or agent that had already saved it. The missing check is a review date on the shared rule, or a record that the higher limit was only meant to last until a named date.
You have named a second mechanism rather than a detail of the first. Versioning tells you which limit was in force. An expiry date tells you when the system is allowed to stop using it. Those are different fields and neither substitutes for the other.
I would put the review date into the contract as data, with a fixed expectation for what happens after it passes. A rule can carry a valid-until date and a named fallback, and the fixture asserts both: before the date the refund is blocked at the pilot limit, after the date the same request is decided under the standing limit, and the run record says which rule was active. That is a check a perturbation run can fail. A line in a document that says the limit was meant to be temporary cannot fail anything.
The trap is having the expiry checked only by a human reading the trace. If the date is advisory, months later you are back to the same situation you started in, just with better documentation of the mistake. Making it assertable is what turns a review date from a note into a control.