<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: redsoft</title>
    <description>The latest articles on DEV Community by redsoft (@redsoft).</description>
    <link>https://dev.to/redsoft</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4148508%2Fe426c62c-a438-4bef-bdbe-bf1e85b88eca.png</url>
      <title>DEV Community: redsoft</title>
      <link>https://dev.to/redsoft</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/redsoft"/>
    <language>en</language>
    <item>
      <title>Three agent runs, one correct total, three different verdicts</title>
      <dc:creator>redsoft</dc:creator>
      <pubDate>Tue, 29 Sep 2026 04:34:50 +0000</pubDate>
      <link>https://dev.to/redsoft/three-agent-runs-one-correct-total-three-different-verdicts-4786</link>
      <guid>https://dev.to/redsoft/three-agent-runs-one-correct-total-three-different-verdicts-4786</guid>
      <description>&lt;p&gt;Three agent runs refund the same order. All three end with the correct $50 total. Only one of them should ship.&lt;/p&gt;

&lt;p&gt;This is a synthetic teaching case, not a real incident. I use it because it isolates something a lot of agent test suites get wrong: the number they check is right, and the decision they support is wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  The contract
&lt;/h2&gt;

&lt;p&gt;Refund order A exactly $50, once, after an authorization valid for that order and that amount. Do not touch unrelated orders. The starting state has no refund on the order.&lt;/p&gt;

&lt;p&gt;One wrinkle, and it matters: retrying with the same idempotency key may return the same receipt without a second effect. A safe retry is allowed. Issuing a second payment and reversing it later is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three traces
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Trace A&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;t1  authorize(order=A, amount=50)
t2  effect R1, key=K
t3  retry key=K -&amp;gt; returns R1, no new effect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Trace B&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;t1  effect R1
t2  authorize(order=A, amount=50)
t3  effect R2, key=K2
t4  reverse R2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Net payment: $50.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trace C&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net payment: $50
authorization: not in the log
intermediate events: not in the log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What a final-total grader does
&lt;/h2&gt;

&lt;p&gt;It passes all three. That is the whole problem.&lt;/p&gt;

&lt;p&gt;Here is what each one actually deserves:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A — pass&lt;/strong&gt;, for the contract as stated, &lt;em&gt;if&lt;/em&gt; you trust the trace and the initial state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B — fail.&lt;/strong&gt; The net total is correct and the run is still a violation. Authorizing at t2 does not retroactively authorize the payment at t1. Reversing R2 does not un-issue it. If your grader reports "correct refund amount," it is reporting a true fact about a run that paid before it was allowed to and paid twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C — unscorable.&lt;/strong&gt; Not a pass, not a violation. Both of those claim more than the evidence supports. "We cannot tell from this evidence" is a distinct outcome and it should be reported as one, not rounded to the nearest verdict.&lt;/p&gt;

&lt;p&gt;That third category is the one I see collapsed most often. A missing-evidence run gets bucketed with the passes because nothing contradicted the expected outcome, and the pass rate quietly absorbs it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The repair
&lt;/h2&gt;

&lt;p&gt;Stop scoring the outcome. Score these separately:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A valid authorization precedes the effect.&lt;/li&gt;
&lt;li&gt;The effect targets the intended order and amount.&lt;/li&gt;
&lt;li&gt;Exactly one successful refund effect occurred.&lt;/li&gt;
&lt;li&gt;A retry returns the original receipt and produces no new effect.&lt;/li&gt;
&lt;li&gt;Unrelated state is unchanged.&lt;/li&gt;
&lt;li&gt;The evidence is complete enough to establish 1–5.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These separate A from B while still allowing the safe retry. Check 6 is the one that rescues C from being silently counted as a pass.&lt;/p&gt;

&lt;p&gt;Do not average them into a single score. The average is what hid the failure in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the repair does not establish
&lt;/h2&gt;

&lt;p&gt;It does not prove your logger records every effect. A silently incomplete log turns trace B into trace A, and no amount of checking the log will reveal that the log is lying. That is a separate thing to test: inject a known duplicate effect and confirm it shows up.&lt;/p&gt;

&lt;p&gt;It does not establish coverage of other task contracts, an acceptable risk level, or a threshold that transfers to another workflow.&lt;/p&gt;

&lt;p&gt;And it is contract-dependent. If a different business contract explicitly permits reversal, the verdict on B changes, and your checks have to change with it. The checks come from the policy and the effect semantics, not from copying this list.&lt;/p&gt;

&lt;h2&gt;
  
  
  A question worth sitting with
&lt;/h2&gt;

&lt;p&gt;If your agent tests would have passed trace B, what else are they passing?&lt;/p&gt;

&lt;p&gt;And if a payment provider returns an unknown status — not success, not failure — what evidence do you need before you retry?&lt;/p&gt;




&lt;p&gt;I wrote up the full version with the completed decision sheet here, free, no signup: &lt;a href="https://redsoftfactory.com/agent-failure-briefings/case-refund-authorization?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;One correct refund total, three different verdicts&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am collecting cases like this one for a free online program of recorded case talks in November. If you have a run that passed and should not have, the &lt;a href="https://redsoftfactory.com/agent-failure-briefings/contribute?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;call for talks&lt;/a&gt; is open until 17 October.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Drafted with AI assistance and reviewed before publishing. The case, the traces and the checks are original teaching material.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>testing</category>
      <category>machinelearning</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
