<?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: Ops Panel</title>
    <description>The latest articles on DEV Community by Ops Panel (@opspanel_dev).</description>
    <link>https://dev.to/opspanel_dev</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%2F4239772%2F475000cf-dd7e-4bd1-8a16-b5d6e93dabcd.png</url>
      <title>DEV Community: Ops Panel</title>
      <link>https://dev.to/opspanel_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/opspanel_dev"/>
    <language>en</language>
    <item>
      <title>I let AI agents ship to production for two months. Here are the five guardrails that survived</title>
      <dc:creator>Ops Panel</dc:creator>
      <pubDate>Sat, 21 Nov 2026 05:32:29 +0000</pubDate>
      <link>https://dev.to/opspanel_dev/i-let-ai-agents-ship-to-production-for-two-months-here-are-the-five-guardrails-that-survived-1bj0</link>
      <guid>https://dev.to/opspanel_dev/i-let-ai-agents-ship-to-production-for-two-months-here-are-the-five-guardrails-that-survived-1bj0</guid>
      <description>&lt;p&gt;I run a small business on a dashboard I wrote myself. It runs on a PC in my room — no server bill, no managed database — and an AI agent edits it almost every day.&lt;/p&gt;

&lt;p&gt;That setup broke in interesting ways. Every guardrail below exists because something went wrong first. After two months, these five are the ones I would put in on day one if I started again.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Split "deciding" from "touching"
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/lib/tasks-core.ts     decides. pure functions, no fs, no fetch, no clock
src/lib/store.ts          touches. reads and writes files
src/app/api/tasks/route.ts  connects the two
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A pure function takes the current time as an argument instead of calling &lt;code&gt;Date.now()&lt;/code&gt;. That sounds like a style preference until you hand the code to an agent.&lt;/p&gt;

&lt;p&gt;Two things change:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tests stop needing setup.&lt;/strong&gt; No mocks, no temp directories — a decision function is called with values and checked against values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can scope what the agent sees.&lt;/strong&gt; "Fix this decision function" is a much smaller blast radius than "fix this file that also writes to disk and calls three APIs". Most of my accidents stopped happening when the file an agent opened could not delete anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. JSON files are fine as a database — if you handle three failure modes
&lt;/h2&gt;

&lt;p&gt;I never set up Postgres for this. At my size, running it is the work. Files you can read with your eyes, diff in git and fix by hand are worth more than query features I do not use.&lt;/p&gt;

&lt;p&gt;But three things will bite you:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A half-written file after a crash.&lt;/strong&gt; Write to a temp path, then &lt;code&gt;rename&lt;/code&gt;. Rename is atomic: the file is either the old content or the new one, never a truncated mix.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;tmp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${file}.tmp-${process.pid}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"utf8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file&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;&lt;strong&gt;Unreadable JSON taking the screen down.&lt;/strong&gt; Never throw on read. Return the fallback and let the page render with one row missing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"utf8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&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;fallback&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;&lt;strong&gt;Losing the data to a git mistake.&lt;/strong&gt; What a bad command destroys is never the code — it is the data you accumulated. Copy it &lt;strong&gt;outside the repository&lt;/strong&gt; on a schedule, keeping generations.&lt;/p&gt;

&lt;p&gt;That last one is not theoretical. A deploy script an agent wrote created a worktree, symlinked &lt;code&gt;node_modules&lt;/code&gt; into it, and cleaned up with &lt;code&gt;git worktree remove --force&lt;/code&gt;. Git for Windows follows junctions and deletes recursively, so it emptied the &lt;strong&gt;main&lt;/strong&gt; checkout's &lt;code&gt;node_modules&lt;/code&gt;. Recovery took 13 seconds (&lt;code&gt;pnpm install --frozen-lockfile&lt;/code&gt;) only because the lockfile was committed. If that cleanup had pointed at my data directory, 13 seconds would have been 13 days.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. One approval path, not two
&lt;/h2&gt;

&lt;p&gt;Approvals arrive from two places here: a button on the dashboard, and a reply in a chat app. For a while each had its own logic. Then the chat path kept a rule the button had dropped, and the two disagreed about what "no answer" meant.&lt;/p&gt;

&lt;p&gt;Both go through one pure function now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;nextAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Approval&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ApprovalConfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nowMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Next&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"wait"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;untilMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decision&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"human"&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decision&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"ng"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"skip"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"human"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;deadline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;askedMs&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;waitMin&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nowMs&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"wait"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;untilMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;deadline&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="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;silentDefault&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"publish"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"silent"&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="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"skip"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"silent"&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;Two entry points with two sets of rules means one of them is quietly out of date. You will not find out from a test. You will find out from the behaviour that surprised you.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Decide in advance what happens when nobody answers
&lt;/h2&gt;

&lt;p&gt;This is the line that made the automation actually usable.&lt;/p&gt;

&lt;p&gt;An approval that waits forever is an automation that stops getting used, because you are not watching most of the time. So every approval carries a wait window and a default:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reversible things (publishing a draft): no answer → &lt;strong&gt;do it&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;things that move money or leave the building: no answer → &lt;strong&gt;skip it&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The distinction I settled on is not "important vs unimportant". It is &lt;strong&gt;can I undo this myself in a minute&lt;/strong&gt;. If yes, let it run. If no, make it undoable first, then let it run.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Only what passes the gate ships
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;types → tests → build → swap the running app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing swaps unless all three pass. Before this existed, I read diffs. I am slower and less consistent than &lt;code&gt;tsc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There is one more line, and it is in the file I hand to the agent:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If it fails, fix it. If you cannot, &lt;strong&gt;report the failure as it is and stop&lt;/strong&gt;. Do not claim success.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I added it after being told a build was done when it was failing. Models will narrate progress if nothing contradicts them. A gate contradicts them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The thing I did not expect
&lt;/h2&gt;

&lt;p&gt;I assumed the hard part of AI-assisted work would be code quality. It was not. The code was mostly fine.&lt;/p&gt;

&lt;p&gt;The hard part was &lt;strong&gt;the gap between "the draft is ready" and "it is live"&lt;/strong&gt; — the two minutes of copying, checking and clicking that I did by hand. The agent made the long part short and left the annoying part untouched, so finished work piled up unpublished for a month.&lt;/p&gt;

&lt;p&gt;What fixed it was not a better prompt. It was treating publication as part of the loop, with an approval step and a default action attached.&lt;/p&gt;




&lt;p&gt;If you want the skeleton rather than the story, I packaged the parts that are not specific to my business — the decision/IO split, the JSON store with those three guards, the approval logic, the backup and gate scripts, the Windows Task Scheduler registration, and the rules file I hand to the agent. Tests included, runs in 15 minutes.&lt;/p&gt;

&lt;p&gt;Happy to answer anything in the comments — especially if you have hit a different failure mode. I would rather add a sixth guardrail from your accident than from mine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Want this for your own shop or company?
&lt;/h2&gt;

&lt;p&gt;The ops panel in this post connects to a POS, rolls up sales, food cost, labour and ordering, and pushes a summary to my phone every morning. It runs every day for two restaurants overseas.&lt;/p&gt;

&lt;p&gt;How it works, and what it costs: &lt;a href="https://opspanel-ai.github.io/ops-panel/?lang=en&amp;amp;utm_source=devto" rel="noopener noreferrer"&gt;https://opspanel-ai.github.io/ops-panel/?lang=en&amp;amp;utm_source=devto&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>typescript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Five ways my coding agents broke the deploy, and the guardrails that stuck</title>
      <dc:creator>Ops Panel</dc:creator>
      <pubDate>Sat, 14 Nov 2026 05:03:01 +0000</pubDate>
      <link>https://dev.to/opspanel_dev/five-ways-my-coding-agents-broke-the-deploy-and-the-guardrails-that-stuck-4n31</link>
      <guid>https://dev.to/opspanel_dev/five-ways-my-coding-agents-broke-the-deploy-and-the-guardrails-that-stuck-4n31</guid>
      <description>&lt;p&gt;I let coding agents ship to my own production — a small internal ops app I use every day. They write code, run the gates, and deploy. It mostly works, and I would not go back.&lt;/p&gt;

&lt;p&gt;But the failures are not the ones I expected. None of them were "the AI wrote bad code." They were all about &lt;strong&gt;concurrency, state, and who is holding what&lt;/strong&gt;. Here are five that actually happened, with the guardrail that fixed each.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A deploy stamped a commit it never built
&lt;/h2&gt;

&lt;p&gt;The deploy script finished with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rev-parse HEAD &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .next-deploy-sha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The intent: record what is running, so the next deploy can skip a rebuild if nothing changed.&lt;/p&gt;

&lt;p&gt;The bug: a build takes 3–4 minutes. If another agent commits &lt;strong&gt;during&lt;/strong&gt; the build, &lt;code&gt;HEAD&lt;/code&gt; has moved by the time you write the stamp. You record a sha you never built. The next deploy sees &lt;code&gt;stamp == HEAD&lt;/code&gt;, says "already running this sha," and exits in two seconds — and that commit is &lt;strong&gt;never built, ever&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Symptom: "the deploy succeeded but the new feature isn't there / the new endpoint 404s." I lost a whole feature to this before I understood it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardrail:&lt;/strong&gt; capture the sha at the &lt;em&gt;start&lt;/em&gt; and write that one.&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="nv"&gt;HEAD_SHA&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(git rev-parse HEAD)"&lt;/span&gt;   &lt;span class="c"&gt;# at the top&lt;/span&gt;
&lt;span class="c"&gt;# ... build ...&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"$HEAD_SHA"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .next-deploy-sha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The general rule: &lt;strong&gt;a stamp must describe the input you used, not the state of the world when you finished.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;git add -A&lt;/code&gt; swallowed another agent's half-finished work
&lt;/h2&gt;

&lt;p&gt;Two agents, one working tree. I committed "my" change with &lt;code&gt;git add -A src tests&lt;/code&gt; and pulled in 153 files from an in-progress refactor. The gates failed twice (an untracked script, then a dozen lint errors), and for a while nobody could deploy.&lt;/p&gt;

&lt;p&gt;Recovery is easy if you know it — &lt;code&gt;git reset --soft &amp;lt;your previous commit&amp;gt;&lt;/code&gt; then &lt;code&gt;git reset&lt;/code&gt;, and re-add your files individually. The working tree is untouched, so the other agent loses nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardrail:&lt;/strong&gt; in a repo where more than one agent works, &lt;code&gt;git add -A&lt;/code&gt; and &lt;code&gt;git add &amp;lt;dir&amp;gt;&lt;/code&gt; are banned. List files explicitly. It feels tedious for about a day and then it feels normal.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. One agent's lint error blocked everyone's deploy
&lt;/h2&gt;

&lt;p&gt;A deploy failed on a gate that had nothing to do with my change: 156 untranslated UI strings from a &lt;em&gt;different&lt;/em&gt; feature, already on &lt;code&gt;HEAD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is what a repo-wide gate does. It is not "your change is bad," it is &lt;strong&gt;the repository is un-deployable until someone fixes an unrelated thing&lt;/strong&gt;. With one human that is a nuisance. With several agents shipping in parallel it is a traffic jam, and the agent that hits it usually has no idea why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardrail:&lt;/strong&gt; two parts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make the gate runnable per-feature so it can be cleared &lt;em&gt;before&lt;/em&gt; committing (&lt;code&gt;node scripts/i18n-scan.mts MyNewView&lt;/code&gt; must print 0).&lt;/li&gt;
&lt;li&gt;When you hit someone else's gate failure, fix it rather than route around it. Routing around means disabling the gate, and then it protects nothing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Builds queued behind a lock nobody owned
&lt;/h2&gt;

&lt;p&gt;One deploy at a time, enforced with a lock directory. Two failure modes showed up within a week:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A deploy killed mid-flight (PC reboot, process reaper) leaves the lock behind. Every later deploy aborts. I found a three-day-old lock blocking everything.&lt;/li&gt;
&lt;li&gt;A trivial change (one JSON data file, no commit) still took 16 minutes, because it waited on someone else's build and then rebuilt the identical sha.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Guardrail:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Take over a stale lock.&lt;/strong&gt; A deploy takes ~4 minutes, so a lock older than 30 minutes has no live owner. Steal it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wait instead of aborting.&lt;/strong&gt; Polling every 5 seconds up to a cap turns "failed, retry manually" into "slow but finished."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip if the sha is already running&lt;/strong&gt; &lt;em&gt;and&lt;/em&gt; the service answers — now safe, because of guardrail 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. The agent killed itself (twice, in different ways)
&lt;/h2&gt;

&lt;p&gt;My favourite category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-kill A.&lt;/strong&gt; An agent ran the test suite. One test started the real process-manager binary. That manager's startup routine reaps orphaned child processes by reading a PID file — the &lt;em&gt;production&lt;/em&gt; PID file. It dutifully killed every live session, including the agent running the test. Not a crash. Suicide by passing its own test.&lt;/p&gt;

&lt;p&gt;Fix: the PID file records the owning process, the reaper refuses to touch children of a live owner, it never kills its own ancestors, and tests point at a scratch file through an env var.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-kill B.&lt;/strong&gt; The reverse: force-killing a process tree left &lt;code&gt;powershell.exe&lt;/code&gt; children re-parented to the system. They accumulated for a week — &lt;strong&gt;112 orphans, 1.2 GB, 6 hours of CPU&lt;/strong&gt; — until "the PC is slow" became the symptom.&lt;/p&gt;

&lt;p&gt;Fix: write live child PIDs to disk, verify the names at startup, and clean them up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardrail:&lt;/strong&gt; any test that can start a real daemon must be pointed at scratch state by default. And before blaming the model for "the PC is slow," check for processes whose parent is dead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bonus failure: nobody noticed it was broken
&lt;/h2&gt;

&lt;p&gt;Four agent tasks in a row returned "failed, exited 1." The code was fine. The CLI's &lt;strong&gt;OAuth session had expired&lt;/strong&gt;, and every feature that used it — drafts, reports, translations, reviews — failed in its own way with its own unhelpful message.&lt;/p&gt;

&lt;p&gt;This is the real hazard of autonomy: &lt;strong&gt;silent, correlated failure&lt;/strong&gt;. Nothing crashed. The dashboard looked normal. Work just stopped happening.&lt;/p&gt;

&lt;p&gt;Now there is an explicit check before accepting any agent job, a banner with a re-login button, and the failure hint names the cause. Same for browser sessions: a job every two hours actually opens the site and confirms the session is alive, instead of checking that a profile directory exists. A directory exists long after a session dies — the panel said "ready" for days while nothing was being posted.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself at the start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The risk is not bad code. The gates catch bad code. The risk is &lt;strong&gt;shared mutable state&lt;/strong&gt;: one tree, one lock, one PID file, one browser profile.&lt;/li&gt;
&lt;li&gt;Every stamp, lock, and cache needs an answer to "what if the owner died?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify liveness, not the existence of an artifact.&lt;/strong&gt; A file, a folder, or a running process name is not proof that the thing works.&lt;/li&gt;
&lt;li&gt;Make failures loud and &lt;em&gt;correlated-aware&lt;/em&gt;. If six features stopped at once, the shared dependency is the bug — say so in the message.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this is AI-specific. Agents just removed the human who used to be sitting between the mistake and the &lt;code&gt;--force&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Want this for your own shop or company?
&lt;/h2&gt;

&lt;p&gt;The ops panel in this post connects to a POS, rolls up sales, food cost, labour and ordering, and pushes a summary to my phone every morning. It runs every day for two restaurants overseas.&lt;/p&gt;

&lt;p&gt;If you want to know how far this would go in your own business, leave a comment and I will walk you through the setup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>git</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Reaching a home-PC dashboard from my phone with Tailscale: three wrong turns</title>
      <dc:creator>Ops Panel</dc:creator>
      <pubDate>Thu, 12 Nov 2026 20:30:18 +0000</pubDate>
      <link>https://dev.to/opspanel_dev/reaching-a-home-pc-dashboard-from-my-phone-with-tailscale-three-wrong-turns-3g0c</link>
      <guid>https://dev.to/opspanel_dev/reaching-a-home-pc-dashboard-from-my-phone-with-tailscale-three-wrong-turns-3g0c</guid>
      <description>&lt;p&gt;I run an internal ops dashboard on a Windows PC at home. It binds to &lt;code&gt;127.0.0.1&lt;/code&gt; only and is never exposed to the internet. I wanted to open it from my phone while out.&lt;/p&gt;

&lt;p&gt;Tailscale is the obvious answer, and the happy path took ten minutes. Then I spent two days on three wrong turns that are worth writing down, because two of them were &lt;strong&gt;security holes&lt;/strong&gt; and one was a DNS failure that looks like a server failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  The happy path
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tailscale serve --bg --http=80 http://127.0.0.1:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That publishes the local app to the tailnet at &lt;code&gt;http://myhost.&amp;lt;your-tailnet&amp;gt;.ts.net/&lt;/code&gt;. Encrypted over WireGuard, reachable only by devices in my tailnet, nothing on the public internet. &lt;code&gt;serve&lt;/code&gt; config persists across reboots.&lt;/p&gt;

&lt;p&gt;One thing to handle on the app side: most frameworks reject requests whose &lt;code&gt;Host&lt;/code&gt; header they don't recognise. I keep an allow-list in env (&lt;code&gt;ALLOWED_HOSTS=myhost.&amp;lt;your-tailnet&amp;gt;.ts.net,myhost&lt;/code&gt;) and read it at boot — so &lt;strong&gt;changing it means restarting the app&lt;/strong&gt;, which cost me twenty minutes of confusion once.&lt;/p&gt;

&lt;p&gt;If you only need "my devices can reach my app," stop here. The rest of this post is what happens when you add anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrong turn 1: one &lt;code&gt;funnel&lt;/code&gt; made the whole host public
&lt;/h2&gt;

&lt;p&gt;I wanted an external service to reach exactly one endpoint, so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tailscale funnel --bg --https=443 --set-path=/api/mcp http://127.0.0.1:3000/api/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works. It also does something I did not think about: &lt;strong&gt;the host now has public DNS and a real certificate.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next morning the dashboard was "broken" on my phone. Safari auto-upgraded &lt;code&gt;http://myhost.&amp;lt;your-tailnet&amp;gt;.ts.net/&lt;/code&gt; to &lt;code&gt;https://&lt;/code&gt;, the upgrade now &lt;em&gt;succeeded&lt;/em&gt; because the host resolves publicly, and port 443 only serves &lt;code&gt;/api/mcp&lt;/code&gt; — so the root returned &lt;strong&gt;404&lt;/strong&gt;. The app was fine the whole time (&lt;code&gt;127.0.0.1:3000&lt;/code&gt; → 200, tailnet &lt;code&gt;:80&lt;/code&gt; → 200).&lt;/p&gt;

&lt;p&gt;The dangerous part is what I nearly did next: "just add &lt;code&gt;/&lt;/code&gt; to the funnel too."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not.&lt;/strong&gt; Two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;funnel&lt;/code&gt; publishes &lt;strong&gt;per port&lt;/strong&gt;. Adding &lt;code&gt;/&lt;/code&gt; to 443 puts the entire app on the public internet.&lt;/li&gt;
&lt;li&gt;Funnel requests &lt;strong&gt;do not carry the &lt;code&gt;Tailscale-User-Login&lt;/code&gt; header&lt;/strong&gt;. If your authorization treats "no user header" as "local request, therefore owner" — mine did — every feature opens with no authentication at all.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That second one is the real lesson. My role check was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// header present  -&amp;gt; that user (guest unless it matches the owner)&lt;/span&gt;
&lt;span class="c1"&gt;// header absent   -&amp;gt; loopback, i.e. me&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perfectly reasonable when the only header-less requests come from &lt;code&gt;127.0.0.1&lt;/code&gt;. Completely wrong the moment a public ingress also produces header-less requests. &lt;strong&gt;An ingress that strips identity turns a "trusted by default" branch into an open door.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you expose anything through &lt;code&gt;funnel&lt;/code&gt;, scope the authorization to the path you exposed, and assume the request is anonymous.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrong turn 2: a port the public DNS doesn't know about
&lt;/h2&gt;

&lt;p&gt;To undo the mess I moved the dashboard to a tailnet-only HTTPS port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tailscale serve --bg --https=8443 --set-path=/ http://127.0.0.1:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the PC: fine. On the phone: &lt;strong&gt;"Server not found."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It looks like the server is down. It isn't — the &lt;em&gt;name&lt;/em&gt; isn't resolving the way I assumed. If the phone's query doesn't go through MagicDNS and lands on public DNS instead (which now exists, thanks to wrong turn 1), it resolves to the funnel ingress — and that ingress only has &lt;strong&gt;443&lt;/strong&gt;. Port 8443 simply isn't there.&lt;/p&gt;

&lt;p&gt;So the failure mode is: name resolves, wrong target, no listener on your port, browser says "server not found," and you go looking at the server.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually worked: a raw TCP forward, addressed by IP
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tailscale serve --bg --tcp=3001 tcp://127.0.0.1:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the phone opens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://100.x.y.z:3001/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the node's tailnet IP. A raw TCP forward doesn't look at &lt;code&gt;Host&lt;/code&gt;, so &lt;strong&gt;there is no name to resolve&lt;/strong&gt; — no MagicDNS, no public DNS, no HTTPS auto-upgrade. It is the one entry point that cannot be broken by a DNS detour. I added it to the phone's home screen; the web manifest uses relative paths, so it still installs as a PWA.&lt;/p&gt;

&lt;p&gt;Two things to know before you copy this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the &lt;strong&gt;IP literal&lt;/strong&gt; to your app's allowed-hosts list — both v4 and the bracketed IPv6 form (&lt;code&gt;[fd7a:...]&lt;/code&gt;). Then restart the app.&lt;/li&gt;
&lt;li&gt;A raw TCP forward also has &lt;strong&gt;no &lt;code&gt;Tailscale-User-Login&lt;/code&gt; header&lt;/strong&gt;, so it hits the same "treated as owner" branch as the funnel. The difference is who can reach it: only tailnet peers. That is only safe while your &lt;strong&gt;ACLs&lt;/strong&gt; actually restrict those peers. I have a friend's machine in the tailnet limited to two ports; the day I relax that ACL, this port has to close.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A debugging trick worth keeping
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://100.x.y.z/     -&amp;gt;  404 page not found   (from tailscaled itself)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That 404 is &lt;strong&gt;proof the VPN tunnel is alive&lt;/strong&gt;, independent of your app, your DNS, and your reverse proxy. When the phone says something is unreachable, this one request splits the problem in half: get the 404 and the network is fine, so look at the app or the Host header; get nothing and it is the tunnel or the ACL.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape of all three mistakes
&lt;/h2&gt;

&lt;p&gt;Every one came from the same place: I reasoned about the &lt;em&gt;transport&lt;/em&gt; and forgot that &lt;strong&gt;the transport decides what identity information arrives&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;serve&lt;/code&gt; inside the tailnet → requests carry &lt;code&gt;Tailscale-User-Login&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;funnel&lt;/code&gt; from the public internet → &lt;strong&gt;no identity&lt;/strong&gt;, and anyone can reach it&lt;/li&gt;
&lt;li&gt;raw TCP → &lt;strong&gt;no identity&lt;/strong&gt;, and tailnet peers can reach it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your authorization has a "no identity means it's me" branch — and a lot of self-hosted setups do, because they started on &lt;code&gt;127.0.0.1&lt;/code&gt; — then adding any new path into the box silently promotes strangers to you.&lt;/p&gt;

&lt;p&gt;The fix is not clever: make "no identity" mean &lt;em&gt;guest&lt;/em&gt;, and grant owner explicitly. I'd rather lock myself out once than find out the other way.&lt;/p&gt;




&lt;h2&gt;
  
  
  Want this for your own shop or company?
&lt;/h2&gt;

&lt;p&gt;The ops panel in this post connects to a POS, rolls up sales, food cost, labour and ordering, and pushes a summary to my phone every morning. It runs every day for two restaurants overseas.&lt;/p&gt;

&lt;p&gt;If you want to know how far this would go in your own business, leave a comment and I will walk you through the setup.&lt;/p&gt;

</description>
      <category>tailscale</category>
      <category>selfhosted</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>git worktree remove --force emptied my main node_modules (Windows junctions)</title>
      <dc:creator>Ops Panel</dc:creator>
      <pubDate>Wed, 11 Nov 2026 20:54:07 +0000</pubDate>
      <link>https://dev.to/opspanel_dev/git-worktree-remove-force-emptied-my-main-nodemodules-windows-junctions-4fm1</link>
      <guid>https://dev.to/opspanel_dev/git-worktree-remove-force-emptied-my-main-nodemodules-windows-junctions-4fm1</guid>
      <description>&lt;p&gt;I let an AI agent build a deploy script for my own ops panel. The script created a &lt;code&gt;git worktree&lt;/code&gt;, built there, then cleaned up with &lt;code&gt;git worktree remove --force&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After the cleanup, the &lt;strong&gt;main&lt;/strong&gt; checkout's &lt;code&gt;node_modules&lt;/code&gt; was empty. Not the worktree's. The main one.&lt;/p&gt;

&lt;p&gt;Here is what actually happened, why recovery took 13 seconds, and the thing that scared me more than the outage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup that caused it
&lt;/h2&gt;

&lt;p&gt;The idea was reasonable: give the agent a scratch copy of the repo so it never touches the working tree I'm using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;repo/                 &amp;lt;- main checkout
repo-build/           &amp;lt;- git worktree, created per deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;node_modules&lt;/code&gt; is big and slow to install, so the script made the worktree's &lt;code&gt;node_modules&lt;/code&gt; a &lt;strong&gt;junction&lt;/strong&gt; pointing at the main one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mklink /J repo-build\node_modules repo\node_modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A junction is the NTFS equivalent of a directory symlink. "The contents of this folder actually live over there."&lt;/p&gt;

&lt;p&gt;Then, at the end of the deploy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree remove --force repo-build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The finding: Git for Windows walks into junctions
&lt;/h2&gt;

&lt;p&gt;I reproduced it deliberately, because an accident you can't reproduce is a rumour.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Git for Windows treats a junction as an ordinary directory and deletes its contents recursively.&lt;/strong&gt; It follows the link and removes the files on the other side — in the main checkout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;rmdir&lt;/code&gt; in cmd does not follow it.&lt;/strong&gt; It removes the link itself and leaves the target alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same apparent operation ("delete this folder"), opposite blast radius, depending on which tool does the deleting. &lt;code&gt;--force&lt;/code&gt; meant no prompt and no warning on the way through.&lt;/p&gt;

&lt;p&gt;If you take one thing from this post: &lt;strong&gt;do not create a link from a place that gets deleted to a place that matters.&lt;/strong&gt; Junctions, directory symlinks, bind mounts — the rule is the same. The link is not the only thing a cleanup routine will remove.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recovery was boring, and that was the point
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm install --frozen-lockfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;13 seconds. Done.&lt;/p&gt;

&lt;p&gt;It was fast because the &lt;strong&gt;lockfile was committed&lt;/strong&gt;. &lt;code&gt;node_modules&lt;/code&gt; is not data; it is a &lt;em&gt;build artifact&lt;/em&gt; with an exact recipe sitting in the repo. &lt;code&gt;--frozen-lockfile&lt;/code&gt; reinstalls precisely what the recipe says, or fails loudly.&lt;/p&gt;

&lt;p&gt;The outage was never the interesting part.&lt;/p&gt;

&lt;h2&gt;
  
  
  The interesting part: what if the junction had pointed at &lt;code&gt;data/&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;My panel keeps &lt;strong&gt;all of its business data as JSON files on local disk&lt;/strong&gt;. No database server. Orders, daily records, customer messages, configuration — files.&lt;/p&gt;

&lt;p&gt;And those files lived &lt;strong&gt;inside the same repository&lt;/strong&gt; the agent was creating and destroying worktrees in.&lt;/p&gt;

&lt;p&gt;The accident drew a line I had never drawn explicitly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;th&gt;If deleted&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Reproducible&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;node_modules&lt;/code&gt;, build output, caches&lt;/td&gt;
&lt;td&gt;One command, with a lockfile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not reproducible&lt;/td&gt;
&lt;td&gt;business JSON, hand-written config&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No way back&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I had been protecting the first category (lockfile committed, good) and doing nothing at all for the second.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  1. Backups go &lt;em&gt;outside&lt;/em&gt; the repository
&lt;/h3&gt;

&lt;p&gt;Every 30 minutes, the durable JSON is copied to a timestamped directory &lt;strong&gt;outside the project tree&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%LOCALAPPDATA%\&amp;lt;app&amp;gt;\backups\data-YYYYMMDD-HHMMSS\
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Outside" matters more than "every 30 minutes." The lesson of the incident is that &lt;strong&gt;a deletion inside the repo can reach anything inside the repo&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;worktree cleanup&lt;/li&gt;
&lt;li&gt;an agent's own tidy-up command&lt;/li&gt;
&lt;li&gt;any deploy step that does "remove the folder, then recreate it"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;code&gt;backup/&lt;/code&gt; folder inside the project is not a backup. It dies with everything else.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The copy is crash-safe and bounded
&lt;/h3&gt;

&lt;p&gt;Two details that are easy to skip and annoying to discover later:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write to a temp directory, then rename.&lt;/strong&gt; If the process dies mid-copy you get no snapshot rather than half a snapshot. Rename is atomic; a directory full of partially written JSON is not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep N and prune.&lt;/strong&gt; Every 30 minutes is 48 directories a day. Decide the retention (I keep the last 24 ≈ 12 hours) and delete the rest, or you will find out when the disk fills.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also: &lt;strong&gt;exclude the churn.&lt;/strong&gt; Heartbeats, &lt;code&gt;*.pid&lt;/code&gt;, lock files, cached market data I can refetch in seconds — none of it belongs in a snapshot. One of my caches was 70 MB and turned 24 snapshots into 1.7 GB before I noticed.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Restore once, on purpose
&lt;/h3&gt;

&lt;p&gt;A backup you have never restored is a hypothesis. Stop the app, copy a snapshot back over &lt;code&gt;data/&lt;/code&gt;, start it, confirm the screens are right. Until you do that, you have a directory of files, not a backup.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. No junctions in worktrees
&lt;/h3&gt;

&lt;p&gt;Each worktree now runs its own &lt;code&gt;pnpm install --frozen-lockfile&lt;/code&gt; and owns its &lt;code&gt;node_modules&lt;/code&gt;. The sharing was meant to save install time; the lockfile already made install fast. Trading tens of seconds for "a cleanup can reach into main" was a bad deal.&lt;/p&gt;

&lt;p&gt;(Separately, Turbopack rejects a &lt;code&gt;node_modules&lt;/code&gt; symlink pointing outside the project anyway, so the clever version was never going to survive.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this bites harder with agents
&lt;/h2&gt;

&lt;p&gt;When you hand work to an agent, directories get created and destroyed while you are not watching. The commands are usually fine in isolation. What changes is that &lt;strong&gt;nobody is reading the &lt;code&gt;--force&lt;/code&gt; before it runs&lt;/strong&gt;, and the blast radius of a wrong assumption is no longer bounded by your attention.&lt;/p&gt;

&lt;p&gt;So the defence is structural, not behavioural:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reproducible things are protected by a &lt;strong&gt;committed lockfile&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Non-reproducible things are copied &lt;strong&gt;outside the agent's reach&lt;/strong&gt;, automatically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No links from deletable places to important places.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this needs a tool. It is "put it in a different folder and copy it on a timer." I just wasn't doing it until something ate a directory in front of me.&lt;/p&gt;

&lt;p&gt;If you are running agents against a repo that also holds your real data: go look at where that data lives, and ask how you would get it back. That question took me 13 seconds to answer for &lt;code&gt;node_modules&lt;/code&gt; and uncomfortably long to answer for everything else.&lt;/p&gt;




&lt;h2&gt;
  
  
  Want this for your own shop or company?
&lt;/h2&gt;

&lt;p&gt;The ops panel in this post connects to a POS, rolls up sales, food cost, labour and ordering, and pushes a summary to my phone every morning. It runs every day for two restaurants overseas.&lt;/p&gt;

&lt;p&gt;If you want to know how far this would go in your own business, leave a comment and I will walk you through the setup.&lt;/p&gt;

</description>
      <category>git</category>
      <category>windows</category>
      <category>devops</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
