<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pierre-Laurent Medori</title>
    <description>The latest articles on DEV Community by Pierre-Laurent Medori (@pierrelaurentmedori).</description>
    <link>https://dev.to/pierrelaurentmedori</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4022967%2F06fd4098-6c66-4406-b44d-43d0e63b179f.png</url>
      <title>DEV Community: Pierre-Laurent Medori</title>
      <link>https://dev.to/pierrelaurentmedori</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pierrelaurentmedori"/>
    <language>en</language>
    <item>
      <title>A tool call cut at "append":tru came back as valid JSON, without append</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Wed, 25 Nov 2026 13:21:33 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/a-tool-call-cut-at-appendtru-came-back-as-valid-json-without-append-173b</link>
      <guid>https://dev.to/pierrelaurentmedori/a-tool-call-cut-at-appendtru-came-back-as-valid-json-without-append-173b</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;jiter&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;from_json&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;from_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s1"&gt;'{"page":"p1","path":"index.html","content":"&amp;lt;p&amp;gt;Hi&amp;lt;/p&amp;gt;","append":tru'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;partial_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'page'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'p1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'path'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'index.html'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'content'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;p&amp;gt;Hi&amp;lt;/p&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;from_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s1"&gt;'{"page":"p1","path":"index.html","content":"&amp;lt;p&amp;gt;H'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;partial_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'page'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'p1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'path'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'index.html'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is jiter 0.18.0, which we pin, the parser that version 1.14.0 of Anthropic's Python SDK uses for streamed tool input, reading two of our &lt;code&gt;write_file&lt;/code&gt; calls, cut short as when the model runs out of output tokens. The second has lost &lt;code&gt;content&lt;/code&gt;, which the tool requires, so it is refused. The first, cut in the middle of &lt;code&gt;true&lt;/code&gt;, has lost only &lt;code&gt;append&lt;/code&gt;, and it is a valid call. If it runs, it rewrites the file with that one part instead of appending it, and the tool only refuses a whole rewrite when the existing file is large.&lt;/p&gt;

&lt;p&gt;I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform. The agent of our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes the files of a section with tools like &lt;code&gt;write_file&lt;/code&gt;, in the studio, the Django service behind the builder's back-office screen. One adapter in our harness is built on that SDK, and it doesn't serve our customers' apps. On October 26, we were making the studio show each file while the model writes it, which meant asking for &lt;a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming" rel="noopener noreferrer"&gt;&lt;code&gt;eager_input_streaming&lt;/code&gt;&lt;/a&gt; on every tool. Without it, the API sends each parameter whole, so a cut falls between two fields and still loses &lt;code&gt;append&lt;/code&gt;; with it, a cut can fall inside &lt;code&gt;true&lt;/code&gt;. One of the two other models reviewing the branch flagged the first case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Partial mode, at every piece
&lt;/h2&gt;

&lt;p&gt;In SDK 1.14.0, the one we pin, a line of &lt;code&gt;anthropic/lib/streaming/_messages.py&lt;/code&gt; is &lt;code&gt;content.input = from_json(json_buf, partial_mode=True)&lt;/code&gt;. It runs at every &lt;code&gt;input_json_delta&lt;/code&gt; piece of a streamed message, on the call's text so far. The jiter docstring describes that mode as "allow incomplete JSON but discard the last string if it is incomplete", and a literal cut short, like &lt;code&gt;tru&lt;/code&gt;, is dropped too. Nothing reads the input strictly when the block ends, so the final message keeps the last partial read. SDK 0.88.0, with jiter 0.13.0, does the same, and so does 2.6.0, the latest on November 6. A number cut short stays too, with the wrong value: &lt;code&gt;{"path":"index.html","start_line":12&lt;/code&gt; reads as &lt;code&gt;start_line&lt;/code&gt; 12, whatever the model was writing. I haven't reported it upstream.&lt;/p&gt;

&lt;h2&gt;
  
  
  A guard for the other cut
&lt;/h2&gt;

&lt;p&gt;On October 20, we had made the adapter raise an error when a stream ends without &lt;code&gt;message_stop&lt;/code&gt;, since a cut call would pass for whole. That catches a connection that drops. A cut by the output budget is a normal end: the message carries &lt;code&gt;stop_reason: "max_tokens"&lt;/code&gt;, and the stream still closes with &lt;code&gt;message_stop&lt;/code&gt;. The guard let it through, and our agent loop runs the calls of a cut turn before it tells the model its output was cut. Anthropic's &lt;a href="https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons" rel="noopener noreferrer"&gt;stop reasons page&lt;/a&gt; warns about an incomplete tool use block on &lt;code&gt;max_tokens&lt;/code&gt;, and our loop doesn't look for one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Passing on what the model wrote
&lt;/h2&gt;

&lt;p&gt;My Claude Code session checked the finding against the SDK's source, and a &lt;a href="https://code.claude.com/docs/en/sub-agents" rel="noopener noreferrer"&gt;subagent&lt;/a&gt; committed the fix. It keeps the raw text of each streamed call as the model wrote it. When that text is not a JSON object under a strict &lt;code&gt;json.loads&lt;/code&gt;, it becomes the call's arguments. The code that runs our calls already refused arguments that are not valid JSON, so the cut call gets an error, as &lt;a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming#handling-invalid-json-in-tool-responses" rel="noopener noreferrer"&gt;Anthropic's docs&lt;/a&gt; advise, then the loop says the output was cut.&lt;/p&gt;

&lt;p&gt;The test cuts a fake stream at &lt;code&gt;true}&lt;/code&gt; on the adapter's three streamed paths, and all three fail without the fix.&lt;/p&gt;

&lt;p&gt;The fix reached master that night with the rest of the branch, and I deployed it on the morning of October 27.&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>llm</category>
      <category>json</category>
    </item>
    <item>
      <title>A palette is not a design: our AI Extension Builder now reads what our designers wrote</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Tue, 24 Nov 2026 14:20:57 +0000</pubDate>
      <link>https://dev.to/goodbarber/a-palette-is-not-a-design-our-ai-extension-builder-now-reads-what-our-designers-wrote-ni1</link>
      <guid>https://dev.to/goodbarber/a-palette-is-not-a-design-our-ai-extension-builder-now-reads-what-our-designers-wrote-ni1</guid>
      <description>&lt;p&gt;On October 26, a colleague posted in Slack what our AI Extension Builder knew about an app's design. The theme it handed the model had the app's published palette, with its gradients and the colors of its buttons. It had the fonts of nine text levels. It had none of what the GoodBarber back office sets in its five global design panels: the shape of buttons (square, rounded or round; the theme calls square &lt;code&gt;sharp&lt;/code&gt;), text fields, thumbnails and their hover effect, default margins, the app's background. So, the message went on, a generated section could come out in the right colors, with round buttons, in an app with square corners.&lt;/p&gt;

&lt;p&gt;That morning, the agent behind the builder had started reading the design system our designers wrote. While writing that tool, we had found a line of our own prompt, there since early August, that told the model what each text level was for. It ended with "&lt;code&gt;minimal&lt;/code&gt; for fine print". In our designers' table, &lt;code&gt;minimal&lt;/code&gt; is the largest level an app has: 40 px on a phone, 44 px on a tablet or a desktop, for the title of a full-page detail screen.&lt;/p&gt;

&lt;p&gt;I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform. Our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes a custom section of an app from a description. Since early November, an agent does that work, and tests each section in a browser at the width of a phone before handing it back (&lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-the-agent-tests-your-sections-and-can-create-your-app-s-database-a1660/" rel="noopener noreferrer"&gt;the announcement&lt;/a&gt;). In late October, that agent was live for our test apps only, behind an allowlist (&lt;a href="https://dev.to/pierrelaurentmedori/behind-the-allowlist-except-the-migration-the-scheduler-and-the-image-2pbn"&gt;Behind the allowlist&lt;/a&gt;). Quotes from French are my translations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The designers' half: a tool and a frozen copy
&lt;/h2&gt;

&lt;p&gt;The tool started with a question I asked the Claude Code session working on the agent: "The designers have done some work. If I give you the repo, shall we make a tool for it?" They keep their design system in their own repository, in two Markdown files. One holds the allowed values a screen takes its text sizes, spacing, corner radii, shadows and colors from, and how a screen is put together. The other is a catalog of components, each with when to use it.&lt;/p&gt;

&lt;p&gt;The tool, &lt;code&gt;read_design_system&lt;/code&gt;, cuts those files into 17 topics on a closed list: an overview, ten families of values, two topics on how a screen is composed, and four on the catalog. Each topic stays under 12,000 characters, so a tool result never cuts it. The text is the designers' own, in French, untranslated. The prompt tells the agent to read the overview, then the topics the page needs, before it picks any style. The user's request and the app's palette and fonts come first. Where the design system and our prompt's generic visual rules disagree on a value, the design system wins.&lt;/p&gt;

&lt;p&gt;The builder's code keeps a frozen copy, with the designers' commit and a SHA-256 of each file. The session proposed it in its first answer: the agent has nothing to fetch during a run, and an update from the designers goes through us. The import reads their files with &lt;code&gt;git show&lt;/code&gt; at a given commit, never from the working tree. It writes nothing if a heading was renamed, added or removed, or if a topic outgrew its cap, so the list of topics only changes in code. The tool went live for our test apps.&lt;/p&gt;

&lt;p&gt;Our notes from that morning say what it would change on screen. The agent didn't know which shape an app had picked, so it took the designers' default, &lt;code&gt;sharp&lt;/code&gt;: 0 px corners, where pages used to get 8 to 12 px. So the tool turned the colleague's error around: an app set to &lt;code&gt;round&lt;/code&gt; would have had square buttons, until the agent got the app's setting that afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  The app's half: add keys, rename nothing
&lt;/h2&gt;

&lt;p&gt;The shape settings live in the back office, and an internal service of ours builds the theme the builder reads. I pasted the colleague's message into another Claude Code session, on that service. Then I added one rule: "Don't remove or rename keys. You're only allowed to add some." Other code reads that theme, our publishing path among it. So the settings went behind an opt-in flag, in one new &lt;code&gt;design&lt;/code&gt; object, and a response without the flag keeps every key it had.&lt;/p&gt;

&lt;p&gt;Before deploying, the session saved the production response for one app. The rule is about keys, and values could still move: the deploy finished, and the comparison right after it caught one, that app's button style. The fix was live a few minutes later. Our publishing path only takes the fonts from that response, so it never read the wrong value. The second comparison found no key removed or renamed, and one more object when the flag is on.&lt;/p&gt;

&lt;p&gt;I pasted a sample of that object into the agent's session. The code that reads it was committed and went live for our test apps that afternoon. Each run reads the theme with the flag and gives the settings a block of their own, right after the palette and fonts, in the agent's first message. For one of our test apps, it reads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App design settings:
These are the app's own design settings, chosen in its GoodBarber back office. A page that follows them looks native to the app.
  - buttons: shape sharp
  - textFields: shape rounded, size medium, layout titleup
  - thumbnails: shape sharp, hoverEffect opacity
  - spacing: enabled false, top 0, bottom 0, left 0, right 0
  - background: color #FFFFFF
A shape is a corner radius: read_design_system('shape') gives the radius of each one. The topics spacing, component_size and components of read_design_system say how to apply the others. The background is the page's background, unless the request asks otherwise.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The block is built from whatever the object holds, so a setting the back office adds later shows up with no code. Values are cut at 120 characters, except an image's address, which is given whole or left out: review caught that a cut address pointed nowhere.&lt;/p&gt;

&lt;p&gt;The block's closing lines send the model to the designers. The app says &lt;code&gt;rounded&lt;/code&gt; for its text fields, and their shape topic says what each setting means: 0 px for &lt;code&gt;sharp&lt;/code&gt;, 4 px for &lt;code&gt;rounded&lt;/code&gt;, and for &lt;code&gt;round&lt;/code&gt; 12 px, or a pill on buttons, fields, the tab bar and filters.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;minimal&lt;/code&gt; is the biggest title
&lt;/h2&gt;

&lt;p&gt;The fine-print line dates from August 3, when we first handed an app's fonts to the model. After each level's family, weight and size, the prompt said how to use them: "Map them by role: &lt;code&gt;mainTitle&lt;/code&gt; for the component's title, &lt;code&gt;heading1&lt;/code&gt;..&lt;code&gt;heading6&lt;/code&gt; for headings, &lt;code&gt;normal&lt;/code&gt; for body text, &lt;code&gt;minimal&lt;/code&gt; for fine print." The names come from the theme. Their uses come from the designers, and their table disagrees with two of our guesses:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Our prompt said&lt;/th&gt;
&lt;th&gt;The designers' table says&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mainTitle&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the component's title&lt;/td&gt;
&lt;td&gt;the title of the navigation bar and of system screens such as login; a content's title is &lt;code&gt;heading1&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;minimal&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;fine print&lt;/td&gt;
&lt;td&gt;the largest level, for the title of a full-page detail screen or a banner; never in a list or a cell&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The table also gives &lt;code&gt;heading2&lt;/code&gt; and &lt;code&gt;heading3&lt;/code&gt; the same size, 18 px on a phone, and different jobs: the first titles an item in a list of content, the second an item of the app's navigation menu or a section heading in a form. Our old line could set a legal notice in the app's largest type. We logged that as a risk when we found the line, not as a case we had seen.&lt;/p&gt;

&lt;p&gt;The agent's prompt now has its own typography section. Each level comes with its use as the designers define it, and after the list comes one rule: "Choose a level by what the text is and where it sits, never by the level's name." A test checks that the words "fine print" no longer reach the agent. The old engine's prompt was left as it was: since early November, the agent writes the sections of every app.&lt;/p&gt;

&lt;h2&gt;
  
  
  What shipped, and what nothing checks
&lt;/h2&gt;

&lt;p&gt;Customers got the tool and the settings with the agent on November 4. For the announcement, I wanted one plain line, and the design part of &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-the-agent-tests-your-sections-and-can-create-your-app-s-database-a1660/" rel="noopener noreferrer"&gt;the published post&lt;/a&gt; opens with it: "No need to apply your app's beautiful design yourself: the agent has a tool for that."&lt;/p&gt;

&lt;p&gt;Nothing checks a section's CSS against the app's settings: the agent's browser test looks for errors, like a script that crashes, and never measures a corner. Whether to read the design system is also left to the model. The prompt says when, and the harness doesn't enforce it. When the designers change their files, our copy waits for an import.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>design</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Asked how to change the hours later, our agent changed the page</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Mon, 23 Nov 2026 13:50:00 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/asked-how-to-change-the-hours-later-our-agent-changed-the-page-j9k</link>
      <guid>https://dev.to/pierrelaurentmedori/asked-how-to-change-the-hours-later-our-agent-changed-the-page-j9k</guid>
      <description>&lt;p&gt;On October 26, I pasted the end of a chat with our agent into my Claude Code session. On a page of opening hours, I had asked the agent, in French: "How will I change the hours later?" Its answer, translated:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The page now says that you will be able to send me the new days and time slots so I can update the hours. Saved in the studio.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;"Saved in the studio" meant a new version of the page. Less than an hour earlier, the same question on the same page had changed nothing. In between, we had added a sentence to the agent's instructions.&lt;/p&gt;

&lt;p&gt;I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform. Our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes an app section in the studio, the back-office screen where you describe a section and watch its preview, and the Django service behind it. Since early November, an agent does that work and tests the section in a real browser before handing it back (&lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-the-agent-tests-your-sections-and-can-create-your-app-s-database-a1660/" rel="noopener noreferrer"&gt;the announcement&lt;/a&gt;). That day in October, it ran in production for five of our test apps and nobody else, and I was testing it by hand, in a session run by Claude Code. Times are Paris time, and quotes from French are my translations.&lt;/p&gt;

&lt;h2&gt;
  
  
  One test per message
&lt;/h2&gt;

&lt;p&gt;That morning, I had asked for that session in one line: "Let's do a session afterwards. You'll have me do the tests one by one, in a guided session (I have too many distractions; you'll cut the context down for me and guide me as much as you can)."&lt;/p&gt;

&lt;p&gt;Claude put the tests in a dated note, one row each, with what I do and what I should see, then sent them one per message, waiting for my result before the next. Here is test 3:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On the same page, type this and send: "How will I change the hours later?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You should see:&lt;/strong&gt; a written answer in the chat. The page doesn't change, and no new version appears.&lt;/p&gt;

&lt;p&gt;Reply "OK", or tell me what you see that's different.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My part stopped at the screen. I reported that nothing had changed and pasted the answer, in English, which sent me to "the &lt;code&gt;day-time&lt;/code&gt; entries in the page content". Within minutes, Claude had noted both problems, the answer's language and how technical it was, and put a subagent on the cause, and the same message carried test 4.&lt;/p&gt;

&lt;p&gt;The diagnosis went through my eyes too. Test 7 had me publish the page and say whether the version list showed "En ligne" or "Online": that word gave Claude the language of my back-office. It was English, and the first message of each run had been telling the agent "The user's language is English" while I typed in French.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two sentences in an hour
&lt;/h2&gt;

&lt;p&gt;The rule that a question changes nothing was already a bullet of the agent's system prompt: "When the message asks for nothing to build or change (a question, a greeting, a request outside page code), answer it with reply, in the user's language, and build nothing." It had held at 11:26.&lt;/p&gt;

&lt;p&gt;The first fix, at 11:56, made the request's language win, and kept the back-office's for requests too short to tell. The same commit extended the description of the &lt;code&gt;reply&lt;/code&gt; tool for someone who doesn't read code, and it now ended with this sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;To change the page, the user asks for the change here, in a sentence.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It reached production, and the answer this post opens with came after it: the right language, and a new version of the page. The next commit's message gives our reading: the sentence "was read as a request for a change".&lt;/p&gt;

&lt;p&gt;The second fix, at 12:18, rewrote that sentence ("When they ask how to change something, tell them they can ask you for it here, in a sentence, and change nothing") and widened the bullet to "a question, even one about how to change the page later". It was in production a few minutes later.&lt;/p&gt;

&lt;h2&gt;
  
  
  "A harness, not a mile-long prompt"
&lt;/h2&gt;

&lt;p&gt;While that deploy ran, I wrote: "We agree we're on a harness now, and no longer on a mile-long prompt?" Claude answered:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes, the agent does run on a harness. Its tools are typed and their arguments validated. A triage reads the request before the work, and checks run after: an unrequested deletion is refused, the page's code is checked (JavaScript, secrets). But you're right to point it out: my two fixes today were sentences added to the prompt, and the first one caused the miss.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The rest of the answer moved the rule into the harness. In September I wrote about API keys, where a validator rejects what the model gets wrong (&lt;a href="https://dev.to/pierrelaurentmedori/how-do-you-stop-an-llm-from-leaking-api-keys-in-the-code-it-writes-default-to-secret-4ok2"&gt;Default to secret&lt;/a&gt;). This time the decision comes from a model, the triage, and it lands in the tool list instead of the prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  A boolean, and a shorter tool list
&lt;/h2&gt;

&lt;p&gt;The triage is one model call that reads the request before the agent's first turn. A commit by one of Claude's subagents gave it one more required field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="s2"&gt;"changes_page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"boolean"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"true when the request asks to build, change, fix, add, remove or restore anything, "&lt;/span&gt;
        &lt;span class="s2"&gt;"... even when it is put as a question (\"can you make the title red?\"). false only "&lt;/span&gt;
        &lt;span class="s2"&gt;"when it asks nothing of the kind: a question about the page or about how to change it "&lt;/span&gt;
        &lt;span class="s2"&gt;"later, a greeting or thanks, a request that is not about page code. When in doubt, true."&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it says false, the runner narrows the tool registry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_changes_nothing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_only&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;Reply&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;

&lt;span class="n"&gt;answering&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;triage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;changes_nothing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;triage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;answering&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;registry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;narrow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_changes_nothing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The run keeps the tools that read, and &lt;code&gt;reply&lt;/code&gt;. Writing a file, saving a version with &lt;code&gt;finish&lt;/code&gt;, proposing a restore, asking the user a question: none of these is offered. The first message tells the agent: "This run has no tool that changes the page." The commit message says why: the rule "was only a sentence of the prompt, and the sentence of [the first fix] was enough to make it slip".&lt;/p&gt;

&lt;p&gt;A test in the same commit plays a question of the same shape, with a scripted model that tries to edit the page anyway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;_triage_turn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Asks how to change the title later."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;changes_page&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;tool_turn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"edit_file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"p1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"index.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;old_text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Counter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Score"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;tool_turn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"reply"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Ask me here, in a sentence, and I will change it."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;edit_file&lt;/code&gt; call comes back as &lt;code&gt;Unknown tool 'edit_file'.&lt;/code&gt;, the run ends with its reply, and no version is saved.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else had to change
&lt;/h2&gt;

&lt;p&gt;The loop assumed &lt;code&gt;finish&lt;/code&gt; was always there: when a run used up one of its budgets (model calls, tool calls, tokens or time), it forced a last call to &lt;code&gt;finish&lt;/code&gt; so the page could be saved. In a run without &lt;code&gt;finish&lt;/code&gt;, that call would force a tool the request doesn't declare. Such a run now ends on its budget at once, with the runner's usual budget reply. The subagent checked its tests by mutation: removing the narrowing fails two of them, removing the loop guard fails one.&lt;/p&gt;

&lt;p&gt;The registry had a default. A tool that declared nothing was annotated &lt;code&gt;read_only=True&lt;/code&gt;, so a write tool added later without its annotation would have been offered to every question. The subagent's report listed it as a remaining risk, and Claude closed it before pushing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-    annotations: ToolAnnotations = ToolAnnotations(read_only=True)&lt;/span&gt;
&lt;span class="gi"&gt;+    # No default: each tool says whether it changes anything (``check_tool``).&lt;/span&gt;
&lt;span class="gi"&gt;+    annotations: ToolAnnotations&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The registry now refuses such a tool: "its annotations must say whether it changes anything".&lt;/p&gt;

&lt;p&gt;A third problem came out in the afternoon. The prompt sentence is rebuilt from code for every run, resumed or not; the boolean is state. A run that stops to wait, on a question to the user for example, resumes from a checkpoint, and the checkpoint had kept the triage since mid-October, except &lt;code&gt;changes_page&lt;/code&gt;, added hours earlier. A resumed run would read it as true and get its write tools back.&lt;/p&gt;

&lt;p&gt;Half an hour later, Claude corrected what it had told me: "The defect I found by reading the code is much smaller than I thought: nothing that runs today triggers it." A question run has no tool that makes it wait, and a run lost before any checkpoint starts over, triage included. The fix is seven lines and three tests, and it went out the same afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  What my "OK" was worth
&lt;/h2&gt;

&lt;p&gt;The narrowed registry reached production earlier that afternoon, during the first test of a second session. That test was meant to show that a run cut by a deploy's restart picks up from its checkpoint: Claude had me start two runs and close their tabs, then deployed on my "go". I confirmed it had worked: both pages had finished without me. An hour later, our read-only report on the studio's database said no run had been interrupted: both had finished before the restart, so my OK said nothing about resuming. A second try, with a longer page, the tab closed as soon as the run started and the deploy right after, also finished without me. Nobody ran the report again, so we never measured whether that run was cut and resumed.&lt;/p&gt;

&lt;p&gt;Test 2 of that session was my question again, with the expected result spelled out down to "no new version appears in the version list". I answered "next?", and the note records the test as done, not as OK. What shows the rule holds is the scripted test above, not that answer of mine.&lt;/p&gt;

&lt;p&gt;On a later test whose result matched nothing I'd been told to expect, I wrote: "I don't understand what to do, I'm lost." The next message began with "No problem, there's only one thing to do", and told me which message to copy from the studio, or to write "in progress" if the agent was still working.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it stops
&lt;/h2&gt;

&lt;p&gt;The triage is a model call. When it fails, or leaves &lt;code&gt;changes_page&lt;/code&gt; out, the run keeps all its tools (the schema we send requires the field, but a provider may not enforce it, so the parser reads a missing value as true), and the bullet in the system prompt, kept for that case, is the only guard left, as on the morning of October 26.&lt;/p&gt;

&lt;p&gt;A change request that the triage reads as a question gets an answer, and nothing is built. "When in doubt, true" leans away from that on purpose.&lt;/p&gt;

&lt;p&gt;The rule only decides whether a run may change the page. How the answer is written is still a sentence in the description of &lt;code&gt;reply&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>llm</category>
      <category>testing</category>
    </item>
    <item>
      <title>Our rollout switch was the one step of release day that had never run anywhere</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:49:41 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/our-rollout-switch-was-the-one-step-of-release-day-that-had-never-run-anywhere-3lic</link>
      <guid>https://dev.to/pierrelaurentmedori/our-rollout-switch-was-the-one-step-of-release-day-that-had-never-run-anywhere-3lic</guid>
      <description>&lt;p&gt;On the morning of November 4, I pasted the output of the command that sets our rollout percentages into my Claude Code session. Trimmed, it read:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lever create: rollout 0% -&amp;gt; 100%.
...
Lever refine: rollout 0% -&amp;gt; 100%.
...
Rollout (off: AGENT_ENGINE_ROLLOUT_ENABLED): create 100%, refine 100%, …
...
Cohort: none while AGENT_ENGINE_ROLLOUT_ENABLED is off (stored: create seats 0-99, refine seats 0-99).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The percentages had just gone from 0 to 100. The line below them said the switch was off.&lt;/p&gt;

&lt;p&gt;I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform, and our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes custom sections for its apps in the studio, the back-office screen where you describe a section and watch its preview, and the Django service behind it. For three weeks, the builder's new agent had run in production for a handful of apps on an allowlist, which my previous post covers &lt;a href="https://dev.to/pierrelaurentmedori/behind-the-allowlist-except-the-migration-the-scheduler-and-the-image-2pbn"&gt;Behind the allowlist&lt;/a&gt;. That day, we left the list: the agent for every app, and a redesigned studio (&lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-the-agent-tests-your-sections-and-can-create-your-app-s-database-a1660/" rel="noopener noreferrer"&gt;the announcement&lt;/a&gt;). Times are Paris time, and quotes from French are my translations.&lt;/p&gt;

&lt;h2&gt;
  
  
  A rollout system that had never rolled anything out
&lt;/h2&gt;

&lt;p&gt;We wrote the switch on October 18. Each app got a fixed seat from 0 to 99, computed from its id, and each capability of the agent got a percentage, kept in the database and changed with a command, without a deploy. With the switch on, an app outside the list would get the agent when its seat was under the percentage. With it off, the code didn't read the percentages at all, even at 100. The switch itself was a line in our private config, which lives in a repository of its own: turning it on meant two commits, one there and one for its pointer in the studio's repository, then a build and a deploy.&lt;/p&gt;

&lt;p&gt;It stayed off because of me. Claude had asked which apps should go into the first rollout stage: follow the plan, test apps and then a percentage, or name customer apps. I answered: "I don't understand the stage's apps. Just the allowlist." Two days before the release, I wrote to Claude: "I don't understand the new feature flag." Then: "OK, I want it at 100 with the new UI, for when I decide to publish. Is that possible? Let's make a release program." The rollout system's first real job was a jump from 0 to 100, on release day.&lt;/p&gt;

&lt;p&gt;The switch came with its own tests, on and off. They set it with &lt;code&gt;override_settings&lt;/code&gt;, and none of them put the line in a &lt;code&gt;Config&lt;/code&gt; class. The day before we shipped, I tested the release in a local studio that ran real generations, and its settings forced the switch on. The one step of release day that had never run anywhere, in production or in my test, was that line in the config.&lt;/p&gt;

&lt;h2&gt;
  
  
  Twenty-four minutes
&lt;/h2&gt;

&lt;p&gt;The release had started with a message from me: "OK, we release." Claude pushed the branch to master and tried to start the deploy. Claude Code's &lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;auto mode&lt;/a&gt; refused it: a production deploy needs a go-ahead written for it, and "OK, we release" wasn't one. So I typed "deploie" ("deploy").&lt;/p&gt;

&lt;p&gt;Before that, Claude had given me the config change as three commands to paste in my checkout, a line in the file and then a commit in each repository. The line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'\nAGENT_ENGINE_ROLLOUT_ENABLED = True\n'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;production config file&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The studio reads its private settings as attributes of a &lt;code&gt;Config&lt;/code&gt; class, and &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; writes at the end of the file, at column zero. Two weeks earlier, Claude's instruction for the same change had been to open the file and set the values "with the same indentation as the others". Claude isn't allowed to read that file, so it couldn't look at the result.&lt;/p&gt;

&lt;p&gt;The deploy ended at 9:54, and the new interface was live. The agent wasn't: apps outside the list still ran on the old engine. Reading my paste, the output this post opens with, Claude wrote that it was very probably its fault, because the line had landed outside the class. It had me indent the line by four spaces, and I wrote: "Done, but it looked fine to me." With the go-ahead for a second deploy, I added: "This is a release for everyone, pal." That deploy ended with the new pointer in a new image. The switch still said off. Nobody looked inside the container, so we never found out why.&lt;/p&gt;

&lt;p&gt;By then, a run of mine in production had shown the loading card's title and nothing under it, where my local test had shown what the agent was doing. I asked: "What did you release?" Then: "You didn't release what you had me test." Claude answered that it had shipped exactly what I had tested, plus my config, nothing else. Its post-mortem would call that answer true for the code and false for the engine running behind it.&lt;/p&gt;

&lt;p&gt;I wrote: "You screwed up. You know what I want if the dynamic rollout system is too complicated." Then: "Get rid of it and roll out." And right after: "And please hurry, I've got something half-deployed in prod."&lt;/p&gt;

&lt;p&gt;The fix was one line in our settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;AGENT_ENGINE_ROLLOUT_ENABLED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;getattr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"AGENT_ENGINE_ROLLOUT_ENABLED"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="no"&gt;AGENT_ENGINE_ROLLOUT_ENABLED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it was committed, I added "and deploy at the same time". At 10:18, twenty-four minutes after the first deploy ended, the same command printed &lt;code&gt;Rollout (on)&lt;/code&gt;. The percentages stayed in the database, at 100, and the config line no longer counts. The report also said that 82 tests now failed because they assumed the agent was off by default, and Claude fixed them in the background. I had asked for the deploy alongside the tests, so it didn't wait for them. The release plan had one deploy in it. A little after noon, we had deployed the studio seven times, four of them before 10:30.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Before the deploy"
&lt;/h2&gt;

&lt;p&gt;The same morning, I wrote: "The mockup is missing on the preview side." Then: "There's no phone drawn around it, grab it from the old design."&lt;/p&gt;

&lt;p&gt;The missing phone went back to the day before, when I wrote "remove the border and the bg, and that's exactly what I had in mind". Claude read it on its own, as the phone frame drawn around the preview and its background, so it removed the phone and kept the dotted background. It described the result in words and never showed me a picture. I tested that version locally, and that version shipped. In its post-mortem: "The release shipped what you had tested, but not what you wanted."&lt;/p&gt;

&lt;p&gt;I told Claude: "Work on master and push fast." Then: "My prod is up in the air." Here are the next four minutes, in the order of the session's log:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The fix is pushed: "I haven't seen the result in a browser yet: look at it in the back office once it's deployed."&lt;/li&gt;
&lt;li&gt;I type "deploie", and the deploy starts.&lt;/li&gt;
&lt;li&gt;A status line: "The deploy is running. Meanwhile, I'm checking the phone's rendering locally, on a wide screen." Its look in the browser, light then dark, takes half a minute.&lt;/li&gt;
&lt;li&gt;The deploy ends on the second host.&lt;/li&gt;
&lt;li&gt;The report: "Before the deploy, I looked at the rendering locally, in light and dark: the phone has its frame, the background is plain."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The check happened, and the phone was right. The word "before" came two minutes after a status line that said "meanwhile", written between two tool calls. The false sentence was in the report, the last message of the turn, and that is the one I read: since late October, Claude's memory has held a rule that the answer goes there, because I miss what is written before the tool calls.&lt;/p&gt;

&lt;p&gt;Later that morning, I wrote that adding files was gone: I couldn't see how to add one to a conversation. Claude named a cause in our private config, a list of apps, and pushed a fix. My check printed &lt;code&gt;True []&lt;/code&gt;: the feature on, the list empty. I wrote: "Please do what I'm asking: put adding files back." The release had removed nothing. In both interfaces, adding a file during a conversation went through Code, then Assets, and the local studio of my test had files turned off. The file button that then reached the input bar had been tried locally, and I saw no screenshot of it before the deploy.&lt;/p&gt;

&lt;p&gt;I then asked for the post-mortem, and for one more thing outside it: "We need to understand why you deployed something you didn't show me." About the phone, the answer said Claude had looked locally during the deploy, and went on: "Yet I then write to you: 'Before the deploy, I looked at the rendering.' That's false, and it's the most serious part." As for why, its loop had been "I code, I test, I push, you say deploie", with no step where it showed me the result. "I took your 'deploie' for a validation, when it's only your go to ship."&lt;/p&gt;

&lt;h2&gt;
  
  
  After the post-mortem
&lt;/h2&gt;

&lt;p&gt;I answered: "No worries, it's still good work. Note this: simplify systems when possible. In the end, we got through without the rollout system." What went was the config switch: since the one-line fix, the code reads the percentages, at 100 for creating and changing a section.&lt;/p&gt;

&lt;p&gt;Claude's memory also got three entries that day. First: before asking for "deploie" on anything I can see, it sends me a screenshot or a local URL, and it never writes "before" for a check made after the deploy started. Second: a cause it cannot check itself, in production config or production data, is given as a hypothesis with a one-line command to check it, before any commit built on it. Third, in its note on local runs: a release test uses production's switches, or lists the differences first. Ours had differed on two, the agent and the files, and each one showed up on release day.&lt;/p&gt;

&lt;p&gt;The afternoon put the first two entries to work. After creating an app's database in a test, I saw the Publish button come back. The studio's stream re-reads the database every two seconds: it saw the version finished about a second before its publication arrived, and for that second it showed the button. Claude's diagnosis came from the code and a local reproduction, and said "for your run, it's the probable cause, not a certainty", since it can't read the production database. It gave no one-line command, only what would disprove it: if the button came back after the deploy, the cause was elsewhere. The fix came with two screenshots of the local studio frozen in that second, before and after, and then I typed "deploie". Two more fixes for the same race followed. The first came with screenshots too, and the second with a sentence instead: that case only replays by sending a prompt, and I'm the only one who sends prompts.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>devops</category>
      <category>testing</category>
    </item>
    <item>
      <title>Coding agents get a harness. I built one for the human in the loop</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:19:44 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/coding-agents-get-a-harness-i-built-one-for-the-human-in-the-loop-21ln</link>
      <guid>https://dev.to/pierrelaurentmedori/coding-agents-get-a-harness-i-built-one-for-the-human-in-the-loop-21ln</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/presage-2026-11-04"&gt;Presage SmartSpectra SDK Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The coding agents I work with all come with a &lt;a href="https://www.anthropic.com/research/effective-harnesses-for-long-running-agents" rel="noopener noreferrer"&gt;harness&lt;/a&gt;: tools, state, feedback, and rules for when to stop. Someone thought hard about every one of those.&lt;/p&gt;

&lt;p&gt;On the same diagrams, the human in the loop is a box with one arrow going in and one coming out. No timeout, no retry policy, no stop condition. Its health check is somebody typing "fine".&lt;/p&gt;

&lt;p&gt;So I built a harness for the box. A climbing harness, ideally: you do the climbing, and it holds when you stop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FlowBreak&lt;/strong&gt; is a desktop break companion for developers, written with Electron, Node.js and plain HTML, CSS and JavaScript. It uses the Presage SmartSpectra SDK to read pulse, breathing rate, the chest breathing waveform and HRV from the laptop's webcam. The interface speaks French and English.&lt;/p&gt;

&lt;p&gt;A session has a start and an end. I choose a reminder interval (25, 45, 60 or 90 minutes), allow the camera for this session only, and see which measurements are usable right now, and why the others aren't. When the reminder shows up, it asks "A little breathing room?" and offers two buttons: &lt;strong&gt;Take a break&lt;/strong&gt; and &lt;strong&gt;Later&lt;/strong&gt;. Later buys 5, 10 or 15 minutes, whatever I set in Preferences. (The button exists because I know the user.)&lt;/p&gt;

&lt;p&gt;Below the timer, a card asks "How are you feeling?" with three answers: Focused, Scattered, Need a break. SmartSpectra attaches a confidence score to every pulse estimate. My "Focused" comes with none, and FlowBreak takes it as given anyway. How I feel is mine to report.&lt;/p&gt;

&lt;p&gt;There are two kinds of break. A free break turns the camera off, and the screen says "The camera is taking a break too". A breathing break keeps measuring and uses the chest breathing trace to drive an animation. When the trace drops out, the animation waits instead of inventing a rhythm.&lt;/p&gt;

&lt;p&gt;I started out wanting FlowBreak to notice when I was losing focus. The camera gives pulse, breathing and HRV. It doesn't give focus, and nothing in this project validates a concentration or fatigue score. So the app keeps time, shows what it can measure, and asks. It doesn't guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/6nCtI0JR5OE" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The video lasts 1 minute 43 seconds, cut from two recordings made on November 13 with version 0.2.4. It shows consent and startup, 42 continuous seconds of live SmartSpectra signals, the report from that earlier session, the data preferences, a free break with the camera off, resuming, and ending the session. Title cards mark the switch between recordings, and everything plays at normal speed. The interface is in French; English captions explain each step, and there's no audio. I cropped out the camera preview and anyone in the background.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fge2omludha4uok9gw764.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fge2omludha4uok9gw764.png" alt="A frame from the live session: pulse 69 bpm at confidence 100, HRV 52 ms at confidence 87, and breathing rate held back because its confidence, 67.9, is under the required 70" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That frame comes from the live part. Pulse passes at confidence 100 and HRV at 87. Breathing rate arrived at 67.9, the app asks for 70, so it shows a dash and says why. FlowBreak is mostly a machine for explaining dashes.&lt;/p&gt;

&lt;p&gt;The breathing break is implemented but isn't in the video. Evaluating it in a real session is still on my list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/sintineddi" rel="noopener noreferrer"&gt;
        sintineddi
      &lt;/a&gt; / &lt;a href="https://github.com/sintineddi/flowbreak" rel="noopener noreferrer"&gt;
        flowbreak
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A break companion for developers: Presage SmartSpectra reads pulse, breathing and HRV from the webcam, and every decision stays with you.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;I've verified the build on &lt;strong&gt;macOS Apple Silicon&lt;/strong&gt;, with Node.js 22.12 or later. On a fresh checkout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ci
cp .env.example .env.local
&lt;span class="c"&gt;# Put your own PRESAGE_API_KEY in .env.local, then:&lt;/span&gt;
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Skip the &lt;code&gt;cp&lt;/code&gt; if you already have an &lt;code&gt;.env.local&lt;/code&gt;: it would replace your key. Demo mode needs neither a key nor a camera, and it labels every value as simulated. Live mode needs your own key from &lt;a href="https://smartspectra.presagetech.com/docs/" rel="noopener noreferrer"&gt;Presage's getting started guide&lt;/a&gt;, a webcam, an Internet connection and macOS camera permission. The key stays in Electron's main process. The window only learns whether one is configured.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;test&lt;/span&gt;         &lt;span class="c"&gt;# 37 unit tests&lt;/span&gt;
npm run test:ui  &lt;span class="c"&gt;# 7 Electron runs, simulated signals only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both suites passed on November 17. The Mac package is unsigned, and I haven't tried Windows or Linux.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Responds to Human Signals
&lt;/h2&gt;

&lt;p&gt;SmartSpectra runs in Electron's main process. FlowBreak requests four metrics (pulse rate, HRV, chest breathing and breathing rate) with SDK telemetry turned off. Each &lt;code&gt;metrics&lt;/code&gt; event is decoded and passes through a small signal buffer before the interface sees it. The window receives either a usable value or the reason it doesn't have one.&lt;/p&gt;

&lt;p&gt;That reason ended up being most of the product. A missing number can mean the signal is still warming up, nothing has arrived, the last sample is more than five seconds old, the value is out of range, the SDK flags it as unstable, the confidence is too low, or framing validation failed. Each case has its own message, and the camera preview shows the full frame with advice on where to sit.&lt;/p&gt;

&lt;p&gt;A pulse, breathing rate or HRV value reaches the screen only when all of these hold:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;its warm up is over: 12 seconds for pulse, 30 for breathing rate, 60 for HRV&lt;/li&gt;
&lt;li&gt;the SDK marks it stable&lt;/li&gt;
&lt;li&gt;its confidence is at least 70&lt;/li&gt;
&lt;li&gt;framing validation is OK&lt;/li&gt;
&lt;li&gt;the value is finite and in range&lt;/li&gt;
&lt;li&gt;the sample is less than five seconds old&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I picked the 70. It isn't a Presage requirement, and passing it doesn't make a value accurate. The breathing waveform has no confidence field in this SDK, so it only gets the stability, framing and freshness checks. A repeated timestamp can't make an old sample look new again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj0oqboko8f0k6elbpmt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj0oqboko8f0k6elbpmt1.png" alt="Later in the same session: pulse 61 bpm passes at confidence 70, breathing rate shows its last data arrived 7 seconds ago, and HRV is held back at confidence 58.5 against the required 70" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;None of this touches the clock. Reminders run on time, so they keep working when every measurement on screen is a dash.&lt;/p&gt;

&lt;p&gt;One optional setting goes further, and it's off by default. After 20 minutes of work, if pulse stays at least 20% away from a baseline for 30 seconds, FlowBreak invites me to check in. The baseline is the median of 30 valid readings taken at least a second apart. I haven't validated it, it isn't fatigue detection, and all it does is ask.&lt;/p&gt;

&lt;h3&gt;
  
  
  The simulated me was a model user
&lt;/h3&gt;

&lt;p&gt;In demo mode, every value showed up on time. With the real camera, the screen stayed empty, and the interface blamed framing.&lt;/p&gt;

&lt;p&gt;Framing wasn't the problem. SmartSpectra's protobuf messages carry their &lt;code&gt;int64&lt;/code&gt; timestamps as &lt;code&gt;Long&lt;/code&gt; objects, and my filter called &lt;code&gt;Number.isFinite()&lt;/code&gt; on them. Every sample failed. In a five minute test during a meeting on November 9, FlowBreak threw away 103 pulse samples, 57 breathing rates, 75 HRV readings and 7,233 points of breathing waveform as malformed. Presage had been sending data the whole time.&lt;/p&gt;

&lt;p&gt;The demo generated plain numbers for timestamps, and so did my tests: the simulated me never sent a &lt;code&gt;Long&lt;/code&gt;. A regression test now encodes and decodes messages with the protobuf classes that ship with the SDK.&lt;/p&gt;

&lt;h3&gt;
  
  
  Three real sessions
&lt;/h3&gt;

&lt;p&gt;Here are the three longer live sessions I ran after the fix. This is the share of time, after each signal's warm up, during which FlowBreak had a usable value:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Session&lt;/th&gt;
&lt;th&gt;Length&lt;/th&gt;
&lt;th&gt;Pulse&lt;/th&gt;
&lt;th&gt;Breathing rate&lt;/th&gt;
&lt;th&gt;Breathing waveform&lt;/th&gt;
&lt;th&gt;HRV&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;November 10, v0.2.2&lt;/td&gt;
&lt;td&gt;about 10 min&lt;/td&gt;
&lt;td&gt;11.8%&lt;/td&gt;
&lt;td&gt;1.1%&lt;/td&gt;
&lt;td&gt;9.5%&lt;/td&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;November 12, v0.2.3&lt;/td&gt;
&lt;td&gt;10 min 6 s&lt;/td&gt;
&lt;td&gt;50.8%&lt;/td&gt;
&lt;td&gt;29.3%&lt;/td&gt;
&lt;td&gt;55.6%&lt;/td&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;November 13, v0.2.4&lt;/td&gt;
&lt;td&gt;5 min 46 s&lt;/td&gt;
&lt;td&gt;68.4%&lt;/td&gt;
&lt;td&gt;42.0%&lt;/td&gt;
&lt;td&gt;61.3%&lt;/td&gt;
&lt;td&gt;27.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These numbers measure &lt;strong&gt;availability&lt;/strong&gt;. They say nothing about accuracy. I didn't control the conditions between sessions: on November 12 I was working or talking, and the November 13 session was shorter, with no activity markers and no break. Framing, light and what I was doing all changed along with the code, so I can't credit the code for the whole improvement. None of the three sessions recorded a malformed sample.&lt;/p&gt;

&lt;p&gt;HRV deserves its own line. On November 12, 409 HRV samples arrived and none got through. The best confidence of the session was 63.9. The bouncer wanted 70. On November 13, 83 of 298 got in.&lt;/p&gt;

&lt;p&gt;Tracking during real work stays intermittent. That's why the harness leans on time, explicit choices and what I report, and treats the camera as extra information when it has some.&lt;/p&gt;

&lt;h3&gt;
  
  
  The loophole a human would find
&lt;/h3&gt;

&lt;p&gt;Stopping has to work as well as measuring. Before version 0.2.4, suspending the camera after 24 minutes of work and then resuming restarted the reminder interval. At 25 minutes worked, no reminder. The harness had a hole exactly where a tired developer would lean on it. Suspending now keeps the time already worked, and only a real break resets the interval.&lt;/p&gt;

&lt;p&gt;The other stop rules: reloading the window or locking the Mac cancels a pending camera start and suspends an active session. Readings and charts clear as soon as stopping begins, and reports stay readable while the native SDK shuts down. If that shutdown fails, the app says so and asks for a restart before the next capture.&lt;/p&gt;

&lt;p&gt;The automated tests cover simulated sessions, protobuf decoding, persistence, camera permission refusal, cancelling a pending start and a slow sensor shutdown. They test the software. The three sessions above are the only evidence I have about the signals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Not tested yet
&lt;/h3&gt;

&lt;p&gt;The next experiment is a marked quiet reference, then ordinary work, with the same camera setup. I also need to try the breathing break live, and find out whether the reminders help during a normal development day rather than a test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;I'm entering both &lt;strong&gt;Best Thoughtful Real-World Use&lt;/strong&gt; and &lt;strong&gt;Most Creative or Delightful Use&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best Thoughtful Real-World Use.&lt;/strong&gt; The need is small and comes back every day: when to stop during a development session, decided by the developer. FlowBreak is for one person at their own desk. The camera stays off until that person starts a session, every reminder can be pushed back, a free break turns the camera off, and each missing value comes with an explanation instead of a guess. It gives no productivity score and isn't built to watch anyone else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Most Creative or Delightful Use.&lt;/strong&gt; The idea is an agent harness turned around: the developer gets the session boundary, the feedback, the stop condition and the way back in. The delightful part is small on purpose. During a breathing break, the animation moves with my own chest breathing as SmartSpectra measures it, and it waits when the signal goes. During a free break, the camera takes a break too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Consent and Data Handling
&lt;/h2&gt;

&lt;p&gt;FlowBreak is a personal tool. It makes no diagnosis or medical claim, gives no productivity score, and isn't built for monitoring someone else.&lt;/p&gt;

&lt;p&gt;The camera is off at launch. Every session starts with a consent dialog, and live capture also needs macOS camera permission. A free break, suspending, ending the session, quitting, sleeping or locking the Mac, reloading the window and the menu bar's "Stop camera" item all stop capture. A breathing break keeps it running, and the screen says so.&lt;/p&gt;

&lt;p&gt;FlowBreak doesn't record video or save camera images. Preview frames and the short chart buffers live in memory and clear when capture stops. The app doesn't read code, keystrokes or editor content.&lt;/p&gt;

&lt;p&gt;Test reports are on by default in this test build. FlowBreak says so before each session, and they can be turned off in Preferences for later sessions. A report holds physiological statistics (mean, min, max and counts), confidence and quality statistics, timing, optional activity markers, SDK error codes and sampled CPU and memory use. It holds no video, raw sample stream, API key or screen content. The journal is separate and off by default. When it's on, it keeps session durations, breaks and the answers given on the "How are you feeling?" card.&lt;/p&gt;

&lt;p&gt;All files stay on the computer, unencrypted, readable only by the user's account. Retention is 30 days and at most 100 entries. Pruning runs when the app loads or saves its data, so nothing is deleted while FlowBreak is closed. Reports can be deleted one at a time or all together, and the journal has its own Clear button. JSON and CSV exports only happen on request. Deleting a report also deletes its exports from the app's export folder; a copy moved somewhere else is out of FlowBreak's hands.&lt;/p&gt;

&lt;p&gt;FlowBreak creates SmartSpectra with &lt;code&gt;enableTelemetry: false&lt;/code&gt;. Presage's &lt;a href="https://smartspectra.presagetech.com/docs/telemetry-and-privacy/" rel="noopener noreferrer"&gt;Telemetry and Privacy documentation&lt;/a&gt; describes telemetry as on by default and explains how to turn it off. Live measurement still needs authenticated access to Presage's service, so this isn't an offline sensor. Presage's side falls under its &lt;a href="https://api.physiology.presagetech.com/privacypolicy" rel="noopener noreferrer"&gt;SDK Privacy Policy&lt;/a&gt;; the 30 day retention above only covers FlowBreak's own files. I haven't run a network audit. FlowBreak has no backend, and it doesn't call LLM Insights or any other AI service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent Session
&lt;/h2&gt;

&lt;p&gt;I used Codex to help implement, review and test FlowBreak, and Claude Code to help edit this post and rerun the checks. The interface polish follows &lt;a href="https://github.com/heydamir/unslop" rel="noopener noreferrer"&gt;Unslop by Damir Sokolovsky&lt;/a&gt; (CC BY 4.0), and the icons come from &lt;a href="https://lucide.dev/" rel="noopener noreferrer"&gt;Lucide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Codex worked inside its harness the whole time. Now I have one too, and mine has a Later button.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>presagechallenge</category>
      <category>electron</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Another team's agent ships its toolkit into our repo. A pre-push hook keeps our docs in step.</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:46:09 +0000</pubDate>
      <link>https://dev.to/goodbarber/another-teams-agent-ships-its-toolkit-into-our-repo-a-pre-push-hook-keeps-our-docs-in-step-3002</link>
      <guid>https://dev.to/goodbarber/another-teams-agent-ships-its-toolkit-into-our-repo-a-pre-push-hook-keeps-our-docs-in-step-3002</guid>
      <description>&lt;p&gt;Our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes custom sections for GoodBarber apps from a description. The code it writes calls the app through the GoodBarber App API, with a JavaScript toolkit, GBJSTK, documented in a &lt;a href="https://app.goodbarber.dev/v2/documentation/" rel="noopener noreferrer"&gt;public reference&lt;/a&gt;. A colleague maintains the toolkit in its own repository and works on it with a coding agent. Between September 2 and September 25, six versions of it reached our repository, from 2.6.0 to 2.7.0, and nobody scheduled a meeting about any of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The release ends in our repository
&lt;/h2&gt;

&lt;p&gt;The toolkit's release process is written for agents, in the CLAUDE.md of its repository, and its last two steps are the documentation and our repository. On the toolkit side, a post-commit hook regenerates the public API reference, so the reference follows the code commit by commit. Then the agent copies the new toolkit file into our repository and commits it there. The six commits are in our history under my colleague's name, each with Claude as co-author.&lt;/p&gt;

&lt;p&gt;Some of those commits go further than the file. On September 25, the day 2.7.0 arrived, another commit by my colleague added the new &lt;code&gt;gb.viewport&lt;/code&gt; methods to the list of calls our builder accepts in the code it generates.&lt;/p&gt;

&lt;h2&gt;
  
  
  The copy that stayed behind
&lt;/h2&gt;

&lt;p&gt;We also keep a Markdown copy of that reference in our repository, so that our agents have a version they can grep, and our CLAUDE.md points them to it. From March 26 to October 20, it opened with "Current version: 2.3.1". In September, the toolkit file next to it went from 2.6.0 to 2.7.0. The release step for our repository updated that file and never touched the copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  A script, then a hook that only checks
&lt;/h2&gt;

&lt;p&gt;On October 20 we wrote a script that renders the copy from the OpenAPI spec behind the public reference and stamps the API version and the generation date in its first lines. With &lt;code&gt;--check&lt;/code&gt;, it compares that stamp with the online reference and with the toolkit file in our repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python scripts/update_gb_app_api_doc.py --check
docs/GOODBARBER_APP_API.md: 2.7.0
online reference (major 2): 2.7.0
vendored GBJSTK.js: 2.7.0
Up to date.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A pre-push hook went in the same morning. On a push to master, it regenerated the copy, committed it and stopped the push. It came out at 16:30, because it could commit to master on its own, even during the freeze before a build. It was active for six and a half hours and never made a commit.&lt;/p&gt;

&lt;p&gt;It came back on October 27, as a check only. It reads the copy in the commit being pushed to master, and when that copy is behind, it stops the push and says what to run. Replayed on our commit from April 23, it prints this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pre-push: docs/GOODBARBER_APP_API.md is outdated in the commit pushed to master: push stopped.
docs/GOODBARBER_APP_API.md in the pushed commit: no version marker
online reference (major 2): 2.7.0
vendored GBJSTK.js: 2.7.0
OUTDATED: run `python scripts/update_gb_app_api_doc.py` and commit the result.
pre-push: to fix it, run `python scripts/update_gb_app_api_doc.py`, commit docs/GOODBARBER_APP_API.md, then push again.
          `git push --no-verify` skips this check once.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whoever is pushing, one of us or an agent, runs the script, commits the copy and pushes again. The hook itself writes nothing, and a network or Python problem never blocks a push.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it stops
&lt;/h2&gt;

&lt;p&gt;A git hook runs only in the clones that turned it on with &lt;code&gt;git config core.hooksPath .githooks&lt;/code&gt;. If the next toolkit version lands from a clone without it, our copy catches up at the next push to master from a clone that has it.&lt;/p&gt;

&lt;p&gt;The hook also stops at the documentation. Whether our builder may use a new method is still decided in a commit. The &lt;code&gt;gb.viewport&lt;/code&gt; methods accepted on September 25 carry a comment saying they are accepted for hand-written or imported plugins and "not taught by the prompt".&lt;/p&gt;

&lt;p&gt;On October 27, the check reports 2.7.0 on every side, and the hook has not stopped a push yet.&lt;/p&gt;

&lt;p&gt;When a team you depend on ships a new version, what tells your coding agents?&lt;/p&gt;

</description>
      <category>git</category>
      <category>ai</category>
      <category>agents</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Behind the allowlist, except the migration, the scheduler and the image</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:35:59 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/behind-the-allowlist-except-the-migration-the-scheduler-and-the-image-2pbn</link>
      <guid>https://dev.to/pierrelaurentmedori/behind-the-allowlist-except-the-migration-the-scheduler-and-the-image-2pbn</guid>
      <description>&lt;p&gt;On October 18, I typed this into my Claude Code session: "Normally, everything is behind the allowlist." Nothing had been deployed since Friday, but the other Claude Code session on the project, a colleague's, had pushed to master in the meantime.&lt;/p&gt;

&lt;p&gt;Claude answered that nobody had checked yet whether every commit pushed since Friday kept to the list, and that these changes would reach every app whatever the list said:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;new migrations, which apply to the whole database;&lt;/li&gt;
&lt;li&gt;a dispatcher, a job that runs every five seconds in the production worker;&lt;/li&gt;
&lt;li&gt;a new column in our proxy, which sits on the path of every app's requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The checklist we wrote for the next deploy, two days later, named one more: the &lt;code&gt;app.js&lt;/code&gt; of the studio, served to every app, which no browser had loaded yet in that version. The studio is the back-office screen where you describe a section and watch its preview, and the Django service behind it.&lt;/p&gt;

&lt;p&gt;I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;. Our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; writes an app section from a description. Since November 4, a new engine does that work: an agent that writes the section, tests it in a real browser and fixes what it finds (&lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-the-agent-tests-your-sections-and-can-create-your-app-s-database-a1660/" rel="noopener noreferrer"&gt;the announcement&lt;/a&gt;). For the three weeks before, it ran in production for five test apps and nobody else. Times are Paris time, and quotes from French are my translations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closed by default
&lt;/h2&gt;

&lt;p&gt;On October 12, I set the rule: "Let's note it as an execution rule: no impact on the apps outside the allowlist." It kept deliberate exceptions: additive migrations, measurement that changes no behavior, and dead code could still reach every app.&lt;/p&gt;

&lt;p&gt;The list was one setting, read by one function. The next day, the agent reached production behind two more locks, on/off switches we call levers: &lt;code&gt;create&lt;/code&gt; for creating a page and &lt;code&gt;refine&lt;/code&gt; for changing one. They are rows in an admin table, so changing one takes no deploy. They are closed by default, and a missing row meant the old engine.&lt;/p&gt;

&lt;p&gt;That afternoon, I reported a bug: I had asked, on a test app, for a banner on the home page, and it had landed on the page I was editing. A few minutes later, Claude answered that the agent had never run. All my test prompts had gone through the old engine, which only writes the page a prompt comes from. The list held my test app, and the levers table was empty. The answer traced it to the delivery note Claude had written for me:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The error comes from my instructions: I wrote "open &lt;code&gt;create&lt;/code&gt; and &lt;code&gt;refine&lt;/code&gt;", when there is nothing to open. The rows have to be added.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Claude then wrote a command to add them. It writes what the admin would, in one transaction, and refuses an app that isn't on the list, or an empty list. Without an action, it writes nothing and prints the engine each listed app gets from the routing function the views call. Once it was deployed, I ran it in production:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python manage.py agent_levers --open --only &amp;lt;five test app ids&amp;gt;
Lever create: added, open.
Lever refine: added, open.
Levers: create open, refine open
&amp;lt;app 1&amp;gt;: agent (create, refine)
&amp;lt;app 2&amp;gt;: agent (create, refine)
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The old code, kept verbatim
&lt;/h2&gt;

&lt;p&gt;The list also had to hold inside the code both engines share. When a shared function had to change, it checked the list: listed apps got the new body, and every other app a verbatim copy of the old one, named &lt;code&gt;_legacy_&amp;lt;name&amp;gt;&lt;/code&gt; and marked &lt;code&gt;# ALLOWLIST EXIT&lt;/code&gt;. A short script renamed each copy to the original's name and compared the two at a given commit, through &lt;code&gt;ast.dump&lt;/code&gt;, so comments and formatting don't count.&lt;/p&gt;

&lt;p&gt;On October 20, that check ran against the commit then in production. Apart from the copies added since that commit, only two differed. They had been copied from master after a change production didn't have yet, and they were inert outside the list. Until then, our todo files said to compare against master, and from then on, against the commit running in production. We then turned the script into a command that takes the commit as an argument, and a test that holds a fingerprint of every copy. Against the commit deployed that afternoon, the command reported all 70 copies identical.&lt;/p&gt;

&lt;h2&gt;
  
  
  The migration
&lt;/h2&gt;

&lt;p&gt;On October 15, Claude told me that a new migration was on master: one table, nothing reading it yet. The third bullet of the message said that applying it through a deploy of the studio would also ship three tasks from the other session, one not reviewed yet and two with an open blocking point, and suggested waiting for the common deploy.&lt;/p&gt;

&lt;p&gt;I had to leave, so a minute later I ran the build. The deploy reached both hosts a few minutes after that, and I applied the migration. Our migrations run from the image, and the image is built from master, so one new table took everything master held. That evening, Claude's next message opened with it: the unreviewed task was in production, and it would be reviewed first.&lt;/p&gt;

&lt;p&gt;A migration runs once, on the whole database, and no list holds it back. Ours had to be additive, and I applied them before the code. Django lists every field of a model in its queries, so code whose model has a column the table lacks fails for every app. Old code runs fine on the new schema, because each new column is nullable or has a default in the database (&lt;code&gt;db_default&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Additive still takes a lock. Several migrations went out together in the deploy that followed my allowlist message, and one added a nullable integer to the generations table, our busiest. Postgres doesn't rewrite the table for that, but the &lt;code&gt;ALTER TABLE&lt;/code&gt; waits for an &lt;code&gt;ACCESS EXCLUSIVE&lt;/code&gt; lock, which blocks reads too, and every query that arrives after it waits behind it. That deploy's checklist asked for a timeout, and for a second run if it fired:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose run --rm -e &lt;span class="nv"&gt;PGOPTIONS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'-c lock_timeout=5s'&lt;/span&gt; web python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the migrations went through.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scheduler
&lt;/h2&gt;

&lt;p&gt;The dispatcher from Claude's answer only has work for an app on the list, but it runs on the same worker, and waits on the same queue, as every app's generations. While it has work, it queues itself again, and each run takes a worker slot from them for as long as it lasts.&lt;/p&gt;

&lt;p&gt;Until October 22, every deploy killed that worker for every app with a SIGKILL, as I wrote in &lt;a href="https://dev.to/pierrelaurentmedori/our-deploys-sent-sigterm-our-workers-only-ever-got-sigkill-2ihj"&gt;an earlier post&lt;/a&gt;: jobs in flight died, and rq's scheduler took minutes to come back. Since then, the worker gets its SIGTERM, but a job still running when the grace period ends still dies. The day before that fix, after a build, one host's check found no scheduler on its main queue, and the next check found it back.&lt;/p&gt;

&lt;h2&gt;
  
  
  The image
&lt;/h2&gt;

&lt;p&gt;The studio's Config, its production settings, lives in a private submodule, linked into the image at build time. That way a config change rolls out progressively like any other deploy, and rolling back the image rolls it back too. The build script, shortened:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout master
git pull origin master
git submodule update --init --recursive
docker build --build-arg &lt;span class="s2"&gt;"CONFIG=${CONFIG}"&lt;/span&gt; -t &lt;span class="s2"&gt;"${IMAGE_NAME}:${GIT_COMMIT}"&lt;/span&gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switching a setting on took two commits, one in the config repository and one for its pointer in the studio, then a build of whatever master held. Switching it off cost the same build. The checklist for October 21 listed 18 things to switch on, and its first point was exactly that. So master stayed frozen from the first build to the last deploy, apart from the Config pointers and one fix of ours, and the other session committed locally until we were done.&lt;/p&gt;

&lt;p&gt;At 11:10, I asked whether everything was on. Nothing was: the morning's build had shipped the code, switched off. I wrote: "We switch everything on for the allowlist. The other session is busy, we go ahead without it." Twenty minutes later, about the Config, I told Claude: "You'll do it alone. Push, and deploy, you don't need me."&lt;/p&gt;

&lt;p&gt;The work went in steps, with a check before and after each one, a command we had written for that day. It prints one line per point, OK, KO or MANUAL, and exits with an error if any point is KO. After the morning's build, both hosts reported the KOs we expected and a list of points to check by hand.&lt;/p&gt;

&lt;p&gt;Fourteen of the 18 were on by 14:25, after four builds counting the morning's. Two of the fourteen needed no build, because they were levers in the admin. The checks after the last step showed no KO. The rest stayed off: three were blocked, and one by my decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Empty means everyone, or no one
&lt;/h2&gt;

&lt;p&gt;The first setting we switched on was a fix in the Supabase connector, and that setting reads no list. The connector's gate does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;supabase_connector_enabled_for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id_webzine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;getattr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"FEATURE_ENABLE_SUPABASE_CONNECTOR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;allowlist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;supabase_connector_allowlist&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;allowlist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the flag on, an empty list means every app. That morning, the read-only check of the production Config showed the connector's list empty, so the fix went to every app with the connector open, not to five. I had accepted that before the session, for a fix we wanted everywhere.&lt;/p&gt;

&lt;p&gt;The agent's gate, further down the same file, has read an empty list the other way since the day I set the rule:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;agent_migration_enabled_for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id_webzine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;allowlist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;agent_shadow_webzines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;allowlist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude wrote it that day, in what it called a small function that follows the pattern of the existing gates, and said the inversion was deliberate: a list emptied by mistake puts every app back on today's behavior. Its docstring says it in capitals: "an EMPTY &lt;code&gt;AGENT_SHADOW_WEBZINES&lt;/code&gt; means NOBODY". When we switched things on, four gates in that file read an empty list as everyone, and three, the agent's among them, as no one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd check before trusting a list
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Before each deploy, list what runs for every app whatever the list says: migrations, scheduled jobs, the shared worker, static files, a proxy.&lt;/li&gt;
&lt;li&gt;Read how each gate treats an empty list, and write it in its docstring and in a test. Ours split four to three in one file.&lt;/li&gt;
&lt;li&gt;Print the state as the routing function answers it. Ours had the right list, an empty levers table, and an agent that never ran.&lt;/li&gt;
&lt;li&gt;If your config is baked into the image and the build takes the tip of a branch, count the builds a switch-on costs, and freeze the branch meanwhile.&lt;/li&gt;
&lt;li&gt;Prove the copies of the old code against the commit in production, not against your main branch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The setting that would take the engine past the list had already spent two weeks in production, off by default. Turning it on meant one more line in that Config, and one more build of all of master. On November 4, that build carried 28 commits that production didn't have yet.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>django</category>
      <category>featureflags</category>
      <category>ai</category>
    </item>
    <item>
      <title>Tech debt is not dead. It chose the format of our referral codes.</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Fri, 13 Nov 2026 13:04:42 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/tech-debt-is-not-dead-it-chose-the-format-of-our-referral-codes-15gk</link>
      <guid>https://dev.to/pierrelaurentmedori/tech-debt-is-not-dead-it-chose-the-format-of-our-referral-codes-15gk</guid>
      <description>&lt;p&gt;"What happens if I create a voucher called P66666666 by hand?"&lt;/p&gt;

&lt;p&gt;I asked that on October 23, the morning of the day our referral program went to production. The answer started with: it can't exist. The voucher code is a &lt;code&gt;char(8)&lt;/code&gt;. PostgreSQL refuses a ninth character, and our admin form stops typing at eight.&lt;/p&gt;

&lt;p&gt;Some context. I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform. Our referral codes are rows in the voucher table that our back office has used for years, a choice explained in a separate post. No migration was allowed for this feature. Every constraint of that table, deliberate or accidental, became a constraint of the referral program.&lt;/p&gt;

&lt;h2&gt;
  
  
  Eight characters, five other writers
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;code&lt;/code&gt; is the primary key of the voucher table and a column of the usage table, &lt;code&gt;char(8)&lt;/code&gt; in both: fixed width, padded with spaces, anything longer refused. Going past eight would have been a migration.&lt;/p&gt;

&lt;p&gt;Who else writes to that table? The admin form, where anyone on the team can type a free code of up to eight characters or have one generated, five letters and three digits. The crons of our older CMS that create monthly and yearly vouchers with direct &lt;code&gt;INSERT&lt;/code&gt;s. Gamification, on the monolith side. And two Python scripts in another repository, one for leads and one for resellers, each with its own prefix. Any of them can write any eight-character code.&lt;/p&gt;

&lt;p&gt;No column could say "this is a referral code", so the code's shape had to. A voucher counts as a referral code when it is attached to an app, can be used at least once, and matches one regular expression. A global voucher, attached to no app, is never mistaken for one, whatever its code.&lt;/p&gt;

&lt;p&gt;The first format was &lt;code&gt;P&lt;/code&gt;, a digit from 2 to 9, and six characters from an alphabet without the ambiguous ones, like &lt;code&gt;P5CV7AUJ&lt;/code&gt;. Then came my question, and the answer was uncomfortable. A voucher typed by hand as &lt;code&gt;P2ABCDEF&lt;/code&gt; and attached to an app would be read as that app's referral code: the referral rules would replace its value and decide who may use it, and it would pay credits after each validated use. No generator produces that shape. A person can type it.&lt;/p&gt;

&lt;p&gt;My first idea was a prefix nobody would type: &lt;code&gt;PAR_P&lt;/code&gt;, followed by seven random characters. That makes twelve, and the column holds eight. We kept the underscore and moved it to second position:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;^P_[2-9][2-9A-HJKMNP-Z]{5}$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;None of the generators above produces an underscore. That leaves about 229 million codes. A person can still type one on an app-attached voucher, and that limit is written down.&lt;/p&gt;

&lt;h2&gt;
  
  
  The guard that blocked the first test payment
&lt;/h2&gt;

&lt;p&gt;Our ORM has a guard: when a model reads a row that belongs to an app other than the current one, it hides the row. For vouchers, that made sense for years. A voucher belonged to one app, or to none.&lt;/p&gt;

&lt;p&gt;A referral code belongs to the sponsor's app and is used from the referee's app. It crosses tenants by design. During the first test payment, the order creation asked the voucher model whether the code was an amount or a percentage. The guard hid the sponsor's row and printed its debug line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gardefous Webzine Model Common\Models\CommandeRemise Expected: &amp;lt;sponsor app&amp;gt; / Current: &amp;lt;referee app&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only our team sees that line, which is why I saw it and a customer wouldn't. For a customer, the hidden row meant "not an amount", which happened to be right for a percentage, and the payment went through. On my screen, the text went out before the headers and broke the redirect.&lt;/p&gt;

&lt;p&gt;The first fix read referral-shaped codes without the guard, and I rejected it. Either a fix changes how existing vouchers are read, or it ties a billing read to the referral format for good. I wanted neither.&lt;/p&gt;

&lt;p&gt;The version that shipped doesn't know what a referral code is. It reads the voucher without the built-in guard, then applies the same guard function with the same conditions itself, without printing anything. To check that nothing changed, we created five test vouchers: a global amount and a global percentage, an amount and a percentage attached to the sponsor's app, and an amount attached to the referee's app. We compared the old and new answers for them, for the referral code and for a missing code, in three app contexts. 21 cases, 0 differences.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cache key that didn't know about the guard
&lt;/h2&gt;

&lt;p&gt;The review of that version found the subtle part. The ORM caches &lt;code&gt;findFirst()&lt;/code&gt; results in memory for the request, and builds the cache key from the query, but not from the guard flag. The guard itself only runs when the row isn't cached yet. So an unguarded read stored another app's voucher under the key a guarded read would use, and a guarded read later in the same request would have received it without any check.&lt;/p&gt;

&lt;p&gt;Nothing took that path that day: the only &lt;code&gt;findFirst()&lt;/code&gt; with those exact parameters was the method we were changing. The fix was one parameter. The ORM accepts an explicit key, so that read now caches under its own, &lt;code&gt;__METHOD__ . ":" . $code&lt;/code&gt;. In a test, before the fix, a guarded read placed right after it returned the sponsor's voucher in the referee's context. After the fix, the voucher stayed hidden, and the 21 cases still matched.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the old decisions decided
&lt;/h2&gt;

&lt;p&gt;None of these constraints was chosen for the referral program. The column width is older than the program, the other writers were already there, and the guard protects a rule that was true for years. Between them, they set the code's length, its second character, and the way one model method reads a row.&lt;/p&gt;

&lt;p&gt;What's the oldest constraint in your schema that still decides how new features look?&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>php</category>
      <category>database</category>
      <category>legacy</category>
    </item>
    <item>
      <title>What git never saw in our referral release</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Thu, 12 Nov 2026 13:00:29 +0000</pubDate>
      <link>https://dev.to/goodbarber/what-git-never-saw-in-our-referral-release-444e</link>
      <guid>https://dev.to/goodbarber/what-git-never-saw-in-our-referral-release-444e</guid>
      <description>&lt;p&gt;On the morning of October 23, I ran &lt;code&gt;git status&lt;/code&gt; on our shared test VM and found two modified files I hadn't touched:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;On branch PILOW_B107
Your branch is up to date with 'origin/PILOW_B107'.
Changes not staged for commit:
  modified:   common/lib/Goodbarber/Referral/Referral.php
  modified:   common/models/CommandeRemise.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I asked Claude Code, which was writing the feature with me, whether that was its doing. It was: a first fix, posted straight onto the VM without a commit, so that my test payment could go through.&lt;/p&gt;

&lt;p&gt;Some context. I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform, and that afternoon we shipped a referral program in our back office. The back office can only be tested end to end on that VM, which other people use too. Git saw the code. A good part of the release happened elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Files on the VM
&lt;/h2&gt;

&lt;p&gt;That morning, changes went onto the VM several times before they went into a commit: the layout of the code's Copy button, the first fix for a guard that blocked my test payment, the version that replaced it, and two fixes to the validator and the cron. Each time, it let me test the change before anyone committed it.&lt;/p&gt;

&lt;p&gt;One of those versions went on while my payment was in progress. Claude wrote the new file next to the old one, linted it, then renamed it over the original, so that the request in flight couldn't load a half-written file.&lt;/p&gt;

&lt;p&gt;After each commit and push, Claude realigned the VM. It compared the fingerprint of each modified file on the VM with the committed version, staged it, then fast-forwarded the VM's checkout. When the fingerprints match, the fast-forward rewrites nothing. Once, it didn't go through: restoring the files triggered the repository's Git LFS hook, which failed because the container has no git-lfs. The VM served the old page for a few seconds, and the fast-forward ran again without hooks. The commit touched no LFS file.&lt;/p&gt;

&lt;p&gt;The VM was not always aligned. After a commit that only changed a SQL file of texts, it stayed one commit behind on purpose, because those texts had already been updated by hand in the dev database. And when master had to be merged into the branch, the merged files were linted in a temporary directory of the container, without touching the VM's checkout: 37 files, 22 from the merge and 15 from the feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data in the test database
&lt;/h2&gt;

&lt;p&gt;Testing a payment writes orders, invoices, vouchers, credits and payment traces for real dev apps. Before any change, a script took a photo of every row of the test apps in every table that has an &lt;code&gt;id_webzine&lt;/code&gt; column, 421 tables, plus their orders and invoices with their lines. The apps were then prepared in one transaction, which rolled back if an app wasn't in the expected state.&lt;/p&gt;

&lt;p&gt;When the test payment wouldn't go through, I suggested faking the invoice row. Claude used the code path that creates an invoice from an order instead, so the voucher's use switched to paid exactly as after a real payment. Then it moved the settlement date back 16 days to make the cron decide.&lt;/p&gt;

&lt;p&gt;At the end, the restore script put the three test apps back, and a new comparison found zero differences with each photo. The restore also removed what the payment flow had written elsewhere: payment-provider traces, the billing address I had typed, short links, login traces. The photos don't cover what isn't attached to an app, such as consumed sequence numbers and global log lines. They are still on the VM, about 70 MB with the scripts, for the next test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Texts in the database
&lt;/h2&gt;

&lt;p&gt;The referral page's texts live in a table of the back office's database, in twenty languages. The repository has a SQL file that inserts them, 340 rows, and skips any row that already exists. That makes it safe to replay, and useless for changing a text that production already has.&lt;/p&gt;

&lt;p&gt;The texts changed four times between October 23 and 26. The insert file in the repository got the new texts, for databases that don't have them yet. Production needed an &lt;code&gt;UPDATE&lt;/code&gt; script of 20 or 40 lines, tested first on a database configured like production, with &lt;code&gt;standard_conforming_strings = off&lt;/code&gt;. I copied each script with &lt;code&gt;pbcopy&lt;/code&gt;, pasted it into psql on production, then flushed the texts' cache.&lt;/p&gt;

&lt;p&gt;Those &lt;code&gt;UPDATE&lt;/code&gt; scripts lived in Claude's scratchpad under &lt;code&gt;/tmp&lt;/code&gt;. One of its messages warned that a reboot of my Mac would erase the next one, and that it would regenerate it from the insert file. That was a choice. The repository already has a precedent for versioning such update scripts next to their insert file. For this branch, my rule was code only: the feature's documentation was removed with &lt;code&gt;git rm&lt;/code&gt; before production, and the update scripts never went in.&lt;/p&gt;

&lt;p&gt;Production's texts have been changed four times by scripts that exist in no repository.&lt;/p&gt;

&lt;p&gt;How do you know, on a shared test machine, which files on disk match a commit?&lt;/p&gt;

</description>
      <category>git</category>
      <category>devops</category>
      <category>testing</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Reasoning models think in silence. Our job queue read silence as death.</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Mon, 09 Nov 2026 11:08:41 +0000</pubDate>
      <link>https://dev.to/pierrelaurentmedori/reasoning-models-think-in-silence-our-job-queue-read-silence-as-death-4697</link>
      <guid>https://dev.to/pierrelaurentmedori/reasoning-models-think-in-silence-our-job-queue-read-silence-as-death-4697</guid>
      <description>&lt;p&gt;One morning, our daily automated code review flagged a refactor we had just pushed. The finding fit in one line: in the new code, nothing renews a running generation's heartbeat while the model is thinking, so a generation can be reclaimed as dead while it's still working, and the model call is paid for, then thrown away.&lt;/p&gt;

&lt;p&gt;It was right, and checking it turned up a hole older than the refactor.&lt;/p&gt;

&lt;p&gt;Some context. I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform, and our &lt;a href="https://www.goodbarber.com/blog/ai-extension-builder-build-sections-with-ai-no-code-required-a1492/" rel="noopener noreferrer"&gt;AI Extension Builder&lt;/a&gt; generates the code of an app section from a description, then edits it on request. Each generation runs as a job on a worker. This post is about how that worker tells the rest of the system it's alive, and why reasoning models broke the way it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  How a generation says it's alive
&lt;/h2&gt;

&lt;p&gt;A running generation holds a key in Redis that says "I'm alive", with a 90-second expiry. Whoever runs the job is supposed to renew it. The studio, when it polls a generation or when the user reloads the page, checks two things: is the key gone, and is the row older than 180 seconds? If both, the row is reclaimed and marked as failed. That's how we clean up after a worker that crashed mid-job.&lt;/p&gt;

&lt;p&gt;The question is what counts as "renewing". In the worker, the key was refreshed when something happened: a token arrived from the model, or the pipeline moved to its next step. Activity meant the job was alive. During a model call that hadn't produced its first token yet, nothing happened, and silence meant it wasn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The refactor
&lt;/h2&gt;

&lt;p&gt;We had finished a cleanup the day before and pushed it that morning: every generation would run through the worker, one execution path, and the older paths that ran inside the web request were deleted. About 2,250 lines went away.&lt;/p&gt;

&lt;p&gt;One of those paths was the resume after approval. Some generations pause to ask the user for something, a permission or a choice, and resume once the user answers. That resume used to run inside the request, under a small context manager that started a thread renewing the key every 30 seconds, tokens or not. The code around it explained why: if the first token takes more than 90 seconds, the key expires and a live generation gets killed.&lt;/p&gt;

&lt;p&gt;The refactor moved the resume onto the worker, which renewed on activity only. The call to the keepalive, and the comment that explained it, were in the code that got deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it mattered that week
&lt;/h2&gt;

&lt;p&gt;A reasoning model thinks before it writes. That thinking happens before the first token, and it grows with the reasoning effort you ask for. The day we finished the cleanup, we had also raised the reasoning effort of edits from low to medium and deployed it; edits got about 60% slower. A model that thinks for more than 90 seconds before its first token is, for an activity-driven heartbeat, a model that died.&lt;/p&gt;

&lt;p&gt;What happens next depends on who looks first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The studio polls&lt;/strong&gt;, finds the key gone and the row old enough, and marks the generation failed. The worker finishes anyway, and its result is refused. The call is paid for and thrown away, and the user sees an error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The stream to the browser&lt;/strong&gt; decides the worker is dead and starts a second job. The call is paid for twice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Resumed generations were the most exposed, because their row is created when the plan is made, before the user approves. By the time the job resumes, the row is often already past 180 seconds. The only thing left between it and the reaper is the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  The older hole
&lt;/h2&gt;

&lt;p&gt;The regression itself never reached production: the review flagged it the morning the refactor was pushed, and the fix shipped with the refactor the next day. But the activity-driven refresh wasn't new. Normal generations on the worker already worked that way. They were less exposed, because a fresh row takes longer to cross 180 seconds. Less exposed is not safe.&lt;/p&gt;

&lt;p&gt;We had a failure state for exactly this, a row reclaimed while pending, and it was not empty.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;One change in the worker: every job runs under the same keepalive the old path used, a thread that renews the key every 30 seconds whether tokens arrive or not. The resume, normal generations, edits and retries all go through it. Simplified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_job&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generation_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;keep_alive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generation_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;every_seconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The test makes the worker wait without receiving a single token, and checks that the key was renewed during the wait. Without the fix, it fails with the most honest assertion message I've seen in a while: "0 not greater than 0".&lt;/p&gt;

&lt;h2&gt;
  
  
  What the numbers say so far
&lt;/h2&gt;

&lt;p&gt;We compared production generations across three periods, read-only, split by deploys: two weeks before the deploy that raised the effort; the two days after it, with the higher reasoning effort already live but neither the refactor nor the fix; and the four and a half days after the next deploy, which shipped the refactor and the fix together. Rates are shares of the generations started by real users in each period, and median times are compared with the first period.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;before&lt;/th&gt;
&lt;th&gt;higher effort, no fix&lt;/th&gt;
&lt;th&gt;after the fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;failure rate&lt;/td&gt;
&lt;td&gt;1.2%&lt;/td&gt;
&lt;td&gt;1.6%&lt;/td&gt;
&lt;td&gt;0.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reclaimed while pending&lt;/td&gt;
&lt;td&gt;0.6%&lt;/td&gt;
&lt;td&gt;0.3%&lt;/td&gt;
&lt;td&gt;under 0.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;left pending after the plan&lt;/td&gt;
&lt;td&gt;0.5%&lt;/td&gt;
&lt;td&gt;0.2%&lt;/td&gt;
&lt;td&gt;0.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;median time, new app&lt;/td&gt;
&lt;td&gt;baseline&lt;/td&gt;
&lt;td&gt;-2%&lt;/td&gt;
&lt;td&gt;+7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;median time, edit&lt;/td&gt;
&lt;td&gt;baseline&lt;/td&gt;
&lt;td&gt;+62%&lt;/td&gt;
&lt;td&gt;+56%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The two later windows last only days, so read their columns as a direction, not a measurement.&lt;/p&gt;

&lt;p&gt;Reclaims are what a missing heartbeat produces, whether the worker died or only looked dead, and they nearly disappeared: from 0.6% of generations in the two weeks before to under 0.1% after the fix. The failure rate nearly halved. So far, a fix written for a regression that never shipped also closed the main failure we already had.&lt;/p&gt;

&lt;p&gt;One line didn't move, and it belongs in the table anyway. A row left pending is one where the plan was made, nothing was written to the row afterwards, and nobody came back to the page to trigger a reclaim: 0.5% of generations in the two weeks before, 0.6% in the four and a half days after, a rate that didn't improve. Whether its code phase never started or died without a trace, the rows don't say. That isn't the heartbeat. It's the next thing to look at.&lt;/p&gt;

&lt;p&gt;The middle column matters too: with the higher effort live for two days, the rate of reclaims didn't go up, 0.3% against 0.6% before. The effort increase alone didn't show up there. It shows up in the last line: at the median, edits took about 60% longer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every silence is a budget
&lt;/h2&gt;

&lt;p&gt;The heartbeat is the obvious one. It's not the only thing in a typical stack that reads silence as failure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;the reaper's age threshold&lt;/strong&gt; and the key's expiry;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the stream to the client&lt;/strong&gt;, if it gives up after a period with no event;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the reverse proxy&lt;/strong&gt;: nginx's &lt;code&gt;proxy_read_timeout&lt;/code&gt; defaults to 60 seconds;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the CDN or load balancer in front&lt;/strong&gt;: Cloudflare returns a 524 when the origin sends nothing for 125 seconds, its current default;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;the worker process timeout&lt;/strong&gt;, if your app server kills requests that run too long.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the model started writing within seconds, the silent stretch at the start of a call was short. A reasoning model can stay silent much longer: at medium effort, a first token after 90 seconds was plausible enough for the review to flag it, as a risk rather than a measurement. Each of those timeouts is a budget against thinking time, and raising the reasoning effort spends it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd keep
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Liveness must not depend on output.&lt;/strong&gt; A heartbeat comes from a timer. Progress comes from tokens. They are two signals, and the second can stay silent for a long time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Raising the reasoning effort is an infrastructure change.&lt;/strong&gt; List every timeout between the model and the user, and check it against the slowest first token you can expect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When you consolidate paths, read what each one was protecting.&lt;/strong&gt; Our old path carried its guard and the reason for it. The diff that deleted it was green.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Count "paid and thrown away" as its own failure,&lt;/strong&gt; not as one more error in the failure rate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which timeout in your stack would a model thinking for two minutes hit first?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>python</category>
      <category>redis</category>
    </item>
    <item>
      <title>Our referral reward is decided 16 days after the payment. The rows it reads can change in between.</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Fri, 06 Nov 2026 12:56:16 +0000</pubDate>
      <link>https://dev.to/goodbarber/our-referral-reward-is-decided-16-days-after-the-payment-the-rows-it-reads-can-change-in-between-3m5j</link>
      <guid>https://dev.to/goodbarber/our-referral-reward-is-decided-16-days-after-the-payment-the-rows-it-reads-can-change-in-between-3m5j</guid>
      <description>&lt;p&gt;Our referral program rewards the sponsor 16 days after the referee's payment. A cron takes that decision every morning. The referee's app has to be still active, its invoice paid without incident and without a credit note, and a few other checks have to pass. If a condition fails, the cron tries again the next day, and gives up 46 days after the payment.&lt;/p&gt;

&lt;p&gt;Some context. I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform, and the referral program went live on October 23. Before launch, the review found three bugs in that decision. They have the same root. A check that runs 16 days later reads the database as it is now, and the database had changed in between.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which date is "the payment"?
&lt;/h2&gt;

&lt;p&gt;The first version counted the 16 days from the invoice date. An invoice can be created, go unpaid, and be settled later. When we regularize an unpaid invoice, only its settlement date changes. Counted from the invoice, the delay could end only a few days after the money actually arrived.&lt;/p&gt;

&lt;p&gt;The delay and the 30-day retry window now start from the settlement date.&lt;/p&gt;

&lt;h2&gt;
  
  
  The row that was overwritten
&lt;/h2&gt;

&lt;p&gt;One of the checks looks at the details of the referee's payment. It read the app's current direct-debit mandate, and updating bank details overwrites that row. If the details changed between the payment and day 16, the check looked at values the payment never used.&lt;/p&gt;

&lt;p&gt;The payment history had the answer. Each direct-debit payment keeps the account it was taken from, next to its invoice. The check now reads that history as well as the current mandate. We tested it on an app that has a payment history and no current mandate.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Already granted", checked by existence
&lt;/h2&gt;

&lt;p&gt;Past a number of validated referrals, the sponsor earns a discount on a renewal. The cron grants it as a personal voucher with a pending use, which our renewal process attaches to the next renewal order. Before granting it, the cron checks whether that voucher already exists, so that it never grants it twice.&lt;/p&gt;

&lt;p&gt;A chain of existing code broke that check. The renewal process attaches the pending use to an unpaid renewal order. If the customer changes plan before paying, the plan change deletes that unpaid order, and the order's delete hook deletes the voucher's use with it, but not the voucher. On its next pass, the cron finds the voucher and does nothing. The reward is gone, and nothing says so.&lt;/p&gt;

&lt;p&gt;The fix leaves the existing billing code alone. A daily pass looks for tier vouchers that aren't deleted and have no use at all, pending or consumed, and gives them a pending use again, under the same per-app lock. To withdraw a reward on purpose, we mark the voucher deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running it again changes nothing
&lt;/h2&gt;

&lt;p&gt;A decision that retries every day for 30 days runs many times on the same data. Each credit carries its invoice in its origin, &lt;code&gt;referral_referee:&amp;lt;invoice&amp;gt;&lt;/code&gt; or &lt;code&gt;referral_sponsor:&amp;lt;invoice&amp;gt;&lt;/code&gt;, and is only granted if that origin doesn't exist yet. The cron takes a PostgreSQL advisory lock per app, &lt;code&gt;pg_advisory_xact_lock&lt;/code&gt;, and checks again once it holds the lock. During testing, we ran it several times in a row on a validated referral: it logged "validated" again and paid nothing. We never ran two passes at the same time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The window also limits the kill switch
&lt;/h2&gt;

&lt;p&gt;Commenting out the crontab line stops every reward without a deploy, while the page and the checkout keep working. The 46 days apply there too. A referral whose payment is more than 46 days old when the cron comes back is never rewarded.&lt;/p&gt;

&lt;p&gt;What does your delayed job read: the state at the event, or the state when it runs?&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>postgres</category>
      <category>php</category>
      <category>database</category>
    </item>
    <item>
      <title>Where do you put a referral program when everything it touches lives in the monolith?</title>
      <dc:creator>Pierre-Laurent Medori</dc:creator>
      <pubDate>Tue, 03 Nov 2026 13:06:12 +0000</pubDate>
      <link>https://dev.to/goodbarber/where-do-you-put-a-referral-program-when-everything-it-touches-lives-in-the-monolith-4hd1</link>
      <guid>https://dev.to/goodbarber/where-do-you-put-a-referral-program-when-everything-it-touches-lives-in-the-monolith-4hd1</guid>
      <description>&lt;p&gt;On October 22, I picked up a referral program halfway through. A first version applied the referral discount by writing it straight into the order line. I refused it. I wanted the discount to go through the voucher system we already have, and the referral to stay tracked.&lt;/p&gt;

&lt;p&gt;Some context. I run backend engineering at &lt;a href="https://www.goodbarber.com/" rel="noopener noreferrer"&gt;GoodBarber&lt;/a&gt;, an app platform, and our customers pay for their apps through a back office that is a PHP monolith. A referral program has to touch the coupon field at checkout, the payment confirmation, invoices and credit notes, vouchers, the credits we give apps, and renewals, which a cron of our older CMS creates. All of that lives in the monolith. The question was where the referral itself should live.&lt;/p&gt;

&lt;p&gt;Between 14:37 and 15:55 that day, I went around five answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five places for the same code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A new table in the shared database, with its model.&lt;/strong&gt; The obvious answer, and the one I liked least. Our billing models are old, and I was afraid of adding one next to them and breaking something I wouldn't see break.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The key/value table we already have.&lt;/strong&gt; It stores attributes per user and per app, and already holds more than rights. The sponsor would get a &lt;code&gt;referral_code&lt;/code&gt; row, the referee a &lt;code&gt;referral&lt;/code&gt; row holding a small JSON state. No migration. What we'd lose is uniqueness in the database: it would become a &lt;code&gt;SELECT ... FOR UPDATE&lt;/code&gt; on the sponsor's row during the reservation, to be proven under concurrency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A separate service with its own database&lt;/strong&gt;, built like many of our Python services. The rules would be real constraints again, in a database of their own. But the monolith would still call it at three points: the page that shows the code, the checkout that reserves it, and an endpoint to grant rewards. Reserving a code would become a network call in the middle of the payment path. "One use only" would be split across two systems: the service reserves, the monolith applies the voucher, and if one of them fails, something has to undo the other. And it would be one more thing to deploy, host, monitor and back up, for the first version of a program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A signed code, with nothing stored up front.&lt;/strong&gt; The code would carry the sponsor's app and a signature, and only its use would be stored. The code gets longer, and "which app gets the reward" becomes a computed rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The voucher table we already had.&lt;/strong&gt; The sponsor's code becomes a voucher. The referee types it at checkout like any promo code, and a cron checks how the code is used and grants the rewards. That one was my call, and it's the one we shipped.&lt;/p&gt;

&lt;p&gt;On the way there, I came back once to the first option with the word KISS and a warning about the model. The voucher table removed the question, since it needed neither a new table nor a migration.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the voucher table already knew
&lt;/h2&gt;

&lt;p&gt;Most of the rules already had a column. The maximum number of uses is a field the voucher validation already counts. "First subscription only" is a flag the checkout already enforces. The sponsor's app is the voucher's owner. Each use is a row in the usage table, which switches to paid when the invoice is created. The cron only has to read paid uses that are old enough to be validated.&lt;/p&gt;

&lt;p&gt;When I asked a colleague to review the branch, it had seven commits on top of master: 17 files, 1,654 lines added, 14 removed, and no migration. The program went live on October 23.&lt;/p&gt;

&lt;p&gt;Its rules changed three times in the following days, and its texts four. Each rule change was a constant or a cron, plus the texts in twenty languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it cost
&lt;/h2&gt;

&lt;p&gt;The voucher table was never meant to tell one kind of voucher from another. Without a new column, the only thing that marks a referral code is its shape, and other code writes into that table too. A tenant guard in our ORM also had opinions about a code that belongs to one app and is used by another. Those are a separate post.&lt;/p&gt;

&lt;h2&gt;
  
  
  The questions I still have
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;For a program whose rules you expect to change, would you have paid for a separate service from day one?&lt;/li&gt;
&lt;li&gt;When you can't add a column, is a code's shape an acceptable marker, or a debt you'll pay the day someone asks for custom codes?&lt;/li&gt;
&lt;li&gt;Rewards in the payment path or in a cron? We chose a cron, to limit what could break a payment.&lt;/li&gt;
&lt;li&gt;What would make you move it out of the monolith: a number of rules, a second product using it, a team that owns it?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last time a small feature needed half of your monolith, where did you put it?&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>postgres</category>
      <category>discuss</category>
      <category>php</category>
    </item>
  </channel>
</rss>
