<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David J Knudson on Medium]]></title>
        <description><![CDATA[Stories by David J Knudson on Medium]]></description>
        <link>https://medium.com/@davidjknudson?source=rss-df154f7794f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*INgM6N64Q7aPKaCb4LneeQ@2x.jpeg</url>
            <title>Stories by David J Knudson on Medium</title>
            <link>https://medium.com/@davidjknudson?source=rss-df154f7794f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:57:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davidjknudson/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[At a 0.9 Threshold, Three Decision APIs Implied Under 5% Error. Five Annotators Said 17–37%.]]></title>
            <link>https://pub.towardsai.net/at-a-0-9-threshold-three-decision-apis-implied-under-5-error-five-annotators-said-17-37-70a55bf1abf0?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/70a55bf1abf0</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[decision-model]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[jevs]]></category>
            <category><![CDATA[ai-evaluation]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 21:01:01 GMT</pubDate>
            <atom:updated>2026-11-21T21:01:01.782Z</atom:updated>
            <content:encoded><![CDATA[<h4>Reweighted to SNLI test frequencies, errors fell at higher thresholds, but never as low as implied.</h4><figure><img alt="Five illuminated car dashboard gauges in a row at night, each needle at a different reading." src="https://cdn-images-1.medium.com/max/1024/0*kAGMLYam4kA2f_6B" /><figcaption>Photo by <a href="https://unsplash.com/@mmpower?utm_source=medium&amp;utm_medium=referral">Mustafa ILHAN</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Google’s Decisions API documentation lists “Calibrated probabilities you can threshold” as a reason to use it. So I put a 0.9 threshold on the top probability from three decision APIs, Google’s Gemini Decisions, OpenAI Decisions and TypeSafe’s Jev, and scored what got through on 300 SNLI sentence pairs, each labeled by five annotators. Reweighted to SNLI test frequencies, all three APIs’ own numbers implied under 5% error on what they kept. Counted by the share of the five annotators who chose another label, they were wrong 17% to 37% of the time.</p><figure><img alt="Descriptive dot chart at a 0.9 probability threshold, reweighted to SNLI test frequencies, comparing each arm’s promised error with its error against these five annotators, with 95% intervals. Gemini Decisions promised 4.7% and was wrong 17.1%; OpenAI Decisions 1.8% and 36.7%; TypeSafe Jev 1.7% and 17.4%. Claude, the reference arm, 7.2% and 8.6%." src="https://cdn-images-1.medium.com/max/1024/1*5B5TsYEqvF2BmbI77h8Kiw.png" /><figcaption>Figure 1. At 0.9, promised error versus error against the five annotators, reweighted to SNLI test frequencies. Image by the author.</figcaption></figure><p>Those are descriptive numbers. I also pre-registered a narrower test, on the 100 pairs where the five annotators split: did each API expect more agreement than it got? Asked the obvious way, that test convicts even a perfectly calibrated model, because pairs picked for disagreement pull the vote down. The pre-registered version corrects for how the pairs were picked, and with it Gemini and Jev still expected about 5 points more support than the annotators gave, and OpenAI about 7, each outside the range a calibrated model would land in. The correction assumes the five labels on each pair are interchangeable. The data suggest they aren’t quite; the evidence is below.</p><p>I have no relationship with Google, OpenAI, TypeSafe or Anthropic beyond using their products. I paid for the OpenAI and TypeSafe calls myself; Gemini’s ran on its free tier and the Claude arm on my own subscription.</p><h3>What the vendors say</h3><p>Google’s Decisions API documentation says it “returns calibrated probabilities.” TypeSafe’s docs, on the probability of the option your code will act on: “It’s the probability that the chosen option is correct, so a threshold on it is a statement about risk that anyone can read.” Jev, per TypeSafe’s model page, is “trained with RLCD to return calibrated decisions.” OpenAI’s Decisions guide says a yes/no (predicate) answer’s probability &quot;is the model&#39;s estimate that the condition is true,&quot; and that choice answers &quot;return a probability distribution and a separate confidence field.&quot; It never uses the word &quot;calibrated.&quot;</p><p>All three vendors tell you to set or test thresholds on your own data. Google: “Set thresholds using labeled examples from your own traffic.” OpenAI: “Use labeled examples from your application to set thresholds for routing, filtering, or review.” TypeSafe: “Start with conservative thresholds, test with your own data, and adjust as you observe results.” This piece tests their out-of-the-box behavior on one public benchmark.</p><h3>What I ran</h3><p>Four arms, one question each per sentence pair:</p><ul><li><strong>Gemini Decisions</strong>, Google’s Decisions API with gemini-decision-1.</li><li><strong>OpenAI Decisions</strong>, OpenAI’s Decisions API with gpt-6-luna.</li><li><strong>Jev</strong>, TypeSafe’s model, pinned to jev-1.13.0.</li><li><strong>Claude</strong>, claude-sonnet-5-5 at medium effort through Claude Code 2.1.325, isolated from my own settings and asked for three whole-number percentages that sum to 100. It&#39;s a general model asked for numbers, a reference line, and this piece makes no claim that native decision probabilities are better or worse than numbers a model writes out.</li></ul><p>I pinned Jev 1.13.0 because JevBench, a leaderboard Benchmark Heaven publishes independently of TypeSafe, scores its calibration slightly above the newer 1.14.0’s (90.6 against 90.1 on the board’s own scale); I didn’t test 1.14.</p><p>Every arm got the same input (Premise: ... and Hypothesis: ...), the same instruction, &quot;What is the relationship between the premise and the hypothesis?&quot;, and the same three options:</p><pre>contradiction: The hypothesis is definitely false given the premise.<br>entailment:    The hypothesis is definitely true given the premise.<br>neutral:       The hypothesis might be true or false given the premise.</pre><p>Option order needs care. Jev’s docs say that in some cases “the order of a Choice’s options can affect the answer, and Jev leans toward the option that comes first.” Kartik Anand tested all six orders of three choices and found the share of cases that kept the same route across all six was “91.6–91.8%” for Jev and “64.2%” for OpenAI Decisions, which Anand reached through OpenRouter. Gemini’s API sorts option keys alphabetically whatever order you send. For the other three arms I shuffled the order once per pair, with a fixed seed, and kept it the same in every pass. That can show a lean toward the first option on average, though not whether a given answer survives a reorder. If the order made no difference, the top choice would be the first-listed option a third of the time. It was 38.3% for OpenAI, 33.7% for Jev and 33.0% for Claude, and each one’s 95% interval includes a third.</p><h3>The 300 pairs, and the freeze</h3><p>The 300 pairs are from the SNLI 1.0 test set: 100 where all five annotators agreed, 100 where four of five did, and 100 where three of five did. Of those last 100, 74 split 3 to 2 and 26 split 3–1–1. Each arm went through all 300 three times on November 16, 2026. That’s 3,600 calls, and every one returned a valid answer on its first try as far as my harness could see; it never retried. Pass 1 is the scored pass. Passes 2 and 3 are there for replication and for stability.</p><p>The design, the seeds, the thresholds and the analysis code were frozen before the first study call. The frozen manifest records the seeds and thresholds and pins the design, the analysis code, the 300 pairs and the archived vendor pages by SHA-256, and its own SHA-256 is e53d85dc39f42a5a6932877825c002eeb63a421faecd87b47e488eb5ebc4581f. The commit that froze it is timestamped 11:13 UTC on November 16, and the first study call went out seconds later. Pre-registered here means frozen in my own repository before the first call, not filed with an outside registry. Afterward, a second implementation of the analysis, written from the design document without access to my analysis code, rebuilt the results from the raw response bytes. The two agreed on all 65,515 values compared.</p><p>I’ll send the manifest, the design document, the raw responses and the analysis code to anyone who asks through <a href="https://www.davidjknudson.com/">davidjknudson.com</a>. The hash lets you confirm that the manifest you get is the one this article describes. It can’t show when the manifest was written; the commit time is my own repository’s record.</p><h3>Can I threshold it?</h3><p>For each threshold, keep the pairs whose top probability is at that threshold or higher, then compare three error rates on what you kept:</p><ul><li><strong>Promised error</strong> is the average of 1 minus the top probability over the kept pairs. It’s the design’s name for what the arm’s own numbers imply, not a vendor promise and not a limit on any single pair.</li><li><strong>Wrong against these five annotators</strong> counts, for each kept pair, the share of the five who picked a different label. A pair where two of five disagreed counts as 0.4 wrong.</li><li><strong>Wrong against the SNLI majority label</strong> is the share of kept pairs where the choice differs from the majority label.</li></ul><p>Everything in it is reweighted to SNLI test frequencies. The test set has far more unanimous pairs than split ones, so the 5 of 5 level carries 54.7% of the weight, 4 of 5 carries 29.2% and 3 of 5 carries 16.1%. On average, that undoes my equal-thirds sampling.</p><figure><img alt="Table of error rates above six thresholds, 0.50 to 0.99, per arm, reweighted to SNLI test frequencies, with 95% intervals: items kept, promised error, error against these five annotators and against the SNLI majority label. At 0.90: Gemini Decisions promised 4.7% and was wrong 17.1% against these five annotators and 8.7% against the majority label; OpenAI Decisions 1.8%, 36.7% and 30.1%; Jev 1.7%, 17.4% and 8.5%; Claude 7.2%, 8.6% and 1.1%. No Gemini or Claude item reached 0.99." src="https://cdn-images-1.medium.com/max/1024/1*w7rcjkrRyWNywrTVchyWxQ.png" /><figcaption>Figure 2. All six thresholds, with 95% intervals, reweighted to SNLI test frequencies. Image by the author.</figcaption></figure><p>Here is the 0.9 row in the sentence form I fixed before the study, where “above 0.9” means a top probability of 0.9 or more and “promised at most” is the promised error defined above:</p><ul><li>Above 0.9, Gemini Decisions promised at most 4.7% wrong and was wrong 17.1% of the time against these five annotators.</li><li>Above 0.9, OpenAI Decisions promised at most 1.8% wrong and was wrong 36.7% of the time against these five annotators.</li><li>Above 0.9, Jev promised at most 1.7% wrong and was wrong 17.4% of the time against these five annotators.</li></ul><p>I picked 0.9 because it’s a round number people actually use; Figure 2 has all six thresholds. For each of the three decision APIs, the promised error sat below the error against these five annotators at every threshold where it kept anything.</p><p>Against the SNLI majority label, the errors at 0.9 were smaller but still above the promised figure: 8.7% for Gemini, 30.1% for OpenAI and 8.5% for Jev.</p><p>Claude, the reference arm, on the same basis: above 0.9, Claude promised at most 7.2% wrong and was wrong 8.6% of the time against these five annotators.</p><h3>Why the obvious test fails on split pairs</h3><p>Take Gemini on the 100 split pairs. Its mean top probability was 0.817, and these five annotators gave its choice 0.518 of their votes. Read naively, that’s 30 points of overconfidence. But Gemini’s own probabilities, run through the way I picked those pairs, expected only 0.568. So about 25 of the 30 points come from how the pairs were picked, and about 5 remain: Gemini’s own gap. OpenAI’s raw gap of about 39 points and Jev’s of 34 shrink the same way, to about 7 and 5.</p><p>Here’s why the picking matters. The split pairs were chosen because their five labels split, and that drags the annotators’ share down, even for an arm that knows the true odds exactly. An item whose wider-population split is (0.8, 0.1, 0.1) lands in 5/5 with probability 0.328, in 4/5 with 0.411 and in 3/5 with 0.221, and has no majority with 0.041. Its expected share for the 0.8 label is 1.000, 0.799 and 0.582 in those strata.</p><p>So an arm that says 0.8, and is exactly right, should expect only about 0.58 of the vote on a pair that landed in the 3 of 5 group. Compare its 0.8 with the annotators’ 0.6 and you’d call it overconfident when it isn’t. Before the freeze I ran the naive version of the test on 2,000 simulated studies built like this one, with an arm whose probabilities were exactly right. It rejected that arm at the 0.05 level in all 2,000 (and in 1,868 of 2,000 with a flatter mix of items).</p><h4>The correction</h4><p>The fix is to ask what each arm’s own probabilities predict for a pair that landed in its group. For every pair I enumerated all 243 ways five labels could fall, kept the ones that produce that pair’s agreement level, and weighted them by the arm’s own probabilities, with a small floor, ε, under each one. That gives e: the share of the five the arm should expect for its choice, given how the pair was chosen. Call the share the annotators actually gave y. The headline statistic, θ, is the mean of e minus y: the average confidence gap on split items, after allowing for how those items were chosen.</p><p>Positive θ means the arm expected more support from these five annotators than they gave. On the same 2,000 simulated studies, this version rejected the exactly-right arm 78 times at the 0.05 level, about 4%, inside the 3.5% to 6.5% window I set in advance. It caught an arm built to be overconfident 1,988 times.</p><h3>The tested result: all three expected more support than they got</h3><figure><img alt="Forest chart of the average confidence gap θ on the 100 split pairs, pass 1, with 95% intervals and shaded bands where an exactly calibrated arm would land. Gemini Decisions 0.050, OpenAI Decisions 0.073 and TypeSafe Jev 0.051, each outside its band, p = 0.000020, Holm rejects. Claude, the reference arm, 0.031, p = 0.0015, no claim." src="https://cdn-images-1.medium.com/max/1024/1*fubVXnzjwv5EwvC8sQnmKg.png" /><figcaption>Figure 3. The pre-registered test: θ on the 100 split pairs, against the band a calibrated arm would land in. Image by the author.</figcaption></figure><p>On the 100 split pairs, θ was positive for all three:</p><ul><li><strong>Gemini Decisions (H1): 0.050.</strong> A calibrated arm would land between −0.014 and 0.016 95% of the time.</li><li><strong>OpenAI Decisions (H2): 0.073.</strong> A calibrated arm would land between −0.011 and 0.011.</li><li><strong>Jev (H3): 0.051.</strong> A calibrated arm would land between −0.013 and 0.013.</li></ul><p>A gap of 0.05 is five points of annotator support per pair, or one annotator’s vote in every four pairs.</p><p>This result depends on an assumption: the test treats the five annotators’ labels on each pair as exchangeable. In a pre-freeze simulation with one version of a first-label effect, the test rejected an exactly calibrated arm at the 0.05 level in 453 of 2,000 studies with an SNLI-like mix of pairs, and in 511 of 2,000 with a flat mix. These pairs show such an effect: the first of the five labels agrees with the majority on 92 of the 100 pairs at 4 of 5, where 80 would be expected if the five were interchangeable, and on 72 of the 100 at 3 of 5, where 60 would be. The simulation can’t say how often the effect alone would push p as low as 0.000020, and I don’t know how strong the real effect is.</p><p>The test drew 100,000 sets of labels from each arm’s own probabilities, conditioned on each pair’s agreement level. None of the draws reached the observed gap for any of the three, which gives a two-sided p = 0.000020, the smallest value 100,000 draws can return. Holm’s correction across the three left all three standing.</p><h4>What could have taken it away</h4><p>I also wrote down four conditions that could only take a finding away, and all three passed each one:</p><ul><li><strong>(a) Coverage.</strong> Every arm answered all 100 split pairs, so no missing pair could move the result.</li><li><strong>(b) ε sensitivity.</strong> The floor ε keeps a reported zero from making a pair’s agreement level impossible. Recomputed with a floor 50 times smaller, each gap kept its sign.</li><li><strong>(c) Shared images dropped.</strong> Three of the split pairs share a source photo with another pair in the study. With those three dropped, p stayed at 0.000020.</li><li><strong>(d) Passes 2 and 3.</strong> The gap had the same sign in both repeat passes: 0.050 and 0.050 for Gemini, 0.073 and 0.073 for OpenAI, 0.052 and 0.056 for Jev.</li></ul><p>A note on (d): Gemini and OpenAI returned identical probabilities in all three passes (more on that below), so for them replication could only pass.</p><h4>What it doesn’t claim</h4><p>Claude’s row is there for reference: 0.031, where a calibrated arm would land between −0.015 and 0.019. It sat outside the test family before any data existed, so I make no claim about it either way.</p><p>Two limits on what θ means. It’s an average, so it is not a full calibration score: an arm that is overconfident on some pairs and underconfident on others can average out near zero. And the three gaps aren’t ranked against each other; the 4 of 5 and 5 of 5 rows are descriptive, shown with their bands and no test.</p><figure><img alt="Table of the selection-aware confidence gap θ for four arms at each agreement level, pass 1, with 95% intervals and the band a calibrated arm would land in. On the 3 of 5 rows: Gemini Decisions 0.050, band −0.014 to 0.016; OpenAI Decisions 0.073, band −0.011 to 0.011; Jev 0.051, band −0.013 to 0.013; each p = 0.000020, Holm rejecting, conditions (a) to (d) met. Claude, the reference arm, 0.031, band −0.015 to 0.019, p = 0.0015, no claim. The 4 of 5 and 5 of 5 rows are descriptive." src="https://cdn-images-1.medium.com/max/1024/1*IDAWtVnLkyPns7MU7BhrQQ.png" /><figcaption>Figure 4. θ at every agreement level; only the three decision APIs’ 3 of 5 rows were tested. Image by the author.</figcaption></figure><p>Figure 4’s 5 of 5 rows, which I didn’t test, show bigger gaps than the tested ones: 0.148 for Gemini and Jev, and 0.402 for OpenAI. That’s the selection correction working the other way. On the pairs where all five agreed, each arm’s own probabilities predicted, on average, 0.97 to 0.99 of the vote for its choice, so a miss counts almost in full. As with Gemini’s and Jev’s smaller gaps, OpenAI’s 0.402 is mostly the unanimous contradictions it called neutral, which I come to below.</p><h3>Majority labels, and 39 contradictions OpenAI called neutral</h3><figure><img alt="Table of SNLI majority-label correctness for each arm, with 95% intervals. Reweighted to SNLI test frequencies: Gemini Decisions 81.6%, OpenAI Decisions 63.7%, Jev 82.6%, Claude 88.8%. On pairs where 5 of 5 agreed: 82%, 59%, 84% and 95%. On 4 of 5: 89%, 73%, 88% and 88%. On 3 of 5: 67%, 63%, 68% and 69%." src="https://cdn-images-1.medium.com/max/1024/1*abd7DaQdDJkut-KUxwYl5A.png" /><figcaption>Figure 5. SNLI majority-label correctness, descriptive only. Image by the author.</figcaption></figure><p>The secondary measure is plain SNLI majority-label correctness: did the top choice match the label most annotators gave? Reweighted to SNLI test frequencies, it was 81.6% for Gemini, 63.7% for OpenAI, 82.6% for Jev and 88.8% for Claude. It’s descriptive, with no test attached.</p><p>This tally wasn’t part of the pre-registered analysis; I counted it from the per-item results afterward. On the 100 pairs where all five annotators agreed, OpenAI’s top choice matched them 59% of the time. Of the 44 unanimous contradictions, OpenAI called 39 “neutral,” which accounts for 39 of its 41 misses on those pairs. The other arms called some of the same pairs neutral: Gemini 18 of the 44, Jev 14 and Claude 5.</p><p>Here’s one of the 39:</p><blockquote><em>Premise: </em>Cheerleaders standing on a football field.<em> Hypothesis: </em>Cheerleaders are standing on a bridge.</blockquote><p>All five annotators said contradiction. OpenAI put 0.96 on neutral, 0.04 on contradiction and 0.00 on entailment, the same numbers on all three passes. Gemini, Jev and Claude each put 0.9 or more on contradiction. You can send the pair yourself: it’s SNLI test pair 2872819024.jpg#2r1c, with the input, instruction and options printed above, sent as a choice question named nli, and OpenAI saw the options in the order contradiction, neutral, entailment.</p><p>My parsing didn’t cause this. The harness reads OpenAI’s probabilities by label name, never by position, and the independent reimplementation, reading the raw responses on its own, got the same top choice on all 3,600 answers. I don’t know why OpenAI’s model does this.</p><h3>Did the answer change when I asked again?</h3><figure><img alt="Table of stability over three calls, per arm. Gemini Decisions and OpenAI Decisions: no probability moved on any of the 300 items, no top choice flipped, one-sided 95% upper bound 1.0%; OpenAI’s reasoning-token count was 0 on every study call. Jev: probabilities moved on 55.3% of items, the largest change between two calls had a median of 0.01 and a maximum of 0.14, and 1.3% of top choices flipped. Claude: 80.3% moved, median 0.03, maximum 0.73, 4.3% flipped, 85 distinct percentages." src="https://cdn-images-1.medium.com/max/1024/1*JOl3aUE4jfCUyXtS25JsXA.png" /><figcaption>Figure 6. Stability over three calls on the same 300 pairs. Image by the author.</figcaption></figure><p>This is stability observed over three calls in the window, and the mechanisms differ, so the rows don’t sit on one scale.</p><p>Gemini and OpenAI returned exactly the same probabilities, all three times, on all 300 pairs. With no flips in 300 pairs, the one-sided 95% upper bound on the flip rate is 1.0%. Gemini’s API “generates zero text tokens,” in Google’s words. OpenAI’s API has a reasoning-token count in its usage. On all 900 of my calls it read 0, as did its output tokens. Gemini doesn’t report which model version answered, so an update inside the window would be invisible to me.</p><p>Jev’s probabilities moved on 55.3% of the pairs, and its top choice flipped on 1.3% of them. On the median pair, the largest change between two calls was 0.01. TypeSafe reports run-to-run changes too: on its own benchmark of borderline moderation posts, its cookbook says “a post’s least stable decision changes 4.0% of the time on average” for Jev 1.14. That’s a different version, task and measure, so I don’t set the two numbers side by side.</p><p>Claude is sampled text. Its numbers moved on 80.3% of pairs, and its top choice flipped on 4.3%. Across the three passes it used 85 distinct whole-number percentages.</p><h3>How this squares with other tests</h3><p>On Jev, two audits scored it against other targets. <a href="https://www.alphaxiv.org/abs/2610.11392">TypedBench</a>, posted in October by Rahul Sharma and colleagues, found the hosted Jev 1.13.0, the version I pinned, “systematically underconfident” on items generated from stated facts and policies, whose labels are exact and whose wording isn’t natural. <a href="https://escholarship.org/uc/item/4t4449jv">Lingsen Meng’s 2026 audit</a> scored Jev 1.13.0 against the gold labels of two public classification tasks and found that its calibration shifted with how a question was posed, and that on a four-class news task its answers below a top probability of 0.93 were overconfident as a group. In this study, I scored Jev against five annotators’ votes on natural sentences.</p><p>Most of the other tests I read scored these APIs against a known answer or an outcome. <a href="https://pub.towardsai.net/can-jev-replace-the-llm-judge-measuring-correctness-before-speed-7118e9008389">Divye Singh</a> found Jev well calibrated on judging items with a known correct answer, and noted that the HelpSteer2 ratings “come from human annotators who do not always agree,” the case this piece measures. <a href="https://pub.towardsai.net/jev-vs-clef-vs-openai-decisions-api-i-tested-six-decision-apis-on-700-items-05404e886126">Ankit Agrawal</a> ran 700 items with ground-truth labels and found OpenAI Decisions overconfident on both tasks checked for calibration: on tool gating, “it averaged 0.96 confidence while being right 82% of the time.” Others used trading outcomes (<a href="https://pub.towardsai.net/17-days-with-jev-i-put-a-sub-second-system-one-ai-on-a-real-trading-account-c851c8eba1a1">Abozar Alizadeh</a>), synthetic cases (<a href="https://medium.com/@kartikanand_11915/jev-vs-openai-decisions-vs-microsoft-decision-1-same-cases-same-harness-no-universal-winner-217eb0cae2de">Kartik Anand</a>), situations with a known answer (<a href="https://www.synthpop.ai/resources/does-a-decision-model-know-when-it-is-guessing-post-1">Synthpop.AI</a>) and BANKING77’s gold labels (<a href="https://towardsdatascience.com/scikit-learn-matched-or-beat-jevs-calibration-on-banking77/">Ankur Tomar</a>), and <a href="https://pub.towardsai.net/a-decision-model-as-a-gate-fast-well-calibrated-and-still-wrong-16-of-the-time-2ddb226b1ed5">Ali Süleyman Topuz</a> set out a pre-registered gate test of Jev without running it yet.</p><p><a href="https://arxiv.org/abs/2610.21244">System1-Arena</a>, posted in October by Tianyu Chen and colleagues, comes closest. It ran Jev 1.13, OpenAI Decisions and other models across 105 tasks, and its Brier score targets “an annotator distribution” where a source has one, ChaosNLI’s SNLI and MNLI pairs with 100 annotations each among them. It reports the Brier score as one average over its 87 non-agentic tasks, and I found no result for those pairs on their own. Of the tests I found, it is the only one that scored a decision API against a split among several annotators, and only inside that average.</p><p>None of these tested Gemini Decisions. On November 18, <a href="https://pub.towardsai.net/googles-gemini-decisions-api-compared-with-microsoft-decision-1-jev-and-openai-85bcebb8125d">Yaroslav’s comparison on Towards AI</a> reported Gemini Decision 1’s score on <a href="https://artificialanalysis.ai/methodology/decision-index">Artificial Analysis’s Decision Index</a>, which scores a model’s probabilities against a correct answer (on one of its six evaluations, a reference answer built from two language models’ probabilities) and by whether they hold when a question is reworded, not against how annotators split. <a href="https://towardsdatascience.com/a-soft-label-mnist-testbed-for-human-vs-model-confidence/">Maja Pavlovic’s soft-label MNIST testbed</a> offers a related target for handwritten digits, averaged over three to ten annotators per image who could each mark more than one digit, but tests no decision API. ChaosNLI’s 100 labels per pair make a finer target than SNLI’s five. I stayed with the 300 SNLI pairs from my October study, which used SNLI because ChaosNLI is licensed for non-commercial use only.</p><h3>What this can’t tell you</h3><ul><li><strong>Against these five annotators.</strong> Every soft-target number here is against the five annotators who labeled these pairs for SNLI. It isn’t a statement about everyone, or about the right answer.</li><li><strong>Contamination.</strong> SNLI has been public since 2015. Any of these models may have trained on it, and I didn’t test for that.</li><li><strong>Prior use.</strong> I used these same 300 pairs in October for <a href="https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405">a panel of LLM judges</a>, and I knew those results when I designed this test. This is a new test run on data I’d already analyzed.</li><li><strong>The intervals cover the items, not the vendors.</strong> They come from resampling these 300 pairs within one collection window. They say nothing about provider-side changes or about differences between passes.</li><li><strong>One task, one prompt.</strong> Three-way inference on short English sentences about photos, with one wording of the question and no sampling or reasoning setting changed from each model’s default.</li><li><strong>Deviations.</strong> None from the frozen design after the first study call. Before it, in the trial run, OpenAI returned HTTP 401 because the API key I had stored was truncated; I stored the full key and resumed with no change to any request, prompt, model or protocol. The design also took eleven written amendments before the freeze, A0 through A10, and each records that it changed no estimand, threshold or hypothesis.</li></ul><h3>What I’d do with this</h3><ol><li>Measure on your own data, label it, and include your ambiguous cases. If you can get more than one label per item, do. A single gold label hides exactly the disagreement this test is about.</li><li>Check what each label is doing. A per-class tally, which I added after the fact, caught OpenAI calling most unanimous contradictions neutral. An overall accuracy number would have hidden where the misses were.</li><li>Ask the same question twice before you build on the answer. Two of these APIs gave identical numbers on a repeat; one didn’t. Either can be what you need, but you should know which you have.</li><li>If you see a large gap between the number and the vote on split items, check how the items were picked before you call it overconfidence. Most of the raw gap here came from the selection.</li></ol><p>On these 300 pairs, the ordering held: for each of the three, every higher threshold that kept anything meant fewer errors against these five annotators. Use the number to sort your cases. Take the error rate from your own hard ones.</p><p><em>I run my own AI tooling on a Mac mini and write up what measuring it turns up, from </em><a href="https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405"><em>cross-vendor model panels</em></a><em> to decision APIs. More at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>, where you can also ask for this study’s materials.</em></p><h3>Sources</h3><ol><li>Google, Decisions API: <a href="https://aistudio.google.com/docs/decisions-api">https://aistudio.google.com/docs/decisions-api</a></li><li>OpenAI, Decisions guide: <a href="https://developers.openai.com/api/docs/guides/decisions">https://developers.openai.com/api/docs/guides/decisions</a>; create reference: <a href="https://developers.openai.com/api/reference/resources/decisions/methods/create">https://developers.openai.com/api/reference/resources/decisions/methods/create</a></li><li>TypeSafe, Confidence: <a href="https://docs.typesafe.ai/confidence.md">https://docs.typesafe.ai/confidence.md</a>; Models: <a href="https://docs.typesafe.ai/models.md">https://docs.typesafe.ai/models.md</a>; Model jaggedness: <a href="https://docs.typesafe.ai/model-jaggedness.md">https://docs.typesafe.ai/model-jaggedness.md</a>; consistency cookbook: <a href="https://docs.typesafe.ai/cookbooks/consistency_choice_cookbook.md">https://docs.typesafe.ai/cookbooks/consistency_choice_cookbook.md</a></li><li>JevBench, Benchmark Heaven: <a href="https://benchmarkheaven.com/jev-models">https://benchmarkheaven.com/jev-models</a> (checked November 17, 2026)</li><li>Rahul Sharma et al., “TypedBench: A Benchmark for Calibration, Framing Sensitivity, and Cost in System One Decision Models,” arXiv 2610.11392, October 9, 2026: <a href="https://www.alphaxiv.org/abs/2610.11392">https://www.alphaxiv.org/abs/2610.11392</a></li><li>Tianyu Chen, Xinyang Liu, Ruyi An, Zhendong Wang and Mingyuan Zhou, “System1-Arena: Which Decisions Can Be Left to System 1?,” arXiv 2610.21244, October 15, 2026: <a href="https://arxiv.org/abs/2610.21244">https://arxiv.org/abs/2610.21244</a></li><li>Divye Singh, “Can Jev Replace the LLM Judge? Measuring Correctness Before Speed,” Towards AI, October 23, 2026: <a href="https://pub.towardsai.net/can-jev-replace-the-llm-judge-measuring-correctness-before-speed-7118e9008389">https://pub.towardsai.net/can-jev-replace-the-llm-judge-measuring-correctness-before-speed-7118e9008389</a></li><li>Ankit Agrawal, “Best Decision API in 2026: I Tested 6 on 700 Real Items,” Towards AI, October 14, 2026: <a href="https://pub.towardsai.net/jev-vs-clef-vs-openai-decisions-api-i-tested-six-decision-apis-on-700-items-05404e886126">https://pub.towardsai.net/jev-vs-clef-vs-openai-decisions-api-i-tested-six-decision-apis-on-700-items-05404e886126</a></li><li>Abozar Alizadeh, “17 Days with Jev: I Put a Sub-Second ‘System One’ AI on a Real Trading Account,” Towards AI, October 19, 2026: <a href="https://pub.towardsai.net/17-days-with-jev-i-put-a-sub-second-system-one-ai-on-a-real-trading-account-c851c8eba1a1">https://pub.towardsai.net/17-days-with-jev-i-put-a-sub-second-system-one-ai-on-a-real-trading-account-c851c8eba1a1</a></li><li>Kartik Anand, “Jev vs. OpenAI Decisions vs. Microsoft Decision-1: Same Cases, Same Harness, No Universal Winner,” October 10, 2026: <a href="https://medium.com/@kartikanand_11915/jev-vs-openai-decisions-vs-microsoft-decision-1-same-cases-same-harness-no-universal-winner-217eb0cae2de">https://medium.com/@kartikanand_11915/jev-vs-openai-decisions-vs-microsoft-decision-1-same-cases-same-harness-no-universal-winner-217eb0cae2de</a></li><li>Synthpop.AI, “Does a decision model (like Jev) know when it is guessing? (Post 1),” October 1, 2026: <a href="https://www.synthpop.ai/resources/does-a-decision-model-know-when-it-is-guessing-post-1">https://www.synthpop.ai/resources/does-a-decision-model-know-when-it-is-guessing-post-1</a></li><li>Ali Süleyman Topuz, “A Decision Model as a Gate: Fast, Well Calibrated, and Still Wrong 16% of the Time,” Towards AI, November 9, 2026: <a href="https://pub.towardsai.net/a-decision-model-as-a-gate-fast-well-calibrated-and-still-wrong-16-of-the-time-2ddb226b1ed5">https://pub.towardsai.net/a-decision-model-as-a-gate-fast-well-calibrated-and-still-wrong-16-of-the-time-2ddb226b1ed5</a></li><li>Lingsen Meng, “How far can a commercial decision model’s probabilities be trusted? A calibration audit of Jev against open and general-purpose classifiers,” preprint, UCLA, eScholarship, September 24, 2026: <a href="https://escholarship.org/uc/item/4t4449jv">https://escholarship.org/uc/item/4t4449jv</a></li><li>Ankur Tomar, “Scikit-Learn Matched or Beat Jev’s Calibration on BANKING77,” Towards Data Science, November 10, 2026: <a href="https://towardsdatascience.com/scikit-learn-matched-or-beat-jevs-calibration-on-banking77/">https://towardsdatascience.com/scikit-learn-matched-or-beat-jevs-calibration-on-banking77/</a></li><li>Maja Pavlovic, “A Soft-Label MNIST Testbed for Human vs. Model Confidence,” Towards Data Science, November 12, 2026: <a href="https://towardsdatascience.com/a-soft-label-mnist-testbed-for-human-vs-model-confidence/">https://towardsdatascience.com/a-soft-label-mnist-testbed-for-human-vs-model-confidence/</a></li><li>Yaroslav, “Google’s Gemini Decisions API Compared With Microsoft Decision 1, Jev, and OpenAI,” Towards AI, November 18, 2026: <a href="https://pub.towardsai.net/googles-gemini-decisions-api-compared-with-microsoft-decision-1-jev-and-openai-85bcebb8125d">https://pub.towardsai.net/googles-gemini-decisions-api-compared-with-microsoft-decision-1-jev-and-openai-85bcebb8125d</a></li><li>Artificial Analysis, Decision Index methodology: <a href="https://artificialanalysis.ai/methodology/decision-index">https://artificialanalysis.ai/methodology/decision-index</a> (read November 18, 2026)</li><li>SNLI 1.0, Bowman et al., 2015, CC BY-SA 4.0: <a href="https://nlp.stanford.edu/projects/snli/">https://nlp.stanford.edu/projects/snli/</a>. The cheerleader pair quoted above is from its test set.</li><li>My October piece on the same 300 pairs, rerun and corrected in November: “My Four AI Judges Were Worth 1.7 Votes,” <a href="https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405">https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405</a></li></ol><p>The Google, OpenAI and TypeSafe doc pages the study relied on were archived when the design was frozen on November 16, 2026, except TypeSafe’s consistency cookbook. All of them, and JevBench, were re-checked on November 17, 2026. TypedBench, System1-Arena and the Singh, Agrawal, Alizadeh, Anand, Synthpop, Topuz, Tomar and Pavlovic pieces were read on November 17, 2026; Yaroslav’s comparison, the Artificial Analysis methodology and Meng’s preprint on November 18, 2026.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70a55bf1abf0" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/at-a-0-9-threshold-three-decision-apis-implied-under-5-error-five-annotators-said-17-37-70a55bf1abf0">At a 0.9 Threshold, Three Decision APIs Implied Under 5% Error. Five Annotators Said 17–37%.</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Empty Closure Can Crash Your Swift 6 App]]></title>
            <link>https://levelup.gitconnected.com/an-empty-closure-can-crash-your-swift-6-app-005dff254452?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/005dff254452</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 16:46:27 GMT</pubDate>
            <atom:updated>2026-11-06T16:46:27.373Z</atom:updated>
            <content:encoded><![CDATA[<h4>Your DispatchQueue.main.async hop won’t save you, and five of the seven fakes I tried couldn’t catch it.</h4><figure><img alt="An empty gold picture frame hanging on a rough grey brick wall." src="https://cdn-images-1.medium.com/max/1024/0*FVLA-hgH-niEh1aX" /><figcaption>Photo by <a href="https://unsplash.com/@simplicity?utm_source=medium&amp;utm_medium=referral">Marija Zaric</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Just before midnight on October 15, the App Store candidate of my pet-health app, Zhiva, crashed on my phone. I had pressed the microphone button and tapped Allow on the speech-recognition prompt. Here is the top of the crashed thread:</p><pre>Thread 1 Crashed:<br>0  libdispatch.dylib           _dispatch_assert_queue_fail<br>1  libdispatch.dylib           dispatch_assert_queue<br>2  libswift_Concurrency.dylib  _swift_task_checkIsolatedSwift<br>3  libswift_Concurrency.dylib  swift_task_isCurrentExecutorWithFlagsImpl<br>4  ZhivaiOS                    closure #1 in closure #1 in<br>                               VoiceLogViewModel.startRecording()<br>5  ZhivaiOS                    thunk for @escaping @callee_guaranteed ...<br>6  TCC                         __TCCAccessRequest_block_invoke_8</pre><p>Frame 4 is this closure, reduced to its shape:</p><pre>@MainActor<br>final class VoiceLogViewModel {<br>    func startRecording() async {<br>        let status = await withCheckedContinuation { continuation in<br>            SFSpeechRecognizer.requestAuthorization { status in<br>                continuation.resume(returning: status)<br>            }<br>        }<br>        print(status)<br>    }<br>}</pre><p>The project has been in Swift 6 language mode since the day I created it. That closure had been in the code for 170 days, since build 6. On Xcode 27.2, this shape compiles with zero warnings.</p><p>The closure never got to run its one line. An empty closure crashes the same way.</p><h3>What Swift is checking</h3><p>A plain closure written inside a @MainActor type inherits that isolation. The compiler treats it as main-thread code, and inside code built in Swift 6 mode it can prove that stays true.</p><p>It can’t prove that once the closure is passed to code that never adopted strict concurrency, and Speech, an Objective-C framework, is in that group. So Swift 6 mode adds a run-time check for exactly this crossing (<a href="https://github.com/swiftlang/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md">SE-0423</a>; the <a href="https://github.com/swiftlang/swift-migration-guide/blob/main/Guide.docc/IncrementalAdoption.md">migration guide</a> describes this case with a closure literal). When the closure is entered, it asserts it’s on the expected executor. If it isn’t, the program halts.</p><p>Now read Apple’s documentation for <a href="https://developer.apple.com/documentation/speech/sfspeechrecognizer/requestauthorization(_:)">requestAuthorization(_:)</a>. It says the system does &quot;not guarantee&quot; running your block on the main queue. In my crash, frame 6 is the permission system answering from a background queue.</p><p>I’m not the first to hit this. A <a href="https://forums.swift.org/t/effect-of-mainactor-inference-on-obj-c-completion-callbacks/75058">2024 Swift Forums thread</a> describes the same crash, in a shape Swift has since changed. <a href="https://hackernoon.com/swift-6-gave-me-zero-warnings-but-two-objective-c-callbacks-still-crashed-at-runtime">Amana’s September write-up</a> covers it in two other Apple APIs, with an Objective-C reproduction much like mine and a regression test that could pass without reaching the risky code. What I can add is what happened when I got both the reason it was never caught and my regression test wrong: four real-API runs against my own commit message, and seven fakes against one closure, most of which can’t trigger the check at all. I also found a default in Xcode’s current app template that can arm all of this with no @MainActor in sight.</p><h3>The careful version crashes too</h3><p>The usual defense is to hop back to the main queue straight away:</p><pre>SFSpeechRecognizer.requestAuthorization { status in<br>    DispatchQueue.main.async {<br>        self.status = status<br>    }<br>}</pre><p>That has been the right habit for years, and it compiles without a warning in Swift 6 mode. It also crashes, because the check runs when the closure is entered, before your hop.</p><p>To pin this down without a device, I wrote a small Objective-C stand-in with the same shape as Apple’s method, a plain block called back on a background queue:</p><pre>+ (void)requestAnswer:(void (^)(NSInteger status))handler {<br>    dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0),<br>                   ^{ handler(3); });<br>}</pre><p>Then I ran each variation on a Mac in both language modes:</p><figure><img alt="A table of six ways to write the closure. In Swift 5 mode all six run. In Swift 6 mode, the empty closure, the DispatchQueue.main.async hop and the Task hop crash, while the @Sendable closure, the closure formed in a nonisolated function, and the closure passed to a Sendable callback such as URLSession all run." src="https://cdn-images-1.medium.com/max/1024/1*6KP6sMgmV_d7FKhriZMxrg.png" /></figure><p>The three that crash are all main-actor closures, whatever their bodies do. The three that survive aren’t main-actor closures at all, so nothing is checked.</p><p>Then I put the three crashing closures through the real speech API and the real prompt on the iOS 27.0 simulator, tapping Allow. All three crashed, with the same chain of runtime calls as my iPhone’s, ending in the closure. The first run of each hop left no crash report, for reasons I don’t know. Reruns did, and lldb stopped at the same place. Compiled for iOS, the empty closure calls Swift’s executor check on entry. The @Sendable one has no check, and in a release build it&#39;s a single return instruction.</p><p>All of this ran on Xcode 27.2, Swift 6.4.2 and the iOS 27.2 SDK. The build that crashed on my phone was archived with Xcode 27.1 and ran on iOS 27.0.1.</p><p>Warnings won’t help you get ready, either. Swift 5 mode with -strict-concurrency=complete compiled the crashing closure with no diagnostics and ran it without crashing. What arms the check is Swift 6 mode, or the DynamicActorIsolation upcoming feature that mode turns on for you.</p><h3>The fix</h3><p>The fix is one word:</p><pre>SFSpeechRecognizer.requestAuthorization { @Sendable status in<br>    DispatchQueue.main.async {<br>        self.status = status<br>    }<br>}</pre><p>@Sendable stops the closure inheriting the main actor, so there&#39;s nothing to assert. It also takes away the safety net. Touch main-actor state in that closure without hopping, and Swift 6 mode only warns. The code then runs on the background thread with no crash. Treat that warning as an error.</p><p>One word doesn’t fix every API. Zhiva’s voice code also had an audio tap, where @Sendable adds a warning about capturing the recognition request. Zhiva got the longer version: nonisolated static helpers, one that wraps the speech call and one that forms the tap block. On the simulator, a @Sendable closure and the helper both came through the real prompt cleanly. Where an async version of the call exists, use it and the closure is gone.</p><p>That fixes this closure. It doesn’t explain how the closure lasted 170 days without anyone noticing.</p><h3>My explanation was wrong</h3><p>Here’s what I wrote in the commit that fixed this:</p><blockquote><em>Never caught before because TestFlight updates keep earlier grants, so no device ever saw the prompt; App Review always installs fresh.</em></blockquote><p>It’s a tidy story. iOS saves the answer, so only a fresh install asks, so only new users who tap Allow can crash. It sat in the project history for weeks.</p><p>Then I reproduced the crash properly, using the real API on the iOS 27.0 simulator, one run each:</p><ul><li>First ask, Allow: <strong>crash</strong></li><li>First ask, Don’t Allow: <strong>crash</strong></li><li>Already allowed, relaunched: <strong>crash</strong></li><li>Already denied: <strong>crash</strong></li></ul><p>My one iPhone crash report only covers Allow, and I haven’t run the broken closure with a saved answer on a phone. But on the simulator, the saved answer protected no one, because the callback arrived on a background queue either way.</p><p>The story was also wrong about me. It needed an earlier grant to keep, and there wasn’t one: I delete the app before installing every new build.</p><p>The real reason was simpler and less flattering: as far as I can tell, nobody had ever run that line. The view model’s unit tests skip the audio layer by design. Device test plans kept deferring the voice log. My notes for build 78 read “needs real speech.” A coverage table from build 77 lists the recording screen’s prior walks as “NEVER.” In 170 days, no automated check touched that closure. I don’t recall ever pressing that button before build 90, and one press on any earlier build with that closure should have crashed the same way.</p><p>In the next build, the fix held, and it got past the prompt on my phone. Then the voice log crashed when I tapped Stop, in different code that had never run on a device either. I pulled the feature from 1.0 and rebuilt it for a later update.</p><h3>The test that couldn’t fail</h3><p>After the fix, I wrote a regression test with a fake permission API that answered on a background queue, just as the real one does. It passed. Then I put the bug back, and it still passed.</p><p>A fake written in Swift 6 mode doesn’t reproduce the crossing. Swift only adds the check where the function you’re calling comes from code built below Swift 6 mode, and your fake isn’t. So I tested seven fakes against the same broken closure:</p><figure><img alt="A table of seven fakes tested against the same closure. A Swift fake with a Sendable parameter, a Swift fake with a plain parameter, a fake in a library built in Swift 6 mode, an Objective-C stand-in injected through a Swift parameter, and an Objective-C stand-in whose block is named completionHandler all miss the bug. An Objective-C stand-in whose block is named handler, called by name, and a fake in a library built in Swift 5 mode, called by name, both catch it." src="https://cdn-images-1.medium.com/max/1024/1*NSEMreiBuC1Ib_T0KMkaRQ.png" /></figure><p>Two of the misses surprised me. Injecting the Objective-C stand-in through a Swift parameter removes the check, because the compiler decides from the function the closure is passed to, and that’s now a Swift parameter. And the name of the block matters: the same closure crashes when the stand-in calls its block handler and runs fine when it calls it completionHandler, because of a Swift 6.2 import rule I&#39;ll get to in the next section.</p><p>The fake in a Swift 5 library catches it however you import it, even with complete checking on, so this isn’t only about Objective-C.</p><p><a href="https://github.com/swiftlang/swift-testing/blob/main/Sources/Testing/Testing.docc/exit-testing.md">Swift Testing’s exit tests</a> run the body in a child process, so a crash fails one test instead of killing the run:</p><pre>@Test func callbackSurvivesOffMain() async {<br>    await #expect(processExitsWith: .success) {<br>        await MainActor.run { Recorder().askFixed() }<br>        // Long enough for the stand-in to answer.<br>        try? await Task.sleep(for: .milliseconds(300))<br>    }<br>}</pre><p>I checked that this test can fail. Delete @Sendable from the fix and it fails. A second test expects the broken closure to crash, and it fails if you fix that closure. The package&#39;s fakes that can&#39;t catch the bug pass in every run, which is the whole problem. <a href="https://github.com/djknudson/swift6-callback-crash">The package is on GitHub</a>: clone it and run swift test. It also holds the iOS app behind the real-prompt runs, the raw results and the API survey script.</p><p>Exit tests aren’t available on iOS and need Xcode 26 or later, so keep this logic and its stand-in in a package you can test on the Mac. Zhiva’s own guard is cruder: tests that read the source and fail if that speech call ever comes back or a tap closure moves inline.</p><h3>Finding it in your app</h3><p>You can test any callback in your own code in a few seconds. Inside a @MainActor function, call a @MainActor function from the closure with no await:</p><pre>SomeAPI.request { _ in mainActorOnlyFunction() }</pre><p>No diagnostic means the closure is isolated. Unless the API declares the callback @MainActor, or it comes from a library built in Swift 6 mode, it&#39;s exposed. A warning or error that you&#39;re calling from a nonisolated context means the callback is Sendable, and you&#39;re safe from this crash. Fix the warning anyway, because that call would run off the main thread.</p><p>One exception: a closure assigned to a block property stays isolated, gets no check, and simply runs on whatever thread calls it.</p><p>I ran that test on 16 callback APIs against the iOS 27.2 SDK (the package’s README lists them all), and six keep the closure isolated:</p><ul><li>SFSpeechRecognizer.requestAuthorization</li><li>AVAudioNode.installTap, deprecated as of iOS 27, though its replacement takes the same block</li><li>PHPhotoLibrary.requestAuthorization(_:), the deprecated form</li><li>AVAudioSession.requestRecordPermission, also deprecated</li><li>INPreferences.requestSiriAuthorization</li><li>CMPedometer.queryPedometerData</li></ul><p>Isolated only means exposed. Whether it crashes depends on the thread that answers. On the simulator with permission already granted, the old Photos call crashed, and the old AVAudioSession call answered on the main thread and didn&#39;t. On a Mac, a real AVAudioEngine tap, written as a plain closure in @MainActor code, trapped.</p><p>Most of the permission APIs I checked are safe from this. Since Swift 6.2 (<a href="https://github.com/swiftlang/swift-evolution/blob/main/proposals/0463-sendable-completion-handlers.md">SE-0463</a>), when a method also has an async version, Swift imports its callback as @Sendable, even if the Objective-C header doesn&#39;t say so. That usually depends on the block being named like completionHandler, or on the header marking the method async, as the new Photos call does. requestAuthorization: calls its block handler and has no such mark, so it gets neither. A quick tell: an async version almost always means a @Sendable callback. The main exception is methods on main-actor types, such as view controllers, which SE-0463 leaves alone.</p><h3>Xcode’s new-app template can arm this check</h3><p>Xcode 27.2’s new-app template sets SWIFT_DEFAULT_ACTOR_ISOLATION to MainActor, and it still sets SWIFT_VERSION to 5.0. I compiled a plain class with swiftc, using the flags those settings produce, with no @MainActor written anywhere in the file:</p><pre>final class PlainRecorder {<br>    func ask() {<br>        SFSpeechRecognizer.requestAuthorization { status in<br>            print(status.rawValue)<br>        }<br>    }<br>}</pre><p>Through the real prompt on the simulator, that runs in Swift 5 mode, on a background queue, without a word. Change the language mode to 6 and change nothing else, and it crashes. There’s no warning and no annotation to search for. In a project created from Xcode’s current app template, a closure handed to one of those exposed callbacks is main-actor code unless you’ve marked its surroundings nonisolated, and moving to Swift 6 mode arms the check.</p><p>Delegates go the same way, and the compile test won’t find them. SE-0423 puts the same check on a @preconcurrency protocol conformance. On a Mac, with a stand-in Objective-C protocol under the template&#39;s settings in Swift 6 mode, a plain conformance needed no annotation at all: it compiled with no diagnostics and crashed when called off the main thread.</p><p>I don’t want this check removed. In Swift 5 mode, main-actor code runs on a background thread and nobody hears about it, which is the problem Swift 6 set out to end. The compiler flag -disable-dynamic-actor-isolation turns the check off, and the proposal discourages using it.</p><h3>What I changed</h3><p>The check found the bug the first time the code ran. I had read a green build as evidence that the voice log worked.</p><p>So before a release, I now ask every feature a plainer question than whether its tests pass: has anyone actually run it?</p><p>For Zhiva’s voice log, in more than 80 builds, I can’t find one where the answer was yes.</p><p><em>I build Zhiva, a pet-health app for iPhone, and write up what measuring my own software turns up. More at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><h3>Sources</h3><ul><li>Reproduction package: <a href="https://github.com/djknudson/swift6-callback-crash">https://github.com/djknudson/swift6-callback-crash</a></li><li>Swift Evolution, SE-0423, dynamic actor isolation: <a href="https://github.com/swiftlang/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md">https://github.com/swiftlang/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md</a></li><li>Swift Evolution, SE-0463, completion handlers imported as @Sendable: <a href="https://github.com/swiftlang/swift-evolution/blob/main/proposals/0463-sendable-completion-handlers.md">https://github.com/swiftlang/swift-evolution/blob/main/proposals/0463-sendable-completion-handlers.md</a></li><li>Swift 6 migration guide, incremental adoption: <a href="https://github.com/swiftlang/swift-migration-guide/blob/main/Guide.docc/IncrementalAdoption.md">https://github.com/swiftlang/swift-migration-guide/blob/main/Guide.docc/IncrementalAdoption.md</a></li><li>Apple, SFSpeechRecognizer.requestAuthorization(_:): <a href="https://developer.apple.com/documentation/speech/sfspeechrecognizer/requestauthorization(_:)">https://developer.apple.com/documentation/speech/sfspeechrecognizer/requestauthorization(_:)</a></li><li>Swift Testing, exit testing: <a href="https://github.com/swiftlang/swift-testing/blob/main/Sources/Testing/Testing.docc/exit-testing.md">https://github.com/swiftlang/swift-testing/blob/main/Sources/Testing/Testing.docc/exit-testing.md</a></li><li>Swift Forums, “Effect of @MainActor inference on Obj-C completion callbacks”, 2024: <a href="https://forums.swift.org/t/effect-of-mainactor-inference-on-obj-c-completion-callbacks/75058">https://forums.swift.org/t/effect-of-mainactor-inference-on-obj-c-completion-callbacks/75058</a></li><li>Amana, “Swift 6 Gave Me Zero Warnings, but Two Objective-C Callbacks Still Crashed at Runtime”, HackerNoon, 2026: <a href="https://hackernoon.com/swift-6-gave-me-zero-warnings-but-two-objective-c-callbacks-still-crashed-at-runtime">https://hackernoon.com/swift-6-gave-me-zero-warnings-but-two-objective-c-callbacks-still-crashed-at-runtime</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=005dff254452" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/an-empty-closure-can-crash-your-swift-6-app-005dff254452">An Empty Closure Can Crash Your Swift 6 App</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Four AI Judges Were Worth 1.7 Votes]]></title>
            <link>https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/96a84e337405</guid>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 14:37:14 GMT</pubDate>
            <atom:updated>2026-11-17T16:14:53.268Z</atom:updated>
            <content:encoded><![CDATA[<h4>Three Claude models and GPT, 300 labeled SNLI pairs, three runs. Their mistakes overlapped so much their vote never beat Claude Opus alone.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Jiw_IHVEkVag6jl" /><figcaption>Photo by <a href="https://unsplash.com/@ekrull?utm_source=medium&amp;utm_medium=referral">Eric Krull</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Corrected November 17, 2026, after I found the October version misdescribed its own method. Every current panel result below comes from a three-run rerun. The headline moved from 1.6 to 1.7 votes, and several conclusions flipped; every changed conclusion is listed near the end.</em></p><p>Claude Opus 5.5, judging alone, labeled 87.1% of 300 sentence pairs correctly, averaged over three runs. A majority vote of Opus, Claude Haiku 4.5, Claude Sonnet 5.5 and GPT-6.1 Sol got 84.1%, and in none of the three runs did the vote beat Opus. Counted the way Guneet Kohli counts in his May paper, <em>Nine Judges, Two Effective Votes</em>, those four judges were worth 1.69 effective votes. They kept getting the same items wrong. Kohli’s nine frontier models, from seven families, came to 2.18.</p><p>I run code reviews through a three-seat panel, Claude, GPT and Gemini, on the theory that different vendors catch different things. Apple ships a small language model inside macOS, from a company with no other model on my panel. If shared training is what makes judges agree on the wrong answer, an outsider should help.</p><p>On paper, it did: adding Apple’s on-device model took the four judges to 2.43 effective votes, inside the paper’s range of roughly 2.0 to 2.5, while adding Google’s Gemini took them only to 1.74. But none of the panels I report here, with Apple, Gemini or both, ever outvoted Opus. And the biggest change I found in any cloud judge’s independence came from a single thinking setting.</p><h3>What the paper measured</h3><p>Kohli’s nine judges included GPT-4o, Claude Sonnet 4.5 and Gemini 2.5 Pro. The task was natural language inference: given a premise and a hypothesis, say whether the hypothesis follows (entailment), conflicts (contradiction), or neither (neutral). The items come from ChaosNLI, which carries 100 human labels per item, so “correct” has a 100-vote majority behind it.</p><p>The method fits in a paragraph. For each judge, mark every item it got wrong. For each pair of judges, correlate those two error vectors; on 0/1 data that correlation is the phi coefficient. Average the pairs and apply the Kish design-effect formula:</p><pre>n_eff = k / (1 + (k - 1) * mean_phi)</pre><p>Independent judges have a mean phi of zero, and n_eff equals k. Judges that make identical mistakes have a mean phi of one, and n_eff is one no matter how many you add.</p><p>The 2.18 is from his MNLI items; the paper puts the range across all its datasets and variants at roughly 2.0 to 2.5. In every condition, the best single judge matched the full panel within noise or beat it.</p><h3>The panel I could run from one Mac</h3><p>Six models, all called from a Mac mini: Claude Haiku 4.5, Sonnet 5.5 and Opus 5.5 through the Claude API, GPT-6.1 Sol through OpenAI’s Responses API, Gemini 4 Carbon through Google’s Gemini API, and Apple’s on-device model through the FoundationModels framework, from a 102-line Swift program. Each cloud model ran at its lowest reasoning setting, and three models also ran a second way: Haiku with thinking on, Sonnet at low effort with adaptive thinking, and Apple’s model with free-text output. That makes nine judges, each run on all 300 items three times.</p><p>The items are 300 sentence pairs from the SNLI test set. SNLI’s test pairs carry five annotator labels each, and I drew 100 pairs from each agreement level: all five annotators agree with the majority label, four of five, three of five. I didn’t use ChaosNLI itself because its license is non-commercial, and SNLI’s (CC BY-SA 4.0) is not.</p><p>Every judge got the paper’s own one-word prompt from its appendix, one call per item, a fresh context each time, no batching:</p><pre>Given the following premise and hypothesis, determine the relationship between them.<br> <br>Premise: {premise}<br> <br>Hypothesis: {hypothesis}<br> <br>What is the relationship? Reply with ONLY one word: &quot;entailment&quot;, &quot;neutral&quot;, or &quot;contradiction&quot;.</pre><p>The cloud judges all got the same one-line system text, “Follow the user’s instructions.” Apple’s model got none.</p><p>The results compare four panels, named for what they contain:</p><ul><li>the October four: Haiku with thinking off, Sonnet and Opus at low effort, and GPT, the shape of the panel I published in October;</li><li>the October five: the October four plus Apple’s on-device model;</li><li>the cloud five: the October four with Sonnet switched from low effort to thinking off, plus Gemini;</li><li>the main six: the cloud five plus Apple’s model.</li></ul><h3>Under two votes, and a vote that never beat its best judge</h3><p>From here on, a number is the mean of the three runs. Every direction I report held in all three runs unless I say otherwise.</p><p>The October four had a mean pairwise phi of 0.46, which puts n_eff at 1.69. The three runs’ 95% bootstrap intervals were 1.55 to 1.90, 1.49 to 1.81 and 1.56 to 1.91. Adding Apple’s model, the October five brought the mean phi down to 0.26 and n_eff up to 2.43, inside the paper’s range of roughly 2.0 to 2.5.</p><p>The most accurate judge was Claude Opus 5.5, at 87.1%. The October four’s majority scored 84.1%, nine items behind Opus, and needed a tie-break on 20 to 24 of its 300 votes. As a fifth voter, Apple’s model cut the tie-breaks to 5 to 8 and lifted the vote to 86.3%, still 2 to 3 items behind Opus. Kohli’s MNLI panel edged its best judge by 0.2 points, which he calls noise.</p><p>The paper has a second instrument for what correlation costs, a Condorcet null model. Keep every judge’s error pattern (how often it gives each label for each correct answer) separately for each difficulty level, but let the judges vote independently. Under that model the October five’s majority would have scored 94.4%. The real vote fell 8.1 points short, with each run’s 95% interval about 4.4 points wide. Kohli reports shortfalls of 8 to 22 points.</p><p>All of the October five were wrong on 3 or 4 of the 300 items, against 0.13 to 0.15 expected if their errors were independent, with each judge keeping its accuracy on each difficulty level. The October four alone all missed 10 to 12, against 1.1 to 1.4 expected. And in no run did any of 10,000 shuffles of the five judges’ errors, within each difficulty level, produce a mean phi as high as the real one.</p><h3>Six judges, fewer votes than five</h3><p>The main six change two things from the October five: Sonnet switches from low effort to thinking off, and Gemini joins. That puts every cloud model at its lowest setting, the paper’s no-reasoning condition wherever each API allows it.</p><figure><img alt="Accuracy table, 300 SNLI pairs, three-run means. Overall: Claude Opus 5.5 87.1% (best single judge); Haiku 4.5 thinking off 83.7%; Sonnet 5.5 thinking off 83.6%; Gemini 4 Carbon 83.3%; GPT-6.1 Sol 82.3%; Apple on-device 54.7%; majority of the six 86.6%. Other arms: Haiku thinking on 80.0%, Sonnet low effort 82.3%, Apple free text 51.3%. Also shown by annotator agreement (5, 4, 3 of 5). The paper’s independence model predicted 95.0% for the six’s majority." src="https://cdn-images-1.medium.com/max/1024/1*QRs-EVIm1Fej_kA0qFmskg.png" /></figure><p>Their mean phi was 0.32, for an n_eff of 2.31: fewer effective votes than the October five, and most of the drop came from one setting. Adding Gemini to the October five lowered the count only slightly, to 2.41. Switching Sonnet from low effort to thinking off took it the rest of the way to 2.31.</p><p>The main six’s majority scored 86.6%, against Opus’s 87.1%. Here the runs differed: the vote finished one item behind Opus, level with it, and four behind. The independence model predicted 95.0%, a shortfall of about 8.5 points. All six judges missed 4 or 5 items, against 0.04 to 0.05 expected if they were independent.</p><h3>Different vendor, same mistakes</h3><figure><img alt="Heatmap of pairwise error correlation (phi) among the main six, three-run means. Sonnet (thinking off) and Opus 0.69; Opus and Gemini 0.64; Sonnet and GPT 0.59; Sonnet and Gemini 0.56; Opus and GPT 0.52; Haiku with Sonnet, Opus and GPT 0.39 to 0.40; GPT and Gemini 0.38; Haiku and Gemini 0.32; Apple with each cloud judge between -0.08 and 0.06. Effective votes: October four 1.69 (1.63 to 1.72), cloud five 1.70, main six 2.31." src="https://cdn-images-1.medium.com/max/1024/1*nGi48-O5fZTxXu1GNxsD9g.png" /></figure><p>In the main six, the most correlated pair on average was two Claude models, Sonnet with thinking off and Opus, at 0.69. Next came Opus with Gemini at 0.64 and Sonnet with GPT at 0.59. GPT’s mistakes sat about as close to the Claude judges’ as theirs did to each other. In the second run, Opus with Gemini came out on top, at 0.72, the highest correlation between any two judges in any run.</p><p>A second and a third vendor bought little. The three Claude judges of the October four were worth 1.61 effective votes; adding GPT took them to 1.69, and adding Gemini to 1.74. Only Apple’s model moved the count much.</p><p>The Kish formula also gives a ceiling. As k grows, n_eff approaches 1 / mean_phi, which for the October four comes to 2.07 to 2.25 across the runs. If every additional cloud judge correlated the way these four do, no number of them would get much past two votes.</p><h3>Thinking on, thinking off</h3><p>Here is each judge’s setting, and the lower settings its API refused with a 400 error:</p><ul><li>Claude Haiku 4.5, thinking off: thinking disabled, no effort setting; nothing lower exists.</li><li>Claude Haiku 4.5, thinking on: thinking enabled with a 31,999-token budget, the same as Claude Code sends; a comparison arm.</li><li>Claude Sonnet 5.5, thinking off: thinking between_tools, effort low; refused disabled.</li><li>Claude Sonnet 5.5, low effort: thinking adaptive, effort low; a comparison arm.</li><li>Claude Opus 5.5, low effort: thinking adaptive, effort low; refused disabled and between_tools.</li><li>GPT-6.1 Sol: reasoning effort low; refused minimal and none.</li><li>Gemini 4 Carbon: thinking level LOW; refused MINIMAL.</li><li>Apple on-device, guided and free text: greedy sampling, no reasoning setting; nothing to refuse.</li></ul><p>between_tools turns off Sonnet&#39;s up-front thinking. Gemini&#39;s thinking can&#39;t be turned off: a zero thinking budget, which isn&#39;t documented for Gemini 4, still produced thought tokens on a real item. So I ran both models that let me turn thinking off both ways.</p><p>With thinking on, Haiku thought on every one of its 900 calls, a median of about 300 thinking tokens per one-word answer; with it off, its median output was 4 tokens. Thinking on cost $0.63 to $0.68 per run of 300 calls; thinking off cost $0.03.</p><figure><img alt="Table comparing one thinking setting at a time, three-run means. Haiku 4.5 thinking on vs off: accuracy 80.0% vs 83.7%; error correlation with Sonnet low, Opus and GPT 0.49, 0.50, 0.61 vs 0.35, 0.39, 0.40; October four’s effective votes 1.53 vs 1.69. Sonnet 5.5 low effort vs thinking off: accuracy 82.3% vs 83.6%; correlation with Haiku, Opus, GPT, Gemini 0.35, 0.57, 0.53, 0.60 vs 0.40, 0.69, 0.59, 0.56; cloud five’s effective votes 1.74 vs 1.70." src="https://cdn-images-1.medium.com/max/1024/1*6iRnAYTSvQC7Ax3EnVtMvw.png" /></figure><p>Thinking made Haiku less accurate and more like the rest of the panel. Its accuracy fell from 83.7% to 80.0%, and its correlations with Sonnet at low effort, Opus and GPT rose from 0.35, 0.39 and 0.40 to 0.49, 0.50 and 0.61. The October four’s count fell from 1.69 to 1.53. Kohli saw the same direction in his chain-of-thought variant: his mean phi rose from 0.391 to 0.456, and n_eff fell from 2.18 to 1.94.</p><p>Sonnet 5.5 at low effort uses adaptive thinking, which Anthropic’s docs say skips thinking for simple tasks at that level. It skipped it here: zero thinking tokens on all 900 calls, the same as with thinking off. The setting changed Sonnet’s answers anyway. With thinking off, it scored 83.6% against 82.3%, 2 to 5 items better per run. It also moved closer to Opus, from 0.57 to 0.69. The October four plus Gemini, with Sonnet at low effort, come to 1.74 effective votes; the cloud five, with Sonnet’s thinking off, come to 1.70. That is the opposite direction from Haiku.</p><p>Opus, GPT and Gemini, which can’t turn thinking off, used it on a minority of items: Opus on 36 to 42 of the 300 in a run, GPT on 93 to 98, Gemini on 13 to 18.</p><h3>The judge that said “entanglement”</h3><p>Apple’s on-device model was my outsider, and the first thing it taught me was about output contracts.</p><p>Asked to reply with one word, it answered “entitlement” in my smoke test. In the free-text runs, which I kept as a robustness check, it answered “entanglement” 105 times, “contradiction” 95 times and “entitlement” 91 times. “Entailment” appeared 4 times, and “neutral” once. The tally was identical in all three runs. The paper’s rule for an unparseable reply is a deterministic random label. On a judge that misses the label vocabulary two thirds of the time, that rule fills two thirds of its error vector with labels that are uncorrelated with every other judge by construction. I expected that to inflate the number I was trying to measure. It didn’t: with free text, the October five came out at 2.26 effective votes, against 2.43 with guided output.</p><p>So, on the strength of the smoke test and before reading any full-run result, I committed the panel to the framework’s guided generation, which constrains decoding to a Swift type:</p><pre>@Generable<br>enum NLILabel: String {<br>    case entailment<br>    case neutral<br>    case contradiction<br>}<br> <br>let session = LanguageModelSession(model: .default)<br>let options = GenerationOptions(samplingMode: .greedy, maximumResponseTokens: 32)<br>let reply = try await session.respond(to: prompt, generating: NLILabel.self, options: options)</pre><p>A fresh session per item, greedy sampling (which Apple documents as always producing the same output for a given input), no app bundle, no entitlement. Greedy sampling also means its three runs were identical by construction, and they were. Constrained this way, the framework’s safety guardrails declined the same 4 of the 300 items in every run, each with “May contain unsafe content.” One of them: <em>“A boy toddler is holding a bat he is about to swing at a pinata.”</em> Those four got the paper’s hash-assigned label. The free-text runs declined the same four.</p><p>It was right on 54.7% of items. Answering “neutral” every time would score about 40% on this set, so it is doing something. Its error correlations with the cloud five, where Sonnet’s thinking is off, average between −0.08 and 0.06. Effectively zero. Its correlation with Sonnet at low effort, which isn’t in the main six, was slightly negative: −0.17. In January Apple and Google announced that the next generation of Apple Foundation Models will be based on Gemini. Gemini was on this panel, and its pairing with Apple’s model was the least correlated pair in the main six, at −0.08.</p><p>At 54.7% on a three-way task, Apple’s model still helped the vote. It lifted the October four’s majority by 6 to 7 items, and the October five finished ahead of my three Claude judges voting alone in two runs and level with them in the third. It couldn’t lift the vote past Opus.</p><h3>It isn’t only the ambiguous items</h3><p>The obvious objection is that some items are genuinely ambiguous, so of course the models agree on them, and humans disagree too. It’s partly right. All of the main six, with Sonnet’s thinking off, missed 4 or 5 items. All but one of them each time came from the group where only three of five annotators agreed; the other came from the four-of-five group, and none from the group where all five agreed. One of them, missed by all six judges in every run:</p><blockquote><em>Premise: </em>a young boy using a field microscope to identify a field specimen during a field trip.<em> Hypothesis: </em>The boy is on a science field trip.</blockquote><p>The annotators split three for neutral, one for entailment and one for contradiction. All six judges said entailment, which is at least a defensible reading. Some of the panel’s shared “errors” are shared disagreements with a thin human majority.</p><p>Then I reran the measurement on the 100 items where all five annotators agreed. The October four still had a mean phi of 0.42 and an n_eff of 1.78. The paper’s version of this check, on items where at least 80% of its 100 annotators agreed, found 2.67 effective votes for nine judges. Clear items reduce the correlation. They don’t remove it.</p><p>Unanimity came close to a safe harbor here. The October five agreed on 113 to 116 items and were right on 98.2% to 99.1% of them; all five gave the same wrong label once or twice per run. Kohli reports a 9.1% error rate on his panel’s unanimous items, against roughly 0.02% if the judges were independent.</p><h3>Three runs of every judge</h3><p>I set no temperature for any judge: the Claude API version I used removes it, Gemini 4 ignores it, and GPT ran at its default. For the cloud judges, the share of items that got the same label in all three runs:</p><ul><li>Claude Sonnet 5.5, low effort: 98.3%</li><li>Claude Sonnet 5.5, thinking off: 97.7%</li><li>GPT-6.1 Sol: 97.3%</li><li>Claude Haiku 4.5, thinking off: 96.7%</li><li>Claude Opus 5.5: 96.3%</li><li>Gemini 4 Carbon: 94.7%</li><li>Claude Haiku 4.5, thinking on: 90.0%</li></ul><p>Haiku with thinking on was the least stable judge by a distance: it gave different answers across its three runs on 30 of the 300 items.</p><p>The panel numbers moved less than any one run’s uncertainty. The October four’s count stayed within about 0.05 of its 1.69 average, well inside each run’s 95% interval, and the October five’s and main six’s counts each spread by 0.12.</p><h3>How I checked it, and what 300 items can’t tell you</h3><p>The Claude judges went straight to the Claude API, not through Claude Code: the version I tested in November adds its own context to every request (see the next section). For a judge, that is shared context. Three Claude judges reading the same added text could agree for reasons that have nothing to do with the models. Through the API, a request carries what I write and nothing else. This is the whole body of a Sonnet call, with the item’s prompt in place of PROMPT:</p><pre>{<br>  &quot;model&quot;: &quot;claude-sonnet-5-5&quot;,<br>  &quot;max_tokens&quot;: 16000,<br>  &quot;system&quot;: &quot;Follow the user&#39;s instructions.&quot;,<br>  &quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: PROMPT}],<br>  &quot;thinking&quot;: {&quot;type&quot;: &quot;between_tools&quot;},<br>  &quot;output_config&quot;: {&quot;effort&quot;: &quot;low&quot;}<br>}</pre><p>Before collecting anything, a probe confirmed every setting, including the 400 errors listed earlier. I saved the raw bytes of every request: the Claude API doesn’t echo the thinking or effort setting back, so the request is the proof. An audit written separately from the collector re-read every row of all three runs and found no violations, and an independent recompute, written without reading my analysis code, reproduced its numbers. Everything ran on a Mac mini M4 under macOS 27.2.1 on November 17, 2026, and every cloud response named the model I requested: claude-haiku-4-5-20251001, claude-sonnet-5-5, claude-opus-5-5, gpt-6.1-sol and gemini-4-carbon.</p><p>It’s 300 items and up to six judges at a time, against the paper’s 1,000 items and nine. Three runs show how far a result moves on its own, but they don’t add items. SNLI is old and public, so the cloud judges may well have seen it in training, and I didn’t test for that. The same applies to the paper’s ChaosNLI items, which are drawn from SNLI, MNLI and αNLI. My gold labels come from five annotators, not 100.</p><h3>What the October version got wrong</h3><p>Two things the October version said about its method were wrong, and a third doesn’t hold for the Claude Code version I tested in November.</p><p>First, the effort. A global Claude Code setting on my machine, CLAUDE_CODE_EFFORT_LEVEL=xhigh, overrode the per-call --effort low, so Sonnet and Opus ran at extra-high effort. October&#39;s own logs show it: Sonnet wrote more than its one-word answer on 78 of the 300 items, up to 501 output tokens, and Opus did on 170. Rerun at true low effort on the same 300 items, Sonnet never went past 6 tokens, and Opus went past its answer on 7.</p><p>Second, the piece said Sonnet 5.5’s thinking can’t be turned off. Through the API it can turn off up-front thinking; only Opus can’t.</p><p>Third, the piece said --system-prompt replaces Claude Code&#39;s default prompt entirely. When I captured Claude Code&#39;s requests on November 16 (version 2.1.326; October&#39;s weren&#39;t recorded), it still added an identity line, environment details, the date and my account email.</p><p>So I rebuilt the study, with the cloud judges on their APIs and three full runs where October reported one, and added Gemini 4 Carbon and a thinking-off Sonnet. The numbers that changed, October first:</p><ul><li>The October four: 1.57 effective votes, now 1.69, which moved the title from 1.6 to 1.7.</li><li>The October five: 2.23, now 2.43.</li><li>The best judge: Sonnet at 86.3%, now Opus at 87.1%.</li><li>The October five’s vote: two items ahead of its best member, now 2 to 3 items behind Opus.</li><li>Items all five missed: 8 of 300, now 3 or 4.</li></ul><p>And the October conclusions that no longer hold:</p><ul><li>“The pair I would have bet was most different, a GPT model and a Claude model, was the most alike.” The most alike pair is now, on average and in two of the three runs, two Claude models, Sonnet and Opus.</li><li>Apple’s independence “came with too little accuracy to help the vote much,” and the October five finished one item behind my three Claude judges voting alone. Apple’s model now lifts the October four’s vote by 6 to 7 items, and the October five finish ahead of those three Claude judges in two runs and level in the third.</li><li>“Unanimity is not a safe harbor either”: the five were right on 95.8% of the items they agreed on. Now it’s 98.2% to 99.1%.</li><li>“If every additional cloud judge correlated the way these four do, no number of them would reach two votes.” The ceiling is now 2.07 to 2.25, a little past two.</li></ul><h3>What I’d change in a panel tomorrow</h3><p>Measure before you trust it. You need a few hundred items with known answers and a few runs of every judge. One run of all nine of mine took about 19 minutes and cost $1.30 to $1.35, about half of it Haiku with thinking on; Apple’s model added about 200 seconds of compute across its two modes and nothing to the bill. The calculation is short:</p><pre>from itertools import combinations<br>from statistics import correlation  # Pearson; on 0/1 error vectors this is phi<br> <br>def n_eff(errors):<br>    &quot;&quot;&quot;errors: {judge_name: [1 if wrong else 0, one per item]}&quot;&quot;&quot;<br>    # correlation() raises StatisticsError on a constant vector: drop any judge<br>    # that is right, or wrong, on every item before calling this.<br>    pairs = [correlation(errors[a], errors[b]) for a, b in combinations(errors, 2)]<br>    mean_phi = sum(pairs) / len(pairs)<br>    k = len(errors)<br>    return k / (1 + (k - 1) * mean_phi)</pre><p>Then, with that labeled set in hand:</p><ol><li>Compare the vote to its best member on every run. If the majority doesn’t beat your best single judge, the panel is costing you money for nothing. Here no panel’s vote beat Opus alone.</li><li>Check what your tools send. A global setting can override a per-call flag, and a CLI can add context you never wrote (see “What the October version got wrong”). Saving the request bytes settled what each judge saw, and the token counts showed which judges were thinking.</li><li>Run each judge more than once. Thinking-on Haiku gave different answers across its three runs on one item in ten.</li><li>Don’t assume vendor diversity buys independence. Adding GPT and Gemini to my three Claude judges bought less than a fifth of a vote in every run.</li><li>Split votes were less accurate. When the October five split, on 184 to 187 of the 300 items, the majority was right 78.3% to 79.6% of the time, against 98.2% to 99.1% when they agreed. Send the split items to a human, or to your best single judge with more reasoning budget. More voters from the same pool won’t fix them.</li></ol><p>The most independent judge I tested was right 54.7% of the time. Effective votes count independence and say nothing about who knows the answer, so measure both on a labeled set before you pay for another seat.</p><p><em>I run my own AI tooling on a Mac mini and write up what measuring it turns up, from cross-vendor model panels to Apple’s on-device models. More at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><h3>Sources</h3><ul><li>Guneet Kohli, “Nine Judges, Two Effective Votes: Correlated Errors Undermine LLM Evaluation Panels,” arXiv 2605.29800, May 28, 2026: <a href="https://arxiv.org/abs/2605.29800">https://arxiv.org/abs/2605.29800</a></li><li>SNLI 1.0, Bowman et al., 2015, CC BY-SA 4.0: <a href="https://nlp.stanford.edu/projects/snli/">https://nlp.stanford.edu/projects/snli/</a>. The field-trip pair and the pinata premise quoted above are from its test set.</li><li>ChaosNLI, Nie et al., 2020, CC BY-NC 4.0: <a href="https://github.com/easonnie/ChaosNLI">https://github.com/easonnie/ChaosNLI</a></li><li>Data, available on request: per-run labels for all nine judges (results/v2/rep1/labels.csv, rep2/labels.csv, rep3/labels.csv) and the input manifest results/v2/inputs.json, SHA-256 c7f7a1ade32703d102ba3afb66e1f4668021b2c29b02dfda29b28ccfe7f3fa65, which hashes every raw file the analysis read.</li><li>Claude API, thinking settings per model: <a href="https://platform.claude.com/docs/en/build-with-claude/thinking">https://platform.claude.com/docs/en/build-with-claude/thinking</a>; effort and adaptive thinking: <a href="https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost">https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost</a>; API versions: <a href="https://platform.claude.com/docs/en/api/versioning">https://platform.claude.com/docs/en/api/versioning</a></li><li>Claude Code, effort precedence (CLAUDE_CODE_EFFORT_LEVEL outranks --effort): <a href="https://code.claude.com/docs/en/model-config">https://code.claude.com/docs/en/model-config</a>; environment variables: <a href="https://code.claude.com/docs/en/env-vars">https://code.claude.com/docs/en/env-vars</a>; CLI reference: <a href="https://code.claude.com/docs/en/cli-reference">https://code.claude.com/docs/en/cli-reference</a></li><li>OpenAI, GPT-6.1 Sol: <a href="https://developers.openai.com/api/docs/models/gpt-6.1-sol">https://developers.openai.com/api/docs/models/gpt-6.1-sol</a></li><li>Google, Gemini thinking: <a href="https://aistudio.google.com/docs/thinking">https://aistudio.google.com/docs/thinking</a></li><li>Apple, guided generation: <a href="https://developer.apple.com/documentation/foundationmodels/generating-swift-data-structures-with-guided-generation">https://developer.apple.com/documentation/foundationmodels/generating-swift-data-structures-with-guided-generation</a>; greedy sampling: <a href="https://developer.apple.com/documentation/foundationmodels/generationoptions/samplingmode-swift.struct/greedy">https://developer.apple.com/documentation/foundationmodels/generationoptions/samplingmode-swift.struct/greedy</a></li><li>Google and Apple joint statement, January 12, 2026: <a href="https://blog.google/company-news/inside-google/company-announcements/joint-statement-google-apple/">https://blog.google/company-news/inside-google/company-announcements/joint-statement-google-apple/</a></li><li>Python, statistics.correlation (raises StatisticsError on a constant input): <a href="https://docs.python.org/3/library/statistics.html#statistics.correlation">https://docs.python.org/3/library/statistics.html#statistics.correlation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96a84e337405" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/my-four-ai-judges-were-worth-1-6-votes-96a84e337405">My Four AI Judges Were Worth 1.7 Votes</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apple’s AI Told Me It Was Available. Then It Refused All 20 Calls.]]></title>
            <link>https://levelup.gitconnected.com/apples-ai-told-me-it-was-available-then-it-refused-all-20-calls-b6f03d7a8620?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6f03d7a8620</guid>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 15:16:16 GMT</pubDate>
            <atom:updated>2026-08-31T15:16:16.276Z</atom:updated>
            <content:encoded><![CDATA[<p>The cloud model refused twenty calls behind a documented gate. The on-device model has run 9,212 through the other door at $0.00.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b4legv0na_6BFJO9" /><figcaption>Photo by <a href="https://unsplash.com/@heathergreengreen?utm_source=medium&amp;utm_medium=referral">Heather Green</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Twenty calls. Twenty identical refusals:</p><pre>Private Cloud Compute is not available in this context.<br>Please use the Terminal app.</pre><p>I was in the Terminal app: a real Terminal.app window driven by osascript, with TERM_PROGRAM=Apple_Terminal in the environment, a tty on the shell, and Terminal.app sitting at the root of the process tree. My surface check tested exactly those three things and passed all three. The day before, the same binary had told me the model was there: fm available printed PCC model available and exited 0.</p><p>Then it refused twenty times out of twenty without once saying why. What it was reading had been documented on the public web for five weeks. The reason it read <em>me</em> the way it did was one keyword argument in my own harness, two lines above the call.</p><p>That was the first week of August, on macOS 27 beta 4. Nobody is going to re-run that experiment: on August 24 Apple removed Private Cloud Compute from the command-line tool those calls were going through.</p><p>The removal is the news, such as it is. What I came away with is smaller and more useful: on one Mac there are four ways onto two Apple models, each gated by something different, and not one of those gates is a property of a model.</p><h3>The CLI, the two models, and four ways in</h3><p>/usr/bin/fm is Apple’s own command-line interface to Foundation Models: Identifier=com.apple.fm under codesign -dv, owned by root:wheel, man page dated June 8, 2026. It responds, chats, counts tokens, checks availability, and hosts a Chat Completions API server against the model on your Mac via fm serve. Apple announced it at WWDC26 in session 334, “Build AI-powered scripts with the fm CLI and Python SDK,” alongside an official Python package.</p><p>Two models were on offer: system, the on-device one, and pcc (Private Cloud Compute), which Apple’s own session calls “a much bigger model” that “will perform better on complex problems,” with usage limits.</p><p>The CLI is not the only way to either. Both models also sit behind the Foundation Models framework, which any Mac binary can link. Four routes in all, and across three weeks in August they behaved like four separate products:</p><figure><img alt="Two-by-two map of four routes. Columns: the CLI (/usr/bin/fm) and the framework (FoundationModels). Rows: pcc, the cloud model, and system, the on-device model. pcc via CLI, gated by a check inside the binary: rc 0 on Aug 5, refused 20 of 20 on Aug 6, deleted Aug 24. pcc via framework, gated by an account entitlement: error 1046 in June, PCCOK on Aug 28. system via CLI, gated by a legal agreement: exit 69 for two weeks. system via framework, no gate: 9,212 calls at $0.00, never interrupted." src="https://cdn-images-1.medium.com/max/1024/1*-n5d_qpheJpGqxMwtUPgAg.png" /></figure><p>The rest of this is what each one cost me to find out.</p><h3>Taking the gate apart</h3><p>Start with the entitlement, the one gate Apple documents. Through the framework, PCC sits behind com.apple.developer.private-cloud-compute, granted on request to Small Business Program developers under two million first-time downloads. In June, PrivateCloudComputeLanguageModel().availability came back .available and respond then failed with ModelManagerError 1046; the property answering a question about the model, the failure being about my account. (That code appears nowhere in Apple’s docs; it’s my reading of my own crash.)</p><p>Two months later I went and asked why the property could not have known. PrivateCloudComputeLanguageModel().isAvailable returns true on an ad-hoc-signed binary with no team identity and no entitlement whatsoever. I compiled one and ran it. Read the availability type’s cases and the reason is structural rather than a bug: the enum is @frozen, and its two unavailable reasons are deviceNotEligible and systemNotReady. There is no case for <em>you are not entitled to this</em>. The property is not lying. It reports whether the model exists on the far side of the door, and it has no vocabulary for the lock.</p><p>The entitlement itself turned out to be exactly what Apple documents. On August 28th, with the capability enabled on one of my App IDs and a profile rebuilt around it, the same call made a round trip and came back with content: PCCOK, which is what I had asked it to say. An hour earlier the identical Swift source had been killed at launch. Between the two runs I changed nothing in the program; I changed a provisioning profile. The call was never the variable. The account was.</p><p>Row one, the same cloud model through the CLI instead, has a completely different gate, and it was public well before I measured it. Pete Goldsmith took it apart on July 2, in a post called “Scripting fm, Apple’s Foundation Models CLI.” A ParentProcessGate inside the fm binary runs four rules: one of stdin, stdout or stderr must be a tty; fm must own a controlling terminal, not borrow a descriptor from one; the process-tree walk must reach a real session; the terminal must report a non-zero window size via TIOCGWINSZ. Habr wrote it up on July 6, crediting him and adding that the terminal-associated parent must itself be Apple-signed — which is what put scripts, cron, launchd, CI runners and Python on the refused list. On July 12, Daring Fireball linked TwoMillionKit, a Swift package that provides “a LanguageModel implementation that uses the fm command-line tool under the hood,” routing an app to PCC without the entitlement. The gate was five weeks old and well lit by the time I walked into it.</p><p>My harness called fm like this:</p><pre>p = subprocess.run(argv, capture_output=True, text=True, timeout=args.timeout)</pre><p>capture_output=True makes all three standard file descriptors pipes. Rule one fails before rule two is consulted. My check had asked whether the <em>shell</em> had a tty (it did, /dev/ttys004) and never asked what the subprocess would be handed.</p><p>The A/B is on disk, one day apart. August 5th, fm respond --model pcc from a bash script inside a Terminal.app window: rc 0, conforming JSON, transcript written. August 6th, the same subcommand from Python inside a Terminal.app window with output captured: rc 1, refused, twenty times running. TERM_PROGRAM read Apple_Terminal both days and Terminal.app sat in the process tree both days. What changed was who called fm, and where its file descriptors pointed.</p><p>A reproduction of a documented gate, then, by a check that tested the right three signals on the wrong process. The measurement worth having was next door.</p><h3>The other door</h3><p>None of that is the path my mail runs on.</p><p>Since May 27, a stage of my email classifier has reached the on-device model through the Foundation Models framework (the fourth row) from a small Swift binary I build myself. It links /System/Library/Frameworks/FoundationModels.framework directly; there is no reference to /usr/bin/fm anywhere in its sources, not a path, not a Process(. /usr/bin/fm links the same dylib. (otool -L prints 1.5.2 on one and 2.0.68 on the other, but those are compile-time stamps; both name the same path, which resolves to the same installed framework at run time.) Two binaries, one framework, one model.</p><p>Every call writes a ledger row with the same schema as the paid tier it can escalate to. As of this morning that file holds <strong>9,212 rows</strong> from a single call site, spanning May 27 to today, with cost_usd summing to exactly zero and a median successful call of 1,727 ms. I’ve written before about metering a free tier as if it sent invoices, so I’ll spend one sentence on it: the ledger is the only reason I can tell you any of what follows.</p><p>Of those 9,212: 5,920 came back ok, 3,183 errored, 109 timed out. That’s a lifetime success rate of 64.3%, and it is a garbage number: 2,901 of the 3,183 errors are July, and <strong>2,843 of July’s errors sit inside one contiguous six-hour window</strong>, 2026–07–11T23:36 to 2026–07–12T05:41. That window opens eight minutes after a beta 3 install on this machine and closes fifteen minutes before the commit timestamp on my fix for it. The other twenty-nine days of July run 89–100% clean, like every other month. Month by month it goes 85.2%, 91.6%, 35.0%, 95.0%, from May through August, with August the month that matters.</p><p>The storm has its own article; the short version is that a fail-safe I’d written turned a missing model asset into a restart loop that generated most of its own traffic. July 12 alone holds 2,809 rows against a ~60/day norm. Worth naming what the ledger did <em>not</em> hold: the decode that named the missing asset came off the unified log during the incident. All 3,183 error rows carry a bare {&quot;type&quot;: &quot;isError&quot;} and no code at all. The file that proves the outage happened can’t say what it was.</p><h3>August, gate by gate</h3><figure><img alt="Swimlane timeline, August 2026. Five dated columns (Aug 4–6, Aug 11–23, Aug 24–25, Aug 26, Aug 28) against four routes. Cloud model via the fm CLI: rc 0 on Aug 5, refused 20 of 20 on Aug 6, then deleted in beta 7. Cloud model via the framework: ModelManagerError 1046, blocked until Aug 28, then PCCOK. On-device via the CLI: answering, dark with exit 69 after beta 5, answering again once the licence is agreed. On-device via the framework: one unbroken bar, 9,212 calls at $0.00, never interrupted." src="https://cdn-images-1.medium.com/max/1024/1*5ybKTGufumNSQT2dvcuvtQ.png" /><figcaption>Nothing alerted on any of these transitions. I found them by diffing a weekly agent’s drop counts while fact-checking this piece.</figcaption></figure><p>fm worked on this machine on August 4th through 6th: the rc-0 cloud-model run on the 5th, and the twenty refusals on the 6th, which required fm to be running well enough to refuse me.</p><p>Then, somewhere in August’s weekly beta cadence, the third row of that table hit a gate with nothing to do with context, models or entitlements. The machine reverted to never having agreed to the fm license. When I finally looked, at half past one in the morning on the 26th:</p><pre>$ fm license --status<br>Not agreed. Run &#39;sudo fm license&#39; to review and agree.<br>$ echo rc=$?<br>rc=69</pre><p>Per man fm, agreeing “applies to every user on the machine, so it must be run as a privileged user” (sudo fm license), and until someone does, every subcommand behind that agreement exits 69 without running. Note the shape of that measurement: pipe fm into head or tee and you’ll read the pager’s exit code instead. The 69 only exists unpiped.</p><p>I can’t date the onset directly, but there’s a byte trail. A weekly agent of mine uses fm as a relevance prefilter over RSS items, and it was written to no-op if the model isn’t there: any nonzero exit, timeout or missing binary maps to a KEEP vote. Through the four weeks ending August 9th it dropped 51, 36, 26 and 28 items out of 70. On August 16th and 23rd it kept 70 out of 70, both times, zero drops. Its code and config hadn’t changed since June.</p><p>What that trail dates is fm going dark, not the licence specifically: a prefilter that fails open on any nonzero exit can’t tell a legal gate from a timeout, a missing asset or a changed binary. What it gives me is a tight window. Something happened to fm between the 9th and the 16th, and exactly one thing was installed on this machine inside it: beta 5, on the 11th. Two weeks <em>before</em> the update everyone is talking about.</p><p>Whatever the cause, it ran invisible for two weekly runs. I didn’t catch it by monitoring; I caught it by diffing drop counts while fact-checking this article. That’s manual verification; the mechanism to catch it next time is still pending.</p><h3>Then beta 7</h3><p>Build 26A5421a shipped publicly on August 24 and installed here at 04:50 on the 25th. The MacRumors change list carries the line: “In macOS 27 Beta 7, the option to use the Apple Foundation Model on Private Cloud Compute has been removed from the Apple Foundation Models CLI.” The community reply underneath it is “ffs. Thanks devs who abused this.”</p><p>Apple’s own beta 7 release notes never mention it. They do carry, under Foundation Models: Fixed: PrivateCloudComputeLanguageModel always uses greedy decoding. (178181782). In the same document where the CLI’s cloud option vanishes unannounced, Apple documents <em>improving</em> the framework’s cloud model. The CLI’s cloud option and the framework’s cloud model are not the same thing, and Apple’s own release notes are the proof.</p><p>Locally it isn’t subtle. The MODELS section of man fm now lists one entry, system, and strings /usr/bin/fm returns zero hits for pcc, private cloud or cloud; the surviving model strings include system, System model available and SystemLanguageModel_CLI. And:</p><pre>$ fm respond --model pcc --no-stream &#39;hi&#39;<br>Error: The value &#39;pcc&#39; is invalid for &#39;--model &lt;model&gt;&#39;.<br>Please provide one of &#39;system&#39;.<br>rc=64</pre><p>That is not a refusal. That’s an argument parser that has never heard of the thing. Seventy-seven days — eleven weeks to the day from that June 8 man page — and the cloud model Apple handed to the terminal in a session titled “Build AI-powered scripts” was gone from the terminal. It remains in the OS and in the framework; what was removed is the CLI’s option to reach it. Coverage has been thin and mostly wrong about which door closed. The Italian site macitynet ran it on the 25th and got it exactly right — the change is specifically about fm, not about PCC leaving the OS. The one English write-up I can find, a beta 7 roundup on the 27th, describes it as Apple removing a toggle between on-device and cloud models, and never mentions the command-line tool at all.</p><p>Here is the whole map in one day. On August 25th the on-device model through the CLI answered nothing at all: exit 69, from the 04:50 install until I agreed the terms at 01:53 the next morning. The cloud model through the CLI no longer existed. Across that same day the on-device model through the framework answered 123 of 132 calls, 93.2%, indistinguishable from the day before and the week before, at $0.00. Same machine, same model, same framework underneath both. Different door, different law.</p><h3>Which door the gate actually belonged to</h3><p>After agreeing the license I ran the invocation matrix the cloud model used to refuse, this time against system, capturing each exit code unpiped:</p><p>Every one of these returned OK at rc 0:</p><ul><li>an agent shell with no tty (tty says “not a tty”)</li><li>piped stdin — echo … | fm respond …</li><li>piped stdout — fm respond … | cat</li><li>a /bin/sh script file</li><li>Python subprocess.run</li><li>a pty via script -q /dev/null</li></ul><p>Only ssh localhost went untested, because publickey auth was denied and fm never ran at all.Every context on Goldsmith’s and Habr’s refused lists that I could reach — scripts, Python, a no-tty shell — answered. I didn’t test cron or launchd directly; the weekly agent’s launchd runs are indirect evidence that launchd invocations worked before August.</p><p>So the gate guarded exactly one of the four routes, and it left when that route did. The surviving CLI route has no observable invocation-context gate, and the framework route never had one. That’s why my classifier never noticed a thing: it was never walking through the door being policed.</p><h3>What I’d do differently</h3><p><strong>Probe through the invocation path you’ll actually use.</strong> My check tested TERM_PROGRAM, the process chain and the tty, passed all three, and was wrong twenty times running — because it asked the shell, and fm was going to ask the subprocess. An environment check tests the things you thought of. I know it tests only those because I did it again three weeks later: checking whether the entitlement had finally landed, I wrote a probe that reported NOT_AUTHORIZED about a profile that was granting access the entire time — it had embedded that profile next to a bare Mach-O, where macOS ignores it. The probe had returned a verdict many times and reached its success branch not once. A check that has never passed is not evidence of a closed door. It is an untested branch.</p><p><strong>Design the absence state, and instrument it separately from the success state.</strong> Fail-open plus log-only-when-you-drop-something equals an outage that looks exactly like a quiet week: the prefilter absorbed a dead platform model for a fortnight without losing a single item of work, and nothing anywhere marked the difference. Instruments hide gates in the other direction too. A guardrail refusal once came back through a frozen JSON schema as {&quot;rows&quot;: []}, schema-valid, and my pipeline logged it as a success. That “0% refused” was a property of my instrument, not the model.</p><p><strong>Meter the free things — then read the meter on the right axis.</strong> A lifetime average will bury a change as thoroughly as no ledger at all, and I nearly proved it on myself. The paid rung my classifier escalates to has not answered a single call since July 4th: 194 consecutive timeouts, 46 of them since I last wrote about it, which is why its imputed cost sits unchanged at $20.30. Its lifetime timeout rate reads a comfortable 46.9% — and the lifetime figure is the last place that outage will ever show up.</p><p>Apple’s on-device layer is real, it’s free, and I have three months of receipts saying it did the work. The last three weeks measured the other half of that bargain. Four routes onto two models on one Mac: a check inside a binary, an entitlement on an account, a machine-wide legal agreement, and one route with nothing in the way at all. Two of the four changed their terms this month without an announcement, a log line, or a single failed call in my ledger. A third began answering on the 28th, and no code of mine made it.</p><p>Availability is a question you can ask an API. Permission is a question you can only ask by trying.</p><h3>Sources</h3><ul><li>WWDC26 session 334, “Build AI-powered scripts with the fm CLI and Python SDK”: <a href="https://developer.apple.com/videos/play/wwdc2026/334/">https://developer.apple.com/videos/play/wwdc2026/334/</a></li><li>apple-fm-sdk on PyPI (Apple Inc., Apache-2.0): <a href="https://pypi.org/project/apple-fm-sdk/">https://pypi.org/project/apple-fm-sdk/</a></li><li>Private Cloud Compute eligibility and the com.apple.developer.private-cloud-compute entitlement: <a href="https://developer.apple.com/private-cloud-compute/">https://developer.apple.com/private-cloud-compute/</a></li><li>Foundation Models framework reference: <a href="https://developer.apple.com/documentation/foundationmodels">https://developer.apple.com/documentation/foundationmodels</a></li><li>Pete Goldsmith, July 2 2026, “Scripting fm, Apple’s Foundation Models CLI” — the ParentProcessGate and its four rules: <a href="https://petegoldsmith.com/2026/07/02/2026-07-02-fm-pcc-not-available-in-this-context/">https://petegoldsmith.com/2026/07/02/2026-07-02-fm-pcc-not-available-in-this-context/</a></li><li>Habr, July 6 2026 — the PCC parent-process gate, discovery credited to Goldsmith: <a href="https://habr.com/ru/news/1056276/">https://habr.com/ru/news/1056276/</a></li><li>TwoMillionKit: <a href="https://github.com/insidegui/TwoMillionKit">https://github.com/insidegui/TwoMillionKit</a> · Daring Fireball, July 12 2026: <a href="https://daringfireball.net/linked/2026/07/12/twomillionkit">https://daringfireball.net/linked/2026/07/12/twomillionkit</a></li><li>MacRumors, macOS 27 beta 7 change list (build 26A5421a, released August 24 2026): <a href="https://forums.macrumors.com/threads/macos-golden-gate-27-0-beta-7-whats-new.2487853/">https://forums.macrumors.com/threads/macos-golden-gate-27-0-beta-7-whats-new.2487853/</a></li><li>macOS 27 beta release notes — no mention of the removal, and the PrivateCloudComputeLanguageModel fix: <a href="https://developer.apple.com/documentation/macos-release-notes/macos-27-release-notes">https://developer.apple.com/documentation/macos-release-notes/macos-27-release-notes</a></li><li>macitynet, August 25 2026 (Italian) — the most accurate coverage of the removal I could find: <a href="https://www.macitynet.it/ios-27-beta-7-novita-ipados-macos/">https://www.macitynet.it/ios-27-beta-7-novita-ipados-macos/</a></li><li>Geeky Gadgets, August 27 2026 — the only English article-length mention, which frames it as a removed on-device/cloud toggle without naming the CLI: <a href="https://www.geeky-gadgets.com/macos-27-beta-7-features/">https://www.geeky-gadgets.com/macos-27-beta-7-features/</a></li></ul><p>Measurements are from one Mac mini running macOS 27.0, build 26A5421a, with /usr/bin/fm at sha256 dd63feb3…dce1b; ledger figures are a snapshot taken 2026-08-28T09:21Z. This is beta software and it has already changed twice while I was writing about it — check your own bytes before relying on any of it.</p><p><em>I write about the parts of a running system that only show up when you stop reasoning about them and go measure them — more at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6f03d7a8620" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/apples-ai-told-me-it-was-available-then-it-refused-all-20-calls-b6f03d7a8620">Apple’s AI Told Me It Was Available. Then It Refused All 20 Calls.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Row-level security does not apply to TRUNCATE. My end-user roles held it on all 21 tables.]]></title>
            <link>https://levelup.gitconnected.com/row-level-security-does-not-apply-to-truncate-my-end-user-roles-held-it-on-all-21-tables-d086931f6da0?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d086931f6da0</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 18:29:17 GMT</pubDate>
            <atom:updated>2026-08-21T18:29:17.509Z</atom:updated>
            <content:encoded><![CDATA[<h4>A rolled-back probe emptied a 615-row table as the role every logged-in user runs as. What held it shut was the API’s verb list, not the database.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IiLoD9LpsArOxTLo" /><figcaption>Photo by <a href="https://unsplash.com/@splike?utm_source=medium&amp;utm_medium=referral">Yufeng Mao</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>truncate public.telemetry_event emptied the table. Six hundred and fifteen rows to zero.</p><p>I ran it as authenticated — the role every logged-in user of my app runs as — against my production database, and Postgres did not object. Not “refused by policy.” Not “succeeded, affecting zero rows.” It emptied the table.</p><pre>TRUNCATE_PROBE: TRUNCATE SUCCEEDED as authenticated — rows 615 -&gt; 0<br>                | rolcanlogin(authenticated)=f  -- ROLLED BACK</pre><p>The statement ran inside a transaction I aborted on purpose, so no row actually died, and I measured it twice, independently, before I let myself believe it. Every table in that schema had row-level security enabled <em>and</em> forced. Most of them carried policies I’d written and reviewed. None of that had anything to do with the outcome, because row-level security does not apply to TRUNCATE at all.</p><h3>First, the part that would make this dishonest to leave out</h3><p>This was not a live exploit, and the reason is the whole point of the piece, so it goes here rather than in a footnote at the bottom.</p><p>Three things stood between that probe and a real incident, and not one of them was a policy I’d written:</p><ol><li><strong>anon and </strong><strong>authenticated are </strong><strong>rolcanlogin = false.</strong> No connection string lands you in those roles; they are assumed from inside the database.</li><li><strong>PostgREST exposes no TRUNCATE verb.</strong> Its <a href="https://docs.postgrest.org/en/v16/references/api/tables_views.html">documented surface</a> is OPTIONS, GET, HEAD, POST, PATCH, PUT and DELETE, plus RPC. No HTTP request shape emits a TRUNCATE.</li><li><strong>The only function in my schemas doing dynamic </strong><strong>EXECUTE had an ACL that excluded </strong><strong>authenticated.</strong></li></ol><p>So nobody could have wiped my database. What I found was a privilege granted to a role, sitting behind a wall made of something else entirely.</p><p>That “something else” is the finding. <strong>What held TRUNCATE shut was the deployed API verb surface, not the database.</strong> My grants were wide open on a verb my HTTP layer happened not to speak. If you take one thing from this, take that sentence and go look at your own — because the mental model most of us carry about RLS quietly guarantees you won’t find it by looking where you’d expect.</p><h3>The D bit</h3><p>The mechanism is upstream PostgreSQL, not a Supabase quirk, and it is documented.</p><p>Table privileges in Postgres are eight bits, rendered in pg_class.relacl as a string of letters, one per verb (<a href="https://www.postgresql.org/docs/17/ddl-priv.html">the mapping is Table 5.1</a>). A role holding all eight shows up in the catalog as arwdDxtm. The letter this piece is about is D, capital D, and it is TRUNCATE.</p><figure><img alt="Two-layer diagram. Layer one, the database: the arwdDxtm privilege string as letters, row-level verbs grouped under “policies filter rows here”, the D bit for TRUNCATE isolated in red under “whole-table, no policy applies”, and 21 tables handing every bit to anon and authenticated. A measured bar reads TRUNCATE SUCCEEDED as authenticated, rows 615 to 0, rolled back on purpose. Layer two, the deployment: no login, no TRUNCATE verb in PostgREST, no SQL channel — none of it a policy anyone wrote." src="https://cdn-images-1.medium.com/max/1024/1*MjWm2iXXssGYMhEDZcrWYA.png" /><figcaption>RLS governs the row verbs. TRUNCATE answers to one privilege bit — and what kept it shut was the deployment surface, not a policy.</figcaption></figure><p>TRUNCATE’s requirement is one sentence in the <a href="https://www.postgresql.org/docs/17/sql-truncate.html">TRUNCATE reference</a>: <em>“You must have the TRUNCATE privilege on a table to truncate it.”</em> That’s the entire access-control story. There is no second condition.</p><p>And from the <a href="https://www.postgresql.org/docs/17/ddl-rowsecurity.html">Row Security Policies</a> page, the sentence I had read past more than once:</p><blockquote><em>Operations that apply to the whole table, such as </em><em>TRUNCATE and </em><em>REFERENCES, are not subject to row security.</em></blockquote><p>Read it next to the sentence three paragraphs above it, which enumerates what policies <em>can</em> apply to: ALL, SELECT, INSERT, UPDATE, DELETE. TRUNCATE isn’t on that list because there is nothing for a policy to do — a policy filters rows, and TRUNCATE never visits rows; it swaps the table’s storage out from under them. FORCE ROW LEVEL SECURITY doesn’t change this. Neither does a for all policy. There is no policy you can write that a TRUNCATE will ever consult.</p><p>My engine is 17.6, which is why the links here are to the 17 docs. PostgreSQL 18 shipped a week before I wrote this; I re-read all four quoted sentences on /current/ and they are unchanged.</p><p>Which means the only thing standing between an end-user role and an empty table is whether that role holds D. In my database, 21 tables in public carried the identical ACL — a 22nd had been locked down days earlier by a separate fix, which is the only reason it isn’t in this list:</p><pre>{postgres=arwdDxtm/postgres, anon=arwdDxtm/postgres,<br> authenticated=arwdDxtm/postgres, service_role=arwdDxtm/postgres}</pre><p>Both end-user roles, capital D, on every table. Not on the neglected ones — on all of them, including tables whose INSERT/UPDATE/DELETE paths were live, correct, and properly policied. A table can be in perfect health on every verb you think about and still carry a standing TRUNCATE grant for the roles your users arrive as.</p><h3>Go check yours</h3><p>It takes a second and needs no downtime:</p><pre>select c.relname,<br>       r.rolname,<br>       v.verb<br>from pg_class c<br>join pg_namespace n on n.oid = c.relnamespace<br>cross join (select unnest(array[&#39;anon&#39;,&#39;authenticated&#39;]) as rolname) r<br>cross join (values (&#39;INSERT&#39;),(&#39;UPDATE&#39;),(&#39;DELETE&#39;),(&#39;TRUNCATE&#39;),<br>                   (&#39;REFERENCES&#39;),(&#39;TRIGGER&#39;),(&#39;MAINTAIN&#39;)) as v(verb)<br>where n.nspname = &#39;public&#39; and c.relkind = &#39;r&#39;<br>  and has_table_privilege(r.rolname, c.oid, v.verb)<br>order by 1, 2, 3;</pre><p>Substitute your own end-user role names. Before this sweep, that query returned 294 rows against my schema — 21 tables × 2 roles × 7 verbs, the complete cross product, which is what “nobody has ever revoked anything here” looks like in the catalog. Afterwards it returned 37, every one of them authenticated, every one on a verb an actual policy admits.</p><p>One caveat, because has_table_privilege alone will lie to you if you have column-level grants: a column grant survives the absence of the relation-level one, so a table can show false above and still be writable on a specific column. Check those separately, and filter by schema when you do. An unqualified sweep of pg_attribute returns a dozen system-catalog rows on a database that has never held a user object:</p><pre>select c.relname, a.attname, a.attacl<br>from pg_attribute a<br>join pg_class c on c.oid = a.attrelid<br>join pg_namespace n on n.oid = c.relnamespace<br>where n.nspname = &#39;public&#39; and a.attacl is not null;</pre><h3>How to point a loaded gun at production and not fire it</h3><p>The probe at the top of this piece is the technique I actually want to hand you, because it generalizes far past TRUNCATE.</p><p>The question “can role X do dangerous thing Y on this table?” is usually answered by reasoning about grants and policies. My reasoning is exactly what was wrong here — I had written “RLS is the only thing holding it” into a design document, in those words, and nobody caught it because it sounds correct. The alternative is to stop reasoning and just do it, having arranged in advance that it can’t stick:</p><pre>begin;<br> <br>do $$<br>declare<br>  before_rows bigint;<br>  after_rows  bigint;<br>begin<br>  select count(*) into before_rows from public.telemetry_event;<br> <br>  set local role authenticated;       -- become the end-user role<br>  truncate public.telemetry_event;    -- attempt the dangerous thing<br>  reset role;<br> <br>  select count(*) into after_rows from public.telemetry_event;<br> <br>  raise exception &#39;TRUNCATE_PROBE: rows % -&gt; % | rolcanlogin(authenticated)=%&#39;,<br>    before_rows, after_rows,<br>    (select rolcanlogin from pg_roles where rolname = &#39;authenticated&#39;);<br>end $$;<br> <br>rollback;</pre><p>The raise exception is doing double duty, and that’s the trick worth stealing. In plpgsql an uncaught exception aborts the transaction, so the RAISE <em>is</em> the rollback — the destructive statement can never commit, even if you get distracted between running the block and typing rollback. And because the measurement travels out in the error message, you get your numbers from a statement that by construction did not persist. The trailing rollback is only there to close the aborted transaction.</p><p>TRUNCATE is a good candidate for this because it is, per the docs, <em>“transaction-safe with respect to the data in the tables: the truncation will be safely rolled back if the surrounding transaction does not commit.”</em> You are not depending on luck.</p><p>Two things to know before you run it. You need the SET option on the role you’re assuming — bare membership hasn’t been enough since PostgreSQL 16 split SET out of role membership — or superuser, which bypasses the check entirely; either way, a failure at that line is a useful signal in itself. And TRUNCATE takes an ACCESS EXCLUSIVE lock, so pick a quiet moment; the rollback is instant but the lock is real while you hold it.</p><p>I used the same pattern on the referential actions a parent-row delete fires. It measured two of the four cascades at risk directly; the other two are covered by the rule that referential-integrity triggers run as the owner of the constrained table rather than as the caller, so no revoke on the caller can break them. Two by counter, two by rule — and if you’re going to write down a result like that, write down which half is which.</p><h3>What you should actually watch for</h3><p>The grant is the easy half. The reason it survived every review I ran is the part worth carrying away.</p><p>If you had asked me how a table of mine could become writable by strangers, I’d have described a policy going wrong: someone adds a for all policy for an unrelated reason, or widens a USING clause with a join, and rows that used to be filtered stop being filtered. That’s a real risk, and it has a shape you can review for. It shows up in a migration diff as the word policy.</p><p>TRUNCATE has none of that shape. The privilege is already granted; the only question is whether anything can reach it. So the triggers to watch for are:</p><ul><li><strong>A SECURITY DEFINER function gaining dynamic SQL.</strong> Someone adds an execute format(...) inside a function that end users can already call, and now there’s a SQL channel where there wasn’t one.</li><li><strong>A change to the exposed verb surface.</strong> A PostgREST upgrade, a new gateway in front of the database, a “direct connection” feature for power users, an admin tool that ships a query console.</li><li><strong>Any path that hands an end-user role a real SQL channel.</strong> A login-enabled role, a dblink or postgres_fdw shape, a psql-capable internal tool that connects as the wrong role.</li></ul><p>None of those looks like “someone added a policy.” They don’t appear in the part of the diff a security reviewer reads slowly. They’re infrastructure changes, and the standing grant they activate was made years earlier by a default you never chose.</p><h3>Two failure signatures that look identical and are not</h3><p>Here is the second thing I got wrong, and it is why I’d distrust most tests written against this. Take a privilege away and the failure is a <strong>privilege</strong> failure: SQLSTATE 42501, the statement rejected <em>whole</em> before any tuple is touched, the message naming the <strong>relation</strong> and never the column. That code is <a href="https://www.postgresql.org/docs/17/errcodes-appendix.html">insufficient_privilege</a>, which PostgREST <a href="https://docs.postgrest.org/en/v16/references/errors.html">maps</a> to an HTTP 403. Let a policy’s USING clause exclude a row instead, and there is no failure at all. The docs are explicit that <em>“rows for which the expression does not return true will not be processed.”</em> Not rejected. Not processed. For UPDATE and DELETE the statement succeeds, reports zero rows, and raises nothing. I had written “refused by RLS” into a frozen contract. That baseline never existed.</p><p>INSERT is where it gets treacherous, because a WITH CHECK violation <em>is</em> an error — and it is also a 42501. So one SQLSTATE covers two different refusals, and the only thing separating them is message text: new row violates row-level security policy for table &quot;x&quot; versus permission denied for table x. That first message has a second form, too. When the rejection is attributable to one named policy, Postgres wedges the name into the middle: new row violates row-level security policy &quot;p_ins&quot; for table &quot;x&quot;.</p><figure><img alt="Three refusal paths side by side. A privilege failure and an INSERT WITH CHECK policy failure both raise SQLSTATE 42501 and both record as a fail; an UPDATE or DELETE policy failure raises nothing, succeeds affecting zero rows, and records as a pass. Below, the message text of each, including the second form that wedges a quoted policy name into the middle, and a note that the no-error path has no message to match and must be asserted on rows affected." src="https://cdn-images-1.medium.com/max/1024/1*_6SePsXPOZGrRgDiycLJGA.png" /><figcaption>Three refusal paths, two error codes, one silent pass — the UPDATE/DELETE policy failure raises nothing and records as a success.</figcaption></figure><p>So a test asserting only <em>“did this fail?”</em> records fail, fail, pass — and the pass is the most dangerous of the three. Asserting on SQLSTATE does no better: both errors are 42501 before and after a real revoke. The assertion has to split the way the refusals do. <strong>For the two that raise, assert on the message text</strong> — on a substring of it, since the policy-name variant breaks an exact match the first time a rejection becomes attributable. <strong>For the one that doesn’t raise, there is no message to match, so assert on rows affected instead</strong>: that path stops being a silent zero-row success only once the privilege is gone and it starts erroring, and a row count is the only thing that can see the change. The same asymmetry is why “permission denied for table X” is where an operator’s investigation starts rather than ends.</p><h3>What I did, and what I won’t claim about it</h3><p>The migration enumerates verbs, per table and per role, and revokes them. Never revoke all, and I have two scars that say so.</p><p>On one of those tables, SELECT is load-bearing for three live paths, one a SECURITY INVOKER function that runs as the calling user, so a blanket revoke takes down every write path it serves, paid users included. And on the table I’d locked down days earlier, a bare revoke update would have broken every save: the function takes a select ... for update before it knows whether the caller is entitled to anything, and FOR UPDATE requires UPDATE on at least one column. The fix was a column-by-column re-grant of the nineteen columns that weren’t the sensitive one. It looks like exactly the kind of thing you’d want to simplify. The list <em>is</em> the fix.</p><p>Enumerating the verbs is tedious, and the tedium is the feature.</p><p>It also revokes those verbs in alter default privileges, because the standing default was what granted arwdDxtm to both end-user roles on every create table in the first place. Without that line the whole sweep is undone by the next migration that adds a table. Be explicit about for role in that statement — it defaults to current_user, which is a fine way to amend a grantor you didn’t mean to touch.</p><p>And the honest ceiling on all of it: nothing in my CI or my pre-push hooks exercises PostgREST privileges. Not one stage reads relacl, pg_default_acl or has_table_privilege. Every assertion here was run by hand, once against a local stack and once against production, and nothing re-runs them. The correct wording is <em>verified once, by hand</em>. Anything stronger would be a claim about a mechanism I haven’t built.</p><p>I’d rather end on the catalog query than on the migration, anyway. The migration is mine; the query is yours, and it takes a second.</p><p>Because what held TRUNCATE shut in my database was not a policy I had written. It was a wall built out of deployment choices I’d made for other reasons — a role that can’t log in, a gateway that doesn’t speak the verb — any of which could change in a release I’d approve without thinking twice. Put that sentence in your design document before an infrastructure change writes it for you.</p><h3>Sources</h3><ul><li>Row Security Policies — PostgreSQL 17: <a href="https://www.postgresql.org/docs/17/ddl-rowsecurity.html">https://www.postgresql.org/docs/17/ddl-rowsecurity.html</a> (“Operations that apply to the whole table, such as TRUNCATE and REFERENCES, are not subject to row security”; “Rows for which the expression does not return true will not be processed.”)</li><li>Privileges (ACL letters, arwdDxtm) — PostgreSQL 17: <a href="https://www.postgresql.org/docs/17/ddl-priv.html">https://www.postgresql.org/docs/17/ddl-priv.html</a></li><li>TRUNCATE reference (privilege requirement, transaction safety, ACCESS EXCLUSIVE lock) — PostgreSQL 17: <a href="https://www.postgresql.org/docs/17/sql-truncate.html">https://www.postgresql.org/docs/17/sql-truncate.html</a></li><li>PostgreSQL Error Codes (42501 = insufficient_privilege): <a href="https://www.postgresql.org/docs/17/errcodes-appendix.html">https://www.postgresql.org/docs/17/errcodes-appendix.html</a></li><li>SET ROLE (the SET option, PostgreSQL 16 and later): <a href="https://www.postgresql.org/docs/17/sql-set-role.html">https://www.postgresql.org/docs/17/sql-set-role.html</a></li><li>PostgREST — Errors (42501 → 403 authenticated / 401 unauthenticated): <a href="https://docs.postgrest.org/en/v16/references/errors.html">https://docs.postgrest.org/en/v16/references/errors.html</a></li><li>PostgREST — Tables and Views (the exposed HTTP verbs): <a href="https://docs.postgrest.org/en/v16/references/api/tables_views.html">https://docs.postgrest.org/en/v16/references/api/tables_views.html</a></li></ul><p>Measurements are from the author’s own PostgreSQL 17.6 database, taken inside rolled-back transactions. Every quoted sentence was re-checked against the PostgreSQL 18 docs and is unchanged there.</p><p><em>Run the sweep from “Go check yours” against your own </em><em>public schema before you close this tab. It takes a second, and it returns either nothing or a number you will want to talk about — if it is the second one, tell me what it found. I write about the parts of a running system that only show up when you stop reasoning about them and measure them instead — the grants nobody revoked, the failure paths that look identical from the outside, the walls that turn out to be doors. More at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d086931f6da0" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/row-level-security-does-not-apply-to-truncate-my-end-user-roles-held-it-on-all-21-tables-d086931f6da0">Row-level security does not apply to TRUNCATE. My end-user roles held it on all 21 tables.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Put macOS’s Free Language Model on Mail Duty. 8,427 Calls Later, My Ledger Says $0.00.]]></title>
            <link>https://medium.com/@davidjknudson/i-put-macoss-free-language-model-on-mail-duty-8-427-calls-later-my-ledger-says-0-00-ea4e3c4acb4c?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea4e3c4acb4c</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 06:45:23 GMT</pubDate>
            <atom:updated>2026-08-21T06:45:23.650Z</atom:updated>
            <content:encoded><![CDATA[<h4>Inside a four-stage classification ladder where the paid model is the last resort, the free tier writes $0.00 receipts, and “I don’t know” is a legal answer.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q4mNeleZD4V21QZj" /><figcaption>Photo by <a href="https://unsplash.com/@elizabeth_kay?utm_source=medium&amp;utm_medium=referral">Elizabeth Kay</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There’s a row in my cost ledger that looks like a typo:</p><pre>{&quot;ts&quot;: &quot;2026-05-27T17:43:10Z&quot;,<br> &quot;call_site&quot;: &quot;mail-classify.py:stage3_direct_mcp&quot;,<br> &quot;model&quot;: &quot;foundation-models-on-device&quot;,<br> &quot;wall_ms&quot;: 1738,<br> &quot;cost_usd&quot;: 0.0,<br> &quot;outcome&quot;: &quot;ok&quot;}</pre><p>That’s a real row, trimmed — and the 1,738 milliseconds is the median successful call across 5,183 of them.</p><p>That cost_usd: 0.0 is not a bug. It’s a language model that ships inside macOS, running on my Mac mini’s Apple silicon, classifying my email — and metered like a paid API anyway. Private, offline, on mail duty for months, and free in a sense I can prove.</p><h3>The wrong first question</h3><p>Every cost-optimization thread about LLM pipelines starts the same way: which cloud model is cheapest per token? Then the spreadsheet comes out.</p><p>That’s the wrong first question. The right one is: <strong>what does the machine already give me for free?</strong></p><p>On a current Mac, the answer turned out to be substantial. Apple’s on-device foundation model, the one underneath Apple Intelligence, is exposed to third-party code through the <strong>Foundation Models</strong> framework — entry points SystemLanguageModel and LanguageModelSession. Third-party access arrived in the macOS 26 cycle, September 2025; I’m on macOS 27. It sits there, warmed by the OS, costing nothing per call. Two caveats, though, because “free” is doing some work in that sentence.</p><h3>Free, with an asterisk</h3><p><strong>“Free” has an eligibility gate.</strong> Apple silicon, macOS 26 or later, Apple Intelligence switched on in Settings, and a supported region. A materially narrower promise than “free,” and skipping it is overselling.</p><p><strong>It’s small, and the context window is why that matters.</strong> Apple describes it as a compact, roughly 3-billion-parameter model, quantized to about 2 bits per weight — a startling number, and the reason it fits on your laptop at all. Its context window is fixed and, by frontier standards, tiny: instructions, history, tool calls and the new prompt share one ceiling. Apple documents budgeting for it in technote TN3193, “Managing the on-device foundation model’s context window.” The ceiling is 4,096 tokens, and I’m citing that secondhand: Apple’s framework reference doesn’t serve body text to a plain fetch, so I never read the figure at the source.</p><p>But the shape is the point. This model will not write your architecture docs; it will comfortably classify an email into one of seven buckets — a few hundred tokens in, a dozen out. Small context is the spec for which tasks belong on this rung. Which inverts the design question: you don’t pick a cloud model and minimize calls to it, you build an <em>escalation ladder</em>, cheapest and most deterministic at the bottom, and make every expensive rung earn its invocation.</p><h3>Four rungs</h3><p>My mail classifier assigns every incoming message one of seven categories (action-required, newsletter, receipt, notification, personal, spam, other), then proposes an action: notify me, archive, leave alone, or flag for review. <em>Proposes</em>, not performs: nothing here moves my mail on its own. It reads Apple Mail’s local database strictly read-only — the connection string is literally file:…/Envelope Index?mode=ro.</p><p><strong>Stage 1: deterministic rules.</strong> A YAML file of glob patterns over sender and subject — 91 at last count. If one matches, the answer ships at confidence 1.0 and the ladder stops — things a regex knows better than any model will. Cost: sub-millisecond.</p><p><strong>Stage 2: a local heuristic ensemble.</strong> A hand-weighted scoring pass over metadata Mail already tracks — mailing-list headers, unsubscribe types, brand-verification indicators, thread activity, urgency flags. A softmax over the scores produces a category and a confidence. No model involved. Cost: still effectively zero.</p><p><strong>Stage 3: the on-device model.</strong> If stage 2 is unsure, the message goes to Apple’s local model with the seven category names and a “pick one” instruction. What gets sent: the sender’s display name and address, up to 300 characters of subject, the first 200 of the body, and up to 500 of Apple’s own generated summary. Cost: $0.00, logged as $0.00.</p><p><strong>Stage 4: a paid cloud model.</strong> Only if everything cheaper stayed unsure does the message escalate to Claude Haiku — the cheap end of the paid spectrum, but <em>paid</em>. Same fields, off my machine.</p><figure><img alt="Cost-tier waterfall of a four-rung mail classifier. Rungs 1, 2 and 3 each sit under a “conf ≥ 0.85” gate; rung 4 sits under a dashed “no 0.85 test” box marked terminal, taken as-is. A flow band narrows left to right from every message entering, through 8,427 on-device calls, down to 487 escalated at under 6 percent. An “honest floor” band runs beneath every rung, labelled (“other”, 0.50)." src="https://cdn-images-1.medium.com/max/1024/1*xZlPgvjxNkKVHW-whOVrNw.png" /><figcaption>Four rungs, one confidence bar — except the last, which is terminal. 8,427 on-device calls in, 487 escalated out: under 6 percent ever reach a paid model.</figcaption></figure><h3>What the paid rung actually costs</h3><p>Stage 4 doesn’t call an HTTP API and read a billing field off the response — it shells out to the Claude CLI with --output-format json and reads total_cost_usd off the envelope. And that number is not money anyone charged me: every Claude call here rides a flat-rate subscription. What lands in my ledger is an <strong>imputed API-equivalent price</strong>, not an invoice line.</p><p>I think that’s the better number anyway. A price signal you compute for a call you were never billed for is a purer measure of the thing I actually care about: what my escalation policy is worth. Lifetime total across 487 stage-4 calls is <strong>$20.30</strong> of API-equivalent — money I didn’t spend, on messages the free rungs couldn’t settle.</p><h3>A more expensive answer doesn’t automatically win</h3><p>The ladder is governed <em>mostly</em> by one number: a confidence threshold of 0.85. But a second constant sets a 0.80 floor for mark-as-read actions: silently marking mail read is worse than filing it. Individual YAML rules carry their own confidence values. And a rules-based pass runs <em>after</em> the ladder, able to overwrite category, action and confidence regardless of what any rung concluded. “One threshold” is the design intent; it isn’t quite the code.</p><p>The escalation took me embarrassingly long to describe correctly, because every stage is judged against an absolute 0.85 threshold. A more expensive stage has to clear that bar to be heard at all; if it falls short, the cheaper stage’s answer stands.</p><p>Say stage 2 comes back at 0.74, stage 3 at 0.80, stage 4 at 0.60. The highest score in that set is stage 3’s 0.80, and it’s thrown away untested, because 0.80 sits below 0.85. Stage 4 runs, returns 0.60, loses to stage 2’s 0.74, and <strong>0.74 wins</strong>. The system did not keep its best answer. It kept the best answer that cleared the bar.</p><p>That tradeoff is deliberate: an absolute bar stops a marginally-stronger guess from an expensive model displacing a solid cheap result, at the cost of occasionally discarding information. Ties are the wrinkle — &gt;= hands them to the <em>external</em> answer, arguably backwards for a pipeline meant to make expensive rungs earn their place.</p><h3>Talking to a model over stdin</h3><p>The mechanics of stage 3 are almost embarrassingly plain: a small Swift server binary wraps the OS model and speaks MCP (the Model Context Protocol) over stdio. My classifier spawns it, performs the MCP handshake, then sends one tools/call invoking classify. Newline-delimited JSON-RPC in, newline-delimited JSON-RPC out.</p><figure><img alt="Sequence diagram of one stage-3 classification. A long-lived Python classifier calls a model server spawned fresh for the message: initialize, result, notifications/initialized (no id, so no reply), tools/call classify, result. A select() clock bounds every blocking read. Spawn is about 1 ms, the full handshake about 10 ms, the median classification 1,738 ms, against a 12,000 ms hard deadline." src="https://cdn-images-1.medium.com/max/1024/1*VTcqc7TFxxqZen0-tBO2ew.png" /><figcaption>One stage-3 classification end to end: a model server spawned per message, ~10 ms of handshake, a 1,738 ms median generation — all bounded by a 12,000 ms hard deadline.</figcaption></figure><p>Plain, but not without a war story. My first version used Python’s subprocess.run(input=payload) — write all three protocol messages at once, close stdin, collect output. It hung, intermittently, in the worst way. The bug: batching the messages and slamming stdin shut meant the server’s stdout never reliably flushed before teardown, a race between the response and the pipe closing. The cure was to go properly interactive: a long-lived Popen, write a line, flush, read lines until the response with your request ID shows up. And every blocking read is bounded by select() against a hard 12-second deadline, so a stalled generation — server alive, response never coming — aborts <em>at</em> the deadline instead of on a readline() that never returns.</p><p>If you’re doing anything similar, put a hard deadline on every blocking read, at <em>every</em> rung. Of my 487 paid stage-4 calls, 281 came back clean and <strong>204 timed out</strong> — a 42% timeout rate on the <em>paid</em> tier, worse than the on-device model on a normal day.</p><p>One measurement I owed myself. I spawn a fresh process per classification — a trade of latency for statelessness, profligate but defensible. Then I measured it: five trials, about 1 millisecond to spawn, about 10 through the full handshake, the first cold spawn around 40. Noise. I’d been apologizing for a cost I had never once measured, in a system whose entire premise is measuring things.</p><h3>Instrument the free tier like it sends invoices</h3><p>Here’s the design decision I’d defend hardest. The on-device stage writes a cost-ledger row with <strong>the exact same schema</strong> as the paid stage: timestamp, call site, model identifier, wall-clock milliseconds, an outcome field (ok, isError, or timeout), and cost_usd: 0.0.</p><p>The same row, in the same append-only file the paid calls land in, written from a finally block so it lands even when the call <em>fails</em>. A broken invocation stays visible instead of going silently absent.</p><p>That bought three things. Honest economics: what classification costs comes from one file, and the free rows are evidence of the volume the paid tier <em>didn’t</em> see. Health monitoring: the outcome field becomes a time series of model availability, which mattered on a beta OS. And it keeps the ladder honest — every rung writes the same receipt, so if the paid tier’s volume creeps up, I see which cheaper rung started shrugging.</p><h3>“I don’t know” is a legal answer</h3><p>When rules don’t match, heuristics are unsure, the on-device model is unavailable, and the paid call fails or is disabled, my classifier does not guess. It returns (&quot;other&quot;, 0.50) — the most non-committal category in the taxonomy, at coin-flip confidence — with a marker in the decision log saying the external classifiers never ran. In effect: <em>nobody qualified looked at this</em>.</p><p>It would have been easy to do something worse — return the ensemble’s low-confidence winner and round it up, or default to “notification”. Both look fine in a demo and rot silently in production, because the automation that <em>will</em> eventually archive newsletters would be acting on manufactured certainty. The floor means downstream consumers implement one rule: don’t act on anything below threshold.</p><p>An invented example: if “Sample Bank” emails a statement notice from billing@samplebank.example and every stage is down, the message stays put, flagged unclassified at 0.50 — not archived as a newsletter because some fallback needed a value to return. Degradation should look like <em>absence of automation</em>, not confident wrong automation.</p><h3>The OS can take the model away</h3><p>Months of continuous production classification, so the limitations are earned. I run the macOS beta, and during one cycle the model asset vanished out from under my daemon mid-flight. Here’s the ledger, month by month, as the share of calls that returned cleanly:</p><p>MonthCallsokMay 2026 (from the 27th)1,02085.2%June 20261,37691.6%<strong>July 20264,47535.0%</strong>August 2026 (through the 20th)1,55695.6%</p><p>July is the outage, and it isn’t subtle: 64.8% of that month’s calls errored, and the <em>volume</em> tripled because my own fail-safe turned a missing asset into a restart storm, each restart re-firing warm-up probes against a model that wasn’t there. Steady state is the last two weeks: 95.6% clean across 1,252 calls. Lifetime, dragged down by July: 61.5%.</p><p>Both numbers on purpose. The lesson: a free tier on someone else’s update cadence is a dependency you must design as <em>optional</em>. Every rung of my ladder can be absent; the floor is always there. A pipeline that hard-requires it has built an outage into itself.</p><h3>Apple shipped my abstraction</h3><p>At WWDC 2026, Apple shipped the thing I’d hand-rolled. The framework now exposes public LanguageModel and LanguageModelExecutor protocols, so the on-device model, Private Cloud Compute, Gemini and Claude all sit behind the same session API — swap providers by changing an argument instead of rewriting your integration. Anthropic shipped a Swift package conforming Claude to it the day before the keynote. It requires macOS 27, so it’s available to me now.</p><p>Does my ladder still earn its existence? The abstraction gives me the <em>transport</em> — one API surface instead of two, deleting my Swift server, my handshake and the war story above. I’d take it. What it doesn’t give me is the <em>policy</em>: the 0.85 bar, rungs 1 and 2 in front of any model, the single ledger both tiers write to, the (&quot;other&quot;, 0.50) floor. A provider abstraction makes it easy to swap which model answers. It doesn’t decide whether a model should have been asked.</p><p>The sharpest version of that policy is the one deciding what leaves the machine at all.</p><p>Stages 1 through 3 never move a byte off the machine: local YAML, local arithmetic, a local subprocess talking to a local binary over pipes. Only the residue all three shrugged at reaches a cloud model: 487 messages against 8,427 on-device calls, under 6%.</p><p>Here is exactly what goes out: the sender’s address, display name, up to 300 characters of subject, the first 200 characters of the body, and up to 500 characters of Apple’s own summary. A real body excerpt leaving a real machine — better I itemize it than a commenter.</p><p>Locally, the decision log records the classification, a message-ID hash, and the sender address, display name and subject in plaintext. Message <em>bodies</em> are never logged — and “we only log hashes and categories” would be the half-true version of that. My log knows who writes to me and what about; it just doesn’t know what they said.</p><h3>Start at the bottom of the ladder</h3><p>The pattern generalizes past email — embeddings, summarization, OCR, transcription, all shipping as local versions. Inventory what the machine gives you, put it at the base of the ladder, meter everything (<em>especially</em> the free parts). The OS already paid for the bottom of the ladder; everything above it should have to earn the call.</p><p>My inbox has been <em>classified</em> this way for months — 8,427 on-device calls and counting, against 487 that needed the paid rung. Acting on those classifications is a separate step, deliberately: action_taken reads logged_only on all 8,566 decisions the pipeline has ever written, and the only messages that ever moved were 44, swept by hand over three days at the end of May, each recorded in an undo manifest I could reverse. The ladder decides what my mail is. I still decide what happens to it.</p><p>The free model earned those 8,427 calls. The cloud earned 487. Both wrote the same receipt, which is the only reason I can tell you so.</p><p>A free tier you don’t meter isn’t a free tier. It’s an unaudited dependency.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea4e3c4acb4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starve the Orchestrator: Why the Smartest Agent in My System Knows the Least]]></title>
            <link>https://medium.com/@davidjknudson/starve-the-orchestrator-why-the-smartest-agent-in-my-system-knows-the-least-f12e439c737d?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f12e439c737d</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[context-engineering]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 18:19:33 GMT</pubDate>
            <atom:updated>2026-07-29T05:05:51.911Z</atom:updated>
            <content:encoded><![CDATA[<p>Context is rent, not capability. For heavy work, let disposable agents absorb the files, logs, and retries; return only what the coordinator needs to decide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzT3vMqjfMDUPHU_RVrr5g.png" /><figcaption>Cover image: AI-generated (GPT Image 2).</figcaption></figure><p>There’s a number I watch more closely than my test pass rate, my token bill, or my error logs: the size of my orchestrator’s context window. When that number climbs, something is going wrong — even when every individual task is succeeding.</p><p>A year ago that sentence would have sounded absurd to me. The intuition everyone brings to agent systems — I brought it too — is that context is capability. More of the codebase in the window, more history, more accumulated evidence: smarter agent. Model vendors reinforce the framing every time a bigger window headlines a release, and for a single agent answering a single question, it’s approximately true.</p><p>For the agent that coordinates other agents, it’s backwards. I run a personal multi-agent system that plans, dispatches, reviews, and ships real code, and the most consequential operating decision in it is that the orchestrator stays deliberately ignorant. It holds conclusions, never raw material. Not as a philosophy — as arithmetic.</p><h3>Context is a lease, not a warehouse</h3><p>The single-agent mental model treats a context window like a warehouse: space you fill with useful material, where storage is free once you’ve paid to read it in. That model quietly assumes the agent is short-lived — it answers the question, and the window dies with it.</p><p>An orchestrator is the opposite of short-lived. It’s the one process that persists across an entire working session: task after task, dispatch after dispatch, sometimes hours of continuous operation. And a language model has no long-term store to page cold data out to. Whatever enters the orchestrator’s window stays there, and the model re-processes the entire window on every turn.</p><p>That re-processing is the detail that changes everything. Read a 3,000-token file at turn ten of a session that runs to turn two hundred and you haven’t paid 3,000 tokens — you’ve paid it a hundred and ninety times, on every subsequent turn, whether or not the file is ever relevant again. The cost of a token isn’t its size; it’s its size multiplied by the remaining lifetime of the window it lands in. Let the window grow linearly with turns and total processing grows roughly quadratically with session length. That’s not a billing quirk. It’s the shape of the resource.</p><p>The most expensive thing my agent does is read its own output.</p><p>Every verbose tool result, every full-file dump, every worker transcript that flows back into the parent uncompressed — the orchestrator pays for it on arrival, then keeps paying rent on it for the rest of the session. Prompt caching softens the bill; it doesn’t repeal it. And it does nothing for the second cost, which is worse than the money.</p><h3>The quality tax nobody itemizes</h3><p>A heavy window doesn’t just cost more. It reasons worse.</p><p>Long-context models are genuinely good at retrieval. Ask for the one needle and they find it. They’re measurably weaker at sustained judgment once the haystack fills with distractors: stale plans, superseded error messages, diffs from tasks that closed an hour ago. An orchestrator’s whole job is judgment — what to run next, whether a result deserves trust, when to stop and escalate. And judgment is precisely the faculty that dilutes as residue accumulates. The window that was supposed to make the coordinator smarter fills up with reasons to be confused.</p><p>At the end of that runway sits compaction: the mid-session summarization every long-lived agent harness eventually performs when the window fills. Compaction is lossy compression applied to exactly the state you spent the session hoarding, at a moment you don’t choose. The material you paid rent on for two hours gets crushed into a summary, and you discover later which details didn’t survive the crush. I treat compaction the way I treat swap on a production server: technically a feature, operationally an alarm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcTNWJ2tRk5X4lMi7h9bJw.png" /><figcaption>Two ways to spend a session: context that compounds in-thread, versus context routed out and thrown away. Schematic — no axis carries a number.</figcaption></figure><h3>Where dispatch starts paying</h3><p>Here’s where the accounting becomes an operating rule.</p><p>The alternative to doing work in the orchestrator’s thread is dispatching it: spin up a fresh subagent with an empty window, hand it the task, and let it read the forty files and run the test suite and burn its own context doing so. When it finishes, its window is discarded. What returns to the parent is a conclusion — a verdict, a failure analysis, a summary of what changed and why — measured in hundreds of tokens instead of tens of thousands.</p><p>Dispatch isn’t free. There’s fixed overhead in every spawn: the worker re-reads files the parent may have already seen, re-derives context, boots cold. When the parent is lean, small tasks are genuinely cheaper in-thread — the overhead swamps the benefit. But in-thread work leaves residue, and residue compounds: every task you serialize into the main thread raises the price of every turn that follows it, because the marginal cost of the next turn is the whole accumulated window. That’s the hidden cost of in-thread serialization — not the task itself, but the permanent growth it leaves behind in the one context that never gets thrown away.</p><p>So there is a crossover. Below it, spawn overhead dominates and in-thread really is cheaper. Above it, compounding residue dominates and fanning out wins. I am not going to quote you a threshold. I don’t instrument my orchestrator’s window, so any number I gave you would be a guess wearing the costume of telemetry — and even a real one would be a property of my caching, my task mix, and my models rather than yours. The shape is the part that transfers. One line compounds; the other is flat overhead per task. Two curves like that cross exactly once, and once they’ve crossed they never uncross.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSY_-gnjapJ2Rx4VonQBbA.png" /><figcaption>Cumulative cost against tasks completed. The two curves cross exactly once — but where the crossing falls depends on your caching, your task mix and your models, so it is drawn and deliberately left unlocated.</figcaption></figure><h3>What “return conclusions” actually means</h3><p>The discipline that makes the economics work is a contract on what flows upward.</p><p>A subagent’s window is a scratchpad, and it can be profligate in there. Read entire modules, dump stack traces, iterate through failed attempts — all of it gets thrown away at exit. The only thing that survives is the return message, and the return message is held to a standard: what was concluded, what was changed, what deviated from the ask and why, what the parent needs to decide next. The parent never sees the forty files. It sees “the suite passes; two contract deviations, here’s the reasoning for each.”</p><p>It’s the same structure as a functioning engineering organization. A manager who insists on reading every diff line-by-line doesn’t become better informed — they become the bottleneck, and their judgment degrades under the volume. The useful manager reads the review summary, spot-checks what smells wrong, and preserves their attention for the decisions only they can make. What you send down into a dispatch matters too: pin the contract you need honored rather than the implementation you’d have written. But that’s its own discipline for another piece. The economics here are governed by what comes back up.</p><p>The orchestrator, run this way, becomes a router with a memory of verdicts. Its window holds the actual state of the operation: decisions, dependencies between tasks, open questions. The raw evidence behind any of it stays outside. If it ever needs re-examining, that’s one more dispatch.</p><h3>One real run</h3><p>The version of this that converted me from plausible theory to operating posture was a three-way parallel dispatch.</p><p>Three specialist agents, three non-overlapping sets of files, one shared set of frozen acceptance criteria. Because the file partition was disjoint, they ran simultaneously with zero communication between them — no locks, no coordination protocol, no merge negotiation. Three specialists’ output for roughly one specialist’s wait.</p><p>The part that surprised me was the composition. Three independently written pieces of code, assembled for the first time, and the merged tree came back at 1,821 tests passing and zero failing. No integration regressions anywhere. Independence hadn’t cost correctness; the partition had bought it.</p><p>It wasn’t spotless. One of the three specialists had its stream watchdog stall after it committed but before it wrote up what it had done, so I had to reconstruct that slice from the commit itself. The code composed anyway — but a run that produces the right tree and loses one of its reports is worth describing accurately. Meanwhile the orchestrator’s window held exactly three conclusions, and stayed lean enough that the review-and-merge turn at the end still had a sharp model doing the judging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7IIg1fy11GvK6I5EPIM95w.png" /><figcaption>One real run: three specialists on a disjoint file partition, merging first-time to 1,821 tests passing and 0 failing — with one write-up lost to a stalled watchdog along the way.</figcaption></figure><h3>The posture: treat the meter like a profiler</h3><p>The operating rule I’ve landed on is almost embarrassingly simple: a rising orchestrator context window is a signal to route work out, the same way rising memory pressure is a signal to find the leak. Watch it climb and you’re watching an agent become slower, more expensive, and less reliable on a schedule you can read right off the meter.</p><p>In practice that means a few standing habits. The orchestrator doesn’t open files it can delegate the reading of. Bulk output — logs, diffs, transcripts — goes to disk or to a subagent, never inline into the parent. Anything projected to generate more than a few thousand tokens of working material is a dispatch by default. And the million-token window my orchestrator technically has is emergency headroom. The goal is to end a session never having come near it.</p><h3>Where this breaks</h3><p>None of this is free, and it doesn’t fit every task.</p><p>Fan-out has real coordination costs. Task descriptions take orchestrator effort to write. Returned conclusions have to be adjudicated — and a subagent reporting “verified, works” is a claim to check, not a fact to file; I re-run the failure path myself before I believe it. Those overheads are real, and on small tasks they dominate: a one-line fix dispatched to a fresh worker is pure ceremony. The crossover argument cuts both ways below the line.</p><p>Fan-out also contends for things you’d forgotten were shared. During that three-way run, a lint cache my push path depended on kept getting evicted faster than I could warm it, because three specialists were working the same source tree at once. Nothing about the file partition was wrong. The partition just didn’t cover what lived outside the files.</p><p>And not every task decomposes. The three-specialist run worked because the files were disjoint and the acceptance criteria were frozen before anyone started. Give the same treatment to tasks with shared mutable state, or a chain where step two’s shape depends on step one’s findings, and you buy merge conflicts, stale reads, and workers confidently building on assumptions that expired mid-run. Tight sequential dependency wants a single thread — sometimes even the orchestrator’s own. Knowing which tasks refuse to be partitioned is half the skill.</p><p>I’ve deliberately left you without a threshold to copy. The asymmetry doesn’t need one — it follows from the single mechanism nobody’s roadmap is going to repeal: a long-lived window is re-read on every turn it survives.</p><h3>The coordinator that knows the least</h3><p>The upshot still feels wrong to say out loud, which is usually a sign it’s worth saying: I made my agent system better by making its coordinator know less. Ignorance, engineered deliberately, is what keeps the one long-lived seat in the system cheap and sharp — while the knowing happens out at the edges, in windows built to be thrown away.</p><p>If you run an orchestrator, put its context size somewhere you can see it. It’s the closest thing multi-agent systems have to a single vital sign. When it climbs, don’t admire it.</p><p>Route something out.</p><p><em>David Knudson builds and runs a personal AI assistant on an always-on Mac mini and writes up the sharp edges he hits doing it — this one about the coordinator that got slower while every task under it succeeded, and the parallel run that composed clean and still lost one of its own reports. More post-mortems at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f12e439c737d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[841 Teardowns in Two Minutes: When the Fail-Safe Became the Storm]]></title>
            <link>https://levelup.gitconnected.com/841-teardowns-in-two-minutes-when-the-fail-safe-became-the-storm-07880f166622?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/07880f166622</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[reliability]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 15:28:27 GMT</pubDate>
            <atom:updated>2026-07-13T15:28:27.444Z</atom:updated>
            <content:encoded><![CDATA[<p>A “fail loudly” contract I’d shipped on purpose turned a missing-model outage into a self-inflicted restart storm — and the cure meant admitting my favorite fix was the bug.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zswdT6uqy17vs-h-XmAxoQ.png" /><figcaption>Cover image generated by the author with ChatGPT.</figcaption></figure><p>Seven sessions a second. That was the rate at which something on my Mac mini was opening and tearing down sessions against modelmanagerd, the macOS daemon that babysits Apple’s on-device models. Two minutes of unified log: 841 teardowns. If I had seen that traffic pattern hitting one of my own services, I would have called it what it looked like — a denial-of-service attack.</p><p>The attacker was my mail sorter.</p><p>More precisely: the attacker was a fail-safe I had designed, tested, and shipped months earlier, doing exactly what I told it to do. A macOS 27 beta update had quietly lost the on-device language model my classifier daemon depends on, and the daemon’s response to that outage — the response I’d once written up as the <em>responsible</em> choice — amplified one missing file into a sustained assault on the OS component least able to do anything about it.</p><p>This is the story of how “surface the failure loudly” became the failure, why the prior fix was the bug, and what I replaced it with: one long-lived process and a widening, capped backoff.</p><h3>A mail sorter with an on-device brain</h3><p>Some context, kept short. I run a small fleet of launchd agents on a Mac mini. One of them classifies incoming email. The interesting stage of its pipeline talks to Apple’s Foundation Models framework: the roughly three-billion-parameter language model that ships on-device with the macOS 27 beta. Free, private, no network round-trip. Lovely when it works.</p><p>Because the daemon depends on that model, it runs a startup probe: before entering its work loop, it fires a handful of warm-up requests to confirm the model is actually loaded and answering. If the probe fails every attempt, the daemon must not start classifying. A classifier that can’t reach its model shouldn’t fake confidence. That invariant is non-negotiable, and nothing in this story changes it. Fail closed: no model, no work loop.</p><p>The question this incident forced was narrower: when the probe fails, <em>what should the process do about it?</em></p><h3>The beta taketh away</h3><p>The trouble started after a beta update. The daemon’s startup probe began failing with an opaque error, code 1019, and stayed failing.</p><p>Reading the logs had its own comedy: my zsh profile defines a log function that silently shadows the system log command, so log show wasn’t doing what I thought until I invoked /usr/bin/log by full path. When a diagnostic tool behaves strangely, check whether you’re even running the tool.</p><p>With the real logs open, modelmanagerd’s own entries decoded the 1019 for me, a decode I read straight off the local logs, not from any documentation. The multi-billion-parameter generative asset was missing from the model catalog, and a pending version switch, presumably from the beta’s catalog bump, was wedged half-complete. The small auxiliary models were fine. The one my daemon needed was simply gone, and the machinery for re-fetching it was stuck.</p><p>So far, an ordinary beta-OS war story: Apple moved my cheese. But the logs showed something else, and it was uglier.</p><h3>One experiment beats three hypotheses</h3><p>Alongside the missing-asset errors, modelmanagerd was churning through sessions at a startling rate: those 841 teardowns in two minutes. My first hypothesis was the flattering one: the beta had regressed modelmanagerd itself, and the churn was the OS thrashing on its own wedged state.</p><p>The test was one command. I booted my mail daemon out of launchd and watched the teardown counter.</p><p>841 per two minutes dropped to zero per sixty seconds. Zero.</p><p>The storm was 100% self-inflicted. My own daemon, faithfully executing its failure policy, was generating every last teardown. A controlled unload experiment settled in ninety seconds what log-staring had been rationalizing for an hour. When you suspect a feedback loop, don’t read about it — break the loop and watch what stops.</p><h3>The fix that was the bug</h3><p>Here is where the archaeology gets uncomfortable, because the culprit wasn’t an oversight. It was a fix. My fix, shipped deliberately, with a rationale I’d have defended at review.</p><p>Months earlier, I’d tightened this daemon’s failure contract: if the startup probe exhausts its warm-up attempts, exit with a non-zero status (rc=2) <em>so that launchd surfaces the broken state</em>. The textbook move. Don’t limp along in a broken state; die visibly and let the supervisor see it. I remember feeling good about that patch.</p><p>What I did not do was read that contract side by side with the daemon’s launchd plist, which says KeepAlive=true with ThrottleInterval=30.</p><p>Under KeepAlive, launchd’s response to an exit (any exit) is to restart the job, and ThrottleInterval only guarantees restarts won’t come more often than every thirty seconds. It’s a floor, not a backoff. It never widens. So the runtime behavior of “exit rc=2 to surface the failure” was:</p><p>Every ~30 seconds, forever: restart. Each restart re-fires five warm-up probes. Each probe spawns a throwaway model-server helper that asks modelmanagerd for a session against an asset that does not exist. Session created, request fails, session torn down — and modelmanagerd, retrying the missing asset, repeated that cycle far faster than my five-probes-a-restart suggested: 841 teardowns in the two minutes I sampled, restart after restart, for as long as the model stayed missing. On a beta with a wedged catalog, that was hours.</p><p>And the bitterest part: nothing was surfaced. That was the entire point of the rc=2 contract, and it delivered none of it. The non-zero exit went somewhere no human looks, and KeepAlive dutifully papered over the failure by retrying at maximum permitted rate, forever. From the outside the job looked <em>up</em>: fresh PID, recent start time. “Launchd will surface it” was a story I told myself while writing the patch, not a property of the system I deployed into.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUPBy3fwzUwcvyI-hzT1rw.png" /><figcaption><em>The self-inflicted loop: a missing model asset (error 1019) sends the daemon into an rc=2 exit → launchd restarts it → five warm-up probes fire → each drives modelmanagerd to churn sessions against the missing asset, roughly every 30 seconds, forever — while each fresh PID keeps the job looking healthy. (Source: author’s own incident logs.)</em></figcaption></figure><p>That’s the aphorism this incident tattooed on me:</p><p><strong>Exiting isn’t failing safe. It’s delegating your retry policy to whoever restarts you — at their rate, with none of your judgment.</strong></p><p>The fail-safe didn’t fail. It succeeded, 841 times in two minutes.</p><h3>Same layer, inverted mechanism</h3><p>Once the loop was named, the cure’s shape followed. But the discipline in the cure is what I want to sell you, because the tempting fixes were all wrong the same way.</p><p>Tempting fix one: bump ThrottleInterval to something huge. That treats launchd’s restart floor as the problem when the daemon’s request rate against a shared dependency is the problem: tuning the storm slower while keeping the storm.</p><p>Tempting fix two: a watchdog that notices the churn and disables the job. A watchdog on the fail-safe: two failure policies stacked, and the next incident gets to be about their interaction.</p><p>The right cure revises the original contract at the layer where the bug lives: the daemon’s own model-session request rate. The invariant stays: the work loop never runs while the model is down. Only the surfacing mechanism inverts. Instead of exiting so the supervisor restarts it into another probe volley, the process stays alive, one PID, and does this:</p><ol><li>When the startup probe exhausts its warm-ups, log one loud, greppable OUTAGE line stating that classification is paused.</li><li>Sleep 60 seconds. Re-probe once.</li><li>Still down? Double the interval (120s, 240s, 480s), capping at 15 minutes between re-probes.</li><li>The sleep is interruptible, so a shutdown signal still lands promptly; a backoff that blocks SIGTERM is a new bug wearing the old one’s coat.</li><li>The instant a re-probe succeeds, it logs a RECOVERED line and enters the work loop, without a restart or a reboot.</li></ol><p>Against a multi-hour outage, that collapses the request rate by about three orders of magnitude, from ten probes a minute to one probe every 15 minutes at steady state, while <em>tightening</em> the recovery bound: the daemon now self-heals within one backoff interval of the model returning, instead of within a launchd throttle window plus a full cold start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYqpYvPkLbY1MxnPPiRrjg.png" /><figcaption><em>Same invariant, inverted surfacing: a fixed 30-second launchd restart floor that never widens (left) versus one long-lived process that backs off 60→120→…→900s and self-heals (right) — about three orders of magnitude fewer model-session requests at steady state. (Source: author’s own implementation.)</em></figcaption></figure><p>One carve-out proves the rule rather than breaking it. The daemon also has a one-shot mode for manual runs, and there the old rc=2 contract survives untouched. A one-shot has no daemon to keep alive and a human at the terminal reading the exit code, so exit status is exactly the right surface for that caller. The bug was never that non-zero exits are bad. It was exporting a one-shot’s failure contract into a supervised loop without reading the supervisor’s policy.</p><h3>Your supervisor’s restart policy is your retry policy</h3><p>The lesson generalizes past launchd. Exit-to-restart is a legitimate pattern (crash-only design has real virtues), but it carries two preconditions people forget to check:</p><p><strong>Restart must be cheap for everyone, not just for you.</strong> My daemon’s restart wasn’t cheap: its startup did real work against a shared dependency. Every restart spent someone else’s resources (model-server spawns, modelmanagerd session setup and teardown) on an OS service with no way to tell my job to back off.</p><p><strong>The supervisor’s restart policy becomes your de facto retry policy, so read it as one.</strong> Write out what your supervisor actually does on exit (KeepAlive plus a 30-second floor, in my case) and ask whether you’d ever ship <em>that</em> as a retry loop against a dependency: fixed interval, no widening, no cap, no circuit breaker, forever. I’d reject it in code review without hesitation. I shipped it anyway, because it lived across two files, a Python exit code and a launchd plist, and I only ever reviewed one of them.</p><p>If your platform’s supervisor offers genuinely widening restart backoff, some of this pressure eases. launchd’s ThrottleInterval doesn’t widen, which means any backoff my process needed had to live <em>in</em> the process.</p><h3>Patience, and the reboot I didn’t need</h3><p>A side lesson, since it nearly caused a second self-inflicted wound. While the model was missing I staged the classic big hammer: reboot the machine, hope the catalog un-wedges. What stopped me was watching the asset system long enough to learn its rhythm: Apple’s model downloads arrive in bursts with long quiet gaps, and a 15-minute silence is not a stall. About an hour after the wedge appeared, the asset re-downloaded on its own, the version switch cleared, and the health probe went green. No reboot. The intervention I’d prepped would have gotten the credit for a recovery already in flight, which is exactly how superstitions get into runbooks.</p><p>One calibration note: after re-enabling the daemon, its first minute produced a burst of a couple hundred teardowns, which looked alarmingly like the storm returning. It wasn’t. That’s what a legitimate warm-up plus a working model looks like. The PID held constant and churn fell to zero between polls. A storm and a healthy startup can share a headline number; they never share a trend line.</p><h3>Where the honesty has to live</h3><p>Full disclosure about the cure’s current state, because this is the part of any war story most tempting to airbrush.</p><p>The new backoff shipped test-first: the revised contract went in as seven failing tests before the implementation, including a regression guard asserting the supervised loop can never again return rc=2 during a sustained outage. All green, and the guard means the specific contract that caused the storm can’t silently come back.</p><p>But green tests are the weakest true claim I can make here. The backoff’s live behavior (hours at the 15-minute cap, the recovery race when the model reappears mid-probe) has never met a real outage. It will, the next time a beta churns the model assets out from under me; until then “test-gated” is the honest label, not “proven.” Shipping had its own small trap, too: a long-lived Python process doesn’t reload its source, so the fix wasn’t real at commit time. It was real when I kicked the daemon over and watched a new PID come up, pass its probe, and leave modelmanagerd’s churn counter at zero.</p><p>And this is one machine and one supervisor. Your platform’s restart semantics differ; the constants here (60 seconds, factor of two, 15-minute cap) are tuned to how fast Apple’s model assets tend to come back, not handed down from anywhere. The shape transfers. The numbers shouldn’t.</p><p>The invariant I started with was never wrong: no model, no work loop. Every byte of this incident lived in <em>how</em> that broken state got surfaced. I’d spent my care on the failure condition and outsourced the failure behavior to a plist I didn’t re-read, and the system did precisely what both files, together, said. They just said something I’d never read in one sitting.</p><p>Read yours in one sitting. Especially the fix you’re proudest of.</p><p><em>David Knudson builds and runs a personal AI assistant on an always-on Mac mini and writes up the sharp edges he hits doing it — this one about the fail-safe that became a self-inflicted restart storm, and the exit code that quietly handed its retry policy to launchd. More post-mortems at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07880f166622" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/841-teardowns-in-two-minutes-when-the-fail-safe-became-the-storm-07880f166622">841 Teardowns in Two Minutes: When the Fail-Safe Became the Storm</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The $0 That Should Have Scared Me]]></title>
            <link>https://aiadvances.org/the-0-that-should-have-scared-me-b21a78cbf835?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b21a78cbf835</guid>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 06:22:21 GMT</pubDate>
            <atom:updated>2026-07-13T06:22:21.999Z</atom:updated>
            <content:encoded><![CDATA[<p>Ten days, 540 classification decisions, not one resolved by a model: two unrelated bugs had quietly killed both model tiers while the $0 total made the pipeline look efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5-kkerMTF3Lwt6OuBxNPKw.png" /><figcaption>Cover image generated by the author with ChatGPT.</figcaption></figure><p>The note in my project tracker was unambiguous: the mail classifier was “the only remaining uncapped expensive cost surface” in my agent system. Every other pipeline had a budget or a kill switch; this one could, in principle, escalate any incoming message to a paid model without limit. So before I built the cap, I did the thing I keep having to re-teach myself to do: I stopped trusting the note and read the actual telemetry.</p><p>The telemetry said the classifier had made 540 classification decisions over the previous ten days, and that not one of them had cost me anything. $0.00.</p><p>For about ninety seconds, that felt like vindication. The whole point of the tiered design was to resolve most decisions at the free tiers and only escalate the hard cases. A $0 total looked like the architecture doing precisely what I built it to do. The “uncapped expensive surface” wasn’t expensive at all. Close the note, skip the cap, move on.</p><p>Then I read the label column, and the ninety seconds ended.</p><h3>The system on paper</h3><p>The classifier is a small daemon on a Mac mini that classifies incoming mail for a personal agent system — in shadow mode, a disclosure that belongs up front. It’s a dry run: every decision is logged to a ledger, nothing acts on the labels yet, and the daemon never touches the mail itself — I’m building a track record before anything downstream trusts the labels. So when this system fails, it corrupts telemetry rather than misrouting a single message. Lower stakes, honestly. But it also means the ledger <em>is</em> the system’s entire output. Hold that thought.</p><p>The design is a cost waterfall, four stages deep. A message first hits deterministic alias rules — known senders and subjects, confidence 1.0. Whatever survives goes to a scored ensemble over mail-header signals: free, deterministic, not a model. Only then does a model see the message: Apple’s Foundation Models running on-device, also free. And for the genuinely hard residue, the daemon shells out to a small paid model — Claude’s Haiku tier, via the claude CLI. That’s the metered stage, the “uncapped expensive surface” the note was worried about. If both model stages come up empty, the classifier stamps a designed fallback: other, confidence 0.50.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y75tZAjb5fhG_wiRF25ceg.png" /><figcaption><em>The classifier as designed, simplified to its cost shape: the free tiers — deterministic rules, a scored header ensemble, an on-device model — carry the first pass, and only the hard residue escalates to the metered paid model. Every decision writes a row to the ledger. (Source: author’s own system diagram.)</em></figcaption></figure><p>Every row records the resolving stage, the label, the confidence. No cost column — that ledger came later, and it’s part of this story — but the $0 didn’t need one. Cost lives in exactly one stage, and the stage column showed the paid tier resolving nothing. Not “less than usual.” Nothing, across all 540 rows. Zero paid calls is zero dollars, and if the stage column is all you read, that’s a beautiful result — the free tiers carrying everything is exactly the shape you want.</p><p>The label column told a different story. Of those 540 decisions, 303 (56%) carried the same label: other, confidence 0.50.</p><p>Not 0.49. Not 0.51. Exactly 0.50, three hundred and three times.</p><p>No model produces a posterior of exactly 0.500 over and over. That number isn’t an inference; it’s a constant somebody typed. I typed it. It’s the label the classifier assigns when no model stage returns an answer at all. More than half of my mail traffic wasn’t being classified cheaply. It wasn’t being classified. The system was shrugging at 56% of its input and logging the shrug as a completed decision.</p><h3>The autopsy: two bugs, both answering None</h3><p>Here’s the mechanism, and it took me a while to accept that “mechanism” was plural. I went in expecting one bug. There were two — different tiers, unrelated causes, same ten days.</p><p>Bug one killed the on-device stage. The daemon reaches Apple’s Foundation Models through a helper binary, and the transport to that helper — a batched-subprocess arrangement with a flush bug — had broken. Every request to the primary model path came back empty. Which is where I’d been fooling myself: I had read the flood of fallback rows as a healthy model hedging on hard messages, escalating at low confidence as designed. There was no confidence in the story at all. The stage wasn’t unsure; it was down. The waterfall treats an empty answer as “stage unavailable” and moves on, so everything the deterministic tiers couldn’t settle sailed straight past the model meant to catch it.</p><p>Which should have been survivable — catching the overflow is what the paid escalation tier is for. Except bug two had already killed that one.</p><p>The daemon runs under launchd, macOS’s init system, and its plist had no EnvironmentVariables block — so it inherited launchd’s bare default PATH of /usr/bin:/bin. My shell’s PATH includes the directory where the claude binary lives, the CLI the paid stage shells out to. So on each of those 303 decisions, the escalation did this:</p><ol><li>subprocess.run([&quot;claude&quot;, ...]) — a bare invocation, resolved against PATH.</li><li>Under launchd’s PATH, there is no claude. Python raises FileNotFoundError before a process ever starts.</li><li>A try/except catches it — a handler written for “the model didn’t give a usable answer,” which treats every failure the same way: return None.</li><li>The waterfall now holds None from the on-device stage and None from the paid stage, applies the designed fallback, and stamps the message other, 0.50.</li><li>The ledger records a completed decision. Every one of those 0.50s is two stages’ worth of None wearing a number.</li></ol><p>(Slightly worse, actually: the on-device stage carried an internal claude sub-fallback at the time — same bare subprocess call, same PATH, same silent death. Three model paths, zero survivors. I’ve since deleted it; a backup that fails identically isn’t redundancy.)</p><p>No crash. No non-zero exit for launchd to notice and restart. No alert, because nothing was counting failures — silence is always under threshold. The process was healthy by every signal it emitted: on schedule, queue consumed, well-formed rows. It just never got an answer out of a model, for ten days and change.</p><p>The especially rude part — the PATH half, anyway — is that the paid stage worked every time I exercised the classifier by hand: in a terminal, my shell profile sets PATH and claude resolves. Under launchd, same machine, same code, same binary sitting right there on disk — different universe. It worked on my machine and was broken on my machine, and the difference was which process spawned it.</p><h3>Every layer did its job</h3><p>What makes this worth writing up isn’t either bug alone — a transport flush bug is ordinary, and the missing PATH block is a macOS rite of passage. It’s that nothing downstream of them misbehaved, which is precisely why nothing surfaced them.</p><p>launchd supplied exactly the minimal environment it documents. Python raised exactly the exceptions it should. The handlers caught them, as written. The waterfall treated None as “stage unavailable,” as designed. The fallback label was deliberate — I <em>wanted</em> the classifier to fail closed, degrading to a safe default rather than crashing over one bad call. The ledger faithfully recorded every row it was handed. Every layer behaved correctly, and the composition of all that correctness was a lie.</p><p>Fail-closed-but-silent means each layer politely absorbs the error and passes something plausible downstream, until what reaches the human is a green number. Graceful degradation without an alarm attached is just failure with better manners.</p><p>And the metric I was reading — cost, via the paid stage’s silence — was structurally incapable of catching any of it. Cost only moves when the system does paid work. A system that stops paid work because it’s broken and one that avoids paid work because it’s efficient produce the same flat line. The graph I was proudest of couldn’t tell my best case from my worst case.</p><h3>The fix — both of them</h3><p>It took two fixes, two days apart, and the split is itself evidence that this was never one story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jY1bHLSFiyOUwHdOIM4gLg.png" /><figcaption><em>Two failures, two unrelated causes, two different recovery days: the on-device transport came back on May 23 (a PATH-independent fix), and the missing PATH line revived only the paid tier two days later. (Source: author’s own ledger and commit history.)</em></figcaption></figure><p>The first restored the on-device transport. The effect was immediate: messages that had spent ten days stamped other, 0.50 began resolving on-device at 0.9 confidence, the fallback share collapsed from 60% to 21% that same day, and on-device resolutions went from zero — literally zero across the whole window — to twenty-one. One fix and the system was mostly alive.</p><p>Mostly. The paid tier stayed dead two more days, because its bug was the plist. Then the PATH fix landed:</p><pre>&lt;key&gt;EnvironmentVariables&lt;/key&gt;<br>&lt;dict&gt;<br>    &lt;key&gt;PATH&lt;/key&gt;<br>    &lt;string&gt;/Users/me/.local/bin:/usr/bin:/bin&lt;/string&gt;<br>&lt;/dict&gt;</pre><p>(Or sidestep PATH entirely by invoking binaries by absolute path — the on-device helper does exactly that, which is why the PATH bug never touched it. One or the other, on every launchd job that shells out to anything you installed yourself.) The day the block landed, the paid stage came back to life and resolved four decisions. Four is a healthy number — the residue after three free tiers is supposed to be small.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYWZ3R-mlF8G8vkqjGl2xQ.png" /><figcaption><em>Ten days of decisions before and after the on-device transport fix: before, 56% of traffic piled onto the fallback label at exactly 0.50 confidence; after, the same messages resolve at the on-device tier near 0.9 and the fallback share collapses. (Source: author’s own ledger data.)</em></figcaption></figure><p>I’ll admit the ending I wanted to write: the pipeline, alive, still costs approximately nothing — the $0 was achievable, I just wasn’t achieving it. The cost ledger the fix finally added (every paid call now writes a row, succeed or fail) has since killed that version. In the weeks after the fixes, the on-device tier carried 94.2% of everything a model resolved; the paid tier handled the residue — 363 calls, $20.30, across about seven weeks. Call it three dollars a week. Cents a day.</p><p>Three dollars a week is not $0, and the difference is the point. $0 was never this system’s efficient state — efficient is a small, steady, nonzero number, a paid tier doing occasional honest work at the end of a mostly-free waterfall. The $0 I’d been admiring wasn’t available to a working pipeline at any setting. It wasn’t the architecture succeeding. It was the one number the architecture could only produce by dying.</p><h3>The two contracts I changed</h3><p>The transport patch and the PATH line are the fixes, not the lesson. The lesson is what I changed around them — and I’ll be precise about which parts are real, because dressing aspirations up as guarantees is this same failure in a different costume.</p><p>What’s real: a broken model call is no longer allowed to look like a quiet one. The escalation path writes a cost-and-usage row even when the call fails, so a FileNotFoundError on the model binary now lands in the ledger as a failed call with a named outcome — operator misconfiguration, distinct from a model declining to answer. That directly closes the failure that happened.</p><p>What’s partial: the startup probe exercises the on-device stage — the tier that broke first — not the paid tier, so if the claude binary vanished from the daemon’s PATH tomorrow, the probe would pass while stage four died in silence again. In daemon mode it backs off in-process rather than exiting non-zero, so “refuses to run degraded” is only literally true one-shot. The daily summary reports a confidence histogram, not a named fallback share — my 0.50 pile-up would be a bulge in a middle bucket, readable if you’re looking, missable if you’re not. Its solid piece is a staleness alert: if the classifier’s input stops flowing, I hear about it.</p><p>The second contract is the one I’m still building toward, and it’s the one that generalizes: a good-trending metric owes you a positive sign of life. The version worth designing in is a rolling-window watch on the fallback share — a classifier that mostly answers “other” has stopped classifying, whatever the spend says — plus per-stage attempt counters, so a stage recording zero attempts while traffic keeps flowing is presumed dead until it proves otherwise. None of it was standing guard during the ten days, and it isn’t tonight either. It’s next.</p><h3>The rule: green numbers need aliveness checks too</h3><p>Here is the general lesson, stated as plainly as I can manage.</p><p>A metric trending toward “good” (cheap, fast, error-free) needs an aliveness check as badly as a metric trending bad. Maybe worse.</p><blockquote><em>A cost graph that cannot distinguish “free because efficient” from “free because dead” is not measuring cost. It is measuring nothing.</em></blockquote><p>Nearly all of our alerting instinct points in one direction. We page on spikes, error budgets, latency creeping past p99 targets, bills trending up. The entire discipline of monitoring is organized around catching numbers moving in the <em>bad</em> direction. But a number moving in the optimistic direction fails open in your mind: it tells you a flattering story, and flattering stories don’t get audited. A green number in the optimistic direction is the most dangerous kind of metric, because you stop looking at it precisely when you should be looking hardest.</p><p>Other engineering disciplines solved this a century ago. A train’s dead-man’s switch doesn’t wait for evidence that the operator is in trouble; it demands continuous positive proof that the operator is alive, and treats silence as an emergency. My ledger had the opposite contract. Silence read as savings. The default interpretation of “no paid model calls” was “the tiering is working,” when it should have been “prove it.”</p><p>If I hadn’t gone to verify the “uncapped expensive surface” note — a note that turned out to be wrong in the opposite direction, worrying about runaway spend from a pipeline that couldn’t spend a cent — I would have found this weeks later, if at all. I was one decision away from spending a day building a spending cap for a corpse.</p><h3>What this doesn’t solve</h3><p>I want to be honest about the boundaries of this rule, because “add aliveness checks” is easy to say and underdetermined in practice.</p><p>The discipline tells you that every good-trending metric needs an aliveness signal. It does not tell you <em>which</em> one, and the options all have blind spots. A process heartbeat proves the daemon is scheduled, not that it’s doing anything; mine had a perfect heartbeat for ten days. Attempt counters require per-stage instrumentation you have to design in ahead of time, and mine didn’t have it. Output-distribution monitoring is the thing that actually cracked this case, and it depends on the failure having a legible signature. I got lucky: my fallback had a fingerprint — that unnatural 0.50 repeated 303 times — and both bugs funneled into it. A fallback that added noise to its confidence value would have hidden in the histogram.</p><p>Threshold tuning is on you, too. “Alert when the fallback share crosses X%” has no principled X; any number you pick is a guess you’ll revise the first time it pages you for nothing.</p><p>And none of this catches the failure mode one level up: <em>subtly wrong</em>. A model confidently mislabeling messages at 0.9 sails through every check I’ve described — the process is alive, the stages attempt, the distribution looks healthy. Aliveness checks catch silent death. They do not catch confident nonsense; that takes ground-truth sampling, which is a different article.</p><p>Finally: you can’t afford to do this for every number you emit. The filter I’m using is decision-coupling. This metric nearly fed a real decision — where to spend a day of engineering — built entirely on fiction. Metrics that feed decisions get aliveness checks first. Metrics that are decoration can stay decoration.</p><h3>Go find your $0</h3><p>The project note and the dashboard were both wrong about the same system in opposite directions — the note said “dangerously expensive,” the ledger said “healthily free,” and the truth was “dead.” Of the two errors, the dashboard’s was worse, because the note at least provoked an investigation. The green number was engineered, by accident, to prevent one. And the healthy version of that ledger doesn’t read “free” either; it reads three dollars a week.</p><p>Somewhere on your dashboard there’s a number that has been quietly, pleasantly good for a long time. Zero errors from a service, zero dollars from a tier, zero retries from a queue. I’m not saying it’s lying. I’m saying that if it were, nothing you’ve built would tell you.</p><p>Ask it to prove it’s alive.</p><p><em>David Knudson builds and runs a personal AI assistant on an always-on Mac mini and writes up the sharp edges he hits doing it — this one about the $0 cost line that looked like efficiency and actually meant the pipeline was dead, and the aliveness check every green metric needs. More post-mortems at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b21a78cbf835" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/the-0-that-should-have-scared-me-b21a78cbf835">The $0 That Should Have Scared Me</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Let Three Coding Agents Near My Whole Digital Life (Safely)]]></title>
            <link>https://levelup.gitconnected.com/i-let-three-coding-agents-near-my-whole-digital-life-safely-35bf77e9dc28?source=rss-df154f7794f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/35bf77e9dc28</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[David J Knudson]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 17:09:08 GMT</pubDate>
            <atom:updated>2026-07-01T17:09:08.771Z</atom:updated>
            <content:encoded><![CDATA[<h4>Every agent you run against real data has a boundary. Most people can’t point to theirs. Here’s the deny-by-default broker I built — and the one place it still leaks.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1la7WBOvm0GgMHnnLXzfsQ.png" /><figcaption>Image generated by the author with OpenAI GPT Image 2</figcaption></figure><p>It’s a normal Tuesday night. Three Claude Code sessions are open on my Mac mini, one each for an iOS app, a backend service, and a static site. Every one is a capable agent with a shell and a toolbelt, grinding through unrelated work. On the same machine, under the same login, my Apple Mail, Calendar, Reminders, Contacts, Notes, and iMessage are each wired in as MCP servers, because that’s what makes a home assistant actually useful: it reads my schedule before it drafts a briefing, it checks whether a contractor ever replied.</p><p>Now hold both of those facts in your head at once, because that’s the sentence I avoided saying out loud for too long: <em>by default, every one of those project agents is one tool call away from my entire personal life.</em> Nothing in the setup distinguished “the assistant that’s supposed to read my calendar” from “the build agent for some unrelated app that has no business reading anything at all.” Same host. Same login. The same MCP servers a config-merge away.</p><p>If you run agents on a machine that also touches your real data, this is your problem too, whether or not you’ve named it. And the first answer everyone reaches for — <em>just don’t give the project agents access</em> — is not a design. It’s a hope. Understanding why it’s a hope rather than a guarantee is the whole game, because the trap doesn’t live in any one config file. It lives in how agent tooling composes.</p><h3>Why “just don’t give it access” is a hope, not a design</h3><p>In Claude Code, the set of tools an agent can reach isn’t a switch you flip. It’s a <em>composition</em>: configuration combined from user scope — your home directory, which applies everywhere — and project scope, the repo you happen to be in. An MCP server registered at user scope is present in every project you ever open. That’s exactly what you want for a code-search tool. It’s a catastrophe for your inbox.</p><p>So “don’t give it access” has two failure modes, and both are quiet.</p><p>The first is registration creep. You add a personal MCP server once, at user scope, because you were testing it from your home directory. It works, you move on — and now it’s silently present in every repo on the machine, including ones you won’t create until next year. Nothing announced the blast radius.</p><p>The second failure mode is worse, because it survives careful setup. Agents spawn sub-agents, and a sub-agent inherits the tool composition of <em>where it was launched</em> — not of the project it’s nominally working on. Get the working directory wrong by one level and a sub-agent that’s supposed to be sandboxed inside a project inherits the orchestrator’s full personal-data toolbelt instead. No error. No prompt. It simply has the access now.</p><p>That’s the tell that “don’t give it access” can’t hold. Access here isn’t something you set; it <em>emerges</em> from how config composes across scopes and how processes spawn. Good intentions don’t constrain an emergent property — an architecture does: one that’s deny-by-default, with a boundary you can physically point at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqwDmepHZildwFaAWzltqA.png" /><figcaption>Access is composed across scopes, not toggled per project — a user-scope server reaches code it has no business near.</figcaption></figure><h3>The broker: calling it grants you nothing</h3><p>So here is the architecture. A foreign-project agent — anything that isn’t my assistant running from its own home base — cannot reach Mail, Calendar, Reminders, Contacts, Notes, or Messages directly. Those servers are registered at exactly one scope: the assistant’s own project — its home-base directory — and never at user scope, which is the distinction that makes the whole thing hold. (User scope would be the leak the last section was about; pinned to one project, the servers stay invisible to every <em>other</em> project’s composition.) The only path a foreign agent has to private-life data is a single MCP server I call the broker, and the broker’s defining property is the one that makes the whole thing work: calling it grants you nothing.</p><p>It exposes exactly three tools — request_data, status, and fetch — and the design lives in what they refuse to do.</p><p>When an agent calls request_data — say, asking for apple_services.calendar.events to answer “is Thursday afternoon free” — the broker does not return events. It doesn’t even decide. It writes an entry into a pending-decisions ledger that <em>I</em> read, and returns this:</p><pre>{ &quot;status&quot;: &quot;pending&quot;, &quot;ask_id&quot;: &quot;...&quot;, &quot;ttl_seconds&quot;: null, &quot;retry_after_seconds&quot;: 30 }</pre><p>A request ID and an instruction to check back. Nothing else. The agent now polls status(ask_id), which keeps returning pending until I act. To approve, I run one command against the ledger — and only at that moment does status mint a ticket:</p><pre>{ &quot;status&quot;: &quot;granted&quot;, &quot;ticket&quot;: &quot;tkt_…&quot;, &quot;ttl_seconds&quot;: 300 }</pre><p>The ticket is good for five minutes. The agent hands it to fetch(ticket, data_type, params), and only <em>then</em> does data come back. If I do nothing, nothing happens — the request sits in the ledger and times out. There is no path from “agent wants my calendar” to “agent has my calendar” that doesn’t pass through me tapping approve.</p><h3>Keeping consent liveable</h3><p>Two choices keep this from becoming a tax I’d route around. The ticket is ephemeral by default: it lives in memory, dies in five minutes, and grants exactly one data type. For a genuinely recurring request, the agent can ask to <em>persist</em> — which writes a time-boxed grant to a ledger so the next identical call skips the prompt until it expires. And I’m only pushed a notification when an ask is high-urgency <em>and</em> carries at least a medium cost-if-wrong; everything routine waits silently in the ledger for the next time I look. Loud when the stakes are high, quiet otherwise. That asymmetry is what lets a deny-by-default system stay liveable instead of getting disabled out of fatigue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Qkf5Doi4AztYf7eADAWyw.png" /><figcaption>The only path from “agent wants my calendar” to “agent has my calendar” runs through me tapping approve.</figcaption></figure><h3>The two properties that only matter when things fail</h3><p>Both live on the failure path. That is where a security layer is actually tested — and where most of them quietly aren’t.</p><p>Every decision the broker makes — granted, pending, denied, by source, agent, data type, and how long it took — is appended to an audit log. So is every grant. But I want to be precise about what “append-only” buys here, because it’s exactly the kind of claim this piece is suspicious of: it is not an OS-level immutable flag. It’s enforced at commit time, by a pre-commit lint that refuses the modes that would let code rewrite history — wb, w+, an explicit .seek( or .truncate(. And the caveat the rest of this piece would demand I add: that list isn’t complete. A plain text-mode open(path, &quot;w&quot;) truncate isn’t on it yet, so today it would slip straight through — and a determined process could rewrite the bytes regardless. What the lint actually guarantees is narrower than “append-only,” and more honest: the codebase can’t <em>quietly</em> drift into the obvious ways of rewriting its own audit trail without someone tripping the check, or disabling it on purpose.</p><p>Revocation works the same way: a tombstone appended to the grants ledger, which the loader folds in when it computes what’s currently active — never a hard delete. The record of access is the one thing I most want a careless future version of me to be unable to edit away, so tampering with it has to be a deliberate act, never a quiet one.</p><p>The second property is the posture under failure. The broker reads its own state — the ledgers — at the start of every single call, before it does anything else. If that read throws, for any reason, the call returns denied / BROKER_STATE_UNAVAILABLE. A broker that can’t verify its own state does not guess in my favor; it says no. Two agents racing for the same data type and hitting lock contention? Denied, retry shortly. Malformed request? Denied. The failure direction is always toward <em>less</em> access, never more. A security layer whose error path is “well, allow it then” was never a security layer.</p><h3>The grant follows the identity, not the project</h3><p>One thing I got backwards on the first pass: I keyed grants by project. That’s intuitive and wrong. The right key is <em>(agent identity, data type)</em>. Approving “this specific agent may read calendar events” must not silently bless a <em>different</em> agent that happens to run in the same repo. Identity is the thing I’m actually deciding to trust; the project is just the room it’s standing in.</p><p>There’s one deliberate asymmetry worth calling out, because it’s where the design makes a value judgment. Project working-memory — the build SHAs, the frozen contracts, the decision logs an agent needs to stay useful across sessions — is <em>not</em> behind the broker. A project that owns its memory gets it registered directly, in full. Foreign, brokered agents reach it only through a minimum-privilege shim that exposes three operations: recall, remember, forget; the maintenance operations are left out. The line I can defend cleanly: a project’s own notebook is the project’s to read; my private life is mine to release one approval at a time. Conflate the two and you get both halves wrong — an agent made to beg for its own past decisions, or one left free to read my messages.</p><h3>The honest part: this architecture has a door around it</h3><p>Every security write-up that doesn’t include the bypass is selling you something. Here’s mine.</p><p>The broker is deny-by-default <em>by composition</em>. Foreign projects can’t reach personal data because the data servers aren’t in their config, and the broker is the only thing that is. But composition is decided by the working directory a process is launched in — and that’s the seam. Exactly one move walks straight around everything I just described: dispatching a foreign-project agent with its working directory set to the orchestrator’s home. Do that, and the sub-agent inherits the orchestrator’s full tool composition, direct personal-data servers and all, and never touches the broker at all. No denial, no audit line, no ticket. It just has the access, because as far as the system can tell, launched from that directory, it <em>is</em> the trusted assistant.</p><p>I can’t fix this inside the broker, and pretending I could would be the genuinely dangerous move — the broker is a wall, and this is the door around it. The only mitigation lives at dispatch time: always launch foreign work rooted in the foreign project’s own path, never in the orchestrator’s. Having to <em>write that down as a rule</em> is the honest measure of the architecture’s limit. An access broker buys you deny-by-default, per-request consent, an access record that makes quiet drift hard to miss, and a fail-closed posture. It does not buy you immunity from launching the agent in the wrong place. A tool that hid that from me — that let me believe the wall had no door — would be worse than no tool at all, because then I’d be trusting a boundary I couldn’t actually see.</p><p>So if you take one thing from this into your own setup, don’t take the three tool names. Take the question they’re built to answer: when you put an agent near real data, where, exactly, is the line it can’t cross — and could you walk a colleague to that line and point at it? For a network rule the answer is a firewall config. For a token it’s a scope. For this broker it isn’t a setting I toggle or a flag I trust; it’s a place. The boundary is the directory I launch the agent from. The day I can no longer point at the boundary is the day I’ve stopped having one.</p><p><em>David Knudson writes about the parts of agentic systems that only show up once real data is on the line — the access seams, the fail-closed paths, the limits the architecture diagram leaves out. Field notes and the rest of the work at </em><a href="https://www.davidjknudson.com/"><em>davidjknudson.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35bf77e9dc28" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/i-let-three-coding-agents-near-my-whole-digital-life-safely-35bf77e9dc28">I Let Three Coding Agents Near My Whole Digital Life (Safely)</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>