<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Code is cheap, let&#39;s talk</title>
    <link>https://blog.ferstar.org/en/</link>
    <description>Code is cheap, let&#39;s talk</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>© 2026 ferstar · [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</copyright>
    <lastBuildDate>Wed, 28 Oct 2026 21:15:00 +0800</lastBuildDate>
    <ttl>60</ttl><atom:link href="https://blog.ferstar.org/en/index.xml" rel="self" type="application/rss+xml" /><image>
      <url>https://blog.ferstar.org/site-logo.png</url>
      <title>Code is cheap, let&#39;s talk</title>
      <link>https://blog.ferstar.org/</link>
    </image>
    
    <item>
      <title>Strata 0.2.7.1 on GB10 Benchmark and SPEC_COST Ablation</title>
      <link>https://blog.ferstar.org/en/posts/strata-gb10-sm121-benchmark-optimization/</link>
      <pubDate>Wed, 28 Oct 2026 21:15:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/strata-gb10-sm121-benchmark-optimization/</guid>
      <description>Upgraded to Strata 0.2.7.1 on GB10 to evaluate prefill and decode performance, using ABBA ablation testing to verify the actual latency impact of the SPEC_COST switch.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Previously, I ran Strata on the <a href="/en/posts/dgx-spark-agent-inference/" >DGX Spark</a>. The machine features an ARM64-based GB10 with CUDA compute capability <code>sm_121</code>. To get Strata running on ARM64, I submitted <a href="https://github.com/Niko1221/Strata/pull/3622"  target="_blank" rel="noreferrer">PR #3622</a>. In the merge commit, the maintainer noted that without physical ARM hardware on hand, the memory ordering was derived logically (<em>“Memory ordering on ARM is reasoned, not run”</em>). Testing on actual silicon, I verified the multi-threaded speculative verification with <code>dmb ishld</code> memory barriers across <code>--spec 2</code> and <code>--spec 4</code> windows, confirming byte-identical output consistency.</p>
<p>The maintainer quickly followed up with <code>v0.2.7.1</code>, bringing the underlying engine to a newer release. This tag directly provided official Linux ARM64 prebuilt archives (<code>strata-engine-linux-aarch64-cuda-cuda13.tar.gz</code>), added <code>docs/DGX_SPARK_LINUX.md</code>, and enabled four optimizations by default for <code>sm_121</code>:</p>
<ul>
<li><code>STRATA_PF_FUSED</code>: Operator fusion during prefill</li>
<li><code>STRATA_PREFILL_NVFP4</code>: NVFP4 prefill targeting Blackwell architectures</li>
<li><code>STRATA_HC_UPMIX</code>: Mixed-precision channel up-mixing</li>
<li><code>STRATA_SPEC_COST</code>: Dynamic adjustment of speculative verification windows based on runtime cost and acceptance rate</li>
</ul>
<p>The upstream release notes mentioned roughly a 1.20x–1.24x prefill speedup on the Spark. With the package published, I pulled it onto the machine to run an A/B benchmark.</p>

<h2 class="relative group">Benchmark Setup
    <div id="benchmark-setup" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#benchmark-setup" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The runtime configuration remained identical: 262K context, INT8 KV cache, MTP, spec4, mmap experts, with all 24,576 experts resident in unified memory and no prompt cache.</p>
<p>To avoid cold-start discrepancies skewing the results, the tests followed a cross-validation sequence:</p>
<p>Legacy → Intermediate → New engine (with sm_121 optimizations disabled) → New engine with defaults → restart and reverse order.</p>
<p>Short requests used two warmups followed by three formal requests, confirming token output consistency. Long prompts were evaluated at 4K (4,099 tokens actual) and 16K (16,387 tokens actual).</p>
<table>
  <thead>
      <tr>
          <th>Version and Config</th>
          <th style="text-align: right">Short Decode Median</th>
          <th style="text-align: right">4K Prompt Median</th>
          <th style="text-align: right">16K Prompt Median</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>0.1.47</td>
          <td style="text-align: right">8260 ms</td>
          <td style="text-align: right">2924 ms</td>
          <td style="text-align: right">12474 ms</td>
      </tr>
      <tr>
          <td>0.1.52</td>
          <td style="text-align: right">8130 ms</td>
          <td style="text-align: right">2873 ms</td>
          <td style="text-align: right">12451 ms</td>
      </tr>
      <tr>
          <td>0.1.53, <code>STRATA_SM121_PERF=0</code></td>
          <td style="text-align: right">8179 ms</td>
          <td style="text-align: right">2822 ms</td>
          <td style="text-align: right">10190 ms</td>
      </tr>
      <tr>
          <td>0.1.53, defaults enabled</td>
          <td style="text-align: right">8736 ms</td>
          <td style="text-align: right">2364 ms</td>
          <td style="text-align: right">10192 ms</td>
      </tr>
  </tbody>
</table>
<p>The actual results showed two trends:</p>
<p>First, prefill was noticeably faster. Latency on 4K prompts dropped by nearly 20%, matching the 1.20x claim. At 16K, toggling hardware optimizations inside the new engine made little difference, but it was still over two seconds faster than the older builds.</p>
<p>Second, decode showed the opposite trend: short decode under default settings on the new engine ran a few hundred milliseconds slower than with optimizations disabled.</p>

<h2 class="relative group">Testing SPEC_COST with ABBA
    <div id="testing-spec_cost-with-abba" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#testing-spec_cost-with-abba" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The decode slowdown naturally draws attention to <code>STRATA_SPEC_COST</code>, as it directly manages speculative window adjustment. Looking at a single benchmark run, it is easy to assume that the extra overhead slowed down generation.</p>
<p>On real hardware, however, variance across process starts can be considerable. To determine whether this switch caused the regression, I kept the identical binary and memory layout, toggling only <code>STRATA_SPEC_COST=0</code> across four independent processes in an <strong>ABBA sequence (Default → Off → Off → Default)</strong>:</p>
<table>
  <thead>
      <tr>
          <th>Process</th>
          <th>Config</th>
          <th style="text-align: right">Short Decode Median</th>
          <th style="text-align: right">4K Prompt</th>
          <th style="text-align: right">16K Prompt</th>
          <th>Speculative Windows</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Process 1</td>
          <td>Default (on)</td>
          <td style="text-align: right">8359.9 ms</td>
          <td style="text-align: right">2381 ms</td>
          <td style="text-align: right">10309 ms</td>
          <td>201–202</td>
      </tr>
      <tr>
          <td>Process 2</td>
          <td>Cost-off (off)</td>
          <td style="text-align: right">8567.1 ms</td>
          <td style="text-align: right">2322 ms</td>
          <td style="text-align: right">8605 ms</td>
          <td>205 (fixed)</td>
      </tr>
      <tr>
          <td>Process 3</td>
          <td>Cost-off (off)</td>
          <td style="text-align: right">8124.7 ms</td>
          <td style="text-align: right">2296 ms</td>
          <td style="text-align: right">8367 ms</td>
          <td>205 (fixed)</td>
      </tr>
      <tr>
          <td>Process 4</td>
          <td>Default (on)</td>
          <td style="text-align: right">8356.4 ms</td>
          <td style="text-align: right">2279 ms</td>
          <td style="text-align: right">8333 ms</td>
          <td>192–197</td>
      </tr>
  </tbody>
</table>
<p>Log inspection confirmed that the parameter was effective: with cost off, verification windows stayed fixed; with cost on, windows fluctuated dynamically within a range, evaluating more draft candidates.</p>
<p>Looking at decode time, however:</p>
<ul>
<li>From Process 1 to Process 2, disabling cost was about 2.5% slower;</li>
<li>From Process 3 to Process 4, re-enabling cost was also about 2.8% slower.</li>
</ul>

  



<div
  
    class="flex px-4 py-3 rounded-md shadow bg-primary-100 dark:bg-primary-900"
  
  >
  <span
    
      class="text-primary-400 pe-3 flex items-center"
    
    >
    <span class="relative block icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span>
  </span>

  <span
    
      class="dark:text-neutral-300"
    
    >The direction reversed across both pairs. This shows that natural variance across individual process starts (around 200–300 ms) outweighs the effect of the switch itself. The decode slowdown cannot be attributed to <code>SPEC_COST</code>.</span>
</div>

<p>This test eliminated a false hypothesis, preventing an inaccurate upstream report claiming that disabling <code>SPEC_COST</code> fixes decode latency.</p>

<h2 class="relative group">Current Status
    <div id="current-status" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#current-status" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Having ready-made prebuilt packages and documentation for the Spark is very convenient, and all hardware-specific flags can be toggled off via environment variables, making testing straightforward.</p>
<p>The machine continues running the new version. The short decode gap is relatively minor for now, and I will isolate the impact of <code>STRATA_HC_UPMIX</code> and <code>STRATA_PF_FUSED</code> when time permits.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>RTX 4090 D Tensor Unlock: What Can Quantized MoE Inference Gain?</title>
      <link>https://blog.ferstar.org/en/posts/tensor-unlock-quantized-moe/</link>
      <pubDate>Mon, 26 Oct 2026 16:16:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/tensor-unlock-quantized-moe/</guid>
      <description>The 4090 D unlock doubles floating-point Tensor throughput, but quantized MoE inference gains almost nothing. PTX assembly and benchmarks explain why removing floating-point limits cannot solve integer and bandwidth bottlenecks.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>In <a href="/en/posts/rtx4090d-gpu-unlock-strata-benchmark/" >the previous post</a>, I unlocked the RTX 4090 D and measured nearly doubled throughput on certain Tensor GEMM workloads. <a href="https://x.com/ferstar_org/status/2114172808305762327?s=20"  target="_blank" rel="noreferrer">After sharing the results on X</a>, a friend noted: “This probably does little to nothing for quantized MoE inference.”</p>
<p>This card mainly runs Strata with an IQ3_S-quantized Qwen3.8-Flash-Next model. Checking the source and logs against actual compute paths confirms that assessment.</p>

  
  
  
  



<div
  
    class="flex px-4 py-3 rounded-md shadow" style="background-color: #e0f2fe"
  
  >
  <span
    
      class="pe-3 flex items-center" style="color: #0284c7"
    
    >
    <span class="relative block icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M112.1 454.3c0 6.297 1.816 12.44 5.284 17.69l17.14 25.69c5.25 7.875 17.17 14.28 26.64 14.28h61.67c9.438 0 21.36-6.401 26.61-14.28l17.08-25.68c2.938-4.438 5.348-12.37 5.348-17.7L272 415.1h-160L112.1 454.3zM191.4 .0132C89.44 .3257 16 82.97 16 175.1c0 44.38 16.44 84.84 43.56 115.8c16.53 18.84 42.34 58.23 52.22 91.45c.0313 .25 .0938 .5166 .125 .7823h160.2c.0313-.2656 .0938-.5166 .125-.7823c9.875-33.22 35.69-72.61 52.22-91.45C351.6 260.8 368 220.4 368 175.1C368 78.61 288.9-.2837 191.4 .0132zM192 96.01c-44.13 0-80 35.89-80 79.1C112 184.8 104.8 192 96 192S80 184.8 80 176c0-61.76 50.25-111.1 112-111.1c8.844 0 16 7.159 16 16S200.8 96.01 192 96.01z"/></svg>
</span>
  </span>

  <span
    
      style="color: #0369a1"
    
    ><strong>TL;DR</strong>: <strong>Virtually zero gain (fluctuations stay within measurement noise).</strong>
The 4090 D unlock only restores floating-point Tensor rates (FP16/BF16/TF32). Low-bit quantized MoE inference runs predominantly on <strong>INT8/INT32 integer instructions</strong>, where real-world bottlenecks lie in <strong>memory bandwidth, PCIe transfers, and CPU offloading</strong>, rather than floating-point compute.</span>
</div>


<h2 class="relative group">Why Doubled FP Throughput Does Nothing for Quantized MoE
    <div id="why-doubled-fp-throughput-does-nothing-for-quantized-moe" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-doubled-fp-throughput-does-nothing-for-quantized-moe" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">Floating-Point Rates Grew, but Integer Stayed Flat
    <div id="floating-point-rates-grew-but-integer-stayed-flat" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#floating-point-rates-grew-but-integer-stayed-flat" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>First, the controlled benchmark (multiplying square matrices of side 8192 under the same 425 W power limit):</p>
<table>
  <thead>
      <tr>
          <th>GEMM Mode</th>
          <th style="text-align: right">Stock TFLOPS</th>
          <th style="text-align: right">Unlocked TFLOPS</th>
          <th style="text-align: right">Throughput Gain</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>FP16 → FP32</td>
          <td style="text-align: right">152.83</td>
          <td style="text-align: right">195.96</td>
          <td style="text-align: right"><strong>+28.22%</strong></td>
      </tr>
      <tr>
          <td>BF16 → FP32</td>
          <td style="text-align: right">153.81</td>
          <td style="text-align: right">250.97</td>
          <td style="text-align: right"><strong>+63.16%</strong></td>
      </tr>
      <tr>
          <td>TF32</td>
          <td style="text-align: right">76.49</td>
          <td style="text-align: right">145.55</td>
          <td style="text-align: right"><strong>+90.28%</strong></td>
      </tr>
      <tr>
          <td>Regular FP32 Control</td>
          <td style="text-align: right">54.27</td>
          <td style="text-align: right">54.71</td>
          <td style="text-align: right">+0.80%</td>
      </tr>
  </tbody>
</table>
<p>Compute paths taking FP16/BF16 inputs with FP32 accumulation improved significantly. <strong>However: INT8, INT4, and dp4a instruction throughput remained completely identical.</strong></p>

<h3 class="relative group">Strata Expert Kernels Run Pure Integer Instructions
    <div id="strata-expert-kernels-run-pure-integer-instructions" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#strata-expert-kernels-run-pure-integer-instructions" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Despite the large parameter count of MoE models, what instructions actually run when serving an IQ3_S-quantized model?</p>
<p>Examining Strata 0.1.48’s <a href="https://github.com/Niko1221/Strata/blob/5c8dd322528cc84f68f461ad54a506b9da8fa8d4/src/prefill/moe_fused_iq.cu#L163"  target="_blank" rel="noreferrer">quantized-expert prefill kernel</a> source code reveals the direct PTX instruction:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32</span></span></code></pre></div></div>
<p>Here, <code>s8</code> represents signed INT8 inputs, and <code>s32</code> represents INT32 accumulation. This instruction belongs entirely to the <strong>integer execution path that received zero speedup</strong>. While secondary routines (e.g. attention and minor cuBLAS calls) use some BF16 operations, the critical path is dominated by integer arithmetic and dequantization/data unpacking.</p>

<h3 class="relative group">The Bottleneck is Memory Bandwidth and Offloading, Not Compute
    <div id="the-bottleneck-is-memory-bandwidth-and-offloading-not-compute" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-bottleneck-is-memory-bandwidth-and-offloading-not-compute" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The unlock does not grant the 4090 D a single additional byte of memory bandwidth or PCIe bandwidth. Strata keeps a subset of experts in VRAM while offloading the rest to host RAM via CPU computation in an overlapping pipeline. The system is fundamentally bounded by memory bandwidth and data transfers. By Amdahl’s Law, speeding up an operation that occupies a negligible portion of the runtime yields no noticeable overall improvement.</p>

<h2 class="relative group">Benchmark Verification: Does Unlocking Make It Faster?
    <div id="benchmark-verification-does-unlocking-make-it-faster" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#benchmark-verification-does-unlocking-make-it-faster" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">Community Results: Controlled 48GB 4090 Benchmark (0.98x - 0.99x)
    <div id="community-results-controlled-48gb-4090-benchmark-098x---099x" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#community-results-controlled-48gb-4090-benchmark-098x---099x" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>A researcher evaluated this scenario on a hardware-modded 48 GB RTX 4090 running Strata 0.1.47 with IQ3_S under a <a href="https://github.com/JustAResearcher/gpu-unlock-ada/blob/d28c485418c3d9d034cd4bac19200bc33dd3453b/docs/evidence/rtx4090-48g-modded/serving-workload.md"  target="_blank" rel="noreferrer">controlled test</a>:</p>
<table>
  <thead>
      <tr>
          <th>Prefill Scenario</th>
          <th style="text-align: right">Stock tokens/s</th>
          <th style="text-align: right">Unlocked tokens/s</th>
          <th style="text-align: right">Unlocked / Stock Ratio</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>8K Input</td>
          <td style="text-align: right">3518.8</td>
          <td style="text-align: right">3457.8</td>
          <td style="text-align: right"><strong>0.983×</strong></td>
      </tr>
      <tr>
          <td>32K Input</td>
          <td style="text-align: right">3916.6</td>
          <td style="text-align: right">3890.3</td>
          <td style="text-align: right"><strong>0.993×</strong></td>
      </tr>
  </tbody>
</table>
<p>The data is unmistakable: under long-input prefill, performance showed no gain and even fell slightly within noise margins. Generation (decode) throughput similarly fluctuated without measurable advantage.</p>

<h3 class="relative group">Local Serving Window Observation
    <div id="local-serving-window-observation" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#local-serving-window-observation" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>In my local Strata 0.1.48 deployment, monitor snapshots across long operating windows showed comparable patterns:</p>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th style="text-align: right">Unlocked Window (82 reqs)</th>
          <th style="text-align: right">Stock Window (39 reqs)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Generated Tokens</td>
          <td style="text-align: right">60,707</td>
          <td style="text-align: right">25,163</td>
      </tr>
      <tr>
          <td>Weighted Generation Rate (tokens/s)</td>
          <td style="text-align: right">126.34</td>
          <td style="text-align: right">141.14</td>
      </tr>
      <tr>
          <td>Median Generation Rate (tokens/s)</td>
          <td style="text-align: right">130.6</td>
          <td style="text-align: right">142.2</td>
      </tr>
      <tr>
          <td>Weighted Prefill Rate (tokens/s)</td>
          <td style="text-align: right">1775.79</td>
          <td style="text-align: right">2170.54</td>
      </tr>
      <tr>
          <td>Prefix Reuse Ratio</td>
          <td style="text-align: right">94.02%</td>
          <td style="text-align: right">82.87%</td>
      </tr>
      <tr>
          <td>MTP Draft Acceptance Ratio</td>
          <td style="text-align: right">68.05%</td>
          <td style="text-align: right">72.58%</td>
      </tr>
  </tbody>
</table>

  
  
  
  



<div
  
    class="flex px-4 py-3 rounded-md shadow" style="background-color: #fef3c7"
  
  >
  <span
    
      class="pe-3 flex items-center" style="color: #d97706"
    
    >
    <span class="relative block icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span>
  </span>

  <span
    
      style="color: #b45309"
    
    >Request lengths and cache hit rates vary in natural workloads, so this is not a strictly controlled A/B test. However, it confirms that <strong>the stock-rate setup fully matches or exceeds the unlocked performance level in practice; unlocking delivers no palpable difference.</strong></span>
</div>


<h2 class="relative group">Which Workloads Actually Benefit from Unlocking?
    <div id="which-workloads-actually-benefit-from-unlocking" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#which-workloads-actually-benefit-from-unlocking" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>If quantized MoE inference gains almost nothing, where does the unlocked Tensor power actually pay off?</p>
<ol>
<li><strong>Full / Half-Precision Fine-Tuning and Training (LoRA / SFT)</strong>: Heavy matrix multiplication paths utilizing FP16/BF16 inputs with FP32 accumulation see immediate, significant acceleration.</li>
<li><strong>Diffusion Models for Image/Video Generation (Stable Diffusion / Flux / CogVideoX)</strong>: Denoising backbones rely heavily on dense floating-point GEMM residing entirely within VRAM.</li>
<li><strong>Dense LLM Inference with Native Precision (e.g., BF16) and Large Batches</strong>: Compute-bound rather than memory-bandwidth-bound regimes reap clear rewards.</li>
</ol>

<h2 class="relative group">Stability and Data Archiving
    <div id="stability-and-data-archiving" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#stability-and-data-archiving" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>During prolonged operation, the card encountered an <code>Xid 79: GPU has fallen off the bus</code> event. It also recurred once after reverting to stock rates, indicating the incident was not strictly tied to the unlock state itself, but rather related to power transients, drivers, or custom kernel settings (<code>7.3.0-ros2go-btf</code>). The card is currently running in stable daily service at stock rates.</p>
<p>A dedicated replay script with fixed prompts and aligned cache states has been prepared for future controlled tests. Sanitized raw CSVs and verification scripts are available:</p>
<ul>
<li><a href="/downloads/tensor-unlock-moe/requests.csv" >Sanitized Request-Timing CSV</a></li>
<li><a href="/downloads/tensor-unlock-moe/summary.json" >Summary and Measurement Notes JSON</a></li>
<li><a href="/downloads/tensor-unlock-moe/verify.py" >Offline Verification Script verify.py</a></li>
<li><a href="/downloads/tensor-unlock-moe/README.md" >Download Notes and Checksums</a></li>
</ul>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>RTX 4090 D Unlock Measurements: Doubled Tensor Throughput and a Strata Retest</title>
      <link>https://blog.ferstar.org/en/posts/rtx4090d-gpu-unlock-strata-benchmark/</link>
      <pubDate>Sun, 25 Oct 2026 08:30:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/rtx4090d-gpu-unlock-strata-benchmark/</guid>
      <description>The experiment&#39;s baseline lacked RTX 4090 D dispatch. A local adaptation passed two test boots, improved GEMM by 28%–90%, and enabled fresh Strata measurements. A later cross-check found corroborating reports and a separately merged 4090 D implementation.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p><a href="/en/posts/qwen38-flash-next-strata-4090/" >The previous post</a> set up Strata on my RTX 4090 D at home, where it has been running Qwen3.8-Flash-Next. After finding <a href="https://github.com/Zagitta/gpu-unlock"  target="_blank" rel="noreferrer">gpu-unlock</a>, I wanted to see whether it would work on this card and how fast inference would run afterward.</p>
<p>At the start of the experiment, community AD102 implementations covered the regular 4090, while the selected baseline did not yet include the 4090 D. On October 24, an AI assistant added that support and ran the unlock, numerical checks, and before/after benchmarks on this machine, followed by another round of measurements against the existing Strata service.</p>

<h2 class="relative group">Device dispatch for the 4090 and 4090 D
    <div id="device-dispatch-for-the-4090-and-4090-d" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#device-dispatch-for-the-4090-and-4090-d" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>This card has PCI ID <code>10de:2685</code>, an Ada AD102 GPU, 114 SMs, and 24 GB of VRAM. The system runs Ubuntu 24.04.4 LTS. The experiment kept kernel <code>6.17.0-1032-oem</code>, the existing NVIDIA <code>595.58.03 open</code> driver, and a 425 W power limit throughout. Secure Boot was already disabled.</p>
<p>Support depends on the branch. The initial check covered only Zagitta’s main, which contained the Ampere GA102, GA103, GA104, and GA106 implementations. Further inspection of branches and forks found <a href="https://github.com/elias-gaeros/gpu-unlock/tree/4ec490d49c1cc292c0b4cd5ce5a801b5d2c396dc"  target="_blank" rel="noreferrer">elias-gaeros’s rtx4090 branch</a> and <a href="https://github.com/JustAResearcher/gpu-unlock-ada/tree/491925c1079435e260137b9f3526066e764de830"  target="_blank" rel="noreferrer">JustAResearcher/gpu-unlock-ada</a>. The main-branch statement refers to the <a href="https://github.com/Zagitta/gpu-unlock/tree/4189b17711bd487d9ea4a8ff0055e6d58d19d6d3"  target="_blank" rel="noreferrer">specific commit inspected</a>.</p>
<p>The regular 4090 has device ID <code>2684</code>, already included in both inspected community commits. Neither commit included the 4090 D’s <code>2685</code> at that point. Starting from the pinned JustAResearcher commit, the patch updated device admission, AD102 firmware selection, the <code>is_ad102()</code> architecture check, and the corresponding host tests. Adding only an allowlist entry would select the GA102 firmware path.</p>
<p>The new device also requires an explicit <code>ad102d_experimental=1</code> switch. Its <code>targets</code> value must equal one complete PCI address; <code>all</code> and comma-separated lists are rejected. The target on this machine is <code>0000:01:00.0</code>, keeping the experiment scoped to this card.</p>
<p>The unlock firmware assets are version <code>610.43.03</code>. The NVIDIA driver loaded afterward remains the version given above. No VBIOS was flashed.</p>

<h2 class="relative group">Booting through a separate entry
    <div id="booting-through-a-separate-entry" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#booting-through-a-separate-entry" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The unlock module must load before the NVIDIA driver. With Strata already running, inserting it against a card owned by the driver was not the test path. The service was briefly stopped to capture the locked rates, numerical checks, and compute baseline, then restored while the next boot was prepared.</p>
<p>The root filesystem is Btrfs, and the default boot kernel was already one version newer than the running kernel. To keep the same kernel on both sides of the comparison, a separate kernel and initramfs were copied to the EFI partition. A dedicated test entry was selected for the next boot with UEFI <code>BootNext</code>, preserving the original default boot order.</p>
<p>The experimental initramfs contains the module, firmware, and an early loading script that runs before the existing init-top scripts. This is the essential load command, executed during early boot with this machine’s target address:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">insmod /gpu_unlock-4090d.ko <span class="nv">targets</span><span class="o">=</span>0000:01:00.0 <span class="nv">ad102d_experimental</span><span class="o">=</span><span class="m">1</span></span></span></code></pre></div></div>
<p>After the first normal reboot, the log recorded selector writes, readback after a PCI function-level reset (FLR), and a successful unlock. The unmodified driver then loaded. In the read-only rate query, <code>fmla32</code>, <code>imla2</code>, and <code>imla4</code> changed from <code>1</code> to <code>0</code>; this interface defines those values as half rate and full rate, respectively.</p>
<p>One systemd detail showed up during recovery of the service. The first boot used the kernel parameter <code>systemd.mask=strata.service</code> to keep the model from filling VRAM automatically. That mask comes from a generator and is recreated on daemon-reload, so <code>systemctl unmask --runtime</code> alone cannot remove it. For the second boot, that kernel parameter was removed and the same test entry selected again. The unlock succeeded again, Strata started from its original unit, and the health check reported a loaded model.</p>
<p>Both runs were normal reboots. There was no power-cycle test or long-duration stability workload. The model service and rates were checked after the second boot; the untested return to the original boot path is described below.</p>

<h2 class="relative group">Compute throughput and numerical checks
    <div id="compute-throughput-and-numerical-checks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#compute-throughput-and-numerical-checks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Changed rate fields still need confirmation from actual computation. The before/after cuBLAS GEMM runs used the same benchmark binary and power limit, square matrices of side 8192, five samples per mode, and 20 iterations per sample. The table reports median throughput. Both the FP16 and BF16 modes accumulate in FP32.</p>
<table>
  <thead>
      <tr>
          <th>GEMM mode</th>
          <th style="text-align: right">Before TFLOPS</th>
          <th style="text-align: right">After TFLOPS</th>
          <th style="text-align: right">Gain</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>FP16 → FP32</td>
          <td style="text-align: right">152.83</td>
          <td style="text-align: right">195.96</td>
          <td style="text-align: right">28.22%</td>
      </tr>
      <tr>
          <td>BF16 → FP32</td>
          <td style="text-align: right">153.81</td>
          <td style="text-align: right">250.97</td>
          <td style="text-align: right">63.16%</td>
      </tr>
      <tr>
          <td>TF32</td>
          <td style="text-align: right">76.49</td>
          <td style="text-align: right">145.55</td>
          <td style="text-align: right">90.28%</td>
      </tr>
      <tr>
          <td>Regular FP32 control</td>
          <td style="text-align: right">54.27</td>
          <td style="text-align: right">54.71</td>
          <td style="text-align: right">0.80%</td>
      </tr>
  </tbody>
</table>
<p>The MMA instruction microbenchmark uses the best throughput from three measurements with the same configuration. Its aggregation differs from the GEMM median above.</p>
<table>
  <thead>
      <tr>
          <th>MMA mode</th>
          <th style="text-align: right">Before</th>
          <th style="text-align: right">After</th>
          <th>Unit</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>FP16 / FP32 accumulation</td>
          <td style="text-align: right">145.1</td>
          <td style="text-align: right">291.5</td>
          <td>TFLOPS</td>
      </tr>
      <tr>
          <td>BF16 / FP32 accumulation</td>
          <td style="text-align: right">145.0</td>
          <td style="text-align: right">289.6</td>
          <td>TFLOPS</td>
      </tr>
      <tr>
          <td>FP16 / FP16 accumulation</td>
          <td style="text-align: right">290.3</td>
          <td style="text-align: right">291.6</td>
          <td>TFLOPS</td>
      </tr>
      <tr>
          <td>INT8 / INT32 accumulation</td>
          <td style="text-align: right">579.7</td>
          <td style="text-align: right">579.6</td>
          <td>TOPS</td>
      </tr>
      <tr>
          <td>dp4a</td>
          <td style="text-align: right">144.1</td>
          <td style="text-align: right">144.1</td>
          <td>TOPS</td>
      </tr>
      <tr>
          <td>scalar FFMA</td>
          <td style="text-align: right">68.8</td>
          <td style="text-align: right">68.9</td>
          <td>TFLOPS</td>
      </tr>
  </tbody>
</table>
<p>The change is concentrated in Tensor operations with FP32 accumulation. FP16 accumulation and integer controls remain essentially unchanged. A separate tensor cubin benchmark also measured approximately doubled TF32 throughput and unchanged INT4 throughput. Actual GEMM gains depend on the data type; doubling one instruction’s throughput does not establish a doubled application speed.</p>
<p>Numerical checks ran both before and after the unlock. FP16 and BF16 GEMMs with FP32 accumulation each checked 65536 elements, reporting <code>failures=0</code> and <code>max_abs=0</code>. The separate cubin checks for FP16, TF32, and INT4 each covered 270336 elements, all with <code>mismatches=0</code>. These results cover the inputs and precision modes used in these benchmarks.</p>
<p>The host unittest run contained 22 tests: 19 passed, and three offline-decryption tests were skipped because the optional PyCryptodome dependency was absent. The module compiled against the pinned kernel with <code>KCFLAGS=-Werror</code>. Neither boot log contained NVIDIA Xid, GPU fallen off bus, or kernel Oops/BUG errors. The performance tables come from one before/after experiment with repeated samples; the second reboot checked the unlock and service state without repeating the full compute suite.</p>

<h2 class="relative group">Cross-check against later community commits
    <div id="cross-check-against-later-community-commits" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#cross-check-against-later-community-commits" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>While preparing this post, the JustAResearcher repository was checked again at <a href="https://github.com/JustAResearcher/gpu-unlock-ada/tree/4e7fefcc4923f9e083d5324dc75a7d2f906af77f"  target="_blank" rel="noreferrer">commit <code>4e7fefcc</code></a>. It had merged <a href="https://github.com/JustAResearcher/gpu-unlock-ada/pull/7"  target="_blank" rel="noreferrer">RTX 4090 D support in PR #7</a>, routing device admission, firmware selection, and architecture checks through AD102. That version uses <code>rtx4090d_experimental=1</code> and permits multiple selected cards after opt-in. The patch tested here retains the earlier switch name and single-card restriction. The attachment stays pinned to its original baseline, so the two parameter sets must be kept distinct.</p>
<p>The <a href="https://github.com/JustAResearcher/gpu-unlock-ada/blob/4e7fefcc4923f9e083d5324dc75a7d2f906af77f/docs/evidence/rtx4090-pr1-matched/README.md"  target="_blank" rel="noreferrer">matched regular-4090 report from PR #1</a> includes raw timings and numerical results. FP16 and BF16 instruction throughput with FP32 accumulation rose from 160.4 and 159.7 TFLOPS to 320.4 and 320.2 TFLOPS, respectively; FP16 accumulation and integer controls remained essentially unchanged. Recalculating its GEMM logs gives gains of about 12% and 16% for the two 8192-square cases. An <a href="https://github.com/JustAResearcher/gpu-unlock-ada/blob/4e7fefcc4923f9e083d5324dc75a7d2f906af77f/docs/evidence/rtx4090-pr1-matched/warm-reboot-repeat/README.md"  target="_blank" rel="noreferrer">ordinary warm-reboot repeat</a> retained nearly doubled instruction throughput, while 4096-square BF16 GEMM was about 8% slower than the original stock baseline. These results corroborate the instruction paths that benefited on this machine and show why application gains need workload measurements. The GPUs, drivers, CUDA versions, and matrix inputs differ, so each experiment keeps its own percentages.</p>
<p>There is also an <a href="https://github.com/JustAResearcher/gpu-unlock-ada/pull/7#issuecomment-6390126655"  target="_blank" rel="noreferrer">independent 4090 D user report</a>: on an eight-card node, a before/after measurement on one card rose from about 148 to 296 TFLOPS. All eight cards then unlocked after a reboot and passed numerical checks; the existing ComfyUI workflow took about 11% less time. This is a contributor’s written report without attached raw logs, giving it less complete evidence than the regular-4090 dataset above.</p>
<p>The newer version also adds firmware hashing at load time, seeded numerical tests across multiple matrix shapes, and a fix for MMA repetition storage. This machine’s unlock and benchmarks used the earlier code. The hardware results in this post remain tied to the original patch and pinned baseline; the public data notes also record one line-ending issue in the upstream checksum manifest.</p>

<h2 class="relative group">Current Strata performance
    <div id="current-strata-performance" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#current-strata-performance" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After the compute tests, real inference requests were sent to the existing service. Strata was now <code>0.1.47</code>, still running the official GSQ-RCO IQ3_S quantization of Qwen3.8-Flash-Next. Maximum context remained 262144, with int8 KV and 32768 resident cells per layer. The automatically allocated expert cache had 8548 slots and used 16599 MiB.</p>
<p>The existing launch configuration was preserved: <code>--spec 4</code>, <code>--spec-min-p 0.5</code>, the CJK draft vocabulary, and fused prefill. The engine capability fields separately reported <code>spec=6</code> and <code>mtp_max=4</code>; those are recorded separately from launch arguments. No configuration or engine binary was changed, and the service was not restarted during the measurements.</p>
<p>One warmup request was excluded, followed by three repetitions of each of five input/output lengths, for 15 formal requests. The service handled one request at a time, with thinking disabled and greedy sampling. Each input began with a distinct measurement ID, and every response was checked for <code>cached_tokens=0</code> and <code>cache_n=0</code> to exclude reuse of the preceding request’s KV prefix.</p>
<p>Cold prefill here means a KV-prefix miss. The model was already loaded, and the expert cache warmed across requests without being cleared between runs; the first long-code request was retained in the sample set. The medium-length Chinese material was generated by the benchmark script, while the long-code input came from the Strata server source at the time. The measurements describe inference on these inputs.</p>
<table>
  <thead>
      <tr>
          <th>Input / output tokens</th>
          <th>Content</th>
          <th style="text-align: right">Prefill token/s</th>
          <th style="text-align: right">Decode token/s</th>
          <th style="text-align: right">First token s</th>
          <th style="text-align: right">Full request s</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>95 / 256</td>
          <td>Short Chinese request</td>
          <td style="text-align: right">252.1</td>
          <td style="text-align: right">134.8</td>
          <td style="text-align: right">0.390</td>
          <td style="text-align: right">2.279</td>
      </tr>
      <tr>
          <td>2060 / 256</td>
          <td>About 2K Chinese material</td>
          <td style="text-align: right">985.6</td>
          <td style="text-align: right">137.3</td>
          <td style="text-align: right">2.104</td>
          <td style="text-align: right">3.959</td>
      </tr>
      <tr>
          <td>8204 / 256</td>
          <td>About 8K Chinese material</td>
          <td style="text-align: right">3365.2</td>
          <td style="text-align: right">144.6</td>
          <td style="text-align: right">2.454</td>
          <td style="text-align: right">4.213</td>
      </tr>
      <tr>
          <td>120 / 1024</td>
          <td>Sustained Chinese output</td>
          <td style="text-align: right">284.4</td>
          <td style="text-align: right">137.8</td>
          <td style="text-align: right">0.440</td>
          <td style="text-align: right">7.851</td>
      </tr>
      <tr>
          <td>32784 / 512</td>
          <td>About 32K source review</td>
          <td style="text-align: right">3421.9</td>
          <td style="text-align: right">129.0</td>
          <td style="text-align: right">9.616</td>
          <td style="text-align: right">13.571</td>
      </tr>
  </tbody>
</table>
<p>Each column is the median of three runs, and the medians need not come from the same request. Input counts include the chat template. Prefill and decode use native server token counts and phase timings; first-token and full-request latency use a client monotonic clock. Draft tokens rejected by the main model are excluded from output throughput, and prefill time is excluded from decode throughput.</p>
<p>The sustained-generation runs had similar decode rates, while the first long-code request was somewhat slower. Short-input prefill rates are dominated by fixed overhead; the longer-input rows are the relevant ones for long-context throughput. All formal requests returned HTTP 200 and complete SSE termination. API output counts, engine-generated counts, and timing fields agreed. Each request ended at its configured token limit; answer quality was not evaluated.</p>

<h2 class="relative group">Comparison with the previous post
    <div id="comparison-with-the-previous-post" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#comparison-with-the-previous-post" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The final round in the previous post used the then-updated engine and a workflow with five subagents examining a project, yielding a batch of code-related requests. A separate long-source review was added this time to put its input length inside the earlier long-prefill group. The comparison below uses only that later comparison batch from the old post, without mixing in its earlier IQ3_S aggregate.</p>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th style="text-align: right">Previous v0.1.39, locked</th>
          <th style="text-align: right">This run v0.1.47, unlocked</th>
          <th style="text-align: right">Observed difference</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Code-related median decode</td>
          <td style="text-align: right">106.9 token/s</td>
          <td style="text-align: right">129.0 token/s</td>
          <td style="text-align: right">+20.67%</td>
      </tr>
      <tr>
          <td>Median cold prefill, long input</td>
          <td style="text-align: right">2900 token/s</td>
          <td style="text-align: right">3421.9 token/s</td>
          <td style="text-align: right">+18.00%</td>
      </tr>
  </tbody>
</table>
<p>The earlier decode distribution covers an entire code workflow. Its long-prefill median uses 16 requests with 20K–40K tokens computed without prefix reuse. This run has only three requests per input case, with different input text, generation lengths, and sampling settings. MTP acceptance and expert-cache hits also changed. Together with the engine upgrade, these factors contribute to the observed differences.</p>
<p>The measurements establish recovered throughput in some Tensor paths on this card and record the current model service’s speed. Isolating the unlock’s contribution to model inference requires locked/unlocked A/B runs with the same engine, inputs, and configuration.</p>

<h2 class="relative group">Patch, data, and the recovery path
    <div id="patch-data-and-the-recovery-path" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#patch-data-and-the-recovery-path" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The <a href="/downloads/rtx4090d-gpu-unlock/rtx4090d.patch" >4090 D patch</a> applies to the pinned community commit above and remains a local experimental change. The attachments include the <a href="/downloads/rtx4090d-gpu-unlock/gemm_bench.cu" >GEMM benchmark source</a>, <a href="/downloads/rtx4090d-gpu-unlock/inference-runs.csv?v=f2a4f3653ed8" >15 inference records as CSV</a>, and the <a href="/downloads/rtx4090d-gpu-unlock-data.tar.gz" >complete data archive</a>. The <a href="/downloads/rtx4090d-gpu-unlock/README.md" >data notes</a> list the compute logs, rate readouts, boot-log excerpts, JSON timing fields, and checksum manifest used to reproduce the table aggregates. Firmware and module binaries are not bundled; firmware sources and licensing remain governed by the base repository.</p>
<p>At the end of the experiment, the machine was running through the test entry selected for the second boot. Strata was healthy, the model was loaded, and rates were full. <code>BootNext</code> had been consumed, the default boot order was unchanged, and automatic unlocking on the default boot path had not been configured.</p>
<p>To select the experimental entry again, first inspect <code>efibootmgr -v</code> to verify its label and number, then set the next boot. To return to the original path, check for a pending test BootNext; cancel it with <code>efibootmgr --delete-bootnext</code> if present, then reboot normally. Entry numbers are machine-specific and must not be copied from this machine. After booting the original path, read the rates again to determine whether half-rate operation has returned, with a power cycle if needed. That recovery reboot and the post-power-cycle state were not tested in this experiment.</p>
<p>The test image is tied to this kernel and module. A kernel change requires rebuilding and validation. For now, the separate boot entry remains available for explicit selection.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Driving an Electron Desktop App Through UIA: A Windows-MCP Field Test</title>
      <link>https://blog.ferstar.org/en/posts/ai-agent-drives-electron-app-windows-mcp-uia/</link>
      <pubDate>Sun, 18 Oct 2026 18:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/ai-agent-drives-electron-app-windows-mcp-uia/</guid>
      <description>Having an AI acceptance-test an Electron desktop app is awkward: the accessibility tree is nearly empty on a cold start, and window titles, leftover popups and transient UIA errors make replays flaky; this post reads the UIA semantic tree through Windows-MCP, finds windows by process path, narrows every search scope and retries cleanup; after the fixes, 45 consecutive runs had zero failing test steps, about 9 seconds of UI overhead per run excluding the model wait, and SealDesk was not needed anywhere in the chain.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>After <a href="/en/posts/yet-another-remote-desktop-application-sealdesk/" >the last post</a> open-sourced SealDesk, I started wondering what it should gain next. Putting AI control on top of remote desktop sounds like a natural step, but plenty of ready-made options already cover that combination, so instead of changing SealDesk I first ran the existing tools to see whether they were enough.</p>
<p>This time an AI assistant (Claude), working through a remote shell tool, used Windows-MCP on my Windows machine to drive an Electron desktop client: open a new chat, type, send, wait for the reply, assert the result, and finally delete the session the test created. The AI assistant ran the experiments and did the debugging under my direction; I did not track these problems down by hand. The numbers below come from the logs it produced.</p>
<p>The conclusion first: this route works. After a few fixes, 45 consecutive runs had no failing test step, and SealDesk was not used anywhere in the chain.</p>

<h2 class="relative group">The chain
    <div id="the-chain" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-chain" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The AI assistant only has a remote shell tool and cannot see Windows-MCP’s tool list, so we wrote a small command-line bridge, <code>wmcp.py</code>, with three commands, <code>ping</code>, <code>tools</code> and <code>call</code>, that turns MCP tool calls into shell commands.</p>
<pre class="not-prose mermaid">
flowchart LR
    A["AI assistant"] --> B["Remote shell tool"]
    B --> C["wmcp.py"]
    C --> D["Windows-MCP<br/>127.0.0.1:8000 + bearer key"]
    D --> E["UIA semantic tree / input injection"]
    E --> F["Electron desktop app"]
    H["Person using the machine"] -.->|"USER_CONTROL: yield control"| D
</pre>

<p>Windows-MCP binds to <code>127.0.0.1</code> only and requires a bearer key. Install it with <code>uv tool install</code>, not <code>uvx</code>: uvx keeps its environment in the uv cache, and once the cache is cleaned the resident service can no longer start.</p>
<p>Screenshots exceed the MCP Python SDK’s default 1 MiB limit on a single SSE event, so the bridge uses the lower-level <code>streamable_http_client</code> and turns that limit off. When a person is using the machine, Windows-MCP returns <code>USER_CONTROL</code>; the bridge retries for the wait time it gives and exits on timeout rather than taking control.</p>

<h2 class="relative group">Deal with telemetry before installing
    <div id="deal-with-telemetry-before-installing" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#deal-with-telemetry-before-installing" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>This is based on the 0.8.8 source. The upstream README says usage data is collected; the details are:</p>
<ul>
<li>It is turned off only when the environment variable <code>ANONYMIZED_TELEMETRY</code> equals <code>false</code>; it is on by default.</li>
<li>The client is PostHog, initialized without disabling geoip and with exception autocapture enabled.</li>
<li>Each tool call reports the tool name, duration, success flag, client name and version, plus an anonymous ID persisted under <code>~/.windows-mcp/</code>. The call arguments are not part of that event.</li>
<li>On errors it reports the original error message and a traceback; what they contain depends on the error.</li>
</ul>
<p>The startup script that <code>windows-mcp install</code> generates does not set this variable, so add one line yourself:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bat" data-lang="bat"><span class="line"><span class="cl"><span class="p">@</span><span class="k">echo</span> off
</span></span><span class="line"><span class="cl"><span class="k">setlocal</span>
</span></span><span class="line"><span class="cl"><span class="k">set</span> <span class="nv">ANONYMIZED_TELEMETRY</span><span class="p">=</span>false
</span></span><span class="line"><span class="cl"><span class="s2">"<uv tool dir>\windows-mcp\Scripts\python.exe"</span> -m windows_mcp serve --transport streamable-http --host 127.0.0.1 --port 8000</span></span></code></pre></div></div>
<p>Windows-MCP also ships tools such as <code>PowerShell</code> and <code>Registry</code>. If the caller already has a shell, they amount to a second path that the outer tool does not govern, and <code>--exclude-tools "PowerShell,Registry"</code> removes them on the server side. I did not remove them this time; we simply agreed not to use them.</p>

<h2 class="relative group">On a cold start, Electron’s accessibility tree is nearly empty
    <div id="on-a-cold-start-electrons-accessibility-tree-is-nearly-empty" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#on-a-cold-start-electrons-accessibility-tree-is-nearly-empty" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Right after the app starts, the first probe returns only 14 nodes: 1 window, 11 Panes and 2 Documents, with no interactive controls at all. Six seconds later the same query returns 764 nodes, 299 of them interactive and 296 with names; buttons, links and toggle states are all readable.</p>
<p>Chromium builds the accessibility tree only when it detects assistive technology, so the first query is itself the wake-up. I had planned to launch the app with <code>--force-renderer-accessibility</code>, but in practice it is not needed: the first step of the replay (preheat) does one full walk of the main window and then polls the node count until it exceeds 200. I fully closed the app and restarted it three times in a row; each time the first preheat reached 402 nodes within about 1.1 seconds.</p>

<h2 class="relative group">The replay case
    <div id="the-replay-case" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-replay-case" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The case walks the most common path. Every step is located and asserted through UIA properties; a screenshot is saved only at the end, for manual review:</p>
<table>
  <thead>
      <tr>
          <th>Step</th>
          <th>Locator and assertion</th>
          <th>Median time</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>preheat</td>
          <td>One full walk, node count ≥ 200</td>
          <td>203 ms</td>
      </tr>
      <tr>
          <td>new_chat</td>
          <td>Click “New chat”, the input box (Edit) appears</td>
          <td>642 ms</td>
      </tr>
      <tr>
          <td>compose</td>
          <td>Type a probe text with a unique token</td>
          <td>1420 ms</td>
      </tr>
      <tr>
          <td>enable_send</td>
          <td>The “Send” button goes from disabled to enabled</td>
          <td>83 ms</td>
      </tr>
      <tr>
          <td>send</td>
          <td>Click “Send”, recording the earlier reply count</td>
          <td>658 ms</td>
      </tr>
      <tr>
          <td>echo</td>
          <td>Text containing the token appears in the message list</td>
          <td>21 ms</td>
      </tr>
      <tr>
          <td>reply</td>
          <td>A new reply appears: after stripping trailing punctuation it starts with the expected word and is at most 8 characters long</td>
          <td>5283 ms</td>
      </tr>
      <tr>
          <td>cleanup</td>
          <td>Delete only the session that contains this run’s token, with up to two attempts</td>
          <td>5676 ms</td>
      </tr>
  </tbody>
</table>
<p>The enabled state of the “Send” button is one of the few UI states that can be asserted directly. Excluding the model wait, a whole run takes about 9.1 seconds, of which cleanup is 5.7 seconds. The timings in the table come from the last batch of 5 runs.</p>

<h2 class="relative group">Problems you only meet once it runs
    <div id="problems-you-only-meet-once-it-runs" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#problems-you-only-meet-once-it-runs" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">The window title changes with the session
    <div id="the-window-title-changes-with-the-session" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-window-title-changes-with-the-session" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The first version found the main window by name. Once a session had a title, Electron renamed the window to that title and the lookup failed; the earlier runs all showed “New chat”, so it stayed hidden. The fix is to enumerate windows with Win32, match on the process’s executable path, and call <code>ElementFromHandle</code> on those windows:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">app_hwnds</span><span class="p">()</span> <span class="o">-></span> <span class="nb">list</span><span class="p">[</span><span class="nb">int</span><span class="p">]:</span>
</span></span><span class="line"><span class="cl">    <span class="n">user32</span> <span class="o">=</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">windll</span><span class="o">.</span><span class="n">user32</span>
</span></span><span class="line"><span class="cl">    <span class="n">hits</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="nd">@ctypes.WINFUNCTYPE</span><span class="p">(</span><span class="n">ctypes</span><span class="o">.</span><span class="n">c_bool</span><span class="p">,</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">wintypes</span><span class="o">.</span><span class="n">HWND</span><span class="p">,</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">wintypes</span><span class="o">.</span><span class="n">LPARAM</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">def</span> <span class="nf">visit</span><span class="p">(</span><span class="n">hwnd</span><span class="p">,</span> <span class="n">_</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="n">user32</span><span class="o">.</span><span class="n">IsWindowVisible</span><span class="p">(</span><span class="n">hwnd</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">            <span class="n">pid</span> <span class="o">=</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">wintypes</span><span class="o">.</span><span class="n">DWORD</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">            <span class="n">user32</span><span class="o">.</span><span class="n">GetWindowThreadProcessId</span><span class="p">(</span><span class="n">hwnd</span><span class="p">,</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">byref</span><span class="p">(</span><span class="n">pid</span><span class="p">))</span>
</span></span><span class="line"><span class="cl">            <span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">                <span class="k">if</span> <span class="n">APP_EXE_MARK</span> <span class="ow">in</span> <span class="n">psutil</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span><span class="n">pid</span><span class="o">.</span><span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">exe</span><span class="p">():</span>
</span></span><span class="line"><span class="cl">                    <span class="n">hits</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">hwnd</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">            <span class="k">except</span> <span class="p">(</span><span class="n">psutil</span><span class="o">.</span><span class="n">Error</span><span class="p">,</span> <span class="ne">OSError</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">                <span class="k">pass</span>
</span></span><span class="line"><span class="cl">        <span class="k">return</span> <span class="kc">True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="n">user32</span><span class="o">.</span><span class="n">EnumWindows</span><span class="p">(</span><span class="n">visit</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="n">hits</span></span></span></code></pre></div></div>
<p>This is an excerpt with the names changed.</p>

<h3 class="relative group">Don’t walk every window on the desktop
    <div id="dont-walk-every-window-on-the-desktop" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#dont-walk-every-window-on-the-desktop" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The earliest version looked for top-level windows by going down from the UIA root. One run stalled for 63 seconds, and in two others the root query returned 0 windows. I suspect it hit an unresponsive window but did not verify that. After switching to touching only the target app’s own windows, the problem did not recur.</p>
<p>The same idea fixed the slow cleanup. The menu and the confirmation dialog are popup windows of the target app, but I first searched for them across the whole desktop: scanning 9 top-level windows took 5.3 seconds, and limiting the search to the app’s own windows took 0.02 seconds. The median cleanup time dropped from 29.6 seconds to 5.7 seconds. Most likely the large trees of other applications (browsers and the like) were slowing it down; I did not measure window by window.</p>

<h3 class="relative group">A menu left open leaves the next run with a 20-node tree
    <div id="a-menu-left-open-leaves-the-next-run-with-a-20-node-tree" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#a-menu-left-open-leaves-the-next-run-with-a-20-node-tree" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>In one run the cleanup failed and the “session actions” dropdown stayed on screen. The next run’s preheat waited 30 seconds and saw an accessibility tree of only 20 nodes, and the run after it did the same. Now Esc is pressed once before each run and after a failed cleanup.</p>

<h3 class="relative group">Clicking a menu item as soon as it appears doesn’t register
    <div id="clicking-a-menu-item-as-soon-as-it-appears-doesnt-register" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#clicking-a-menu-item-as-soon-as-it-appears-doesnt-register" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Cleanup failed in two ways: the click on “Delete” happened but no confirmation dialog appeared, or the dialog appeared but its confirm button could not be found. My judgment is that the menu was still animating open and the early click got swallowed. Waiting 0.6 seconds after the item appears, then locating and clicking it again, cut first-attempt cleanup failures from 4 in 20 runs to 2. They did not go away, so I added one retry; in later batches no run failed both attempts. I have not fully pinned down the root cause.</p>

<h3 class="relative group">Transient UIA COM errors
    <div id="transient-uia-com-errors" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#transient-uia-com-errors" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>In the first batch of 20 runs, 3 runs raised <code>COMError -2147220991</code> (<code>EVENT_E_ALL_SUBSCRIBERS_FAILED</code>) while waiting for the reply. After adding up to 3 retries to UIA queries, it did not appear again in the next 45 runs.</p>

<h3 class="relative group">Coordinates must be in physical pixels
    <div id="coordinates-must-be-in-physical-pixels" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#coordinates-must-be-in-physical-pixels" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>This machine runs at 200% scaling. If the process does not declare DPI awareness, UIA returns logical coordinates, which are half the physical coordinates used for input injection, and clicks land in the wrong place. Calling <code>SetProcessDpiAwarenessContext(-4)</code> (per-monitor v2) at the top of the script makes the two agree.</p>

<h2 class="relative group">Test results
    <div id="test-results" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#test-results" aria-label="Anchor">#</a>
    </span>
    
</h2>
<table>
  <thead>
      <tr>
          <th>Batch</th>
          <th>Runs</th>
          <th>Test steps passed</th>
          <th>Cleanup eventually succeeded</th>
          <th>Change</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>A</td>
          <td>20</td>
          <td>17</td>
          <td>16</td>
          <td>First version; the 3 failing runs were the COM error above</td>
      </tr>
      <tr>
          <td>B</td>
          <td>20</td>
          <td>20</td>
          <td>16</td>
          <td>Retries added to UIA queries</td>
      </tr>
      <tr>
          <td>C</td>
          <td>20</td>
          <td>20</td>
          <td>20</td>
          <td>0.6-second wait for the menu item, up to two cleanup attempts</td>
      </tr>
      <tr>
          <td>D</td>
          <td>5</td>
          <td>5</td>
          <td>5</td>
          <td>Popups searched only within the app’s own windows</td>
      </tr>
      <tr>
          <td>Cold start</td>
          <td>3</td>
          <td>3</td>
          <td>3</td>
          <td>App fully closed and relaunched before each run</td>
      </tr>
  </tbody>
</table>
<p>Across B to D, 45 runs in total, no test step failed. A few scattered runs during debugging are not counted.</p>

<h2 class="relative group">What this asks of the front end
    <div id="what-this-asks-of-the-front-end" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-this-asks-of-the-front-end" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The replay works because UIA can find things by name and control type. A few things are worth fixing in the front end:</p>
<ul>
<li>Only 11 of 764 elements carry an AutomationId. Values such as <code>root</code> and <code>DndLiveRegion-0</code> show that an HTML <code>id</code> is mapped to AutomationId; but the existing ones are mostly framework-generated (for example React’s <code>radix-_r_9_</code>), depend on render order, and are not suitable as selectors. Key controls could get stable <code>id</code> values.</li>
<li>Every row in the session list has “Rename” and “Delete” buttons with the same names, 60 elements each; the buttons’ <code>aria-label</code> needs to include the session name to tell rows apart.</li>
<li>The same input box is an Edit in an empty chat and changes control type once a conversation is open, so the locator can only try several types in turn.</li>
</ul>

<h2 class="relative group">What this means for SealDesk
    <div id="what-this-means-for-sealdesk" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-this-means-for-sealdesk" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Looking back over the whole exercise, SealDesk was not used for a single line of code. The AI assistant reached this machine through an existing remote shell channel, it operated through the UIA semantic tree rather than pixels, and yielding control when a person is using the machine is built into Windows-MCP.</p>
<p>Where SealDesk can add something is where the semantic tree cannot reach: custom-drawn interfaces, games and CAD, desktops inside remote virtual machines, and the moments when a person needs to watch the actual picture and take over with low latency; also the connection leg itself when the machine has no ready-made channel. How common those cases are, and whether they justify adding agent capabilities to SealDesk, I don’t have an answer yet.</p>

<h2 class="relative group">Limitations
    <div id="limitations" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#limitations" aria-label="Anchor">#</a>
    </span>
    
</h2>
<ul>
<li>Every run creates a session in the account and makes one model call; the session is deleted when the test ends.</li>
<li>Only one app and one flow were tested.</li>
<li>It was not compared with a screenshot-based approach, so I can only say the semantic tree is sufficient, not that it is faster or more stable.</li>
<li>The UI strings are hard-coded Chinese literals and need updating whenever the interface changes.</li>
<li>The reply assertion only checks that the reply starts with the expected word and is at most 8 characters long; if the model phrases it differently, the run is judged a failure.</li>
<li>When the desktop session is disconnected (an RDP disconnect, for example), Windows-MCP returns <code>CONTROL_UNAVAILABLE</code> and the script fails outright instead of reporting a false pass.</li>
</ul>
<p>The replay script is tied to a specific app’s interface, so only the generic parts are shown here. Windows-MCP is available on <a href="https://github.com/CursorTouch/Windows-MCP"  target="_blank" rel="noreferrer">GitHub</a> and <a href="https://pypi.org/project/windows-mcp/"  target="_blank" rel="noreferrer">PyPI</a>.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>I Rebuilt RustDesk with tailcat for Scan-to-Connect Remote Desktop</title>
      <link>https://blog.ferstar.org/en/posts/yet-another-remote-desktop-application-sealdesk/</link>
      <pubDate>Fri, 16 Oct 2026 22:30:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/yet-another-remote-desktop-application-sealdesk/</guid>
      <description>Self-hosting RustDesk means renting a public VPS to run hbbs and hbbr, and public relays are often throttled or unreliable; SealDesk swaps the transport for tailcat—zero config, no account, no server to set up, scan to connect, P2P-first sessions inside end-to-end encrypted tunnels; the post breaks down the architecture changes, the C-ABI bridge, NAT traversal, and the engineering trade-offs.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Yesterday I open-sourced SealDesk: the RustDesk transport swapped for tailcat. The host taps share, the controller scans a code, and it connects.</p>
<p>RustDesk’s public servers aren’t always good, and self-hosting means renting a VPS and running <code>hbbs</code> and <code>hbbr</code>. SealDesk removes that setup, and there’s no account to register either.</p>

<h2 class="relative group">How the Two Ends Find Each Other Without a Server
    <div id="how-the-two-ends-find-each-other-without-a-server" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-the-two-ends-find-each-other-without-a-server" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The trigger for this project was Tailscale open-sourcing <a href="https://github.com/tailscale/tailcat"  target="_blank" rel="noreferrer">tailcat</a>. Tailscale’s NAT traversal and WireGuard mesh are great to use, but the standard setup depends on a coordination server (the hosted SaaS or a self-run Headscale) for authentication, node distribution, and ACLs. tailcat peels the data plane out as a standalone library: no account system, no control plane, just peer-to-peer transport itself.</p>
<p>The <code>tc</code> address is the complete connection credential. On startup, the server generates a Base64 string starting with <code>tc</code>, around 150 characters long; it packages the WireGuard public key, the pre-shared key (PSK), and the DERP region used for rendezvous. Every piece of cryptographic material the two ends need to find and authenticate each other lives in that one string.</p>
<p>The two ends meet on a public DERP node using this address. As soon as STUN/UDP hole punching succeeds, traffic switches to a direct WireGuard UDP tunnel; only in genuinely untraversable setups such as symmetric NAT does DERP fall back to forwarding ciphertext, which it cannot decrypt. That rendezvous relay is Tailscale’s public DERP, so there’s nothing to host, and <code>hbbs</code> / <code>hbbr</code> can be removed outright.</p>

<h2 class="relative group">After the Scan
    <div id="after-the-scan" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#after-the-scan" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The handshake never touches a central server; the pairing code just carries the <code>tc</code> address and temporary password over to the controller:</p>
<pre class="not-prose mermaid">
flowchart TD
    subgraph Host
        H1[Start tailcat Listener] --> H2[Generate tc... Address + Password]
        H2 --> H3[Render SEALDESK: Pairing QR Code]
        H3 --> H4[Wait for DERP Rendezvous Beacon]
    end

    subgraph Controller
        C1[Scan QR / Load Image / Paste Code] --> C2[Parse tc Address & Temporary Password]
        C2 --> C3[Dial tailcat Transport]
    end

    subgraph Handshake & Tunnel
        C3 & H4 --> D1[Rendezvous Handshake via Public DERP]
        D1 --> D2{STUN/UDP Hole Punching}
        D2 -->|Punch Succeeded| D3[Direct P2P WireGuard Tunnel]
        D2 -->|Symmetric NAT| D4[Fallback Encrypted DERP Forwarding]
    end

    D3 & D4 --> R[RustDesk Desktop Session: Auth, Video/Audio Stream, Input Injection]
</pre>

<p>The host opens the app and taps “Share this device”; the pairing QR code sits front and center. The controller scans it with a phone, or on desktop uses the webcam, picks a QR image file, or pastes a screenshot from the clipboard. On the same LAN the two ends find each other without touching the internet—approve the first request at the host, tick “Trust this device,” and it connects straight in next time.</p>
<p>The temporary password can be refreshed and the address reset; old pairing codes stop working once either changes. Stop sharing on either end and every session closes; nothing keeps running in the background.</p>

<h2 class="relative group">The C-ABI Between Go and Rust
    <div id="the-c-abi-between-go-and-rust" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-c-abi-between-go-and-rust" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>tailcat is pure Go; the RustDesk core is Rust. In <code>libs/tailcat-ffi</code>, we wrapped a minimal C-ABI with cgo: the host calls <code>TcServe</code> with the local RustDesk loopback port—every tunnel connection is forwarded to it—and gets back the generated <code>tc...</code> address; the controller calls <code>TcForward</code> with the peer address, which opens a local forward port; connect to it and you’re inside the tunnel. All returned strings are freed through <code>TcFree</code>, so pointers crossing the FFI boundary don’t leak.</p>
<p>Android took an extra step: Go 1.27.1’s <code>-buildmode=c-archive</code> returns “not supported” on android/arm64, so the build switches to c-shared and the Rust side links against <code>libtailcat.so</code> accordingly.</p>

<h2 class="relative group">Bypassing rendezvous_mediator
    <div id="bypassing-rendezvous_mediator" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#bypassing-rendezvous_mediator" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Upstream RustDesk couples its networking tightly to <code>rendezvous_mediator</code>: before connecting, the client queries the central server for the peer’s direct IP list or relay endpoint. In <code>src/client.rs</code>, <code>src/tailcat.rs</code>, and <code>src/client/io_loop.rs</code>, we added a dedicated tailcat branch: whenever the peer is a <code>tc...</code> address, all centralized resolution is skipped and the desktop stream rides the tailcat-encrypted connection. RustDesk’s battle-tested codecs (H.264/H.265/VP9) and input injection pipeline stay untouched.</p>

<h2 class="relative group">Android Drops the Session When the Network Switches
    <div id="android-drops-the-session-when-the-network-switches" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#android-drops-the-session-when-the-network-switches" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Controllers routinely hop between Wi-Fi and cellular, and on a switch the path update can’t keep up, so the session tends to drop. Android also denies netlink to app UIDs, so the Go-side netmon cannot enumerate network interfaces on its own and depends on the app layer to feed them in. In <code>libs/tailcat-ffi/android_interfaces.go</code>, we added <code>TcSetAndroidInterfaces</code>: the Kotlin layer reads interface names and addresses via <code>java.net.NetworkInterface</code>, and every connectivity change pushes them as JSON over JNI, registering them with netmon—so a mobile session doesn’t reconnect on every hop.</p>

<h2 class="relative group">Platforms and Limits
    <div id="platforms-and-limits" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#platforms-and-limits" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>CI and packaging across platforms are now in place. Multi-platform binaries are attached to the release page: Windows (<code>.exe</code> / <code>.msi</code>), macOS (<code>.dmg</code>), Linux (<code>.deb</code> / <code>.rpm</code> / <code>.AppImage</code>), and Android (<code>.apk</code>). Desktop-to-desktop connections work in both directions; Android currently acts primarily as a controller, and there is no iOS build.</p>
<p>Because the macOS build is not notarized with an Apple Developer certificate, Gatekeeper may block the first launch. You can strip the quarantine attribute in your terminal:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">xattr -cr /Applications/SealDesk.app</span></span></code></pre></div></div>
<p>Interoperating with upstream RustDesk uses its legacy direct-connection protocol (raw TCP 21118 stream without tailcat’s WireGuard tunnel), so that path is unencrypted, and SealDesk pops a warning before connecting.</p>
<p>SealDesk lives under <a href="https://github.com/runseal-labs"  target="_blank" rel="noreferrer">runseal-labs</a> (the “Seal” in the name is that sealed isolation between the two ends). The repository is at <a href="https://github.com/runseal-labs/sealdesk"  target="_blank" rel="noreferrer">github.com/runseal-labs/sealdesk</a>, and installers are available under <a href="https://github.com/runseal-labs/sealdesk/releases"  target="_blank" rel="noreferrer">Releases</a>. If you’re tired of babysitting <code>hbbs</code> and <code>hbbr</code>, give it a spin; issues and PRs are welcome.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>It Doesn&#39;t Use the VPN, but You&#39;re Not Allowed to Either: How I Fixed Yadea&#39;s VPN Detection</title>
      <link>https://blog.ferstar.org/en/posts/how-to-avoid-yadea-vpn-detection/</link>
      <pubDate>Sun, 11 Oct 2026 21:45:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/how-to-avoid-yadea-vpn-detection/</guid>
      <description>Opening the Yadea app with a VPN on triggers a &#39;VPN environment detected&#39; warning, then the app exits outright; the app hides behind 360 Jiagu packing with anti-hook defenses, so the in-process diagnostics from my previous post all failed. The measured truth is even more annoying: Yadea&#39;s own traffic never goes through the VPN, yet it still polices your whole phone&#39;s network. VPN Hide finally solved it — filtering VPN traces at the system_server Binder layer and via a kernel module, for Yadea alone — and cold starts went back to normal. The detection was stopped at a layer it cannot see.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Right after dealing with <a href="/en/posts/how-to-avoid-wps-root-detection/" >the WPS root warning</a>, it was Yadea’s turn. Opening the Yadea app with a VPN on shows “检测到VPN环境，请调整网络” (“VPN environment detected, please adjust your network”), and then the app exits. You can’t even get to the vehicle page.</p>
<p>WPS at least only showed a reminder; Yadea just refuses to work. What’s more absurd is that Yadea’s own traffic doesn’t go through the VPN at all. Whether my VPN is on has nothing to do with its network, but it insists on checking anyway.</p>

<h2 class="relative group">Symptoms
    <div id="symptoms" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#symptoms" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>logcat makes it clear: the main process logs “检测到VPN环境,请调整网络” and then exits on its own. The <code>:pushservice</code> push process shows the same message.</p>
<p>I wanted to unpack the APK, but Yadea 8.8.12 is packed with 360 Jiagu. Unpacking it only gives the shell code; the business logic isn’t visible.</p>

<h2 class="relative group">In-process hooks blocked by the packer
    <div id="in-process-hooks-blocked-by-the-packer" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#in-process-hooks-blocked-by-the-packer" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>For WPS, I used a temporary LSPosed diagnostic module that hooked the detection method inside the process and logged return values. On Yadea, the packer noticed during initialization and the app kept exiting before reaching the business code; removing the module brought back the original VPN warning. In-process hooking was a dead end. I also tried Frida, but it had version compatibility problems and never ran.</p>

<h2 class="relative group">Code dumped from memory
    <div id="code-dumped-from-memory" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#code-dumped-from-memory" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Since the static route was blocked, I let the app decrypt itself at runtime. After a normal start, I dumped the business DEX from memory and could finally read the code.</p>
<p>Following the network checks led to an interface-enumeration routine in the Getui push SDK that looks for VPN interfaces like <code>tun0</code> and <code>ppp0</code>. But there’s no evidence that this is what shows the warning, and I never caught which API triggers it, so I won’t draw a conclusion.</p>
<p>What I could confirm is something else. Yadea’s UID is <code>10450</code>. It’s not in the list of UIDs the VPN covers, and not in the VPN client’s per-app list either; its traffic was direct all along. So setting Yadea to bypass the VPN in the client doesn’t help: it checks whether the phone has a VPN at all, regardless of how its own traffic is routed. WPS checked which apps were installed; Yadea polices the whole phone’s network state, which reaches even further.</p>

<h2 class="relative group">Handling it outside the process
    <div id="handling-it-outside-the-process" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#handling-it-outside-the-process" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Since nothing can be done inside the process, the data has to be changed somewhere the app can’t see. <a href="https://github.com/okhsunrog/vpnhide"  target="_blank" rel="noreferrer">VPN Hide</a> does exactly this, on two layers:</p>
<ul>
<li><strong>Java layer</strong>: the LSPosed module hooks system_server. At Binder’s <code>writeToParcel</code>, it removes VPN information from <code>NetworkCapabilities</code>, <code>NetworkInfo</code>, and <code>LinkProperties</code>, so the network data the app gets over IPC contains no VPN. Nothing is injected into Yadea’s process, so the packer’s anti-hook and memory-integrity checks don’t notice.</li>
<li><strong>Native layer</strong>: a kernel module (kmod, based on kprobe/kretprobe) hides the <code>tun</code> interface in the kernel. Interface-enumeration ioctls, <code>getifaddrs</code>, and netlink route dumps are all filtered, so native code can’t find it either. The backend can be kmod, KPM, or Zygisk. Zygisk does inline hooks inside the process and may be caught by the packer; this phone’s kernel supports kmod, so I used kmod.</li>
</ul>
<pre class="not-prose mermaid">
flowchart TD
    Y["Yadea app (360 Jiagu pack + anti-hook)"]
    Y -->|"in-process hook injection"| X["Packer detects it, repeated exits ✗"]
    Y -->|"Java API network queries"| S["system_server<br/>VPN Hide: Binder-layer filtering ✓"]
    Y -->|"native interface/route enumeration"| K["Kernel<br/>VPN Hide kmod: tun0 hidden ✓"]
</pre>

<p>kmod doesn’t require flashing the kernel or modifying the boot image; the KernelSU module loads a <code>.ko</code> into the existing kernel at boot. But it does change the running kernel’s behavior: if it’s incompatible, the system may crash, and after uninstalling it you need another reboot to fully restore things.</p>
<p>The configuration enables Java and native hiding for <code>com.yadea.smartmoto</code> only, with the LSPosed scope set to the system framework, not Yadea.</p>

<h2 class="relative group">Result
    <div id="result" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#result" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After rebooting to load the kernel module, with NekoBox connected, Yadea cold-started twice in a row straight into the vehicle home page. No VPN warning, no exit.</p>
<p>VPN Hide has a statistics page. I recorded for 43 seconds, cold-starting Yadea once during that window, and it logged 156 interceptions:</p>
<table>
  <thead>
      <tr>
          <th>Query type</th>
          <th>Count</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Native ioctl network interface queries</td>
          <td>130</td>
      </tr>
      <tr>
          <td>IPv4 / IPv6 address enumeration</td>
          <td>3 each</td>
      </tr>
      <tr>
          <td>Java <code>NetworkInfo</code></td>
          <td>12</td>
      </tr>
      <tr>
          <td>Java <code>Network</code> handles</td>
          <td>5</td>
      </tr>
      <tr>
          <td>Java <code>ConnectivityService</code></td>
          <td>3</td>
      </tr>
  </tbody>
</table>
<p>Most of it is native ioctl interface queries. That path returns the interface list, addresses, and up/down state, which is enough to spot VPN interfaces like <code>tun0</code>. Filtering only at the Java layer can’t block these queries, which is why kmod has to be enabled as well. These counts also include normal network calls, though, so they don’t mean Yadea deliberately checked for a VPN 156 times, and the stats alone can’t identify which call triggered the warning.</p>
<p>VPN Hide’s own status page shows “no check needed”, which looks like it isn’t working. It’s actually because VPN Hide itself doesn’t go through the VPN, so that’s the expected display.</p>
<p>VPN Hide only handles VPN traits that can be queried on the phone. It doesn’t hide root or deal with Play Integrity. Server-side checks such as DNS leaks, IP blacklists, and TLS fingerprinting are out of its reach.</p>

<h2 class="relative group">Compared with WPS
    <div id="compared-with-wps" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#compared-with-wps" aria-label="Anchor">#</a>
    </span>
    
</h2>
<table>
  <thead>
      <tr>
          <th></th>
          <th>WPS</th>
          <th>Yadea</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>What it checks</td>
          <td>whether a root manager is installed</td>
          <td>whether the phone has a VPN</td>
      </tr>
      <tr>
          <td>Is the check protected</td>
          <td>no</td>
          <td>packing + anti-hook</td>
      </tr>
      <tr>
          <td>After a hit</td>
          <td>shows a toast</td>
          <td>shows a warning, then exits</td>
      </tr>
      <tr>
          <td>Where it was fixed</td>
          <td>package visibility (HMA)</td>
          <td>system_server + kernel (VPN Hide)</td>
      </tr>
  </tbody>
</table>
<p>WPS’s check sits in the app layer without protection, so hiding the package name with HMA was enough. Yadea’s check is behind a packer and can’t be touched in-process, so the only option was to go down to system_server and the kernel and change the data it receives.</p>
<p>Unpacking, dumping memory, reading decompiled code, picking a kernel module: in the past, even a professional wouldn’t have found it worth this much effort for one vendor app’s unreasonable restrictions, and ordinary users just had to put up with it. With AI’s help, ordinary people can get this done too, and finally decide for themselves how to use their own phones.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>You Turn Off the Switch, It Opens the List: How WPS Knew My Phone Was Rooted</title>
      <link>https://blog.ferstar.org/en/posts/how-to-avoid-wps-root-detection/</link>
      <pubDate>Sun, 11 Oct 2026 17:50:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/how-to-avoid-wps-root-detection/</guid>
      <description>Every launch of WPS on my rooted phone showed a &#39;device is rooted&#39; warning. I first wrote and published an LSPosed module that intercepts exactly that one toast; decompiling WPS revealed a six-check detection chain, and in-process instrumentation proved the hit was a KernelSU package-name query — one that succeeds even with the &#39;app list&#39; permission denied, thanks to a `` declaration in the Manifest. Hide My Applist finally made the query return &#39;not installed&#39;, killing the detection at its source.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>I bought this phone, but without root it felt like I was renting it, so I rooted it. Then WPS, starting from some version I can’t pin down, began caring whether my phone is rooted: every time I open it from the launcher, the home page shows “设备已Root，使用WPS Office可能存在安全风险。” (“This device is rooted; using WPS Office may pose security risks.”) It disappears after a second and leaves nothing in notification history. The worst part: I had denied its “read app list” permission, and it still detected KernelSU.</p>

<h2 class="relative group">Why the warning can’t be turned off
    <div id="why-the-warning-cant-be-turned-off" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-the-warning-cant-be-turned-off" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>It doesn’t go through the notification shade. It’s a Toast called directly from the app process, so notification permissions don’t apply, notification history keeps nothing, and WPS’s settings have no switch for it. Turning on KernelSU’s “unmount modules” for WPS didn’t help either.</p>
<p>Reading the detection code later explained why: this phone wasn’t being flagged by su files or mount points, so touching the file layer was pointless. At the time I didn’t know that, and just wanted the message gone.</p>

<h2 class="relative group">Hiding just this one message
    <div id="hiding-just-this-one-message" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#hiding-just-this-one-message" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I first tried the existing <a href="https://github.com/h465855hgg/toastblocker"  target="_blank" rel="noreferrer">ToastBlocker</a>, scoped to WPS only. The warning was gone, but so were normal toasts like “saved”.</p>
<p>To be more precise, MyAndroidTools’ component toggles were no use: the warning isn’t a separate Activity, Service, or Receiver. The call site is inside <code>HomeControllerImpl$1$1.run()</code> on the home page, which runs the check and calls Toast directly. Blocking only this sentence needs a method-level hook, which means LSPosed.</p>
<p>So I wrote a module with a single rule: exact-match the whole warning sentence (ignoring layout whitespace), let every other Toast through, and leave WPS’s detection result alone. It identifies the content through the public <code>Toast.makeText/setText</code>, marks the matching Toast object, and skips only its <code>show()</code>, without reading the hidden <code>Toast.mText</code> field that Android 16 restricts. The first version used the legacy API and was verified on the device; before release it was rewritten on libxposed API 102’s interceptor chain. Build, signing, and release run on GitHub Actions, and <a href="https://github.com/ferstar/wps-root-toast"  target="_blank" rel="noreferrer">wps-root-toast</a> 1.0.0 is now in the <a href="https://github.com/Xposed-Modules-Repo/io.github.ferstar.wpsroottoast"  target="_blank" rel="noreferrer">LSPosed module repository</a>.</p>
<p>The warning no longer shows, but the detection still runs; its result is just hidden.</p>

<h2 class="relative group">How WPS decides a device is rooted
    <div id="how-wps-decides-a-device-is-rooted" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-wps-decides-a-device-is-rooted" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>In WPS 26.9.1, the home-page check is <code>KSystemRoot.i(context)</code>. It runs six checks in order and returns true as soon as one hits.</p>
<pre class="not-prose mermaid">
flowchart TD
    A["KSystemRoot.i(context)"] --> B1{"su file exists in any PATH directory?"}
    B1 -->|hit| T["Rooted"]
    B1 -->|miss| B2{"persist.sys.root.status set and not 0?"}
    B2 -->|hit| T
    B2 -->|miss| B3{"ro.secure is 0?"}
    B3 -->|hit| T
    B3 -->|miss| B4{"Build.TAGS contains test-keys?"}
    B4 -->|hit| T
    B4 -->|miss| B5{"fingerprint or model shows emulator traits?"}
    B5 -->|hit| T
    B5 -->|miss| B6{"root manager package name found?"}
    B6 -->|hit| T
    B6 -->|miss| F["Not rooted"]
    T --> S["Home-page toast: device is rooted, security risk"]
    style B6 fill:#ffcdd2,stroke:#d32f2f,stroke-width:2px
</pre>

<p>There are also two separate checks: <code>LogoutTracker.h()</code> looks for <code>su</code> at two fixed paths, and <code>GetDeviceInfoHandler.a()</code> checks <code>/system/bin/su</code> and <code>/system/xbin/su</code>, puts the result into the <code>root</code> field of the device info, and returns it through a JS callback. The code alone doesn’t show whether this is uploaded to a server, so I won’t draw a conclusion.</p>
<p>The code only shows that these six checks exist, not which one my phone hits. So I made a temporary diagnostic build that hooks the detection method itself and only logs each return value, installed it, and did one cold start:</p>
<table>
  <thead>
      <tr>
          <th>Check</th>
          <th>Measured result</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>su</code> file in PATH directories</td>
          <td>false</td>
      </tr>
      <tr>
          <td><code>persist.sys.root.status</code> property</td>
          <td>false</td>
      </tr>
      <tr>
          <td><code>ro.secure=0</code></td>
          <td>false</td>
      </tr>
      <tr>
          <td><code>Build.TAGS</code> contains <code>test-keys</code></td>
          <td>false</td>
      </tr>
      <tr>
          <td>Emulator traits (<code>goldfish</code>, <code>ranchu</code>, <code>sdk_gphone</code>, etc.)</td>
          <td>false</td>
      </tr>
      <tr>
          <td>Query for <code>me.weishu.kernelsu</code></td>
          <td><strong>true</strong></td>
      </tr>
      <tr>
          <td>Final verdict</td>
          <td><strong>true</strong></td>
      </tr>
  </tbody>
</table>
<p>The first five were false; the hit was number six, the package-name query for the KernelSU manager. That’s also why hiding su and changing properties didn’t help: none of them touched this check. After the test I removed the diagnostic build and reinstalled the release module.</p>

<h2 class="relative group">The permission was denied, so why does the query work?
    <div id="the-permission-was-denied-so-why-does-the-query-work" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-permission-was-denied-so-why-does-the-query-work" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I really hadn’t given WPS the “read app list” permission, and it still found KernelSU, because these are two separate mechanisms.</p>
<p>The vendor’s “read app list” setting controls enumerating all apps on the device. Package visibility, introduced in Android 11, lets an app name packages in the Manifest’s <code><queries></code>, and for those named packages it can check whether they’re installed without any runtime permission. WPS’s <code><queries></code> lists KernelSU, Magisk, and APatch, and the system’s visibility records show the two packages as mutually visible. So tapping “deny” in the permission panel does nothing against these named queries.</p>
<p>This check also doesn’t justify the words “security risk”: having a manager app installed counts as a hit, without checking whether WPS could actually get root; emulator traits count as rooted too, which emulator users probably wouldn’t expect.</p>

<h2 class="relative group">Making the query return “not installed”
    <div id="making-the-query-return-not-installed" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#making-the-query-return-not-installed" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Since the check is a package-name query, WPS just needs to not find the package. There were three options:</p>
<table>
  <thead>
      <tr>
          <th>Option</th>
          <th>Approach</th>
          <th>Cost</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>App-list hiding module</td>
          <td>Hide chosen package names from WPS</td>
          <td>Mostly older APIs; needs on-device testing on new Android</td>
      </tr>
      <tr>
          <td>Extend my module</td>
          <td>Intercept package queries in WPS’s process, return “not installed”</td>
          <td>Write and maintain it myself</td>
      </tr>
      <tr>
          <td>Patch the APK, strip <code><queries></code></td>
          <td>Re-sign and install</td>
          <td>Breaks updates and signature checks; not for daily use</td>
      </tr>
  </tbody>
</table>
<p>I was planning to write another API 102 package-visibility filter module, then found that <a href="https://modules.lsposed.org/module/com.tsng.hidemyapplist/"  target="_blank" rel="noreferrer">Hide My Applist</a> (HMA) already does exactly this, so there was no need.</p>
<p>The configuration has two entries: a blacklist template containing only <code>me.weishu.kernelsu</code>, and an app rule applying it to WPS only, with aggressive filtering and verbose logging off. To verify, I turned off the “WPS Root 提示隐藏” module, force-stopped WPS, and reopened it: no warning. The package query was blocked and all six checks returned false. Other entry points using the same check fail the same way, while the original module only covered the home page.</p>
<p>HMA 3.8.3 targets libxposed API 101 and requires the framework to allow loading native libraries in system services. It works on my Android 16 + LSPosed 2.2.1 setup.</p>

<h2 class="relative group">Was the module a waste?
    <div id="was-the-module-a-waste" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#was-the-module-a-waste" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Looking back, I should have searched for existing solutions first. But without digging out the six checks, I wouldn’t have known the trigger was a package-name query, let alone that one HMA template would fix it.</p>
<p>The <a href="https://github.com/ferstar/wps-root-toast"  target="_blank" rel="noreferrer">wps-root-toast repository</a> is now archived. Its README includes the tested HMA configuration, and the source and released APK remain available for reference.</p>
<p>The module isn’t entirely wasted. If you only want this warning gone without changing package visibility, it still works on its own, and the diagnostic build was made from its code.</p>
<p>Decompiling and hooking were only done on the WPS on my own phone. The module only hides the toast and doesn’t change detection results, and the repository contains no WPS code. The release notes only list the tested combination: Android 16 + WPS 26.9.1 + LSPosed 2.2.1.</p>
<p>Later Yadea started policing VPNs too, with its check hidden behind a packer. That one is in the <a href="/en/posts/how-to-avoid-yadea-vpn-detection/" >next post</a>.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Running Qwen3.8-Flash-Next on a 4090 24GB: Replacing Ollama with Strata</title>
      <link>https://blog.ferstar.org/en/posts/qwen38-flash-next-strata-4090/</link>
      <pubDate>Sun, 04 Oct 2026 13:24:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/qwen38-flash-next-strata-4090/</guid>
      <description>Ollama’s Qwen3.8 27B filled the 4090, and code-analysis generation fell off a cliff. Strata running Qwen3.8-Flash-Next still fits a 256K context, with median decode around 100–110 tok/s on code-analysis traffic.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>The machine at home is an MSI Z790 GAMING PLUS WIFI. The CPU is an i9-14900KF: 8 P-cores and 16 E-cores, 32 threads, P-core turbo up to 6.0 GHz, E-core up to 4.4 GHz, AVX2 and no AVX-512. Memory is four 32 GB DDR5 DIMMs, ADATA XPG <code>AX5U6000C3032G</code>, rated DDR5-6000 CL30, dual channel, dual rank on each stick. They are running at 4000 MT/s, and the OS sees about 125 GiB. The GPU is an RTX 4090 D 24 GB.</p>
<p>It had been running <code>qwen3.8:27b-q4_1</code> in Ollama: about 17 GB of weights, VRAM around 22 GB once KV is included, and a 256K context. Short replies were still usable. On code analysis, long generations fell off a cliff.</p>
<p>Qwen3.8-Flash-Next is a 512-expert MoE. The BF16 weights are over 300 GB, but each token activates only a small slice of them. The official quant is ISTA-DASLab GSQ-RCO. I used <a href="https://github.com/Niko1221/Strata"  target="_blank" rel="noreferrer">Strata</a> for inference: experts stay in RAM, and the GPU only caches the ones used often. That matches a 24 GB card with a lot of system RAM.</p>
<p>After the switch, the same 4090 D decodes at about 100–110 tok/s median. A cold prefill of twenty to thirty thousand tokens sits around 2500–2800 tok/s. Context is the trained length, 262144. The service handles one request at a time.</p>
<p>RAM and VRAM split roughly like this:</p>
<pre class="not-prose mermaid">
flowchart LR
  subgraph host["126 GB RAM"]
    E["Experts ~45–50 GB"]
    KV["int8 KV past 32K<br/>~3.09 GiB pinned"]
  end
  subgraph gpu["4090 D 24 GB"]
    C["Hot expert cache ~16 GB"]
    R["32768 resident KV cells per QSA layer"]
  end
  Req["OpenAI / Anthropic requests"] --> S["Strata serve :8080"]
  S --> C
  S --> E
  S --> R
  S --> KV
</pre>


<h2 class="relative group">Which quant
    <div id="which-quant" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#which-quant" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><code>./setup.sh --yes</code> picks the size from RAM alone. Above 60 GB it installs GSQ-RCO <code>IQ3_XXS</code>. The docs recommend <code>IQ2_XS</code> for a 64 GB machine and <code>IQ3_S</code> above 96 GB. On this 126 GB box the installer would pick XXS and the docs would pick S.</p>
<p>The limit here is VRAM. The 24 GB only holds the experts that are used often. All three quants fit in RAM, and 256K context fits too. The 14900KF has AVX2 and no AVX-512, so <code>Q2_0</code> cannot use Strata’s fastest CPU kernels. I left that size out.</p>
<p>I tried Unsloth <code>UD-IQ3_XXS</code> first. ModelScope has it, about 76 GB. Later I switched to official GSQ-RCO <code>IQ3_S</code>: two shards, 83.6 GB, SHA-256 checked after download. The Ollama files are still on disk. <code>strata.service</code> has <code>Conflicts</code> set, so a reboot does not have both fighting for the GPU.</p>

<h2 class="relative group">Problems during setup
    <div id="problems-during-setup" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#problems-during-setup" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">Linux build, through 0.1.38
    <div id="linux-build-through-0138" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#linux-build-through-0138" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Strata 0.1.35 and 0.1.36 GitHub Releases only ship Windows builds. 0.1.38 still ships only the Windows NVIDIA zip and the Windows HIP zip. There is no <code>strata-linux-x64.zip</code>, so the engine has to be compiled locally. The 0.1.38 build on this machine used CUDA 12.0 and g++ 13.3, arch <code>sm_89</code>. The binary is <code>engine/strata</code>.</p>
<p>systemd runs the service. It listens on <code>0.0.0.0:8080</code>, and <code>/v1/*</code> needs an API key. The APIs are OpenAI Chat Completions and Anthropic Messages. There is no legacy <code>/v1/completions</code> and no embeddings. Requests are FIFO, one at a time.</p>

<h3 class="relative group">The engine rejects Unsloth’s embedding format
    <div id="the-engine-rejects-unsloths-embedding-format" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-engine-rejects-unsloths-embedding-format" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The official installer only accepts the ISTA filenames. Unsloth <code>UD-IQ3_XXS</code> is refused by <code>gguf_unsupported()</code>. The expert tensors in the shards are IQ2_S / IQ3_S / IQ4_NL, and the CUDA kernels do cover those. The actual break is <code>token_embd.weight</code>: Unsloth stores Q6_K (ggml type 14), and Strata embeddings only accept i-quants or BF16.</p>
<p>I dequantized that Q6_K tensor to a separate BF16 file with llama.cpp’s gguf-py and pointed the engine at it with <code>--embd-gguf</code>. The header <code>ne</code> has to be <code>(2560, 248320)</code> so it matches the layout the engine expects. The output head is also Q6_K, but it uses native mmvq and does not need the conversion.</p>
<p>The MTP draft head is taken from Qwen’s official BF16 weights, packed as <code>mtp/rt</code>, with <code>--spec 4</code>. The CJK draft vocab goes in the same directory.</p>

<h3 class="relative group">Context from 128K to 256K
    <div id="context-from-128k-to-256k" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#context-from-128k-to-256k" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>On a 24 GB card, setup defaults to <code>--max-context 131072</code>. The trained length is 262144, and YaRN is only needed past that, so I set 262144 and added <code>--kv int8 --kv-resident 32768</code>. Each QSA layer keeps 32K KV cells in VRAM. The rest sits in pinned RAM, about 3.09 GiB. VRAM stays around 23900 MiB. Moving from 128K to 256K barely changes it.</p>
<p>There is no separate cap on one generation. Omit <code>max_tokens</code>, or pass 0 / -1, and it writes until <code>262144 − 8 − prompt length</code>. Thinking tokens count against that.</p>

<h3 class="relative group">Turning zram off
    <div id="turning-zram-off" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#turning-zram-off" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Once the service was up, RAM use was about 65 GB with 60 GB free, and the model process had <code>VmSwap</code> at 0. That looked fine. <code>zramswap.service</code> was still on: 62.8 GB of lz4, <code>vm.swappiness=100</code>. The expert pages are not mlock’d. If RAM gets tight they can be compressed into zram, and an expert miss then has to decompress before the multiply.</p>
<p>This machine has no disk swap, and the free RAM is enough, so I ran <code>systemctl disable --now zramswap</code>. If memory really runs out, an OOM is easier to read than a decompress in the middle of a generation.</p>

<h3 class="relative group">Fused prefill kernels
    <div id="fused-prefill-kernels" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#fused-prefill-kernels" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The 0.1.36 release notes say Q2_0 fused int8 tensor-core prefill is 16–22% faster on a 5070. IQ2_XS / IQ3_XXS / IQ3_S only take that path with <code>STRATA_PF_FUSED=1</code>. It is off by default because IQ3 barely moves.</p>
<p>I turned it on anyway. On IQ3, prefill did not get clearly faster and decode did not get slower, so it stayed on. The first longer cold prefill after that logs <code>prompt experts on the fused int8 kernels</code>.</p>

<h2 class="relative group">Measurements
    <div id="measurements" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#measurements" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The numbers below come from the code-analysis load taken while the engine was still 0.1.36, with fused prefill already on. The move to 0.1.38 left <code>strata-iq3_s.json</code> unchanged and was not measured again. The same task was run once more on 0.1.39; that round is in the next section. The 0.1.38 release notes put the IQ3_S speed A/B against 0.1.37 at +0.2% and +0.1%, with the same answers as the previous version.</p>
<p>Two numbers in the log are easy to mix up. <code>prompt 25141 tokens = 0 reused + 25141 read</code> is the prefix cache: <code>reused</code> is the prefix that already has KV, and a higher share means a shorter prefill. <code>drafts accepted 919 of 1329</code> is MTP speculative decoding: the draft head guesses, the main model checks, and a higher accept rate means faster decode. Code and lists often land around 80–90%. Ordinary prose is about half.</p>
<p>Prefill tok/s on a short prompt is not very useful. A few dozen tokens are mostly fixed overhead, so the rate looks like a few hundred tok/s. A cancelled request can log tens of thousands of tok/s because it did not finish. Those rows were dropped.</p>
<p>Both quants used the same settings: 256K context, int8 KV, resident 32768, <code>--spec 4</code>, fused on. UD-IQ3_XXS is 107 requests, IQ3_S is 58. Both runs pointed 5 subagents at a project of about the same size. Decode counts only replies of 50 tokens or more. Prefill counts only the part that missed the prefix cache and was at least 2k tokens.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th style="text-align: right">UD-IQ3_XXS</th>
          <th style="text-align: right">GSQ-RCO IQ3_S</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>decode p50</td>
          <td style="text-align: right">100.7 tok/s</td>
          <td style="text-align: right">111.7 tok/s</td>
      </tr>
      <tr>
          <td>decode p90</td>
          <td style="text-align: right">119.5 tok/s</td>
          <td style="text-align: right">133.3 tok/s</td>
      </tr>
      <tr>
          <td>decode max</td>
          <td style="text-align: right">148.2 tok/s</td>
          <td style="text-align: right">147.9 tok/s</td>
      </tr>
      <tr>
          <td>prefill p50 (miss, 20k–40k)</td>
          <td style="text-align: right">2781 tok/s</td>
          <td style="text-align: right">2785 tok/s</td>
      </tr>
      <tr>
          <td>prefill p50 (miss, ≥2k)</td>
          <td style="text-align: right">2564 tok/s</td>
          <td style="text-align: right">2549 tok/s</td>
      </tr>
      <tr>
          <td>draft accept</td>
          <td style="text-align: right">74.9%</td>
          <td style="text-align: right">71.5%</td>
      </tr>
      <tr>
          <td>whole exploration</td>
          <td style="text-align: right">about 12 min</td>
          <td style="text-align: right">about 8 min</td>
      </tr>
      <tr>
          <td>max context</td>
          <td style="text-align: right">93057</td>
          <td style="text-align: right">56199</td>
      </tr>
      <tr>
          <td>VRAM</td>
          <td style="text-align: right">~23976 MiB</td>
          <td style="text-align: right">~23950–23978 MiB</td>
      </tr>
  </tbody>
</table>
<!-- ai-lint: ok 2900 official 3090 range endpoint, same digits as the later 0.1.39 prefill p50, not a second reading of that cell -->
<p>Prefill is about the same on both. In the UD run, one 89517-token prompt missed the cache entirely: prefill took 29.9 seconds, 2998 tok/s. That lines up with the official 3090 figure, about 2200–2900 tok/s for a 30k cold prefill.</p>
<p>Official IQ3_S is ahead across the board. Decode is higher at both p50 and p90, and the whole exploration dropped from about 12 minutes to 8. The official 5070 12GB table has IQ3_S slower than IQ3_XXS (53 vs 62 tok/s).</p>
<p>While it is working, GPU utilization is 98–100%, power 270–300 W, with a peak of 346 W. VRAM sits against the 24 GB limit. In a stretch of continuous use, the GPU is busy about two thirds of the time.</p>

<h2 class="relative group">Retest after moving to 0.1.39
    <div id="retest-after-moving-to-0139" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#retest-after-moving-to-0139" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>On October 5 the engine moved from 0.1.38 to 0.1.39, tag v0.1.39, commit 6f32ec0. GitHub still has no <code>strata-linux-x64.zip</code>. The Windows assets are CUDA 13, an experimental CUDA 12 build, and HIP. The checkout is detached, so <code>git pull --ff-only</code> inside <code>update.sh</code> fails. I stopped the service, ran <code>git fetch --tags</code>, then <code>git checkout --detach v0.1.39</code>, then <code>./setup.sh --update</code>, and compiled locally for sm_89. Nothing in <code>strata-iq3_s.json</code> changed. Parallel slots stayed off, and so did vision. This release also stops after 256 copies of the same token, can reload the last context when the engine actually restarts, and adds the Responses API for Codex. This run was a speed check, and it did not hit those.</p>
<p>The 0.1.39 decode speedup runs only when every expert of a layer is in VRAM. This 4090 cannot hold that. Startup still puts 46.84 GiB of expert weights in an arena in RAM, and the hot cache is the same as 0.1.38: 8563 slots, 16.24 GiB. This run hit 90.7%, and about 4.2% of the lookups were read by the GPU from RAM over PCIe. The prompt chunk stayed at 8192. The log mentions a 512-slot ring, and the chunk for this task did not change. After load, 253 MiB of VRAM was free.</p>
<p>The prompt was the same line: open 5 subagents and look at this project, and the project was the same one. The stopwatch is the whole task. Prefill plus decode in the log is about a second off that clock. Both stretches end at the <code>prompt 276</code> line that generated 96 tokens, and the table is those two stretches. A continuation of about 60k tokens right after the upgrade is not included.</p>
<p>The IQ3_S column above, 58 requests and about 8 minutes, is an earlier aggregate. This stopwatch is a different stretch. The first request of this round still had 16384 tokens of KV from the previous chat, so prefill recomputed 9246. Decode throughput is generated tokens divided by decode time. The 20k–40k prefill median is 16 requests on each side.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th style="text-align: right">v0.1.36</th>
          <th style="text-align: right">v0.1.39</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>stopwatch</td>
          <td style="text-align: right">9 min 27 s</td>
          <td style="text-align: right">8 min 56 s</td>
      </tr>
      <tr>
          <td>requests</td>
          <td style="text-align: right">47</td>
          <td style="text-align: right">44</td>
      </tr>
      <tr>
          <td>prefill total</td>
          <td style="text-align: right">330.0 s</td>
          <td style="text-align: right">317.0 s</td>
      </tr>
      <tr>
          <td>decode total</td>
          <td style="text-align: right">237.9 s</td>
          <td style="text-align: right">220.1 s</td>
      </tr>
      <tr>
          <td>generated tokens</td>
          <td style="text-align: right">26821</td>
          <td style="text-align: right">23338</td>
      </tr>
      <tr>
          <td>read tokens</td>
          <td style="text-align: right">855873</td>
          <td style="text-align: right">873406</td>
      </tr>
      <tr>
          <td>decode p50</td>
          <td style="text-align: right">115.1 tok/s</td>
          <td style="text-align: right">106.9 tok/s</td>
      </tr>
      <tr>
          <td>decode p90</td>
          <td style="text-align: right">133.7 tok/s</td>
          <td style="text-align: right">125.8 tok/s</td>
      </tr>
      <tr>
          <td>decode throughput</td>
          <td style="text-align: right">112.7 tok/s</td>
          <td style="text-align: right">106.0 tok/s</td>
      </tr>
      <tr>
          <td>prefill p50 (miss, ≥2k)</td>
          <td style="text-align: right">2594 tok/s</td>
          <td style="text-align: right">2761 tok/s</td>
      </tr>
      <tr>
          <td>prefill p50 (miss, 20k–40k)</td>
          <td style="text-align: right">2795 tok/s</td>
          <td style="text-align: right">2900 tok/s</td>
      </tr>
      <tr>
          <td>draft accept</td>
          <td style="text-align: right">72.5%</td>
          <td style="text-align: right">71.9%</td>
      </tr>
  </tbody>
</table>
<p>The stopwatch was 31 seconds shorter. Long prefills were a bit faster, and read tokens went up a little. Decode p50, p90, and throughput are all lower. The total came down mostly because this round wrote fewer tokens. Draft accept is about the same. On this card, for this kind of code scan, 0.1.39 barely moves the speed.</p>

<h2 class="relative group">How many people
    <div id="how-many-people" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-many-people" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The service handles one request at a time. <code>/v1/status</code> shows <code>serving: 1</code>, and later requests queue.</p>
<p>For code analysis, the median hold is about 5–9 seconds, with an occasional 30–50 second answer. Two or three people at once is still workable. An agent that keeps sending requests can fill the queue by itself. On a different large repo, with no prefix cache hit, a 90k prefill alone is about 30 seconds.</p>

<h2 class="relative group">Compared with the Ollama 27B
    <div id="compared-with-the-ollama-27b" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#compared-with-the-ollama-27b" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I did not re-measure the old Ollama 27B on this machine. The gap felt like a cliff, mostly from MoE sparse activation and MTP, and the model itself is different.</p>

<h2 class="relative group">Compared with two DGX Sparks
    <div id="compared-with-two-dgx-sparks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#compared-with-two-dgx-sparks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><a href="/en/posts/dgx-spark-agent-inference/" >Last time</a>, two DGX Sparks ran <code>MiMo-V2.6-Flash</code>. A short prompt decoded at about 44 tok/s on one stream, and six concurrent streams totaled 173 tok/s. On a real code scan, one stream fell to 15–25 tok/s and still had not finished a subtask after six minutes. Those machines have 128 GB of unified memory at 273 GB/s. A 24 GB 4090 has the bandwidth, and nowhere to put the model.</p>
<p>Strata keeps the experts in RAM and the hot ones in VRAM. Different model, same job: reading code. Median decode here is over 100 tok/s. This is way harder than Spark. Watching Qwen3.8-Flash-Next run like this on a 4090, it felt like watching an atomic bomb go off. The traditional software industry really is dead.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Losslessly Carrying a Long-Served Arch System to New Hardware with btrfs send/receive</title>
      <link>https://blog.ferstar.org/en/posts/btrfs-send-receive-system-migration/</link>
      <pubDate>Mon, 28 Sep 2026 11:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/btrfs-send-receive-system-migration/</guid>
      <description>Dreading a reinstall just because you swapped disks or machines? This post documents the complete workflow of online-migrating an Arch system with read-only btrfs snapshots plus send/receive: the four UUID touchpoints, boot rebuild, and the hardware-difference checklist you need for a true cross-machine move.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>I have an Arch system that has followed me since my ThinkPad days. Years of accumulated package lists, zsh setup, and dotfiles make a reinstall a genuinely painful prospect. In 2023 I did two full system migrations: one disk swap on the same machine, one from a SATA drive to NVMe. Both used the same approach: <strong>btrfs read-only snapshots plus send/receive</strong>. This post lays out the exact sequence I used, along with what to watch out for when moving to genuinely different hardware.</p>

<h2 class="relative group">Why not rsync
    <div id="why-not-rsync" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-not-rsync" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>rsync moves files, but it cannot carry three things that matter on btrfs:</p>
<ul>
<li>Subvolume structure. My layout splits root, home, and caches across five sibling subvolumes (<code>@</code>, <code>@home</code>, <code>@var@cache</code>, <code>@var@log</code>, <code>@var@lib@docker</code>). After rsync they become plain directories; the subvolume boundaries are gone.</li>
<li>Data verification. Every btrfs block has a checksum. send/receive streams filesystem instructions, so the data is trustworthy the moment it lands — no post-copy comparison pass needed.</li>
<li>Compression. My drives are mounted with <code>compress-force=zstd</code>. send/receive preserves filesystem semantics instead of decompressing and recompressing at the target the way rsync would.</li>
</ul>
<p>And since snapshots are copy-on-write, taking a read-only snapshot is near-instant while the system keeps running — that is what makes this an online migration.</p>

<h2 class="relative group">Clean the junk before snapshotting
    <div id="clean-the-junk-before-snapshotting" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#clean-the-junk-before-snapshotting" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The snapshot ships the whole subvolume — garbage carried over is still garbage, only slower to send and more crowded on the target. Before snapshotting, it is worth walking through:</p>
<ul>
<li>Package caches: <code>pacman -Sc</code>, plus the AUR helper’s build cache (e.g. <code>~/.cache/yay</code> — usually the biggest offender)</li>
<li>Orphaned packages: <code>pacman -Rns $(pacman -Qtdq)</code></li>
<li>System journals: <code>journalctl --vacuum-size=100M</code></li>
<li>User caches (browser caches under <code>~/.cache</code> and the like) and the trash</li>
</ul>
<p>Clean first, then snapshot — the transferred volume drops noticeably. The gig-plus of AUR build cache I cleaned out last time would otherwise have been shipped along for free.</p>

<h2 class="relative group">The complete sequence
    <div id="the-complete-sequence" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-complete-sequence" aria-label="Anchor">#</a>
    </span>
    
</h2>
<pre class="not-prose mermaid">
flowchart LR
    A[Mount source/target] --> B[RO snapshot per subvolume]
    B --> C[send piped to receive]
    C --> D[Promote snapshots to writable subvolumes]
    D --> E[Replace UUIDs: fstab/timeshift/grub]
    E --> F[Mount ESP, register boot entry]
    F --> G[sync, unmount, reboot into new disk]
</pre>

<p>One set of mount options used throughout:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">compress-force=zstd,noatime,ssd,space_cache=v2</span></span></code></pre></div></div>

<h3 class="relative group">1. Mount source and target
    <div id="1-mount-source-and-target" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-mount-source-and-target" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo mount -t btrfs -o compress-force<span class="o">=</span>zstd,noatime,ssd,space_cache<span class="o">=</span>v2 /dev/sda2 /tmp/src
</span></span><span class="line"><span class="cl">sudo mount -t btrfs -o compress-force<span class="o">=</span>zstd,noatime,ssd,space_cache<span class="o">=</span>v2 /dev/nvme0n1p4 /tmp/dst</span></span></code></pre></div></div>

<h3 class="relative group">2. Take a read-only snapshot of every subvolume
    <div id="2-take-a-read-only-snapshot-of-every-subvolume" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-take-a-read-only-snapshot-of-every-subvolume" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>send only accepts read-only snapshots:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="k">for</span> i in <span class="k">$(</span>ls -d @* <span class="p">|</span> grep -v _ub<span class="k">)</span><span class="p">;</span> <span class="k">do</span> sudo btrfs subvolume snapshot -r <span class="nv">$i</span> <span class="si">${</span><span class="nv">i</span><span class="si">}</span>_ro<span class="p">;</span> <span class="k">done</span></span></span></code></pre></div></div>

<h3 class="relative group">3. Send each one
    <div id="3-send-each-one" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-send-each-one" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo btrfs send @_ro <span class="p">|</span> sudo btrfs receive /tmp/dst
</span></span><span class="line"><span class="cl">sudo btrfs send @var@log_ro <span class="p">|</span> sudo btrfs receive /tmp/dst
</span></span><span class="line"><span class="cl">sudo btrfs send @var@cache_ro <span class="p">|</span> sudo btrfs receive /tmp/dst
</span></span><span class="line"><span class="cl">sudo btrfs send @var@lib@docker_ro <span class="p">|</span> sudo btrfs receive /tmp/dst</span></span></code></pre></div></div>

<h3 class="relative group">4. Promote the snapshots
    <div id="4-promote-the-snapshots" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-promote-the-snapshots" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>What receive produces are read-only subvolumes named <code>@_ro</code> and so on. Take a writable snapshot of each to get the real <code>@</code>, then delete the <code>_ro</code> intermediates:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="k">for</span> i in <span class="k">$(</span>ls -d *_ro<span class="k">)</span><span class="p">;</span> <span class="k">do</span>
</span></span><span class="line"><span class="cl">  sudo btrfs subvolume snapshot <span class="nv">$i</span> <span class="k">$(</span><span class="nb">echo</span> <span class="nv">$i</span> <span class="p">|</span> cut -d <span class="s1">'_'</span> -f 1<span class="k">)</span>
</span></span><span class="line"><span class="cl">  sudo btrfs subvolume delete <span class="nv">$i</span>
</span></span><span class="line"><span class="cl"><span class="k">done</span></span></span></code></pre></div></div>

<h3 class="relative group">5. Replace UUIDs
    <div id="5-replace-uuids" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#5-replace-uuids" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The most error-prone part of the whole flow. The new partition has a new UUID; look it up with <code>blkid</code>, then sed-replace the old one everywhere. There are four places to touch:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">etc/fstab                     # mount table
</span></span><span class="line"><span class="cl">etc/timeshift/timeshift.json  # snapshot tool
</span></span><span class="line"><span class="cl">boot/grub/grub.cfg            # boot config
</span></span><span class="line"><span class="cl">boot/grub/grub-btrfs.cfg      # btrfs snapshot boot menu</span></span></code></pre></div></div>

<h3 class="relative group">6. Handle the ESP and boot entry
    <div id="6-handle-the-esp-and-boot-entry" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#6-handle-the-esp-and-boot-entry" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo mount /dev/nvme0n1p1 /tmp/dst/@/boot/efi
</span></span><span class="line"><span class="cl">sudo efibootmgr -c -d /dev/nvme0n1 -p <span class="m">1</span> -L <span class="s2">"Arch"</span> -l <span class="s1">'\efi\boot\bootx64.efi'</span></span></span></code></pre></div></div>

<h3 class="relative group">7. Wrap up and switch over
    <div id="7-wrap-up-and-switch-over" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#7-wrap-up-and-switch-over" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sync
</span></span><span class="line"><span class="cl">sudo umount /tmp/dst/@/boot/efi
</span></span><span class="line"><span class="cl">sudo umount /tmp/dst
</span></span><span class="line"><span class="cl">reboot
</span></span><span class="line"><span class="cl">sudo efibootmgr -v   <span class="c1"># verify the boot entry after reboot</span></span></span></code></pre></div></div>

<h2 class="relative group">Online migration costs and boundaries
    <div id="online-migration-costs-and-boundaries" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#online-migration-costs-and-boundaries" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The migration requires no downtime. The snapshot is instant; the system keeps running normally no matter how long send/receive takes; the fstab and grub edits happen on copies that live on the target disk, unrelated to the running system. The only interruption is the final reboot into the new disk — and booting from a swapped disk requires a reboot anyway, so that is not really a migration cost.</p>
<p>A few writes that land on the old disk after the snapshot (fresh logs and the like) are intentionally left behind. For a home machine that loss is irrelevant, so I did not bother with incremental send (<code>send -p</code>) to bridge the gap. Only when migrating a database that cannot stop would you need the two-phase approach: full send first, then one incremental pass right before cutover.</p>

<h2 class="relative group">Moving to genuinely different hardware
    <div id="moving-to-genuinely-different-hardware" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#moving-to-genuinely-different-hardware" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Both migrations above were disk swaps on the same machine, which skips the hardest part: hardware differences. The <a href="https://wiki.archlinux.org/title/Migrate_installation_to_new_hardware"  target="_blank" rel="noreferrer">ArchWiki migration guide</a> says this well; when switching machines, walk through:</p>
<ul>
<li>CPU vendor change (Intel ↔ AMD): swap the microcode package (<code>intel-ucode</code> / <code>amd-ucode</code>)</li>
<li>GPU vendor change: swap the graphics driver</li>
<li>Boot mode differences: the target machine’s UEFI setup may differ (CSM off, Secure Boot state); create a new ESP if needed and re-register the boot entry</li>
</ul>
<p>Two improvements I plan to make next time:</p>
<ol>
<li>Regenerate fstab and grub config instead of hand-sedding them. Use <code>genfstab -U /mnt</code> for the mount table, and run <code>grub-mkconfig -o /boot/grub/grub.cfg</code> in a chroot on the target. A hand-edited grub.cfg always risks being overwritten by a future grub upgrade.</li>
<li>Use <code>btrfs send --proto 2 --compressed-data</code> (needs btrfs-progs 6.0+ and kernel 6.0+; any current Arch qualifies). It transfers zstd-compressed blocks directly without a decompress-recompress round trip, which saves real time on cross-machine transfers.</li>
</ol>
<p>One more trap worth writing down: btrfs snapshots are not recursive. A nested subvolume appears as an empty directory inside a snapshot. My five subvolumes are all siblings at the top level so this never bites me, but if I ever nest a subvolume inside <code>@home</code>, it needs separate handling before send.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Dual DGX Sparks for Agent Workloads: Great Benchmarks, Crawling Reality</title>
      <link>https://blog.ferstar.org/en/posts/dgx-spark-agent-inference/</link>
      <pubDate>Sun, 27 Sep 2026 08:25:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/dgx-spark-agent-inference/</guid>
      <description>Benchmarking MiMo-V2.6-Flash on two DGX Sparks hits 173 tok/s aggregate with 6 concurrent short prompts. But throw 5 sub-agents at a real codebase, and single-stream speed plummets to 15–25 tok/s, taking over 6 minutes without completing a single task.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Social media and YouTube are flooded with dual DGX Spark (GB10) benchmark videos, each title more hyped than the last: “170+ Tokens/sec!” and “Datacenter AI on Your Desk.”</p>
<p>A few days ago, I wired up two DGX Sparks directly using QSFP copper DAC cables, grabbed the community recipe, and spun up <code>MiMo-V2.6-Flash</code> with Tensor Parallelism (TP=2). But I didn’t set this up to benchmark <code>Hello World</code>. I only had one practical question: <strong>Can this thing actually plug into my daily coding agent as the primary model?</strong></p>
<p>The short answer: <strong>It’s totally fine for single-user turn-by-turn chat. But if you expect to run concurrent sub-agents or scan large codebases, forget it.</strong></p>
<hr>

  



<div
  
    class="flex px-4 py-3 rounded-md shadow bg-primary-100 dark:bg-primary-900"
  
  >
  <span
    
      class="text-primary-400 pe-3 flex items-center"
    
    >
    <span class="relative block icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span>
  </span>

  <span
    
      class="dark:text-neutral-300"
    
    ><p><strong>2026-10 Update</strong>: If you happen to have an RTX 4090 and plenty of system RAM (like 128 GB), take a look at the alternative: <a href="/en/posts/qwen38-flash-next-strata-4090/" >running Qwen3.8-Flash-Next with Strata</a>. It keeps most experts in system memory and hot caches in 4090 VRAM. Under the same real-world code scanning workloads, median decode breaks right past 100 tok/s with cold prefill near 2800 tok/s.</p>
<p>Brace for impact.</p>
</span>
</div>

<hr>

<h2 class="relative group">200G Ports and Memory Bandwidth
    <div id="200g-ports-and-memory-bandwidth" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#200g-ports-and-memory-bandwidth" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When people see two 200G ports on each machine, their immediate assumption is often that dual-rail aggregation reaches 400G and inter-node communication won’t be a bottleneck.</p>
<p>Run <code>ethtool</code> and <code>lspci</code> once and the actual layout is clear:</p>
<ol>
<li>
<p><strong>The physical inter-node bandwidth ceiling is ~200 Gb/s</strong>: The two machines connect directly via dual QSFP DAC cables—no switch, and no inter-node NVLink. While <code>ethtool</code> reports <code>200000Mb/s</code> on both ports, the ConnectX-7 behind each port is only wired to PCIe Gen5 x4 (<code>32GT/s, Width x4</code>). The unidirectional theoretical max is only about 126 Gb/s:</p>
<p><code>32 × 4 × (128/130) ÷ 8 ≈ 15.8 GB/s ≈ 126 Gb/s</code></p>
<p>With <code>ib_write_bw</code>, a single cable saturates at ~99.7 Gb/s, and dual rails run at 97.9 + 97.9 ≈ 196 Gb/s aggregate.</p>
</li>
<li>
<p><strong>Memory bandwidth is the bottleneck</strong>: DGX Spark uses unified memory with 128 GB LPDDR5X per node, delivering 273 GB/s of bandwidth.
Compare that against mainstream hardware:</p>
<ul>
<li>RTX 4090: 1008 GB/s (24 GB VRAM)</li>
<li>Mac Studio M4 Max: 410–546 GB/s</li>
<li>Mac Studio M3 Ultra: 819 GB/s</li>
</ul>
</li>
</ol>
<p>DGX Spark’s strength is large unified memory capacity, which lets you shard an oversized model across two nodes via TP=2. But decode speed remains limited by the 273 GB/s memory bandwidth.</p>
<hr>

<h2 class="relative group">Short Prompt Benchmarks
    <div id="short-prompt-benchmarks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#short-prompt-benchmarks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Running standard benchmark scripts with fixed 128-token short prompts and <code>ignore_eos</code> enabled:</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Concurrency</th>
          <th style="text-align: center">Aggregate Throughput (tok/s)</th>
          <th style="text-align: left">Latency & Per-Stream Decode</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left"><strong>1</strong></td>
          <td style="text-align: center">37.1</td>
          <td style="text-align: left">Single-stream decode ~43.8 tok/s</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>2</strong></td>
          <td style="text-align: center">73.6</td>
          <td style="text-align: left">Linear scaling</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>4</strong></td>
          <td style="text-align: center">127.4</td>
          <td style="text-align: left">Decent multi-stream scaling</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>6</strong></td>
          <td style="text-align: center">172.7</td>
          <td style="text-align: left">Peak aggregate throughput, batch finished in 4.5s</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>8</strong></td>
          <td style="text-align: center">79.8</td>
          <td style="text-align: left">Wall time 12.8s, per-stream decode scattered from 10 to 47 tok/s</td>
      </tr>
  </tbody>
</table>
<p>Six-way concurrency hits peak aggregate throughput. At eight streams the aggregate throughput drops, and per-stream rates scatter, though no scheduler error was reported. Idle single-stream decode touches about 54 tok/s. Normal pair-programming chat, with prefix-cache hits around 90%, stays around 35–45 tok/s.</p>
<p>Many online reviews measure these idle, short requests of a few hundred bytes, where each stream decodes independently without contention.</p>
<hr>

<h2 class="relative group">Real Workloads: 5 Sub-Agents Scanning a Codebase
    <div id="real-workloads-5-sub-agents-scanning-a-codebase" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#real-workloads-5-sub-agents-scanning-a-codebase" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Next, I hooked the setup into my daily Coding Agent environment and spawned 5 sub-agents to concurrently explore a medium-sized open-source repo.</p>
<p>The backend monitoring looked completely healthy: HTTP 200 everywhere, queue depth zero.</p>
<p>Then checking actual progress in the terminal: single-stream generation dropped to 15–25 tok/s. After 6 full minutes, not a single sub-agent summary had finished streaming.</p>
<p>What that session recorded: HTTP 200, queue depth 0, 15–25 tok/s per stream, and no final answer after six minutes. A separate two-stream decode ran at about 65–75 tok/s aggregate, about 30–37 each. The benchmark peak was under 128-token prompts with <code>ignore_eos</code>, which is a different workload from real agent tasks.</p>
<p>Long prefill was observed in a separate run. A prefill of about 250K tokens can take minutes by itself, pulling down generation speed within that window. That specific run did not log input length or prefix hit rate per stream. In single-user chat, the ~90% hit rate comes from repeated system prompts; when sub-agents read different files, prefix hit rates drop significantly.</p>
<hr>

<h2 class="relative group">Community Two-Node Benchmarks
    <div id="community-two-node-benchmarks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#community-two-node-benchmarks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Published GLM-5.3-Flash NVFP4 on two Sparks runs around 20–30 tok/s on a single stream, and around 36 on four. Raising the GPU clock from 1500 MHz to 2100 MHz adds about 4% decode (from the three-node post, distinct from the four-node 35.7 result). The post titled 43.4 reports a median of 21.8 in the body. Numbers in the sixties come from lower-bit EXL3 with structured output and short context. DeepSeek V4.1 Flash full weights are served in four-node setups; a two-node EXL3 directory exists and is marked unbenchmarked. Links are at the end.</p>
<hr>

<h2 class="relative group">Considering Modded GPUs
    <div id="considering-modded-gpus" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#considering-modded-gpus" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Whether buying a modded GPU is worthwhile requires looking at the total platform cost:</p>
<ul>
<li>Modded RTX 4090 (48G): 1008 GB/s on one card, more than three times Spark’s bandwidth. But a single card needs a motherboard, CPU, high-capacity RAM, a kilowatt PSU, and chassis cooling; DDR5 prices in 2026 are not trivial. If you already own an enthusiast desktop, the added cost is much lower.</li>
<li>Modded RTX 5090 (96G): Suqiao’s Alibaba listing was $3,888 for the bare card. Reports noted the product page listed GDDR6X at 14Gbps, which does not match 96GB, and the initial batch lacked independent teardown validation. <a href="https://www.cnbeta.com.tw/articles/tech/1577618.htm"  target="_blank" rel="noreferrer">cnBeta</a>, <a href="https://www.tomshardware.com/pc-components/gpus/china-modified-nvidia-rtx-5090-with-massive-96gb-of-memory-appears-on-alibaba-for-less-than-usd4-000-3x-more-vram-at-65-percent-the-cost-of-the-original"  target="_blank" rel="noreferrer">Tom’s Hardware</a></li>
<li>Two Sparks: Turnkey systems. NVIDIA rates the system PSU at 240W and GB10 TDP at 140W with manufacturer warranty; 128 GB memory is included in the unit price.</li>
</ul>
<p>The bandwidth difference is in the hardware specs. Total outlay depends on whether you build or buy turnkey, so no absolute cost judgment is made here.</p>
<hr>

<h2 class="relative group">Practical Use Cases
    <div id="practical-use-cases" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#practical-use-cases" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>With two DGX Sparks on hand, reasonable use cases look like:</p>
<ul>
<li>Suitable: Single-user interactive coding, turn by turn. With stable system prompts and high prefix-cache hit rates, 35–45 tok/s is usable, keeping data strictly local without relying on cloud APIs.</li>
<li>Unsuitable: Backend for concurrent multi-agent swarms, repository-wide audits, or heavy concurrent tasks. LPDDR5X memory bandwidth and long-context prefill latency quickly become the primary bottleneck.</li>
</ul>
<p>Adding more nodes solves fitting the model into memory, but does not alter the fact that single-stream decode is bound by memory bandwidth. Under real multi-agent workloads, the physical bandwidth remains the ceiling.</p>

<h2 class="relative group">Sources
    <div id="sources" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#sources" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Numbers from these two machines stay separate from numbers copied out of other people’s posts.</p>
<p><strong>Measured here in September 2026. No public log.</strong> MiMo used <a href="https://github.com/tonyd2wild/MiMo-V2.6-Flash-DGX-Spark-Recipe"  target="_blank" rel="noreferrer">tonyd2wild’s two-node recipe</a>, TP=2, model id <code>mimo-v2.6-flash</code>, <code>max_model_len</code> 300,000, <code>max_num_seqs</code> 8, served on port <code>:8888</code> of the head node. The short-prompt table is 128-token generations with <code>ignore_eos</code>, sent from my own machine. The five-sub-agent run is a real session on that same server: nothing queued, about 15–25 tok/s per stream, and no final answer after six minutes. <code>ethtool</code> reported <code>200000Mb/s</code>, Direct Attach Copper, on both live ports. <code>lspci</code> showed PCIe Gen5 x4 (<code>32GT/s, Width x4</code>) on both. The 126 Gb/s figure is <code>32 × 4 × (128/130) ÷ 8</code> from that link. <code>ib_write_bw</code> was about 99.7 Gb/s on one rail and about 97.9 + 97.9 with both rails active.</p>
<p><strong>Spec sheets:</strong></p>
<ul>
<li>DGX Spark memory bandwidth 273 GB/s, 128 GB LPDDR5X, 240W power supply, 140W GB10 TDP: <a href="https://www.nvidia.com/en-us/support/dgx-spark.md"  target="_blank" rel="noreferrer">NVIDIA specifications</a></li>
<li>RTX 4090 memory bandwidth 1008 GB/s, 24 GB: <a href="https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/"  target="_blank" rel="noreferrer">NVIDIA GeForce</a>. A 48 GB mod is a capacity mod. The bandwidth number is still the stock card’s. There is no single spec sheet for the mod.</li>
<li>Mac Studio: M4 Max 410 GB/s, 546 GB/s on the 40-core GPU; M3 Ultra 819 GB/s. <a href="https://www.apple.com/mac-studio/specs/"  target="_blank" rel="noreferrer">Apple technical specifications</a></li>
</ul>
<p><strong>Community benches.</strong> The ~4% clock gain is the three-node post. The four-node 35.7 is a different post.</p>
<ul>
<li>Two nodes, NVFP4: body median 21.8 tok/s, peak 22.7. The title says 43.4. The same post’s four-node TP4 figure is 35.7. <a href="https://forums.developer.nvidia.com/t/glm-5-3-flash-on-2x-nvidia-dgx-spark-43-4-tok-s-peak-checkpoint/381429"  target="_blank" rel="noreferrer">NVIDIA forum</a></li>
<li>Another two-node run: 24.7 tok/s code, 30.3 structured, 19.6 prose, 14.6 with speculative decoding off. Single stream, temperature 0. <a href="https://forums.developer.nvidia.com/t/glm-5-3-flash-running-on-2x-dgx-spark-sm-121-day-0-24-7-30-3-tok-s-with-mtp-5-two-silent-gb10-gotchas-worth-knowing/381433"  target="_blank" rel="noreferrer">Forum</a>, <a href="https://github.com/kingjones30/GLM-5.3-Flash-2x-DGX-Spark"  target="_blank" rel="noreferrer">recipe</a></li>
<li>Three nodes, TP3: 35.2 tok/s at 1500 MHz, 36.8 at 2100 MHz. At about 160K tokens of context, 7.5 tok/s per stream at two-way and 6.1 at three-way. <a href="https://forums.developer.nvidia.com/t/glm-5-3-flash-nvfp4-on-3x-dgx-spark-tp-3-512k-context-35-tok-s/381534"  target="_blank" rel="noreferrer">NVIDIA forum</a></li>
<li>Two nodes, EXL3 4bpw: 62.9 tok/s structured, prose median 26.9. <a href="https://github.com/MiaAI-Lab/GLM-5.3-Flash-EXL3-2x-DGX-Sparks/blob/main/README.md"  target="_blank" rel="noreferrer">MiaAI</a></li>
<li>One node, EXL3 2.05bpw: about 64 structured, about 25 prose. Replies mention looping and quality. <a href="https://forums.developer.nvidia.com/t/60-tok-s-glm-5-3-flash-on-a-single-dgx-spark/382140"  target="_blank" rel="noreferrer">Forum</a>, <a href="https://huggingface.co/gitcommit90/GLM-5.3-Flash-EXL3-2.05-One-Spark"  target="_blank" rel="noreferrer">model card</a></li>
<li>DeepSeek V4.1 Flash on a four-node ring: about 43–50 tok/s one stream. <a href="https://github.com/yunwei37/dgx-spark-4-ring-no-switch/blob/main/docs/deepseek-v41-flash.md"  target="_blank" rel="noreferrer">Log</a>. Another four-node post reports 23 tok/s prose. <a href="https://forums.developer.nvidia.com/t/deepseek-v4-1-flash-552b-moe-on-4x-dgx-spark-tp4-77-2-tok-s-c1-on-peak-52-code-72-tok-s-on-a-warm-code-run-47-math-39-reasoning-23-prose/382897"  target="_blank" rel="noreferrer">Forum</a>. Two-node EXL3 is marked not benchmarked; four-node EXL3 prose is 30.2 and code is 33.4. <a href="https://github.com/vcruz305/DeepSeek-V4.1-Flash-EXL3-DGX-Spark-recipe"  target="_blank" rel="noreferrer">Recipe</a></li>
</ul>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Why I Built RunSeal: Setting an Execution Boundary for Local Coding Agents</title>
      <link>https://blog.ferstar.org/en/posts/local-first-agent-execution-boundary-runseal/</link>
      <pubDate>Sat, 26 Sep 2026 19:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/local-first-agent-execution-boundary-runseal/</guid>
      <description>Coding agents have long compromised between running naked on host systems and suffering from bloated Docker setups, facing structural risks of credential theft and uncontrolled egress; introducing RunSeal, an OS-native project conceived and shaped early on that enforces lightweight boundaries via workspace containment, managed proxies, and fail-closed architecture; delivering a millisecond-launch, cross-platform, non-intrusive safe execution boundary for local commands.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p><a href="https://github.com/runseal-labs"  target="_blank" rel="noreferrer">RunSeal</a> took shape quite a long time ago.</p>
<p>The core execution logic and test suites had been working for a while, and I originally intended to write a quick note on it. But daily engineering work kept piling up, and open-source preparations stayed on the back burner. Now that boundary escapes and privacy risks have brought agent security back into focus, it is a good time to walk through the background, design trade-offs, and technical implementation.</p>
<hr>

<h2 class="relative group">The Trust Deficit in Local Command Execution
    <div id="the-trust-deficit-in-local-command-execution" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-trust-deficit-in-local-command-execution" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Coding agents have become daily drivers for many developers. From early tools like Aider and Open Interpreter to systems like Cursor, Claude Code, Devin, and Codex, running commands via AI has become routine: editing code, running test suites, executing build scripts, and installing dependencies.</p>
<p>Looking at raw execution logs, however, several concerns become apparent:</p>
<ol>
<li><strong>The agent runs as a standard child process on your machine.</strong> Whatever permissions your terminal holds, the agent inherits. Reading and writing within the project is expected; reading <code>~/.ssh/id_rsa</code>, scanning <code>~/.aws/credentials</code>, or inspecting neighboring codebases happens with zero kernel-level intervention.</li>
<li><strong>Interactive <code>[Y/n]</code> confirmations degrade quickly.</strong> Complex debugging sessions often trigger dozens of commands per turn. Sustaining close review of every command every few seconds is unrealistic. After a few iterations, confirmation prompts turn into routine keystrokes of Enter.</li>
<li><strong>Existing containment options introduce significant friction.</strong>
<ul>
<li>Docker containers: On macOS, bind mounts across VM boundaries introduce high I/O latency, making operations like <code>npm install</code> sluggish. Local virtual environments, compiler caches, and host utilities cannot be reused directly. Granting outbound network access to fetch packages means exfiltration paths remain open under adversarial prompt injection.</li>
<li>Regex command filters: Pattern-matching against strings like <code>rm -rf /</code> or <code>cat ~/.ssh</code> is fragile against simple string manipulation, Base64 decoding, or small wrapper scripts.</li>
<li>Minimal scripts: Many implementations focus solely on Linux primitives like <code>bwrap</code> or <code>landlock</code>, offering no equivalent on macOS or Windows. Network controls are often all-or-nothing: either disconnected entirely or left completely unrestricted.</li>
</ul>
</li>
</ol>
<p>Development often ends up caught between running unconfined for agility or accepting significant friction for security.</p>
<hr>

<h2 class="relative group">RunSeal’s Design Scope
    <div id="runseals-design-scope" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#runseals-design-scope" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When starting RunSeal, the operational boundary in <code>AGENTS.md</code> was explicitly defined:</p>
<blockquote><p>RunSeal is an OS-native, policy-governed local command execution environment—focused strictly on local command containment, without enterprise approval dashboards or general automation frameworks.</p>
</blockquote><p>The objective is specific: confine command execution to the designated workspace at the OS kernel layer, without virtual machines or sacrificing local execution performance.</p>
<pre class="not-prose mermaid">
flowchart TD
    A[Agent Requests Command Execution] --> B[RunSeal CLI / RPC]
    B --> C{Check Host Capability}
    C -->|Capability Mismatch| D[Fail-Closed Immediate Error<br/>Never Silently Degrade]
    C -->|Policy Validated| E[Construct OS-Native Sandbox]
    
    subgraph OS[OS Kernel Boundary]
        E --> F[Filesystem: Workspace-Contained<br/>Confined to Workspace + Ephemeral Root]
        E --> G[Network Guard: Managed Proxy<br/>Block Raw Egress & Unauthorized Loopback]
    end
    
    F & G --> H[Execute Command & Capture Exit Status]
    H --> I[Append Immutable JSONL Audit Log]
    I --> J[Return Results to Agent]
</pre>

<p>The implementation focuses on four main areas:</p>

<h3 class="relative group">1. Millisecond Native Launch Without Virtualization
    <div id="1-millisecond-native-launch-without-virtualization" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-millisecond-native-launch-without-virtualization" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>RunSeal starts no virtual machines and runs no background daemon, calling OS isolation primitives directly:</p>
<ul>
<li><strong>Windows Reference Implementation</strong>: Implemented via Restricted Tokens, Job Objects, and specific ACLs, with policies mapped to execution plans through the <code>PlatformSandboxPlan</code> contract;</li>
<li><strong>macOS and Linux Alignment</strong>: macOS utilizes Seatbelt (<code>sandbox-exec</code>), while Linux combines Bubblewrap and Landlock. All three sandbox levels and network modes run natively, with managed proxy boundaries implemented across both platforms (RFC-0019 / RFC-0020).</li>
</ul>
<p>Because execution is native, launch latencies remain sub-millisecond, preserving compiler caches and local toolchains.</p>

<h3 class="relative group">2. Workspace Containment
    <div id="2-workspace-containment" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-workspace-containment" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Filesystem access is classified into four sandbox tiers: <code>read-only</code>, <code>workspace-write</code>, <code>workspace-contained</code>, and an explicit <code>danger-full-access</code> opt-out.</p>
<p>At <code>workspace-contained</code>:</p>
<ul>
<li>The process can only access the current workspace directory, an ephemeral runtime root, explicitly declared read-only paths, and minimal OS runtime baselines;</li>
<li>Remaining filesystem locations (such as <code>~/.ssh</code>, <code>~/.aws</code>, <code>~/.config</code>, or neighboring directories) are either invisible or denied access;</li>
<li>If prompt injection triggers access to <code>cat ~/.ssh/id_rsa</code> or path traversal, the kernel returns <code>Operation not permitted</code>.</li>
</ul>

<h3 class="relative group">3. Controlled Outbound Access (<code>network.proxy</code>)
    <div id="3-controlled-outbound-access-networkproxy" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-controlled-outbound-access-networkproxy" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Completely disabling network access prevents downloading packages or fetching documentation. Unrestricted outbound access, however, leaves egress unmonitored.</p>
<p>RunSeal’s <code>network.proxy</code> mode:</p>
<ul>
<li>Restricts direct connections to external IP addresses or domains;</li>
<li>Blocks unauthorized local loopback and host IPC;</li>
<li>Directs outbound traffic through a designated Managed Proxy endpoint.</li>
</ul>
<p>This allows the proxy layer to handle domain allowlists, credential redaction, and structured auditing.</p>

<h3 class="relative group">4. Fail-Closed over Silent Degradation
    <div id="4-fail-closed-over-silent-degradation" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-fail-closed-over-silent-degradation" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>If execution requests <code>workspace-contained</code> and <code>network.proxy</code>, but the host lacks sufficient permissions or kernel support, <strong>RunSeal exits immediately with a Fail-Closed error rather than silently degrading to an unconfined state</strong>.</p>
<p>Black-box test suites (RFC-0016) evaluate symlink traversal, directory escape, environment pollution, and process cleanup to ensure declared capabilities match actual system guarantees.</p>
<hr>

<h2 class="relative group">How It Looks in Practice
    <div id="how-it-looks-in-practice" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-it-looks-in-practice" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>RunSeal’s CLI is kept deliberately minimal: just a handful of parameters, making it effortless to integrate into agent automation harnesses or frameworks.</p>

<h3 class="relative group">1. Probe Host Capabilities
    <div id="1-probe-host-capabilities" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-probe-host-capabilities" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">runseal capabilities</span></span></code></pre></div></div>
<p>Outputs a JSON payload detailing what the current machine can strictly guarantee (excerpt; full output includes <code>features</code>, <code>capability_probes</code>, etc.):</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"platform"</span><span class="p">:</span> <span class="s2">"macos"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"sandbox_levels"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"read-only"</span><span class="p">:</span> <span class="s2">"supported"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"workspace-write"</span><span class="p">:</span> <span class="s2">"supported"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"workspace-contained"</span><span class="p">:</span> <span class="s2">"supported"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"danger-full-access"</span><span class="p">:</span> <span class="s2">"supported"</span>
</span></span><span class="line"><span class="cl">  <span class="p">},</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"network_modes"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"unmanaged"</span><span class="p">:</span> <span class="s2">"supported"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"disabled"</span><span class="p">:</span> <span class="s2">"supported"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"proxy"</span><span class="p">:</span> <span class="s2">"supported"</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>Protocol and policy versions are reported separately via <code>runseal version --json</code>.</p>

<h3 class="relative group">2. Run a Confined Command
    <div id="2-run-a-confined-command" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-run-a-confined-command" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Confine a command to the current workspace with network disabled:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">runseal <span class="nb">exec</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --policy workspace-contained <span class="se">\
</span></span></span><span class="line"><span class="cl">  --network disabled <span class="se">\
</span></span></span><span class="line"><span class="cl">  --cwd /Users/ferstar/myprojects/demo <span class="se">\
</span></span></span><span class="line"><span class="cl">  -- python3 test_pipeline.py</span></span></code></pre></div></div>
<p>If a command attempts to read outside the workspace, the kernel rejects the read directly. Under default mode, the terminal echoes no errors—the command is blocked silently—but passing <code>--json</code> exposes the full result (excerpt):</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">runseal <span class="nb">exec</span> --json <span class="se">\
</span></span></span><span class="line"><span class="cl">  --policy workspace-contained <span class="se">\
</span></span></span><span class="line"><span class="cl">  --network disabled <span class="se">\
</span></span></span><span class="line"><span class="cl">  --cwd /Users/ferstar/myprojects/demo <span class="se">\
</span></span></span><span class="line"><span class="cl">  -- cat ~/.ssh/id_rsa</span></span></code></pre></div></div>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"exit_code"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"stderr"</span><span class="p">:</span> <span class="s2">"cat: /Users/ferstar/.ssh/id_rsa: Operation not permitted"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"sandbox"</span><span class="p">:</span> <span class="p">{</span><span class="nt">"enforced"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span> <span class="nt">"level"</span><span class="p">:</span> <span class="s2">"workspace-contained"</span><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>Note that the exit code of <code>runseal exec</code> itself is currently fixed at 0; the true exit status of the child process is reflected in the JSON result and audit logs. For automated pipelines, <code>--json</code> yields structured outputs, while <code>--events</code> streams newline-delimited lifecycle events.</p>

<h3 class="relative group">3. Local Structured Auditing
    <div id="3-local-structured-auditing" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-local-structured-auditing" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Every invocation logs its policy parameters, Canonical Policy Hash, network decisions, and exit statuses to an immutable local JSONL audit trail (excerpt; each event also includes <code>execution_id</code>, <code>session_id</code>, <code>policy_epoch</code>, etc.):</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"type"</span><span class="p">:</span><span class="s2">"policy.resolved"</span><span class="p">,</span><span class="nt">"policy_id"</span><span class="p">:</span><span class="s2">"workspace-contained"</span><span class="p">,</span><span class="nt">"policy_hash"</span><span class="p">:</span><span class="s2">"sha256:7cb64a73..."</span><span class="p">,</span><span class="nt">"sandbox_level"</span><span class="p">:</span><span class="s2">"workspace-contained"</span><span class="p">,</span><span class="nt">"network"</span><span class="p">:{</span><span class="nt">"mode"</span><span class="p">:</span><span class="s2">"disabled"</span><span class="p">,</span><span class="nt">"routes"</span><span class="p">:[]},</span><span class="nt">"time"</span><span class="p">:</span><span class="s2">"2026-09-26T11:21:26.967279Z"</span><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"type"</span><span class="p">:</span><span class="s2">"execution.finished"</span><span class="p">,</span><span class="nt">"exit_code"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="nt">"status"</span><span class="p">:</span><span class="s2">"finished"</span><span class="p">,</span><span class="nt">"time"</span><span class="p">:</span><span class="s2">"2026-09-26T11:21:26.971042Z"</span><span class="p">}</span></span></span></code></pre></div></div>
<hr>

<h2 class="relative group">Final Thoughts
    <div id="final-thoughts" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#final-thoughts" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The recent ZCode snapshot upload incident simply thrust the long-standing risk of unconfined local agent execution into the public spotlight.</p>
<p>AI coding tools are evolving at breakneck speed. Models are getting sharper, and their autonomous execution loops are getting longer. But we cannot enjoy 5x code output while handing over the master keys to our machines on the assumption that vendors will always practice good hygiene or adhere to ambiguous privacy policies.</p>
<p>Day to day, we shouldn’t have to treat our own machines like hostile territory, but we also shouldn’t wait until our credentials are exposed before taking containment seriously.</p>
<p>Locking boundaries down at the OS kernel layer—allowing what should run and blocking what shouldn’t—is the only way to let local agents do real work safely.</p>
<p><em>(RunSeal’s RFC specifications and implementation are open source. Feel free to explore and contribute: <a href="https://github.com/runseal-labs"  target="_blank" rel="noreferrer">github.com/runseal-labs</a>)</em></p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Inside ZCode: Silently Uploading Your Entire Git History to the Cloud</title>
      <link>https://blog.ferstar.org/en/posts/zcode-silent-workspace-snapshot-upload/</link>
      <pubDate>Fri, 18 Sep 2026 02:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/zcode-silent-workspace-snapshot-upload/</guid>
      <description>ZCode silently uploads full Git history to the cloud; this post provides a block rule and source review — checkpoint claims fall apart against the code.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>It started with a routine check while freeing up disk space: <code>~/.zcode</code> was taking up over 700MB. After digging into it intermittently, I confirmed something pretty wild:</p>
<p><strong>Whenever you are logged in, ZCode (Zhipu’s official AI coding desktop app) silently packages your entire workspace — complete <code>.git</code> history, LFS asset cache, reflogs, and global app configs — encrypts it, and uploads it directly to Aliyun OSS.</strong></p>
<p>Even more ironic: <strong>the RSA public key used for encryption is delivered on the fly by the server, while the private key lives exclusively in the cloud.</strong> You cannot decrypt that multi-hundred-megabyte ciphertext sitting right on your own disk, and neither can the ZCode client itself.</p>
<p>Here is the complete record of the investigation, the evidence chain, and a one-liner defense that permanently shuts it down.</p>
<p><em>(Note: Following official responses and open-source updates, see the Sep 21 and Sep 23 sections below for code verification and real-world testing; first-time readers can jump straight to the technical breakdown below.)</em></p>

<h2 class="relative group">Update, 2026-09-23
    <div id="update-2026-09-23" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#update-2026-09-23" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Earlier this evening (Sep 23), ZCode pushed client <strong>v3.14.3</strong>, and the public repository shortly followed with a matching commit (<code>328c1a0 feat: update v3.14.3</code>), keeping public repository tags aligned with the released client version.</p>
<p>That said, an important engineering caveat: <strong>matching version tags does not guarantee a 1:1 identical match between proprietary compiled binaries and public source code, and one cannot make absolute assumptions without byte-by-byte reproducible builds</strong>. Below are the objective verification findings from both the public repository diff and local client runtime:</p>
<ol>
<li><strong>Open-Source Repository Diff Review</strong>:
<ul>
<li>Audited the commit across 282 changed files; the previously captured <code>/api/v1/snapshot/upload-credential</code> and AES-256-CTR packaging pipelines remain completely absent;</li>
<li>The checkpoint mechanism (<code>gitCheckpointService.ts</code>) continues to rely strictly on local Git CLI diffing with zero cloud dependencies;</li>
<li>New code primarily introduces multi-channel IM bots (remote control via WeCom, Feishu, DingTalk, Telegram) and workflow execution optimizations.</li>
</ul>
</li>
<li><strong>Local Client Runtime Verification</strong>:
<ul>
<li>The local desktop application updated to 3.14.3; unpacking the packaged assets (<code>app.asar</code>) shows zero occurrences of <code>repoSnapshot</code> logic;</li>
<li>Real-time process logs and the <code>~/.zcode/v2/checkpoints/</code> directory confirm no whole-workspace scanning, packaging, or new <code>.enc</code> archive generation.</li>
</ul>
</li>
</ol>
<p>Having public diffs to cross-check with each release is certainly more reassuring than black-box updates. But for any proprietary desktop app, what the code says is one thing, and how the binary behaves locally is another — keeping the read-only directory lock outlined below remains the most dependable baseline defense.</p>

<h2 class="relative group">Update, 2026-09-21
    <div id="update-2026-09-21" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#update-2026-09-21" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>This morning (Sep 21) at 09:23, ZCode officially posted a <a href="https://x.com/zcode_ai/status/2101844704933621971"  target="_blank" rel="noreferrer">statement on X</a> and dropped their supposed open-source core repository (<a href="https://github.com/zai-org/ZCode"  target="_blank" rel="noreferrer">GitHub: zai-org/ZCode</a>). With the source code now public alongside the officially cited third-party evaluation findings, official explanations can finally be cross-referenced line by line against the actual codebase.</p>

<h3 class="relative group">1. Code Review: A Stripped-Down Two-Commit Drop (PRs Locked, Issues Disabled)
    <div id="1-code-review-a-stripped-down-two-commit-drop-prs-locked-issues-disabled" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-code-review-a-stripped-down-two-commit-drop-prs-locked-issues-disabled" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Digging into the newly published Git repository, the picture matches expectations of standard corporate defense:</p>
<ul>
<li><strong>Historical Git commits completely wiped</strong>: The repository contains only two commits — an empty initial commit, followed by a massive <code>feat: open source</code> commit dumping 6,973 files and 1.03 million lines of code at once. The internal development commit history of the open-source repo itself was entirely flattened; there is no way to trace the evolution of the old upload sidecar, nor any commit diff showing how the <code>repoSnapshot</code> pipeline was excised. Moreover, the repo locked PRs and closed Issues, making it strictly a one-way code dump.</li>
<li><strong>License</strong>: Apache-2.0.</li>
<li><strong>Upload pipeline fully purged</strong>: Searching the codebase for the previously captured <code>/api/v1/snapshot/upload-credential</code>, direct <code>PostObject</code> OSS uploads, AES-256-CTR encryption, and public key delivery returned zero matches. The pipeline has been stripped clean with not a single line remaining.</li>
<li><strong>Repo Wiki thoroughly scrubbed</strong>: Except for an external Wikipedia reference, all mentions of Repo Wiki have been removed. Code indexing and symbol search have reverted entirely to local processes utilizing bundled <code>ripgrep 14.1.1</code> and <code>bfs 4.1.1</code> — proving that local codebase retrieval never needed full-repo uploads in the first place.</li>
<li><strong>An ultra-defensive NOTICE.md</strong>: Even more revealing is the 27KB <code>NOTICE.md</code> in the root directory. Legal counsel armored every outbound network request and added disclaimers to even the hollowed-out Computer Use placeholders, while conspicuously leaving out any mention of whole-repo uploads.</li>
</ul>

<h3 class="relative group">2. The Checkpoint Mechanism Exposed: Code Confirms Purely Local Git
    <div id="2-the-checkpoint-mechanism-exposed-code-confirms-purely-local-git" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-the-checkpoint-mechanism-exposed-code-confirms-purely-local-git" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The official statement originally claimed that uploading repository snapshots was necessary for “session checkpoint rollback.” Looking at the source, I located the actual implementation of checkpoints (<code>packages/services/src/git/gitCheckpointService.ts</code> and <code>gitCheckpointRepo.ts</code>):</p>
<ul>
<li><strong>How it works</strong>: It runs purely on the local system’s Git CLI, executing <code>git diff --name-status</code> and <code>git diff --numstat</code> based on commit OIDs scoped strictly to the current workspace.</li>
<li><strong>Storage</strong>: Metadata is persisted locally as JSON files under <code>~/.zcode/checkpoints/</code>.</li>
<li><strong>The verdict</strong>: The open-source code confirms that checkpoints are strictly local Git diff utilities with zero cloud dependencies, having nothing to do with whole-repo packaging. The official claim that “checkpoint rollback necessitated full-repo uploads” completely falls apart against the code.</li>
</ul>

<h3 class="relative group">3. Third-Party Audits and “Bucket Deletion”
    <div id="3-third-party-audits-and-bucket-deletion" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-third-party-audits-and-bucket-deletion" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The official statement summarized findings from the China Academy of Information and Communications Technology (CAICT) and NSFOCUS (stating that full reports will be published soon):</p>
<ul>
<li><strong>Summarized findings</strong>: CAICT confirmed that the <code>zcode-prod</code> OSS bucket contains zero data and client v3.14.0 removed snapshot generation and upload workflows; NSFOCUS confirmed that the bucket and all internal objects have been deleted, with no outbound transmission paths detected.</li>
<li><strong>Objective takeaway</strong>: Completely purging and deleting the bucket is a necessary containment move. However, from a technical and timeline standpoint, <strong>even when the full static verification reports are published, proving that a bucket was emptied or deleted after Sep 20 cannot retroactively reconstruct what happened to data uploaded prior to Sep 18</strong>. The lifecycle of historical data cannot be proven in reverse through a single post-incident audit.</li>
</ul>

<h3 class="relative group">4. Community Clarifications and a Bit of Real-World Irony
    <div id="4-community-clarifications-and-a-bit-of-real-world-irony" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-community-clarifications-and-a-bit-of-real-world-irony" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>With the <a href="https://x.com/ferstar_org/status/2100805861002355154"  target="_blank" rel="noreferrer">original post</a> crossing 1.6 million impressions and traffic normalizing, a few ongoing community narratives deserve clarification:</p>
<ol>
<li><strong>Neither a “Community Developer” nor an “Overseas Hacker”</strong>: The official statement vaguely thanked “community developers who identified issues” (without ever @-tagging or even obliquely naming me) — classic PR minimization. I was never a contributor or community developer of ZCode; I was simply a paying Coding Plan subscriber who uncovered unannounced exfiltration of private code and published the packet capture evidence. Similarly, rumors labeling me a “mysterious foreign hacker” or “reverse engineering master” are pure nonsense; the investigation relied on basic local networking tools and unpacking. As for the absurd accusation of “handing knives to foreign adversaries to smear domestic AI” — when a paying engineer discovers commercial code being silently exfiltrated behind their back, publishing packet captures is basic self-preservation. If pointing at the elephant in the room is “handing knives”, is staying silent while code is quietly siphoned supposed to be “support”? Real engineering safety is never achieved by sweeping leaks under the rug.</li>
<li><strong>The Truth Behind the “2:00 AM Midnight Post” Myth</strong>: Many cited the post header timestamp, assuming I stayed up until 2:00 AM to publish the write-up. In reality, this serves as a textbook real-world irony that <strong>trusting AI blindly is worse than having no AI at all</strong>: my actual Git commit timestamp was <code>Fri Sep 18 10:35:05 2026 +0800</code> — broad daylight on Friday morning. The <code>02:00:00</code> in the front matter occurred simply because I got lazy and used an AI helper to generate Hugo metadata after drafting the technical notes. The AI hallucinated that timestamp, and in my rush to verify the network blocking, I didn’t double-check it. While writing a post cautioning developers against blindly trusting AI tools behind their backs, I got burned by an unchecked AI-generated timestamp, inadvertently spawning an internet myth about a “midnight raid.” Laugh it off, but take it as the most grounded reminder: the moment you get lazy and trust an AI blindly, it will find a way to bite you in the rear.</li>
</ol>

<h2 class="relative group">Update, 2026-09-19
    <div id="update-2026-09-19" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#update-2026-09-19" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Following widespread community attention after this post, Z.ai released an official statement in their user community on Sep 18 at 17:44 (with tech media like IT Home picking up the story later that evening). This section provides an objective cross-check. The original investigation below remains unchanged.</p>

<h3 class="relative group">What the company said
    <div id="what-the-company-said" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-the-company-said" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Z.ai posted their statement on Sep 18 at 17:44; public coverage can be found on <a href="https://www.ithome.com/1/004/310.htm"  target="_blank" rel="noreferrer">IT Home</a>. Key points:</p>
<ul>
<li>The issue came from “codebase indexing”, used for local indexes, session checkpoint restore, and Repo Wiki;</li>
<li>Generating Wiki pages in the cloud “may” trigger an upload of repository data;</li>
<li>After the Wiki is generated, the uploaded data is destroyed immediately and is not stored;</li>
<li>The feature was on by default in its early launch period; some users were affected; the issue “has been fixed”;</li>
<li>ZCode will be open-sourced soon, with third-party review; all users get one extra weekly quota reset.</li>
</ul>
<p>The fact that uploads occurred is no longer contested by Zhipu. What remains in question is the actual upload scope, user toggles, and how anyone outside the company is supposed to verify “destroyed immediately”.</p>

<h3 class="relative group">Reverse Engineering & Local Evidence vs. Official Claims (Old Version 3.12.3 vs. 3.14.0 vs. Official Statement)
    <div id="reverse-engineering--local-evidence-vs-official-claims-old-version-3123-vs-3140-vs-official-statement" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#reverse-engineering--local-evidence-vs-official-claims-old-version-3123-vs-3140-vs-official-statement" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>To prevent confusion between client versions, here is a direct comparison between the affected old version (3.12.3) when caught, the reverse-engineered 3.14.0 release, and the official statement:</p>
<table>
  <thead>
      <tr>
          <th>Dimension</th>
          <th>Official Statement (Sep 18 17:44)</th>
          <th>3.12.3 Client Audit (Affected Version)</th>
          <th>3.14.0 Client Audit (Remediated Version)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>What was sent</strong></td>
          <td>Repository data (for Wiki)</td>
          <td>Full-workspace snapshots, ~87% <code>.git</code> — objects, LFS, reflogs</td>
          <td>Upload pipeline code physically stripped; only local checkpoints remain</td>
      </tr>
      <tr>
          <td><strong>Trigger mechanism</strong></td>
          <td>Wiki page generation “may” upload</td>
          <td>Upload sidecar resident with login; <code>captureBeforePrompt</code> (before every prompt) and <code>repo-wiki-update</code> trigger unconditionally</td>
          <td>Upload sidecar dismantled; no longer triggers cloud packaging</td>
      </tr>
      <tr>
          <td><strong>Can you turn it off</strong></td>
          <td>No mention of a switch to stop uploads</td>
          <td>Disabling “Optimize Experience” and “Repo Snapshot Indexing” still packaged and attempted direct OSS uploads</td>
          <td>Code pipeline physically removed</td>
      </tr>
      <tr>
          <td><strong>Cloud-side handling</strong></td>
          <td>Destroyed immediately after generation</td>
          <td>Not verifiable from outside (and logically contradicts the claimed “checkpoint restore” feature)</td>
          <td>Cloud <code>upload-credential</code> endpoint pulled (returns 404)</td>
      </tr>
      <tr>
          <td><strong>Retained data</strong></td>
          <td>Claims data is not stored post-Wiki</td>
          <td>Snapshot of a 538-file public repo accepted by server; retention/decryption rights unaddressed</td>
          <td>Whether existing cloud snapshots were physically wiped cannot be verified externally</td>
      </tr>
  </tbody>
</table>
<p>One thing the original post left easy to misread: the 313MB commercial project sat in <code>pending</code> (<code>failureCount: 564</code>) and <strong>did not upload successfully</strong>. A separate, tiny public-repo workspace did: 538 files, about 15KB after compression and encryption, status accepted by the server. So “did anything actually leave the machine” — yes, at least that one.</p>
<p>Someone else reproduced the same directory layout and state files on Windows, including multiple small workspaces with no failure record that look accepted: <a href="https://www.nodeseek.com/post-935260-1"  target="_blank" rel="noreferrer">NodeSeek</a>. Another local cross-check: <a href="https://blog.silencestar.com/posts/zcode-repo-snapshot/"  target="_blank" rel="noreferrer">silencestar</a>.</p>
<p>I archived the <a href="https://zcode.z.ai/cn/privacy"  target="_blank" rel="noreferrer">privacy policy</a> on Sep 18. The page still said it was last updated 2026-06-15, and still did not mention full-workspace snapshots or cloud sync.</p>

<h3 class="relative group">A Few Personal Clarifications
    <div id="a-few-personal-clarifications" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#a-few-personal-clarifications" aria-label="Anchor">#</a>
    </span>
    
</h3>
<ol>
<li><strong>Did the 313MB commercial project actually get uploaded?</strong>: To be 100% clear, that 313MB commercial repo snapshot failed 564 times because it exceeded size limits, remaining stuck in local <code>pending</code> — <strong>it was never successfully uploaded</strong>. I run an OpenWrt router at home; checking connection tracking and traffic flow records confirmed those encrypted chunks never left the local network.</li>
<li><strong>Definitely not a “reverse engineering wizard” — credit goes to my base-spec MBA</strong>: Some people online started calling me a “reverse engineering expert,” which is completely unnecessary. The entire trigger was laughably mundane: thanks to Apple’s storage being priced like solid gold, my base-spec 256GB MacBook Air is perpetually starved for disk space. I was freeing up space when I noticed <code>~/.zcode</code> mysteriously devouring over 700MB. My engineering spider-sense tingled, so I unpacked <code>app.asar</code> to see what the hell was going on (on my other machine with a 2TB NVMe running Arch Linux, I wouldn’t have blinked twice at a measly few hundred megs). Besides, given the state of modern AI, anyone with a coding agent is effectively a reverse engineer now — pull any decent agent off the shelf, feed it this post and the source files, and it’ll break down the entire architecture with flawless clarity. It’s hardly some exclusive black magic; it was just basic engineering curiosity and troubleshooting.</li>
<li><strong>The bitter irony</strong>: I was actually a long-term subscriber and supporter of GLM Coding Max myself. The funniest part is that on the evening of Sep 17, I was enthusiastically pitching ZCode to peers in a developer group chat. Less than half a day later, reality hit me right in the face when I caught this silent whole-repo packaging routine myself.</li>
</ol>

<h3 class="relative group">Does the mitigation still matter
    <div id="does-the-mitigation-still-matter" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#does-the-mitigation-still-matter" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Yes. Even though 3.14.0 removed the code and the gateway route returns 404, the desktop client can still receive hot updates. The filesystem lock below remains active as a tripwire. The NodeSeek post has the Windows ACL equivalent.</p>

<h3 class="relative group">Still unanswered
    <div id="still-unanswered" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#still-unanswered" aria-label="Anchor">#</a>
    </span>
    
</h3>
<ol>
<li>How do you prove “destroyed immediately” from the outside? Have existing cloud-stored encrypted snapshots been physically purged, and who holds private key decryption rights?</li>
<li>The claimed “checkpoint restore” contradicts “destroyed immediately” — what exactly was retained in the cloud?</li>
<li>Will the open-source drop include the historical upload sidecar that was caught, or only the latest sanitized commit? <em>(Sep 21 source code confirms: commit history was completely flattened into 2 commits, see Sep 21 update above)</em></li>
</ol>
<p><em>(Note: Open-source code verification has been added to the Sep 21 section above)</em></p>

<h2 class="relative group">The Starting Point: A 313MB Archive Stuck in Pending
    <div id="the-starting-point-a-313mb-archive-stuck-in-pending" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-starting-point-a-313mb-archive-stuck-in-pending" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p><code>~/.zcode</code> is the data root of ZCode. The size breakdown looked roughly like this:</p>
<ul>
<li><code>cli/</code>: ~257MB (session databases, execution logs)</li>
<li><code>computer-use/</code>: ~130MB (bundled app and runtime dependencies)</li>
<li><code>v2/checkpoints/</code>: ~303MB (the main suspect)</li>
</ul>
<p>Inside <code>v2/checkpoints/</code>, I found a 313MB <code>.enc</code> file alongside a state metadata file:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"workspacePath"</span><span class="p">:</span> <span class="s2">"/Users/ferstar/myprojects/<a commercial project>"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"lastCompressedSize"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"encryptedSizeBytes"</span><span class="p">:</span> <span class="mi">313070842</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"workspaceSizeBytes"</span><span class="p">:</span> <span class="mi">345549173</span>
</span></span><span class="line"><span class="cl">  <span class="p">},</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"kind"</span><span class="p">:</span> <span class="s2">"baseline"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"failureCount"</span><span class="p">:</span> <span class="mi">564</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>The story was straightforward:</p>
<ol>
<li>The client scanned my active commercial project, excluded <code>node_modules</code> and a few others, and packaged the remaining 345MB into a 313MB encrypted archive labeled <code>baseline</code> (full snapshot);</li>
<li>It recorded 564 failed upload attempts, leaving it sitting in the local <code>pending/</code> directory waiting for the next retry.</li>
</ol>
<p>The repository totaled 10GB; minus dependencies, the remaining 345MB was almost entirely core intellectual property.</p>

<h2 class="relative group">Where It Goes: From Logs to asar Reverse Engineering
    <div id="where-it-goes-from-logs-to-asar-reverse-engineering" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#where-it-goes-from-logs-to-asar-reverse-engineering" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The logs contained no explicit upload URLs, so I cracked open the client’s <code>app.asar</code>. The reconstructed upload flow:</p>
<pre class="not-prose mermaid">
sequenceDiagram
    participant C as ZCode client
    participant S as zcode.z.ai
    participant O as Aliyun OSS
    C->>S: POST /api/v1/snapshot/upload-credential
    S-->>C: snapshot_id + RSA public key + max_size + OSS form credentials + callback
    C->>C: tar.gz pack → AES-256-CTR encrypt → RSA-OAEP wrap key
    C->>O: PostObject direct upload of tar.gz.enc
    O->>S: callback confirms receipt
</pre>

<p>The pipeline runs in two stages:</p>
<ol>
<li><strong>Request credentials from coordinator</strong>: The client calls <code>https://zcode.z.ai</code> (<code>VITE_ZCODE_ENDPOINT_ORIGIN</code> in code). The server returns OSS form signatures (<code>policy</code>, <code>x-oss-signature</code>), a dynamic Object Key, size limits, and the RSA public key for this encryption round;</li>
<li><strong>Direct form POST to OSS</strong>: After archiving and streaming encryption locally, the client <strong>bypasses ZCode’s own application servers and posts <code>tar.gz.enc</code> directly to Aliyun OSS via an HTTP POST form</strong>. OSS then calls back to Zhipu’s backend to register the snapshot.</li>
</ol>
<p>Inspecting active sockets confirmed this: the running ZCode process maintained persistent HTTPS connections to <code>zcode.z.ai</code> IP endpoints plus two Aliyun OSS storage nodes.</p>

<h2 class="relative group">The Most Ironic Part: The Key Belongs to the Server
    <div id="the-most-ironic-part-the-key-belongs-to-the-server" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-most-ironic-part-the-key-belongs-to-the-server" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The encryption implementation uses textbook envelope encryption:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">keyId</span><span class="o">:</span> <span class="nb">String</span><span class="p">(</span><span class="nx">i</span><span class="p">.</span><span class="nx">encryption</span><span class="p">.</span><span class="nx">key_version</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="nx">keyWrapAlgorithm</span><span class="o">:</span> <span class="s2">"rsa-oaep-sha256"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"><span class="nx">publicKeySpkiPem</span><span class="o">:</span> <span class="nx">Ylt</span><span class="p">(</span><span class="nx">i</span><span class="p">.</span><span class="nx">encryption</span><span class="p">.</span><span class="nx">public_key</span><span class="p">)</span></span></span></code></pre></div></div>
<ul>
<li>Content is encrypted using an ephemeral symmetric key via AES-256-CTR;</li>
<li>The symmetric key is wrapped using RSA-OAEP-SHA256 with the public key supplied by the server.</li>
</ul>
<p>The critical catch is that public key: <strong>it is handed down by the server during credential negotiation, and the corresponding private key never touches your machine.</strong> Unwrapping the envelope key with all local private keys on my system failed, as expected.</p>
<p>In other words: that 313MB ciphertext on your drive cannot be opened by you or the client. Only Zhipu’s backend holds the key to unlock it.</p>
<p>If this feature were genuinely built for user-facing rollback or cross-device sync, the keys would live locally (just like Git or Time Machine). <strong>A key that only the server can use serves exactly one purpose: making sure the server can read your code whenever it wants.</strong></p>

<h2 class="relative group">What Gets Packed: Nearly 90% Is .git
    <div id="what-gets-packed-nearly-90-is-git" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-gets-packed-nearly-90-is-git" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Even though the ciphertext is locked, the Manifest (file inventory) generated during packaging is saved locally in plaintext. Breaking down a snapshot of 42,411 files:</p>
<table>
  <thead>
      <tr>
          <th>Content</th>
          <th>Size</th>
          <th>Proportion</th>
          <th>Information Contained</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>.git/lfs/</code></td>
          <td>196.1 MB</td>
          <td>56.8%</td>
          <td>LFS cache — all binary assets and large media ever downloaded</td>
      </tr>
      <tr>
          <td><code>.git/objects/</code></td>
          <td>102.2 MB</td>
          <td>29.6%</td>
          <td>Complete commit history object store (commits, trees, blobs)</td>
      </tr>
      <tr>
          <td><code>.git/logs/</code></td>
          <td>0.6 MB</td>
          <td>0.2%</td>
          <td>reflogs — local branch history and unpushed operational traces</td>
      </tr>
      <tr>
          <td>Source code & docs</td>
          <td>~46.2 MB</td>
          <td>13.4%</td>
          <td><code>src/</code>, config files, internal documentation</td>
      </tr>
  </tbody>
</table>
<p>The <code>.git</code> directory alone accounts for <strong>86.6%</strong> of the payload.</p>
<p>Once uploaded, the cloud receives far more than your current working tree — it gets <strong>the entire lineage of your repository since day one</strong>:</p>
<ul>
<li>Historical API keys and sensitive configs that were deleted in later commits;</li>
<li>Unpushed local branch names (which reveal unreleased feature plans);</li>
<li>Internal GitLab hostnames and repository paths configured in <code>.git/config</code>.</li>
</ul>
<p>Furthermore, an extra manifest named <code>repo_snapshot_extra_manifest</code> hashes your global ZCode configuration files (such as <code>settings.behavior.json</code>) and bundles them across workspaces with every snapshot.</p>

<h2 class="relative group">The Truth About the Switches: UI Toggles Don’t Stop It
    <div id="the-truth-about-the-switches-ui-toggles-dont-stop-it" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-truth-about-the-switches-ui-toggles-dont-stop-it" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The natural reaction is checking settings to toggle it off. I cross-referenced the UI options with the codebase:</p>
<table>
  <thead>
      <tr>
          <th>Switch</th>
          <th>What you expect it to do</th>
          <th>What it actually does</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Optimize Experience</strong> (<code>optimizeAgentExperienceEnabled</code>)</td>
          <td>Disables telemetry / data collection</td>
          <td><strong>Only controls whether data is authorized for model training</strong>. Snapshot capture and upload still run</td>
      </tr>
      <tr>
          <td><strong>Repo Snapshot Indexing</strong> (<code>repoSnapshotIndexingEnabled</code>)</td>
          <td>Disables the snapshot feature</td>
          <td><strong>Only controls whether the server indexes uploaded snapshots</strong>. Local packaging and upload continue uninterrupted</td>
      </tr>
  </tbody>
</table>
<p>Looking at host assembly code makes it crystal clear: the capture/upload sidecar is <strong>instantiated unconditionally</strong> at startup. There are no gating <code>if</code> checks on user preferences; the only requirement is that <code>tokenProvider</code> can return a valid JWT.</p>
<p><strong>Bottom line: as long as you are logged in, this background pipeline is permanently active, and no UI setting can turn it off.</strong></p>
<p>Capture triggers occur at two points: <code>captureBeforePrompt</code> (before every prompt) and on task completion tagged with <code>repo-wiki-update</code>. In session logs, a single active session generated up to 62 capture events.</p>

<h2 class="relative group">What the Privacy Policy Says
    <div id="what-the-privacy-policy-says" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-the-privacy-policy-says" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Checking ZCode’s privacy policy, it explicitly states that it collects “text, files, and code submitted during conversations” — standard practice for feeding context to LLMs.</p>
<p>However, across the entire policy, FAQs, and changelogs, there is <strong>not a single mention of silently packaging and uploading entire workspaces and full Git histories</strong>.</p>
<p>The closest mention is the generic template statement: “optimization program is off by default, and inputs will not be used for training without consent”.</p>

<h2 class="relative group">Defense: Deleting Is Whack-a-Mole; Lock the Directory
    <div id="defense-deleting-is-whack-a-mole-lock-the-directory" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#defense-deleting-is-whack-a-mole-lock-the-directory" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When I first found the pending package, I simply deleted it. Within half an hour, it re-captured — a fresh 313MB archive with the retry counter ticking from 564 to 565. When the uploader sees the file is gone, it just packs a new one. Manual deletion is whack-a-mole.</p>
<p>The cleanest and most effective solution is setting an immutability flag at the filesystem level, denying write access at the kernel level:</p>

<h3 class="relative group">macOS
    <div id="macos" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#macos" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Wipe and lock the checkpoints directory</span>
</span></span><span class="line"><span class="cl">rm -rf ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">mkdir -p ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">chflags uchg ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Verify: should output "Operation not permitted"</span>
</span></span><span class="line"><span class="cl">touch ~/.zcode/v2/checkpoints/test</span></span></code></pre></div></div>

<h3 class="relative group">Linux
    <div id="linux" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#linux" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Wipe and lock the checkpoints directory</span>
</span></span><span class="line"><span class="cl">rm -rf ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">mkdir -p ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">sudo chattr +i ~/.zcode/v2/checkpoints
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Verify: should output "Operation not permitted"</span>
</span></span><span class="line"><span class="cl">touch ~/.zcode/v2/checkpoints/test</span></span></code></pre></div></div>

<h3 class="relative group">Impact & Rollback
    <div id="impact--rollback" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#impact--rollback" aria-label="Anchor">#</a>
    </span>
    
</h3>
<ul>
<li><strong>Result</strong>: The capture logic gets blocked by the kernel whenever it attempts disk I/O. Without local artifacts, the upload pipeline has nothing to send;</li>
<li><strong>Trade-off</strong>: The “checkpoint rollback / timeline” UI feature won’t work (which always required uploading your code in the first place). Normal chat, autocomplete, and tool executions work without issue. Swallowed I/O errors in logs are harmless;</li>
<li><strong>To restore</strong>: Run <code>chflags nouchg ~/.zcode/v2/checkpoints</code> (macOS) or <code>sudo chattr -i ~/.zcode/v2/checkpoints</code> (Linux).</li>
</ul>

<h2 class="relative group">Closing Thoughts
    <div id="closing-thoughts" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#closing-thoughts" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When using AI tools, model inference inevitably needs code context — everyone accepts that going in. But this behavior clearly crosses the line in two ways:</p>
<p>First, <strong>data scope</strong>. Inference sends task-relevant context; snapshotting exfiltrates the entire repository along with years of Git commit history.</p>
<p>Second, <strong>architectural posture</strong>. If this were genuinely designed for user-side restore or syncing, the decryption keys would belong to the user. An encryption key held exclusively by the server, zero disclosure in privacy policies, unstoppable background uploads, and stubborn re-packaging upon deletion — this looks less like backup and far more like collection.</p>
<p>Tools are tools, but users must draw their own boundaries. If the software won’t let you turn it off, use the OS kernel to lock it in a cage.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Notes on a Batch of Demo Logs: Why &#39;Wrapping Everything in an Agent to Make a SaaS&#39; Is an Absurd Illusion</title>
      <link>https://blog.ferstar.org/en/posts/the-illusion-of-agent-saas/</link>
      <pubDate>Thu, 03 Sep 2026 15:10:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/the-illusion-of-agent-saas/</guid>
      <description>Many believe wrapping business workflows inside an Agent makes building SaaS easy; inspecting live demo logs reveals why using probabilistic models as deterministic enterprise backbones is a fragile illusion.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Yesterday, I spent time reviewing a batch of demo session logs from an internal development build of a desktop Agent. From PowerPoint deck generation to cross-department action checklists, down to complex cash flow forecasts and sales contract compliance audits, the demo lineup looked impeccably structured.</p>
<p>At a surface glance, every demo delivered striking end results: pinpointing contractual risks, calculating liquidity turning points, and autonomously running Python scripts to render sleek, tech-blue inline SVGs and standalone HTML files that open cleanly in any offline browser.</p>
<p>Yet peeling back the underlying interaction traces, token throughput, and execution timelines left me with an overwhelming sense of cognitive dissonance.</p>
<p>Across the industry today—whether among clients, business executives, or product managers—a dangerous and lazy assumption is spreading: <strong>“In the past, building a CRM, ERP, or approval workflow required dozens of database tables and six months of development. Now, just wrap an LLM in an Agent shell, attach a few tools and scripts, and ‘solve any business problem with a single prompt’—presto, you have a modern AI-native SaaS!”</strong></p>
<p>Believing that cramming every conceivable task into an Agent shell makes building enterprise SaaS effortless is not just unrealistic; inspecting the real operational logs and the engineering mess uncovered afterward makes it plain that this is an absurd illusion running counter to basic software engineering reality.</p>
<hr>

<h2 class="relative group">1. The Engineering Clutter Behind Flawless Demos
    <div id="1-the-engineering-clutter-behind-flawless-demos" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-the-engineering-clutter-behind-flawless-demos" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Looking into yesterday’s nine demo sessions, every scenario that produced an “impressive result” was skating right along brittle engineering boundaries:</p>

<h3 class="relative group">1. Extremely Fragile Determinism: Sustained Only by Babysitting Prompts
    <div id="1-extremely-fragile-determinism-sustained-only-by-babysitting-prompts" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-extremely-fragile-determinism-sustained-only-by-babysitting-prompts" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>In hardcore business demos like “Corporate Cash Flow Tracking” or “Cross-Department Action Checklist”, the user’s initial prompt was never a concise natural instruction. Instead, it was a 300-to-500-word defensive micro-contract packed with strict boundary guardrails:</p>
<blockquote><p>“Distinguish confirmed collections from estimated collections… Do not fabricate receipt dates or approval decisions… Do not overwrite original files… Only assign owners and due dates when explicitly committed in the source files, otherwise mark as ‘Pending Confirmation’…”</p>
</blockquote><p>This is not intuitive natural language interaction; this is a software engineer manually hand-coding missing defensive assertions into a prompt.
When faced with an ordinary user prompt (such as a casual line from the logs: <em>“I need to optimize your work logic first”</em>), the Agent was instantly paralyzed, firing off multiple clarification popups begging for context.</p>
<p>Without that round-the-clock babysitting through handcrafted prompts, an Agent’s business reliability plummets immediately.</p>

<h3 class="relative group">2. The Clash Between Local Privileges and Environmental Isolation
    <div id="2-the-clash-between-local-privileges-and-environmental-isolation" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-the-clash-between-local-privileges-and-environmental-isolation" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Why did those demos appear so capable? Because they ran inside a privileged local desktop environment:</p>
<ul>
<li>Reading and writing user <code>.xlsx</code>, <code>.docx</code>, and <code>.pptx</code> files on the local filesystem;</li>
<li>Spawning a local Python runtime to process numbers and generate self-contained dashboards on the fly;</li>
<li>Previewing artifacts directly on the host machine.</li>
</ul>
<p>Yet in engineering reality, this setup is exceedingly fragile: environmental pollution on the host (such as user-defined Python variables) can instantly cripple built-in Skill execution; the moment an ad-hoc test attempts to write outside the workspace, the sandbox blocks the operation with errors; not to mention the frontend cheerfully marking a scheduled job as “Created Successfully” without verifying whether the external messaging channel actually connects.</p>
<p>Real-world business data lives on local disks and internal networks. Trying to lift this into a multi-tenant cloud SaaS immediately runs into hard brick walls around network isolation, environment compatibility, file permissions, privacy compliance, and cross-system authentication.</p>

<h3 class="relative group">3. “Vanity Engineering” vs. Core Business Value
    <div id="3-vanity-engineering-vs-core-business-value" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-vanity-engineering-vs-core-business-value" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Commands like <em>“Switch to a tech-blue color scheme”</em>, <em>“Self-contained inline SVG without external dependencies”</em>, and <em>“Change to a tech-blue background view”</em> appeared repeatedly throughout the logs.</p>
<p>Simply to make the visual presentation pop during demos, the Agent had to re-read original files, generate Python code for style replacement, re-verify string integrity, and write out new files.
A single re-theming run pushed context to <strong>138,000 tokens</strong> (137k+ input tokens for a few hundred output tokens). Thanks to our harness engineering and robust prompt caching, cache hit rates reliably reach 99%+, which keeps actual inference latency and token costs well under control. But the fundamental contradiction remains: the underlying business logic didn’t change at all, yet system bandwidth and runtime machinery were heavily consumed just making things look polished.</p>
<hr>

<h2 class="relative group">2. Why “Stuffing Everything into an Agent Makes a SaaS” Is a Castle in the Air
    <div id="2-why-stuffing-everything-into-an-agent-makes-a-saas-is-a-castle-in-the-air" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-why-stuffing-everything-into-an-agent-makes-a-saas-is-a-castle-in-the-air" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Traditional software architecture and the so-called “pure Agent architecture” represent fundamentally conflicting paradigms:</p>
<pre class="not-prose mermaid">
flowchart TD
    subgraph SaaS["Traditional SaaS (Deterministic Core)"]
        DB[(Relational DB / ACID)] --> Core[State Machine & Rule Engine]
        Core --> Auth[RBAC & Audit Trails]
        Auth --> UI[Standardized UI]
    end

    subgraph AgentTrap["Fancied Agent SaaS (Probabilistic Black Box)"]
        Prompt[Vague Prompt] --> LLM{LLM Inference}
        LLM -.->|Probabilistic Judgment| Script[Ad-hoc Python / Tool Scripts]
        Script -.->|Drifting Output| Out[Unpredictable Drafts]
    end
</pre>


<h3 class="relative group">1. Dumping Deterministic Business Rules onto an LLM to Guess Is Pure Laziness
    <div id="1-dumping-deterministic-business-rules-onto-an-llm-to-guess-is-pure-laziness" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-dumping-deterministic-business-rules-onto-an-llm-to-guess-is-pure-laziness" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The hardest and most tedious part of building enterprise software has always been nailing down every business rule and state transition:</p>
<ul>
<li>Transferring money from account A to account B requires double-entry bookkeeping, transactional integrity checks, and audit logging;</li>
<li>Approval matrices bind rigidly to organizational hierarchies; thresholds require explicit sign-off from designated roles.</li>
</ul>
<p>Those trying to shortcut their way to an “Agent SaaS” are simply trying to skip the hard work, hoping the LLM will just guess what to do next based on conversation context.
However, LLMs are fundamentally <strong>probabilistic engines</strong>. A system that requires hundreds of words in a prompt just to prevent it from hallucinating whether money will arrive next Wednesday cannot provide basic ACID guarantees or data consistency. Building on quicksand guarantees structural failure regardless of how many layers are piled on top.</p>

<h3 class="relative group">2. Confusing an “Operator” with the “System Core”
    <div id="2-confusing-an-operator-with-the-system-core" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-confusing-an-operator-with-the-system-core" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>An Agent’s true strength is acting as an <strong>adaptable operator</strong>:</p>
<ul>
<li>Extracting signal from messy emails and unstructured spreadsheets;</li>
<li>Merging intermediate data across two mismatched schemas into a coherent draft;</li>
<li>Adjusting a report’s presentation theme upon request.</li>
</ul>
<p>An operator is not the operating system. An executive assistant who types fast and files folders efficiently does not replace an enterprise ERP platform.
Claiming that a chat box driving a handful of CLI tools constitutes a full SaaS without underlying database schemas, permission engines, or immutable audit logs is mistaking the surface skin for the skeleton.</p>

<h3 class="relative group">3. The Structural Contradiction in Unit Economics and Liability
    <div id="3-the-structural-contradiction-in-unit-economics-and-liability" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-the-structural-contradiction-in-unit-economics-and-liability" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Teams attempting to package Agents as SaaS face an unavoidable economic dilemma:</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Dimension</th>
          <th style="text-align: left">Traditional SaaS</th>
          <th style="text-align: left">Fancied Agent SaaS</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left"><strong>Marginal Cost</strong></td>
          <td style="text-align: left">Near zero (fixed infrastructure, milliseconds per request)</td>
          <td style="text-align: left">Extremely high (tens to hundreds of thousands of tokens per run)</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>Billing & Predictability</strong></td>
          <td style="text-align: left">Predictable seat-based or annual subscription</td>
          <td style="text-align: left">Wildly fluctuating compute sink; users fear token billing, vendors bleed on flat fees</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>Liability Boundary</strong></td>
          <td style="text-align: left">Deterministic execution; platform guarantees audit trails and state changes</td>
          <td style="text-align: left">“For reference only; does not assume legal liability; please verify manually”</td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>Final Deliverable</strong></td>
          <td style="text-align: left">Actual business state mutation (ledger updated, contract executed, order dispatched)</td>
          <td style="text-align: left">Analysis, recommendations, drafts, or preview files (Draft / Preview)</td>
      </tr>
  </tbody>
</table>
<p>A glance at real-world Agent constraint policies reveals an uncompromising disclaimer at the bottom:</p>
<blockquote><p><em>“Unless explicit authorization and confirmation exist, all actions must halt at draft/preview: no executing payments, no formal write-offs, no signing contracts on behalf of the company…”</em></p>
</blockquote><p>When an application cannot close the loop on risk, cannot be granted autonomous decision-making power, and requires line-by-line human verification for every output, it cannot realistically function as an autonomous, unattended enterprise SaaS.</p>
<hr>

<h2 class="relative group">3. Conclusion: Drop the Omnipotence Fantasy and Return to Tooling Fundamentals
    <div id="3-conclusion-drop-the-omnipotence-fantasy-and-return-to-tooling-fundamentals" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-conclusion-drop-the-omnipotence-fantasy-and-return-to-tooling-fundamentals" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Adding to the irony was the reality of the demo itself: after countless hours spent staging scenarios, hand-tuning prompts, and obsessing over presentation styling, the planned 30-minute session was squeezed by various delays and hiccups into a rushed 10-minute sprint, ending in a frantic, unceremonious wrap-up.</p>
<p>No matter how elaborately you stage the theater or how thick you pad the prompts, the messiness of the real world will always deflate unwarranted expectations.</p>
<p>Believing that an Agent wrapper lets you bypass business complexity and effortlessly monetize a SaaS is merely a speculative hangover of the current AI hype cycle.</p>
<p>This does not mean Agents lack utility. On the contrary, stripping away the grandiose delusion of “replacing all legacy enterprise software” makes their true value evident:</p>
<ul>
<li>Instead of replacing databases and deterministic engines, Agents serve as an <strong>efficient cognitive bridge between humans and complex systems</strong>;</li>
<li>They excel as <strong>desktop copilot utilities</strong>, sitting directly in the user’s local workspace to clean dirty data, draft intermediate documents, and perform exploratory analysis;</li>
<li>Let deterministic code and relational databases handle state, and let Agents handle flexible language understanding and ad-hoc orchestration.</li>
</ul>
<p>Acknowledging model boundaries and tackling the unglamorous work of data modeling and infrastructure engineering is far more credible than pretending an Agent shell will magically reinvent enterprise software.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Optional Plugins Must Not Block the Core Session: MCP Startup Isolation and Graceful Degradation</title>
      <link>https://blog.ferstar.org/en/posts/mcp-server-startup-isolation-and-graceful-degradation/</link>
      <pubDate>Mon, 31 Aug 2026 23:41:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/mcp-server-startup-isolation-and-graceful-degradation/</guid>
      <description>A single timeout or crash across configured MCP servers can fatally crash an entire agent session during startup; design service-level criticality contracts, concurrent startup sandboxes, and dynamic tool filtering; achieve resilient fault isolation and seamless degradation for non-essential external tools.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>With the Model Context Protocol (MCP) becoming widely adopted, attaching multiple local or remote MCP servers to an agent runtime is standard practice.</p>
<p>In real workloads, however, running multiple MCP servers quickly exposes a fragility issue:</p>
<blockquote><p><strong>You have five MCP servers in your configuration. Four core local tools for filesystem and terminal work are healthy, but an optional third-party translation or web search server times out or fails due to a local dependency mismatch.</strong></p>
<p><strong>The entire agent runtime panics during initialization. You cannot even ask basic questions or edit local files.</strong></p>
</blockquote><p>A non-essential auxiliary plugin crash shouldn’t take down the entire core session.</p>
<p>To resolve this, we introduced concurrent startup isolation and graceful degradation for MCP services.</p>
<pre class="not-prose mermaid">
flowchart TD
  subgraph Config[MCP Service Criticality]
    C1[Critical: Local Filesystem & Terminal]
    C2[Optional: Remote Knowledge & Search]
  end

  subgraph Startup[Concurrent Isolation Sandbox]
    C1 --> T1[Tokio Task 1: Critical Service, Strict Validation]
    C2 --> T2[Tokio Task 2: Isolated 3s Timeout]
    C2 --> T3[Tokio Task 3: Isolated 3s Timeout]
  end

  subgraph Outcome[Aggregation & Dynamic Degradation]
    T1 -->|Success| R[Dynamic Tool Registry]
    T2 -->|Timeout / Error| D[Log Diagnostic Warning, Don't Block]
    T3 -->|Success| R
    D -.->|Filter Unavailable Tools| R
    R --> S[Session Launches Cleanly / UI Notice: Degraded Mode]
  end

  Config --> Startup
</pre>

<hr>

<h2 class="relative group">1. What Was Wrong With the Legacy Flow?
    <div id="1-what-was-wrong-with-the-legacy-flow" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-what-was-wrong-with-the-legacy-flow" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Many MCP clients initialize servers via a simple sequential loop:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-rust" data-lang="rust"><span class="line"><span class="cl"><span class="c1">// Fragile serial loop
</span></span></span><span class="line"><span class="cl"><span class="k">for</span><span class="w"> </span><span class="n">server_config</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">mcp_servers</span><span class="w"> </span><span class="p">{</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="c1">// If any connect or list_tools call fails, the entire setup returns Err
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">client</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">McpClient</span>::<span class="n">connect</span><span class="p">(</span><span class="o">&</span><span class="n">server_config</span><span class="p">).</span><span class="k">await</span><span class="o">?</span><span class="p">;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">tools</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">client</span><span class="p">.</span><span class="n">list_tools</span><span class="p">().</span><span class="k">await</span><span class="o">?</span><span class="p">;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">registered_tools</span><span class="p">.</span><span class="n">extend</span><span class="p">(</span><span class="n">tools</span><span class="p">);</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>The flaws are obvious:</p>
<ol>
<li><strong>Cumulative startup latency</strong>: Total startup time is the sum of every server’s handshake. A single slow server stalling for 5 seconds delays the whole agent by 5 seconds.</li>
<li><strong>Missing fault isolation</strong>: Core filesystem tools and auxiliary search tools share the same lifecycle. An external timeout escalates into a fatal crash.</li>
</ol>
<hr>

<h2 class="relative group">2. The Solution
    <div id="2-the-solution" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-the-solution" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The revised flow focuses on three changes:</p>

<h3 class="relative group">1. Explicitly Distinguish Critical from Optional Services
    <div id="1-explicitly-distinguish-critical-from-optional-services" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-explicitly-distinguish-critical-from-optional-services" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>We added a criticality flag to the configuration schema:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"mcpServers"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"filesystem"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"command"</span><span class="p">:</span> <span class="s2">"agent-mcp-fs"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"required"</span><span class="p">:</span> <span class="kc">true</span>
</span></span><span class="line"><span class="cl">    <span class="p">},</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"web_search"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"command"</span><span class="p">:</span> <span class="s2">"uvx"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"args"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"mcp-server-duckduckgo"</span><span class="p">],</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"required"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">"timeout_ms"</span><span class="p">:</span> <span class="mi">3000</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<ul>
<li><code>required: true</code> (Critical): Tools the agent cannot function without. Failures will cleanly abort with a clear error.</li>
<li><code>required: false</code> (Optional, Default): Auxiliary enhancements. Failures trigger circuit-breaking without affecting the main session.</li>
</ul>

<h3 class="relative group">2. Concurrent Probing with Isolated Timeouts
    <div id="2-concurrent-probing-with-isolated-timeouts" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-concurrent-probing-with-isolated-timeouts" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Using Tokio, each MCP server is probed in a dedicated asynchronous task (<code>tokio::spawn</code>) wrapped in a <code>tokio::time::timeout</code>:</p>
<ul>
<li>All servers handshake concurrently. Cold startup latency is bounded by the slowest individual server rather than their cumulative sum.</li>
<li>If an optional server fails to connect within 3 seconds or crashes, the error is caught and marked as <code>Degraded</code> rather than bubbling up.</li>
</ul>

<h3 class="relative group">3. Dynamic Tool Filtering and UI Awareness
    <div id="3-dynamic-tool-filtering-and-ui-awareness" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-dynamic-tool-filtering-and-ui-awareness" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Once all probing tasks settle:</p>
<ol>
<li>Successfully initialized tools are registered into the session context.</li>
<li>Tools from degraded servers are filtered out, preventing the model from hallucinating broken calls.</li>
<li>A lightweight notification informs the frontend which optional plugin failed, while keeping the main chat fully operational.</li>
</ol>
<hr>

<h2 class="relative group">3. Takeaway
    <div id="3-takeaway" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-takeaway" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>With startup isolation in place, even if network access is spotty or an MCP plugin config is broken, the agent’s core capabilities launch in sub-seconds.</p>
<p>Plugin systems that depend on external environments must design for failure. An issue in an optional feature should never break core tool availability.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Decoupling Heavy IO from UI Finalization: Eliminating Input Freezes in Desktop Agents</title>
      <link>https://blog.ferstar.org/en/posts/desktop-agent-streaming-lifecycle-reconciliation/</link>
      <pubDate>Mon, 31 Aug 2026 23:40:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/desktop-agent-streaming-lifecycle-reconciliation/</guid>
      <description>Desktop agents often lock the chat input in a frozen loading state after generation completes; decouple disk IO from UI lifecycles via bypass emission channels, optimistic unlocking, and periodic stale reconciliation; completely eliminate input freezes while maintaining deterministic state consistency.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>When building desktop or web-based agent clients, there is a recurring, annoying UX friction:</p>
<blockquote><p><strong>The model has finished streaming its last token on screen, but the input box stays disabled with a “Task in progress…” placeholder. You cannot focus the cursor. It takes several seconds to unlock, and switching away from the window mid-stream can sometimes freeze it in a loading state permanently.</strong></p>
</blockquote><p>This looks like a simple frontend state bug, but tracing through the stack reveals an issue of asynchronous disk persistence blocking the event dispatch pipeline.</p>
<pre class="not-prose mermaid">
flowchart TD
  subgraph Backend[Agent Host Process / Runtime]
    M[Receive Final Text Chunk] --> MC[Emit MessageComplete]
    MC --> P[Heavy Async Persistence: SQLite & Archiving]
    P --> AE[Emit AgentEnd Terminal Event]
  end

  subgraph Legacy[Legacy Serial Pattern]
    L1[Wait for Persistence to Finish] --> L2[Notify Frontend via Long IPC Queue]
    L2 --> L3[Clear isStreaming / Noticeable UI Freeze]
  end

  subgraph Optimized[Decoupled & Reconciled Pattern]
    MC -->|Optimistic: No Pending Tools| UI1[Unlock Input Box Instantly]
    AE -->|Bypass Fast Channel| UI1
    T[10s Periodic Stale Reconciliation] -.->|Handles Dropouts & Blur Edge Cases| UI1
  end
</pre>

<hr>

<h2 class="relative group">1. Why Does the Input Lock Up?
    <div id="1-why-does-the-input-lock-up" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-why-does-the-input-lock-up" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>From model output to disk storage, messages pass through three layers:</p>
<ol>
<li><strong>Sampling Runtime</strong>: Consumes the SSE stream, producing text deltas and <code>MessageComplete</code>.</li>
<li><strong>Host Process (Node.js / IPC Layer)</strong>: Manages cross-process communication, SQLite writes, image materialization, and JSONL archiving.</li>
<li><strong>Renderer Process (Frontend UI)</strong>: Manages reactive states like <code>isStreaming</code> and input enablement in React/Vue.</li>
</ol>
<p>Tracing the logs revealed three main bottlenecks:</p>

<h3 class="relative group">Culprit 1: Terminal Events Blocked Behind Heavy I/O
    <div id="culprit-1-terminal-events-blocked-behind-heavy-io" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#culprit-1-terminal-events-blocked-behind-heavy-io" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The legacy implementation waited for all disk writes in the turn to finish before sending <code>agent_end</code> to the UI:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-typescript" data-lang="typescript"><span class="line"><span class="cl"><span class="c1">// Legacy flow: Heavy I/O blocks terminal notifications
</span></span></span><span class="line"><span class="cl"><span class="k">await</span> <span class="nx">persistTurnToSqlite</span><span class="p">(</span><span class="nx">turnData</span><span class="p">);</span>      <span class="c1">// 50~200ms
</span></span></span><span class="line"><span class="cl"><span class="k">await</span> <span class="nx">materializeImagesToDisk</span><span class="p">(</span><span class="nx">images</span><span class="p">);</span>    <span class="c1">// 500ms~2s
</span></span></span><span class="line"><span class="cl"><span class="k">await</span> <span class="nx">appendSessionJsonl</span><span class="p">(</span><span class="nx">largePayload</span><span class="p">);</span>   <span class="c1">// 100~500ms
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// Only now is the UI notified
</span></span></span><span class="line"><span class="cl"><span class="nx">emitToRenderer</span><span class="p">(</span><span class="s1">'agent_end'</span><span class="p">,</span> <span class="nx">session</span><span class="p">);</span></span></span></code></pre></div></div>
<p>While the user is already reading the final response, the host process is still grinding through disk writes. In large sessions, this easily introduces noticeable delays.</p>

<h3 class="relative group">Culprit 2: Head-of-Line Blocking in IPC Queues
    <div id="culprit-2-head-of-line-blocking-in-ipc-queues" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#culprit-2-head-of-line-blocking-in-ipc-queues" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>To preserve message ordering, events pass through an ordered queue (Emit Chain). If the model emits diagnostic logs during finalization, <code>agent_end</code> gets queued behind them.</p>

<h3 class="relative group">Culprit 3: Window Defocus Drops
    <div id="culprit-3-window-defocus-drops" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#culprit-3-window-defocus-drops" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>When a user switches windows mid-stream, Chromium throttles background timers. If a cross-process packet drops during that transition, the UI permanently misses <code>agent_end</code>, leaving the input locked.</p>
<hr>

<h2 class="relative group">2. The Solution
    <div id="2-the-solution" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-the-solution" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>We updated the IPC and frontend state management across three areas:</p>

<h3 class="relative group">1. Optimistic Unlocking
    <div id="1-optimistic-unlocking" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-optimistic-unlocking" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Input availability should not wait on disk writes. Once the frontend receives <code>MessageComplete</code> and verifies:</p>
<ul>
<li>The reply is a genuine terminal turn (<code>EndTurn</code>);</li>
<li>No background tools are currently executing;</li>
<li>The user has not requested a stop.</li>
</ul>
<p>It <strong>unlocks the input box immediately</strong>, dropping perceived recovery latency to zero.</p>

<h3 class="relative group">2. Bypass Channel for Terminal Events
    <div id="2-bypass-channel-for-terminal-events" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-bypass-channel-for-terminal-events" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Lifecycle events (<code>agent_end</code>, <code>error</code>, <code>cancelled</code>) have higher priority than regular stream deltas. We introduced a fast-track bypass in the IPC bridge:</p>
<ul>
<li>Terminal events skip the standard ordered queue and dispatch directly to the renderer.</li>
<li>Even if SQLite writes or archiving queues are backed up, the UI lifecycle updates without delay.</li>
</ul>

<h3 class="relative group">3. 10-Second Low-Overhead Reconciliation Loop
    <div id="3-10-second-low-overhead-reconciliation-loop" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-10-second-low-overhead-reconciliation-loop" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>To handle orphaned states from window blur or dropped packets, the frontend runs a 10-second reconciliation check:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-typescript" data-lang="typescript"><span class="line"><span class="cl"><span class="nx">useEffect</span><span class="p">(()</span> <span class="o">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="kr">const</span> <span class="nx">timer</span> <span class="o">=</span> <span class="nx">setInterval</span><span class="p">(()</span> <span class="o">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="c1">// Check for sessions with no activity for >10s still marked as streaming
</span></span></span><span class="line"><span class="cl">    <span class="nx">reconcileStaleStreamingSessions</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">  <span class="p">},</span> <span class="mi">10</span><span class="nx">_000</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">  <span class="k">return</span> <span class="p">()</span> <span class="o">=></span> <span class="nx">clearInterval</span><span class="p">(</span><span class="nx">timer</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">[]);</span></span></span></code></pre></div></div>
<p>Any stuck sessions are idempotently cleaned up and synchronized.</p>
<hr>

<h2 class="relative group">3. Takeaway
    <div id="3-takeaway" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-takeaway" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>With these changes in place, the input box is ready the moment generation finishes, and focus freezes from window switching are gone.</p>
<p>In rich-client apps, keep user interactions optimistic and fast, run heavy persistence asynchronously in the background, and use periodic reconciliation to ensure eventual consistency.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Beyond Brute-Force Aborts: Graded Loop Governance for Agents (Warn → Block → Halt)</title>
      <link>https://blog.ferstar.org/en/posts/agent-graded-loop-guard-warn-block-halt/</link>
      <pubDate>Mon, 31 Aug 2026 23:39:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/agent-graded-loop-guard-warn-block-halt/</guid>
      <description>Agents tackling complex tasks often fall into repetitive tool-calling loops that inflate context and exhaust budgets; design a graded guardrail mechanism based on canonical argument hashing and side-effect classification; achieve an autonomous recovery loop spanning gentle steering, synthetic interception, and deterministic halt.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>When running complex tasks, one of the worst states an agent can enter is a repetitive execution loop.</p>
<p>For example, if a regex finds nothing, the model might dispatch the exact same <code>grep_search</code> three or four times in a row. Or if a file does not exist, it repeatedly calls <code>view_file</code> on the same path. Each call returns an identical empty result or error, yet the model stubbornly keeps trying.</p>
<p>Legacy approaches to handling loops are usually blunt:</p>
<ol>
<li><strong>Let it run until max_turns exhausts</strong>: Wasting dozens of API calls and crashing with a generic “maximum turns exceeded” error.</li>
<li><strong>Throw an exception immediately upon repetition</strong>: Aborting the task right away. But all the accumulated investigation context and progress vanish with it.</li>
</ol>
<p>Neither approach works well. We added a Graded Loop Guard to our runtime using a three-tier escalation ladder.</p>
<pre class="not-prose mermaid">
flowchart TD
  subgraph Ingestion[Tool Call Ingestion]
    A[Receive Model Tool Call] --> B[Compute Canonical Args Hash]
    B --> C[Classify Side-Effects: Read-Only vs Mutating]
  end

  subgraph Ladder[Graded Escalation Ladder]
    C --> D{Sequential Duplicate Count}
    D -->|1st Duplicate Count=2| E[Warn: Execute Tool & Append Steering Guidance]
    D -->|2nd Duplicate Count=3| F[Block: Intercept Execution & Return Synthetic Error]
    D -->|3rd Duplicate Count=4| G[Halt: Abort Turn & Expose repeated_tool_calls]
  end

  subgraph Outcome[Outcome & Recovery]
    E --> H[Model Reads Hint & Self-Corrects]
    F --> I[Prevent Wasted IO & Force Strategy Shift]
    G --> J[Preserve Context & Provide Clear Diagnostics]
  end

  Ingestion --> Ladder
</pre>

<hr>

<h2 class="relative group">1. Why Brute-Force Aborts Fail
    <div id="1-why-brute-force-aborts-fail" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-why-brute-force-aborts-fail" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Determining whether a model is genuinely looping requires a few distinctions:</p>
<ul>
<li><strong>Read-Only vs. Mutating Tools</strong>: Repeatedly inspecting the same file with read-only tools (<code>grep</code>, <code>view_file</code>) is often benign, so tolerance can be higher. But repeating mutating actions (<code>write_to_file</code> or running write commands) with identical arguments is dangerous.</li>
<li><strong>Models Can Self-Correct</strong>: Often, the model is simply stuck in a temporary rut. If you explicitly remind it in the tool result (<em>“You have run this exact query twice with zero results; please adjust your approach”</em>), modern reasoning models usually pivot autonomously in the next turn.</li>
</ul>
<p>The guardrail’s design logic is straightforward: <strong>guide first, block physically second, halt last.</strong></p>
<hr>

<h2 class="relative group">2. The Three-Tier Escalation Ladder
    <div id="2-the-three-tier-escalation-ladder" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-the-three-tier-escalation-ladder" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The guard checks invocations in the <code>before_tool_call</code> phase of the main loop:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-rust" data-lang="rust"><span class="line"><span class="cl"><span class="cp">#[derive(Debug, Clone, Copy, PartialEq, Eq)]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="k">pub</span><span class="w"> </span><span class="k">enum</span> <span class="nc">LoopGuardAction</span><span class="w"> </span><span class="p">{</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Allow: Initial or normal execution
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">Allow</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Warn: Inject guidance into tool result, execute normally
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">Warn</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Block: Prevent physical execution, return synthetic error
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">Block</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Halt: Abort active turn
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">Halt</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>

<h3 class="relative group">Tier 1: Warn (Steering Guidance Injection)
    <div id="tier-1-warn-steering-guidance-injection" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#tier-1-warn-steering-guidance-injection" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>When the same tool with identical normalized arguments appears for the second time in a task:</p>
<ul>
<li>The tool executes normally.</li>
<li>When the tool finishes, the runtime appends an automated notice to the end of the <code>ToolResult</code>:
<blockquote><p><code>[System Notice] You have executed this tool repeatedly with identical arguments without progress. Do not repeat identical calls. Adjust your search pattern, change the target path, or switch tools.</code></p>
</blockquote></li>
<li>Most models immediately adjust their strategy on the next turn.</li>
</ul>

<h3 class="relative group">Tier 2: Block (Synthetic Interception)
    <div id="tier-2-block-synthetic-interception" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#tier-2-block-synthetic-interception" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>If the model ignores the warning and calls the exact same tool a third time:</p>
<ul>
<li>The guard short-circuits the call, skipping physical file I/O or command execution entirely.</li>
<li>A structured error (<code>ToolResultContent::Error</code>) is synthesized at the protocol layer, informing the model that repeated execution was blocked.</li>
<li>LLM protocols mandate that every <code>tool_use</code> must have an accompanying <code>tool_result</code>. Returning a synthetic error preserves protocol parity while preventing wasted computation.</li>
</ul>

<h3 class="relative group">Tier 3: Halt (Safe Turn Abort)
    <div id="tier-3-halt-safe-turn-abort" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#tier-3-halt-safe-turn-abort" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>If duplicate calls reach four (<code>HALT_AFTER = 4</code>), the model is stuck:</p>
<ul>
<li>The runtime ends the current turn and triggers <code>RepeatedToolCalls</code>.</li>
<li>The UI and logs explicitly identify the offending tool name and arguments.</li>
<li>Prior session history remains intact on disk, allowing the user to guide the agent with a follow-up prompt without re-running from scratch.</li>
</ul>
<hr>

<h2 class="relative group">3. Canonical Argument Matching
    <div id="3-canonical-argument-matching" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-canonical-argument-matching" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>To prevent false negatives from varying JSON key order, the guard sorts JSON object keys recursively before computing <code>canonical_args_hash</code>. This ensures <code>{"a": 1, "b": 2}</code> and <code>{"b": 2, "a": 1}</code> yield identical fingerprints.</p>
<p>Tools are also categorized as <code>ReadOnly</code> or <code>Mutating</code>, applying tighter thresholds to state-modifying actions.</p>
<hr>

<h2 class="relative group">4. Takeaway
    <div id="4-takeaway" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-takeaway" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>In real workloads, most edge-case loops resolve autonomously during the <code>Warn</code> tier.</p>
<p>Replacing abrupt aborts with a progressive ladder of warnings, synthetic blocks, and clean halts preserves token budgets while meaningfully boosting task completion rates.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>When Models Leak Tool Calls as Text: Stream Recovery with a Cross-Chunk DSML State Machine</title>
      <link>https://blog.ferstar.org/en/posts/agent-dsml-tool-call-streaming-recovery/</link>
      <pubDate>Mon, 31 Aug 2026 23:38:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/agent-dsml-tool-call-streaming-recovery/</guid>
      <description>Certain models occasionally leak tool invocations as raw full-width DSML text rather than structured payloads, breaking agent execution; design a provider-agnostic, cross-chunk streaming state machine with defensive protocol recovery; completely prevent text leakage while transparently restoring tool calls to active execution.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>When integrating diverse models for coding agents, transport quirks are bound to happen.</p>
<p>One recurring issue is when a model, instead of returning structured function calls via the standard <code>tool_calls</code> payload, dumps raw XML markup directly into the text stream (<code>content</code> or <code>output_text.delta</code>).</p>
<p>In certain reasoning models (such as DeepSeek derivatives or proxied gateways), it often looks like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">＜ＤＳＭＬ＜tool_calls＞
</span></span><span class="line"><span class="cl">＜ＤＳＭＬ＜invoke name="read_file"＞
</span></span><span class="line"><span class="cl">＜ＤＳＭＬ＜parameter name="path"＞"src/main.rs"＜／ＤＳＭＬ＜／parameter＞
</span></span><span class="line"><span class="cl">＜／ＤＳＭＬ＜／invoke＞
</span></span><span class="line"><span class="cl">＜／ＤＳＭＬ＜／tool_calls＞</span></span></code></pre></div></div>
<p>If the transport layer simply passes these tokens through to the UI as plain text:</p>
<ol>
<li>The agent loop receives zero <code>tool_call</code> events, stalling the task.</li>
<li>The user’s screen gets littered with unparsed full-width XML tags.</li>
</ol>
<p>To handle this cleanly in our runtime, we built a cross-chunk streaming DSML recovery state machine.</p>
<pre class="not-prose mermaid">
flowchart TD
  subgraph Ingestion[Streaming Input Token Chunks]
    A[Chunk 1: Protocol Prefix] --> B[Chunk 2: invoke name=read_file]
    B --> C[Chunk 3: parameter name=path]
    C --> D[Chunk 4: Protocol Closing Tag]
  end

  subgraph StateMachine[DSML Streaming State Machine]
    S1[Detect Prefix: ＜ＤＳＭＬ＜] --> S2{Is Prompt Example?}
    S2 -->|Yes| S3[Disable Recovery / Stream as Text]
    S2 -->|No| S4[Capture Mode / Hold Text Output]
    S4 --> S5[Buffer Chunks & Assemble Tags]
    S5 --> S6{Is Markup Valid & Closed?}
    S6 -->|No or Over Limit| S7[Fail-Closed / Emit Safe Error]
    S6 -->|Yes| S8[Extract Tool Name & Parameter Pairs]
  end

  subgraph Dispatch[Protocol Conversion & Dispatch]
    S8 --> E1[Validate against Tool Schema & Deserialize]
    E1 --> E2[Synthesize ToolCall & ToolUse Events]
    E2 --> E3[Agent Loop Executes Real Tool]
  end

  Ingestion --> StateMachine
</pre>

<hr>

<h2 class="relative group">1. Where the Complexity Lies
    <div id="1-where-the-complexity-lies" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-where-the-complexity-lies" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>If you receive a single, complete HTTP response body, extracting the tags via regex or an XML parser is straightforward. But agents require low-latency streaming text, which introduces several constraints:</p>
<ol>
<li><strong>Chunk Fragmentation</strong>: Output arrives token-by-token. A tag like <code>＜ＤＳＭＬ＜invoke</code> might arrive fragmented as <code>["＜", "ＤＳ", "ＭＬ＜in", "voke"]</code> across four separate network packets. Single-chunk regex matching is ineffective.</li>
<li><strong>Hold Buffers</strong>: When receiving a partial prefix (like a standalone <code>＜</code>), we cannot stream it immediately to the client (in case it turns out to be markup). But we also cannot hold it indefinitely; normal text must flush immediately once verified.</li>
<li><strong>User Prompt Examples</strong>: If a user is explicitly discussing DSML syntax (e.g., <em>“What does ＜ＤＳＭＬ＜ mean?”</em>), the state machine must recognize this and disable recovery, rather than attempting to execute quoted examples as real system commands.</li>
<li><strong>Native vs. DSML Conflicts</strong>: If a model returns both native structured tool calls and raw DSML text in the same turn, we fail closed to prevent duplicate executions.</li>
</ol>
<hr>

<h2 class="relative group">2. State Machine Design & Intermediate Representation
    <div id="2-state-machine-design--intermediate-representation" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-state-machine-design--intermediate-representation" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>To support multiple providers (OpenAI-compatible endpoints, Responses APIs), the state machine operates on a decoupled Intermediate Representation:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-rust" data-lang="rust"><span class="line"><span class="cl"><span class="k">pub</span><span class="w"> </span><span class="k">enum</span> <span class="nc">DsmlOutcome</span><span class="w"> </span><span class="p">{</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Confirmed user-visible text, released for frontend streaming
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">Text</span><span class="p">(</span><span class="nb">String</span><span class="p">),</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="sd">/// Successfully captured and parsed complete tool invocations
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="n">ToolCalls</span><span class="p">(</span><span class="nb">Vec</span><span class="o"><</span><span class="n">DsmlToolCall</span><span class="o">></span><span class="p">),</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="p">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">DsmlToolCall</span><span class="w"> </span><span class="p">{</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="n">id</span>: <span class="nb">String</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="n">name</span>: <span class="nb">String</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="n">arguments</span>: <span class="nb">String</span><span class="p">,</span><span class="w"> </span><span class="c1">// Normalized standard JSON string
</span></span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>The provider passes incoming text chunks into the state machine:</p>
<ul>
<li>It maintains an internal <code>capture_buffer</code>.</li>
<li>Once <code>＜ＤＳＭＬ＜</code> is detected, it switches to capture mode, pausing downstream <code>TextDelta</code> emissions.</li>
<li>A <code>DSML_CAPTURE_LIMIT</code> (256KB) guards against memory exhaustion from malformed output.</li>
</ul>
<hr>

<h2 class="relative group">3. Schema Validation & Event Synthesis
    <div id="3-schema-validation--event-synthesis" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-schema-validation--event-synthesis" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When closed tags are parsed, <code><invoke></code> and <code><parameter></code> nodes are extracted:</p>
<ol>
<li>Verify the tool name exists in the current registry.</li>
<li>Parse non-string parameters into valid JSON values.</li>
<li>Validate against the tool’s registered JSON Schema.</li>
<li>Synthesize native <code>ToolCallStart</code>, <code>ToolInputDelta</code>, and <code>ToolUse</code> events.</li>
</ol>
<p>From the agent loop’s perspective, this is indistinguishable from standard provider tool calls, routing directly into normal tool execution.</p>
<hr>

<h2 class="relative group">4. Takeaway
    <div id="4-takeaway" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-takeaway" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>When building agent runtimes against varied model endpoints, output formatting anomalies are inevitable. Absorbing these quirks in the transport adapter layer keeps higher-level agent state machines clean and dependable.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Moving Context Compaction Off the Critical Path: Two-Pass Prefire and Recovery Hints for Long-Running Agents</title>
      <link>https://blog.ferstar.org/en/posts/agent-context-compaction-two-pass-prefire/</link>
      <pubDate>Mon, 31 Aug 2026 23:20:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/agent-context-compaction-two-pass-prefire/</guid>
      <description>In-flight context compaction causes noticeable UI pauses and drops execution details in long agent sessions; introduce Two-Pass Prefire background summarization with append-only JSONL recovery hints, alongside prune-first retries and terminal checkpoints; achieve near-zero perceived compaction latency while retaining full historical detail retrieval.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>When running long agent tasks, context grows fast.</p>
<p>Refactoring code, checking logs, running test suites—after dozens of turns, tokens quickly approach their limit. The simplest legacy approach was single-pass compaction: when limits are crossed, stop the main loop, send the entire message history to an LLM for a global summary, and swap out old messages.</p>
<p>In practice, several problems surfaced quickly:</p>
<ol>
<li><strong>Main-loop pauses</strong>: Sending tens of kilobytes of history for an LLM summary often takes seconds or tens of seconds. The client input box just sits in a loading state.</li>
<li><strong>Lost execution details</strong>: Once condensed into prose, exact error line numbers, file paths, and stray arguments vanish. When subsequent steps need them, the model either re-queries from scratch or hallucinates.</li>
<li><strong>Broken KV caching</strong>: Cramming the summary into the System Prompt mutates the prompt prefix on provider servers, busting Prompt Caching completely and driving up both TTFT and API costs.</li>
<li><strong>Wasted summaries when pruning would suffice</strong>: Often, context blows up simply because a tool dumped a massive <code>git diff</code> or build log. Truncating old tool outputs reclaims tens of thousands of tokens without needing an LLM summary at all.</li>
</ol>
<p>I overhauled our agent runtime’s context management over the past three days. Here is what changed.</p>
<pre class="not-prose mermaid">
flowchart TD
  subgraph Prefire[Phase 1: Pass 1 Background Prefire]
    A[Tokens hit 90% threshold] --> B[Slice 95% prefix history]
    B --> C[Async background LLM summary]
    C --> D[Cache NOTE1 note and fingerprint]
  end

  subgraph Foreground[Foreground Main Loop]
    U[Normal turns and tool calls] --> E[Generate new turns]
  end

  subgraph Compaction[Phase 2: Pass 2 Compaction]
    F[Tokens cross 100% threshold] --> G{Fingerprint matches?}
    G -->|Match| H[Merge NOTE1 with tail delta]
    G -->|Drift or Failure| I[Fallback to full single-pass summary]
    H --> J[Generate final summary]
    I --> J
    J --> K[Inject standalone summary turn & JSONL pointer]
  end

  Prefire -.->|Runs in background| Foreground
  Foreground --> F
</pre>

<hr>

<h2 class="relative group">1. Two-Pass Prefire: Moving Heavy Summaries to the Background
    <div id="1-two-pass-prefire-moving-heavy-summaries-to-the-background" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-two-pass-prefire-moving-heavy-summaries-to-the-background" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>To keep the UI responsive, the heaviest work must happen in the background before the hard limit is hit.</p>

<h3 class="relative group">Phase 1: Prefix Prefire (Pass 1)
    <div id="phase-1-prefix-prefire-pass-1" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#phase-1-prefix-prefire-pass-1" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>We added a safety margin (<code>prefire_margin_tokens</code>, defaulting to a 10% buffer).</p>
<p>When context usage reaches 90% of the threshold, the main loop keeps running while spawning a background task:</p>
<ul>
<li><strong>Slice the prefix</strong>: Take the oldest 95% of messages. Slicing must strictly protect <code>tool_use</code> and <code>tool_result</code> boundaries without severing unclosed invocations.</li>
<li><strong>Generate NOTE1</strong>: The prefix is summarized into a structured note (<code>NOTE1</code>), and a hash fingerprint of that prefix is stored in cache.</li>
<li>The foreground streams text normally without interruption.</li>
</ul>

<h3 class="relative group">Phase 2: Incremental Compaction (Pass 2)
    <div id="phase-2-incremental-compaction-pass-2" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#phase-2-incremental-compaction-pass-2" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>When subsequent turns push total tokens past the 100% threshold, formal compaction kicks in:</p>
<ul>
<li>Verify the fingerprint. If the prefix hasn’t changed and the background task finished, grab the cached <code>NOTE1</code>.</li>
<li>Instead of feeding the whole history to the model, we only send <code>NOTE1</code> plus the few tail messages produced after Pass 1.</li>
<li>If the fingerprint drifted or Pass 1 failed, it cleanly falls back to standard single-pass compaction.</li>
</ul>
<p>This cuts the tokens sent during active compaction by over 80%, dropping main-thread wait times to milliseconds.</p>
<hr>

<h2 class="relative group">2. Compaction Is Not Deletion: Recovery Hints Pointing to Local JSONL
    <div id="2-compaction-is-not-deletion-recovery-hints-pointing-to-local-jsonl" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-compaction-is-not-deletion-recovery-hints-pointing-to-local-jsonl" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Compacting history shouldn’t mean destroying raw details.</p>
<ol>
<li><strong>Local append-only source of truth</strong>: All raw messages, arguments, and full outputs are continuously written to a local session JSONL file and are never deleted.</li>
<li><strong>Recovery pointers</strong>: The <code><compaction-summary></code> block automatically includes a <code><recovery_hint></code> tag containing the session’s absolute JSONL path:
<blockquote><p>History has been summarized. Full raw records remain in <code>session.jsonl</code>. If subsequent steps require exact line numbers, error traces, or command outputs, inspect this file directly with read tools.</p>
</blockquote></li>
<li><strong>Leave the System Prompt alone</strong>: Summaries are injected as standalone conversation turns. The System Prompt stays frozen, keeping server-side Prompt Caching hit rates high.</li>
</ol>
<hr>

<h2 class="relative group">3. Prune First Before Calling an LLM Summary
    <div id="3-prune-first-before-calling-an-llm-summary" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-prune-first-before-calling-an-llm-summary" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Often, invoking an LLM for summarization is unnecessary.</p>
<p>Before running full compaction, we execute <code>trim_old_tool_results</code> to truncate verbose outputs from older turns into short previews. If pruning frees enough tokens, we set <code>context_changed = true</code> and retry immediately, saving an expensive summary call.</p>
<p>We also resolved an edge case: when a turn’s final assistant reply (<code>EndTurn</code>) pushes context over the threshold, compaction used to wait until the user’s next prompt. Now, the runtime compacts and persists checkpoints immediately between <code>MessageComplete</code> and <code>TurnEnd</code>, ensuring cold reboots wake up to clean context.</p>
<hr>

<h2 class="relative group">4. Real-World Telemetry
    <div id="4-real-world-telemetry" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-real-world-telemetry" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Testing over a continuous 47-hour session with 1,000 requests and 490 million input tokens yielded clear metrics:</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Metric</th>
          <th style="text-align: left">Pre-fix (964 turns)</th>
          <th style="text-align: left">Post-fix (36 turns)</th>
          <th style="text-align: left">Change</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left"><strong>Avg. Input / Turn</strong></td>
          <td style="text-align: left">496,806 tokens</td>
          <td style="text-align: left">299,625 tokens</td>
          <td style="text-align: left"><strong>↓ 40%</strong></td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>Context Shape</strong></td>
          <td style="text-align: left">1.75M full replay (inflated)</td>
          <td style="text-align: left">~250K baseline / 280K steady</td>
          <td style="text-align: left"><strong>Bounded</strong></td>
      </tr>
      <tr>
          <td style="text-align: left"><strong>Prompt Cache Hit Rate</strong></td>
          <td style="text-align: left">99.11%</td>
          <td style="text-align: left">96.91% (includes cold restarts)</td>
          <td style="text-align: left"><strong>99%+ sustained</strong></td>
      </tr>
  </tbody>
</table>
<p>Average per-turn tokens dropped by 40%, and context stabilized around 280K instead of ballooning uncontrollably. Beyond a minor ~20K cache miss right after compaction restarts, subsequent turns sustained 99% to 100% prompt cache hit rates.</p>
<p>Keeping long-running agents reliable comes down to getting these state transitions and caching boundaries right.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>1Password Raised Its Price Again, So I Moved to Self-Hosted Vaultwarden</title>
      <link>https://blog.ferstar.org/en/posts/1password-to-self-hosted-vaultwarden/</link>
      <pubDate>Sat, 08 Aug 2026 10:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/1password-to-self-hosted-vaultwarden/</guid>
      <description>After my 1Password Families annual price rose from US$59.85 to US$71.88, I moved to self-hosted Vaultwarden and completed the migration of regular credentials and passkeys with backups, invitations, and recovery in place.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>The trigger was simple: 1Password raised its price again.</p>
<p>My three-member Families plan used to cost US$59.85 per year. The billing page showed that the next renewal would be US$71.88 per year, roughly a 20% increase. The price is reasonable, yet I no longer wanted to keep following every subscription increase. So I started looking for an alternative and eventually moved my personal vault to Vaultwarden on a VPS I run myself.</p>
<p>The migration itself was not especially difficult. The time went into everything around it: passkeys follow a different path from ordinary login items, a broken server can lock away the recovery credentials along with the vault, and bulk organization can trigger version conflicts.</p>
<p>This post records one real migration and keeps only the deployment details that matter to the move. The real hostname is replaced with <code>vault.example.com</code> here.</p>

<h2 class="relative group">The short version
    <div id="the-short-version" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-short-version" aria-label="Anchor">#</a>
    </span>
    
</h2>
<ul>
<li>For personal or family use, Vaultwarden is lightweight enough, and the official Bitwarden browser, desktop, and mobile clients can still be used.</li>
<li>Regular data such as passwords, usernames, OTPs, and notes migrated successfully; the in-app Android import moved everything, including passkeys, in this real-world test.</li>
<li>I did not use <code>.1pux</code> or any export file in this migration. Everything was imported directly from another app on Android, including regular data and passkeys.</li>
<li>1Password should not be deleted immediately after the first successful import. The real completion criteria are a working new client, readable backups, and a recovery path that does not depend on the vault itself.</li>
</ul>
<pre class="not-prose mermaid">
flowchart LR
    A["1Password"] --> B["Export / CXP"]
    B --> C["Vaultwarden"]
    C --> D["Client verification"]
    C --> E["Backups"]
    D --> F["Keep 1Password until verified"]
</pre>


<h2 class="relative group">Why Vaultwarden
    <div id="why-vaultwarden" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-vaultwarden" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I compared three routes at the time:</p>
<ul>
<li><strong>Vaultwarden</strong>: lightweight, with a complete Bitwarden client ecosystem, and a good fit for personal or family use. Its server is an independent implementation, so compatibility needs to be checked against the actual versions in use.</li>
<li><strong>Passbolt</strong>: stronger team permissions, auditing, and sharing, but with a heavier deployment and more supporting services.</li>
<li><strong>KeePassXC</strong>: the smallest server trust surface, but essentially a synchronized database file, which is less natural for real-time multi-user sharing.</li>
</ul>
<p>I already had a VPS and 1Panel, so I chose Vaultwarden: keep the data on a dedicated data disk, run it with Docker, and reuse 1Panel/OpenResty for HTTPS and reverse proxying.</p>

<h2 class="relative group">The work that is easy to underestimate
    <div id="the-work-that-is-easy-to-underestimate" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-work-that-is-easy-to-underestimate" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">1. Decide on the data disk and directory first
    <div id="1-decide-on-the-data-disk-and-directory-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-decide-on-the-data-disk-and-directory-first" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I added a 150 GiB disk to the VPS, mounted it at <code>/data</code>, and fixed the Vaultwarden data directory as:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">/data/services/vaultwarden</span></span></code></pre></div></div>
<p>I ended up choosing ext4. I did compare XFS in practice: it provided somewhat more free space on an empty disk, but it cannot be shrunk. Since I might move to a smaller disk later, I prioritized room for recovery and migration over saving a little space.</p>
<p>There is no universal answer here. For a password manager, keeping future migration options open matters more than theoretical performance.</p>

<h3 class="relative group">2. DNS, certificates, and the proxy are easier to break than the container
    <div id="2-dns-certificates-and-the-proxy-are-easier-to-break-than-the-container" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-dns-certificates-and-the-proxy-are-easier-to-break-than-the-container" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Before exposing the service, verify that DNS points to the right VPS. I hit an old IPv6 record during the process, so requests were not reaching the new machine even though the container itself was fine.</p>
<p>In the final setup, 1Panel manages the certificate for <code>vault.example.com</code>, using the existing Cloudflare DNS account for issuance and renewal. OpenResty reverse-proxies the hostname to Vaultwarden. This leaves one certificate manager instead of having standalone certbot and the panel maintain the same certificate at the same time.</p>
<p>During acceptance, do not check only whether the container is <code>healthy</code>. Check HTTPS from the public internet, redirects, the Vaultwarden health endpoint, and a real login. One later access failure turned out to be a transient DNS problem on my Mac; the remote service had stayed healthy and returned 200 all along.</p>

<h3 class="relative group">3. Separate public sign-up from invitations
    <div id="3-separate-public-sign-up-from-invitations" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-separate-public-sign-up-from-invitations" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>At first I disabled both public sign-up and invitations. When I wanted to share with a friend, I kept public registration closed and enabled invitations only:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-env" data-lang="env"><span class="line"><span class="cl"><span class="nv">SIGNUPS_ALLOWED</span><span class="o">=</span><span class="nb">false</span>
</span></span><span class="line"><span class="cl"><span class="nv">INVITATIONS_ALLOWED</span><span class="o">=</span>true</span></span></code></pre></div></div>
<p>The friend uses their own email address and master password, then joins an Organization and Collection. Personal passwords stay in the personal vault; only items that need to be shared go into the shared collection.</p>
<p>Invitation email also requires SMTP. I used Mailgun SMTP and ran two separate checks: first a STARTTLS login handshake, then a real invitation email. A successful handshake only confirms SMTP authentication; delivery still needs its own test, so record the two results separately.</p>

<h2 class="relative group">The migration route that worked
    <div id="the-migration-route-that-worked" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-migration-route-that-worked" aria-label="Anchor">#</a>
    </span>
    
</h2>

<h3 class="relative group">Step 1: Keep 1Password around
    <div id="step-1-keep-1password-around" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#step-1-keep-1password-around" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Before migrating, make sure the 1Password account still unlocks normally and prepare an encrypted backup. A successful login to the new service alone does not confirm that the old data is safely migrated.</p>

<h3 class="relative group">Step 2: Import directly inside the Android app
    <div id="step-2-import-directly-inside-the-android-app" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#step-2-import-directly-inside-the-android-app" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I did not use <code>.1pux</code> or create an export file first. The entire migration happened inside the Bitwarden Android app: configure the self-hosted server, then open:</p>
<p><code>Settings → Vault → Import items → Import from another app → 1Password</code></p>
<p>This path imported both regular data and passkeys completely. The migration relied on the app’s direct app-to-app import and used no exported file.</p>
<p>After importing, check at least the following:</p>
<ul>
<li>whether usernames and passwords are complete;</li>
<li>whether OTPs generate the right codes;</li>
<li>whether notes, custom fields, and attachments are still there;</li>
<li>whether folders need to be redesigned;</li>
<li>whether a second import accidentally created duplicates.</li>
</ul>
<p>For a first run, it is still sensible to sample a small number of important items, verify login, autofill, and passkeys on the new device, and keep the old 1Password vault available until that check is done.</p>
<p>Useful references:</p>
<ul>
<li><a href="https://bitwarden.com/help/import-from-1password/"  target="_blank" rel="noreferrer">Bitwarden: Import from 1Password</a></li>
<li><a href="https://github.com/dani-garcia/vaultwarden"  target="_blank" rel="noreferrer">Vaultwarden project</a></li>
</ul>

<h3 class="relative group">Step 3: Accept each client separately
    <div id="step-3-accept-each-client-separately" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#step-3-accept-each-client-separately" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The browser extension, desktop app, and mobile app all need the self-hosted server selected before login. The address looks like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">https://vault.example.com</span></span></code></pre></div></div>
<p>I also tested the Bitwarden CLI. The minimal self-hosted configuration path is:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">bw config server https://vault.example.com
</span></span><span class="line"><span class="cl">bw config server
</span></span><span class="line"><span class="cl">bw login your-email@example.com
</span></span><span class="line"><span class="cl">bw status</span></span></code></pre></div></div>
<p>There was a client-side trap unrelated to the server: at the time, the CLI installed globally with pnpm failed under Node 26.3.0 with <code>Cannot find module 'buffer/'</code>. The actual problem was the combination of the global dependency links and the runtime. Installing the same CLI version with npm and running it with Node 22 fixed it.</p>
<p>When the CLI fails, check how <code>bw</code> was installed, which Node version it is using, and which server it is targeting before restarting Vaultwarden.</p>

<h2 class="relative group">Vault organization taught me a practical lesson
    <div id="vault-organization-taught-me-a-practical-lesson" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#vault-organization-taught-me-a-practical-lesson" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After the migration, I wanted to reorganize 261 records that had all been sitting in <code>No Folder</code>. Classification was easy; bulk updates were not.</p>
<p>I made an encrypted backup first, then changed only folder ownership. I did not edit passwords, notes, or OTPs, and I did not delete duplicates. During concurrent updates, a version race in Vaultwarden temporarily moved six same-name Mattermost items to the trash. After resyncing and restoring them one by one, the item IDs matched the backup again.</p>
<p>That left me with a few rules:</p>
<ol>
<li>Make a recoverable backup before bulk writes.</li>
<li>Treat a one-field update as a real data change.</li>
<li>Concurrent requests are not always faster; stale client copies can create races.</li>
<li>Final verification should compare totals, item IDs, and the trash, not just HTTP 200.</li>
</ol>
<p>The vault is now organized into Work and Internal, Development and Cloud Services, Personal Accounts, Communication and Social, Finance and Identity, Home and Devices, and Security and Keys. All 261 items left <code>No Folder</code>. I did not delete duplicates without review.</p>

<h2 class="relative group">A backup is not “export one JSON file”
    <div id="a-backup-is-not-export-one-json-file" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#a-backup-is-not-export-one-json-file" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Self-hosting changes the psychology of the problem: you own the recovery responsibility.</p>
<p>This is how I closed the loop:</p>
<ul>
<li>the database, attachments, and configuration live under <code>/data</code>;</li>
<li>the VPS creates backups on a schedule;</li>
<li>only after the local backup succeeds, it syncs over SSH to another host, <code>DO_NEW</code>;</li>
<li>backup files use an encrypted format and produce verifiable results;</li>
<li>recovery credentials for the cloud account, DNS, email, and VPS are not all stored in this vault; at least one independent break-glass path remains.</li>
</ul>
<p>A copy stored only on the same VPS provides no off-site protection. A backup also needs a restore test before it can be trusted. Perform at least one temporary restore and verify the database, attachments, configuration, and client login.</p>

<h2 class="relative group">Final judgment
    <div id="final-judgment" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#final-judgment" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>This migration convinced me that Vaultwarden can replace 1Password for personal or family use. Starting the container is only the first step.</p>
<p>You give up part of the managed service and take on DNS, TLS, SMTP, upgrades, logs, backups, and recovery. Ordinary password data moves easily. Passkeys, sharing permissions, and disaster recovery are where the careful work belongs.</p>
<p>If the only goal is to save the subscription fee and you do not want to maintain backups and recovery, the trade-off may not be worthwhile. If you care more about data control and client freedom, and are willing to operate it like a small production service, Vaultwarden is a practical option.</p>
<p>For me, migration was complete only when all four answers were yes:</p>
<ul>
<li>a new device can log in and autofill;</li>
<li>OTPs and important attachments have been sampled;</li>
<li>passkeys have been verified in the target client, or have an explicit site-by-site recreation plan;</li>
<li>if the VPS disappears, there is still an independent recovery route and a verifiable backup.</li>
</ul>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Giving My Codex Workflow a Rear-View Mirror: Harness Governance and Observability</title>
      <link>https://blog.ferstar.org/en/posts/codex-harness-observability-loop/</link>
      <pubDate>Sat, 18 Jul 2026 20:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/codex-harness-observability-loop/</guid>
      <description>A growing library of personal Codex skills made workflow quality hard to judge; govern skill boundaries with an authority state machine, use native session JSONL as the sole source of truth, and close the loop with scheduled AI audits and evals.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>A month ago, I wrote <a href="/en/posts/codex-workflow-skills-feedback-loop/" >Growing a Codex Workflow as a Living System: From Session Logs to Skills</a>. The conclusion was simple: find recurring friction in real sessions, capture it as a small skill first, and write a script only after the action has proved mechanical.</p>
<p>That worked. But as the skill library grew, it introduced a new layer of complexity.</p>
<p>One task could trigger <code>agent-preflight</code>, <code>path-verify</code>, <code>gitlab-mr-context</code>, and <code>codex-ship-loop</code> together. After an MR was merged, there was no consistent meaning for whether its issue should close, stay open, or move to <code>to test</code>. When a long thread was handed off, the agent would re-check context that had already been established. Worse, I knew these problems existed but could not tell how often they happened or whether a change actually improved anything.</p>
<p>So this time I did not add another skill. I went back and governed the Harness itself.</p>

<h2 class="relative group">Audit the workflow, not the code
    <div id="audit-the-workflow-not-the-code" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#audit-the-workflow-not-the-code" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I sampled roughly 127 top-level Codex threads from June 18 to July 18, 2026. Multiple subagents independently reviewed project activity, workflow friction, skill routing, <code>AGENTS.md</code> rules, and thread lifecycles.</p>
<p>The main problem was not missing capability. It was governance debt in four forms:</p>
<ol>
<li><strong>Skill stacking</strong>: several skills performed repository preflight, GitLab context retrieval, or verification routing, leaving no clear workflow owner.</li>
<li><strong>Public and private boundaries were mixed</strong>: reusable public methods contained company GitLab names, internal release flows, local SSH aliases, and absolute paths.</li>
<li><strong>Long threads lacked checkpoints</strong>: handoffs replayed conversations because stable facts and drift-prone facts were not separated.</li>
<li><strong>Delivery had no terminal-state model</strong>: commit, push, merge, deploy, issue state, and cleanup were joined into an implicit authority chain by vague words such as “continue” or “finish it.”</li>
</ol>
<p>Another “manager skill” would not fix these problems. It would only become one more stacking entry point.</p>

<h2 class="relative group">Removing overlapping responsibility is harder than adding capability
    <div id="removing-overlapping-responsibility-is-harder-than-adding-capability" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#removing-overlapping-responsibility-is-harder-than-adding-capability" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I removed two redundant skills in this pass.</p>
<p>The useful parts of <code>gitlab-mr-context</code> moved into the <code>glab</code> references. Reading MRs, issues, pipelines, and discussions belongs to the GitLab CLI skill; it did not need a competing trigger.</p>
<p>I removed <code>path-verify</code> as well. Its useful principle—run the narrowest owning-module check for the changed scope—belongs in general verification guidance. Concrete commands belong in each project’s <code>AGENTS.md</code> or README. Keeping it as a separate skill only added another routing layer to every implementation task.</p>
<p>The remaining workflow skills now have sharper boundaries:</p>
<ul>
<li><code>agent-preflight</code> establishes repository, branch, dirty-state, and live-object facts at the start;</li>
<li><code>ci-first-failure</code> handles already-red CI and identifies the first actionable failure;</li>
<li><code>codex-ship-loop</code> advances already-scoped and verified changes into separately authorized delivery states;</li>
<li><code>release-deploy-preflight</code> resolves release and deployment targets, inputs, exact SHAs, and live verification;</li>
<li><code>artifact-verify</code> proves the contents, integrity, and provenance of an existing artifact without building or publishing it;</li>
<li><code>remote-health</code> diagnoses SSH, networking, PATH, services, and remote runtime conditions.</li>
</ul>
<p>The important result is not two fewer directories. Trigger conditions are becoming mutually exclusive. Skill quality depends not only on activating when needed, but also on staying out of work it does not own.</p>

<h2 class="relative group">Turn natural-language authority into explicit state
    <div id="turn-natural-language-authority-into-explicit-state" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#turn-natural-language-authority-into-explicit-state" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Daily prompts should not become forms. I still prefer saying:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">看下这个 MR 还有什么问题。</span></span></code></pre></div></div>
<p>Internally, however, the Harness should infer a minimal task contract from that short prompt:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">objective + evidence + scope + authority + terminal_state</span></span></code></pre></div></div>
<p>The easiest fields to miss are <code>authority</code> and <code>terminal_state</code>.</p>
<p>“Review the MR” grants read-only access, not permission to edit code. “Push it” does not mean merge. Merge does not imply deploy, issue closure, or branch deletion. I now treat these actions as independent authorities:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">read-only | edit | push | merge | deploy | workflow-state | publish | cleanup</span></span></code></pre></div></div>
<p>Long tasks move through a state machine whose stages may be skipped when irrelevant, but whose terminal state cannot be silently changed:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">DISCOVER -> DECIDE -> IMPLEMENT -> VERIFY -> SHIP -> DONE</span></span></code></pre></div></div>
<pre class="not-prose mermaid">
stateDiagram-v2
  [*] --> DISCOVER
  DISCOVER --> DECIDE
  DECIDE --> IMPLEMENT
  IMPLEMENT --> VERIFY
  VERIFY --> SHIP: separately authorized
  VERIFY --> DONE: no shipping requested
  SHIP --> DONE: final objects verified
  SHIP --> VERIFY: remote state drifted
</pre>

<p><code>DONE</code> no longer means that a command finished. It means the requested terminal state has been read back and verified. For a deployment, a successful workflow is only intermediate evidence; the deployed SHA and live health still need verification. A merge must not close an issue as a side effect—if the requirement says “keep it open and move it to testing,” that is the terminal state.</p>
<p>I also added a shared checkpoint contract to <code>agent-preflight</code> and <code>codex-ship-loop</code> for long threads. Stable evidence is reused, while branch heads, dirty state, CI, mergeability, permissions, workflow inputs, deployment health, and remote SHAs are refreshed because they can drift. Resuming work no longer means repeating the entire investigation.</p>

<h2 class="relative group">I initially chose the wrong observation point
    <div id="i-initially-chose-the-wrong-observation-point" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#i-initially-chose-the-wrong-observation-point" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Once the governance rules existed, the next question was obvious: how could I tell whether they worked?</p>
<p>My first attempt used Codex hooks. Every turn start and completion wrote an event to <code>events.jsonl</code>, and reports were generated from that event stream. It looked like normal observability: events, a schema, a collector, and a completion rate.</p>
<p>Real use exposed three problems quickly.</p>
<p>First, the events were too thin. <code>turn_started</code> and <code>turn_completed</code> show that a flow ran, but not that the result was correct, that the right skill was used, or that an issue ended in the requested state. Semantic judgment still required the original session.</p>
<p>Second, the hooks created a second source of truth. Native Codex session JSONL already records lifecycle, tokens, tool calls, models, and permission policy. Copying part of that into a lower-fidelity event stream introduced path, migration, and consistency problems.</p>
<p>Third, a hook sits on the critical path of every interaction. After one script refactor, the old hook still pointed to a deleted <code>codex_hook.py</code>, so every task stop produced an error. The observation system had begun polluting the system it was supposed to observe.</p>
<p>That failure taught me something useful: not every form of “automatic collection” belongs in hooks. The critical path is appropriate only for information that must be intercepted at event time and does not already exist in native data. Offline quality auditing is not such a case.</p>

<h2 class="relative group">Native JSONL as the sole source of truth
    <div id="native-jsonl-as-the-sole-source-of-truth" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#native-jsonl-as-the-sole-source-of-truth" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The final design became much smaller: remove the hooks and custom event database, and read <code>$CODEX_HOME/sessions/**/*.jsonl</code> directly.</p>
<pre class="not-prose mermaid">
flowchart TD
  A[Native Codex session JSONL<br/>single source of truth] --> B[Deterministic scanner]
  B --> C[Content-free metrics<br/>completion / latency / tokens / tools]
  C --> D[Scheduled AI audit]
  D -->|no signal| E[Short health report]
  D -->|repeated high-signal anomaly| F[Minimal source-session review]
  F --> G[Sanitized eval candidate]
  G --> H[Baseline]
  H --> I[Harness change]
  I --> J[Regression trials]
</pre>

<p>The first layer is a deterministic scanner. It emits content-free aggregates: completion rate, median/P95 duration and time to first token, input/output tokens, tool calls per turn, tool/model/permission-policy distributions, and opaque session/turn references for incomplete work. Prompts, responses, commands, paths, URLs, tool arguments, and tool results never enter the derived report.</p>
<p>The second layer is a scheduled AI audit. It does not summarize every session again. It minimally inspects source sessions only when there is a high-signal condition such as persistent incompletion, a meaningful latency or cost regression, or a recurring workflow failure. With no actionable signal, it sends only a short health result.</p>
<p>There is deliberately no “automatically edit the skill” step. Observation can recommend one of five dispositions: keep observing, promote to an eval, change a skill, change deterministic tooling, or fix instrumentation. Edit, commit, push, merge, deploy, and publish still require independent authority. Autonomous improvement should not mean autonomous privilege expansion.</p>

<h2 class="relative group">Metrics are not conclusions; evals justify changes
    <div id="metrics-are-not-conclusions-evals-justify-changes" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#metrics-are-not-conclusions-evals-justify-changes" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>A completion rate rising from 90% to 95% does not prove that the Harness became smarter. The recent tasks may simply have been easier. Fewer tool calls may mean greater efficiency, or it may mean that the agent skipped necessary verification.</p>
<p>I therefore use metrics as a filter, not a judge. What should drive a Harness change is a sanitized, reproducible eval distilled from repeated failures.</p>
<p>The current cases include:</p>
<ul>
<li>review-only work must not edit anything;</li>
<li>a push request must stop before merge;</li>
<li>after merge, an issue may need to remain open in <code>to test</code>;</li>
<li>deployment must bind to an exact SHA and verify live provenance and health;</li>
<li>red CI must be reduced to its first actionable failure;</li>
<li>skill installation links must point from install to source;</li>
<li>artifact verification must inspect contents, not merely report a successful download.</li>
</ul>
<p>These evals test both positive triggers and negative routing. A normal README typo should not activate <code>harness-observe</code>, and application OpenTelemetry is not the responsibility of a personal Codex Harness.</p>
<p>My improvement loop now looks like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">real sessions -> aggregate signals -> minimal semantic review -> sanitized eval
</span></span><span class="line"><span class="cl">              -> baseline -> Harness change -> regression -> observe again</span></span></code></pre></div></div>

<h2 class="relative group">Where the system stands now
    <div id="where-the-system-stands-now" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#where-the-system-stands-now" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>This is not a “self-evolving agent platform” that automatically rewrites its own prompts. I think stopping short of that is the right choice.</p>
<p>The current system delivers three more practical properties:</p>
<ol>
<li><strong>Workflow boundaries</strong>: more skills are not automatically better, and public methods, project facts, and private machine configuration each have a proper home.</li>
<li><strong>Terminal delivery states</strong>: MRs, merges, deployments, issues, and cleanup are no longer connected by vague verbs.</li>
<li><strong>Evidence-based improvement</strong>: native sessions provide facts, metrics surface anomalies, AI performs bounded semantic review, and evals verify changes.</li>
</ol>
<p>The next step is not collecting more data. It is building comparable baselines over time, strengthening deterministic graders for high-risk flows, and measuring which skills actually reduce rework and authority mistakes.</p>
<p>The complete implementation is public in <a href="https://github.com/ferstar/my-agent-skills"  target="_blank" rel="noreferrer">ferstar/my-agent-skills</a>. The previous article covered how recurring experience becomes a skill. This one covers the second half: <strong>once the skill library grows, how to keep it from becoming another form of technical debt—and how to know whether the workflow is actually improving.</strong></p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>PS5 Minecraft Stuck on Loading: Split Microsoft HTTPS from Game UDP</title>
      <link>https://blog.ferstar.org/en/posts/ps5-minecraft-hybrid-routing/</link>
      <pubDate>Thu, 16 Jul 2026 10:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/ps5-minecraft-hybrid-routing/</guid>
      <description>Minecraft on a PS5 stayed on the loading screen; packet capture showed slow Microsoft/Azure HTTPS setup, and proxying only TCP 443 while keeping DNS and UDP 19132 direct fixed it.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>The symptom looked like “Minecraft multiplayer is broken”: the PS5 had Internet access, the store and account did not show an error, but Minecraft would often sit on the loading screen for a long time when opening server or online-related pages.</p>
<p>The obvious suspects were DNS, IPv6, BedrockConnect, and even a Geyser instance on the LAN. None was the root cause.</p>
<p>The fix was small: <strong>proxy TCP 443 only for this PS5 through ShellCrash; keep DNS and Minecraft UDP 19132 direct.</strong></p>
<pre class="not-prose mermaid">
flowchart LR
  P[PS5] -->|TCP 443: Microsoft / Azure auth and resources| C[ShellCrash proxy]
  P -->|UDP 19132: Minecraft game traffic| I[Direct Internet]
  P -->|DNS| D[Normal DNS]
</pre>


<h2 class="relative group">Do not rush to change DNS
    <div id="do-not-rush-to-change-dns" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#do-not-rush-to-change-dns" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>BedrockConnect solves an entry-point problem: how to enter a custom server on console Bedrock. It is not a general fix for slow Minecraft loading. DNS rewriting by the router, a transparent proxy, or IPv6 can certainly make it fail; but in this case the loading problem remained even after returning to default DNS.</p>
<p>Do not proxy the entire PS5 first, either. Minecraft’s control plane and game data plane are different:</p>
<ul>
<li>sign-in, authorization, skins, and resource downloads are mostly TCP 443;</li>
<li>actual multiplayer game traffic is UDP; Bedrock commonly uses port 19132;</li>
<li>DNS is another independent variable.</li>
</ul>
<p>Global proxying looks convenient, but it can drag UDP, LAN discovery, and MTU issues into the problem at once. The debugging surface gets much larger.</p>

<h2 class="relative group">How this was narrowed down
    <div id="how-this-was-narrowed-down" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-this-was-narrowed-down" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I checked three layers of evidence.</p>
<p>First, the router was not under load. Continuous Wi-Fi pings from the PS5 to the router had no loss and stayed within a few milliseconds. The LAN was not the bottleneck.</p>
<p>Second, direct HTTPS requests from the router to a Microsoft authorization endpoint completed over both IPv4 and IPv6. Microsoft services were not completely unreachable.</p>
<p>Third, packet capture during the loading stage showed DNS, TCP 443, and TLS traffic for Microsoft/Azure authorization and resource domains. It had not entered sustained Minecraft UDP game traffic. More importantly, after the PS5 sent a SYN, the SYN-ACK from Azure took more than a second to return.</p>
<p>That narrowed the issue from “the game server is unreachable” to “the direct path to Microsoft/Azure HTTPS is poor.” The router was healthy and game UDP had not started, so only that control-plane path needed optimization.</p>

<h2 class="relative group">Final rule: precise routing by MAC address
    <div id="final-rule-precise-routing-by-mac-address" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#final-rule-precise-routing-by-mac-address" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Here is the smallest rule set for OpenWrt plus ShellCrash. Replace <code>PS5_MAC</code> with the PS5 MAC address and <code>REDIR_PORT</code> with ShellCrash’s redir port, the port actually listening on the router. The rules cover both IPv4 and IPv6.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="cp">#!/bin/sh
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nv">PS5_MAC</span><span class="o">=</span><span class="s1">'AA:BB:CC:DD:EE:FF'</span>
</span></span><span class="line"><span class="cl"><span class="nv">REDIR_PORT</span><span class="o">=</span><span class="s1">'7892'</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">iptables -t nat -D PREROUTING -m mac --mac-source <span class="s2">"</span><span class="nv">$PS5_MAC</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  -p tcp --dport <span class="m">443</span> -j REDIRECT --to-ports <span class="s2">"</span><span class="nv">$REDIR_PORT</span><span class="s2">"</span> 2>/dev/null
</span></span><span class="line"><span class="cl">iptables -t nat -I PREROUTING <span class="m">1</span> -m mac --mac-source <span class="s2">"</span><span class="nv">$PS5_MAC</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  -p tcp --dport <span class="m">443</span> -j REDIRECT --to-ports <span class="s2">"</span><span class="nv">$REDIR_PORT</span><span class="s2">"</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">ip6tables -t nat -D PREROUTING -m mac --mac-source <span class="s2">"</span><span class="nv">$PS5_MAC</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  -p tcp --dport <span class="m">443</span> -j REDIRECT --to-ports <span class="s2">"</span><span class="nv">$REDIR_PORT</span><span class="s2">"</span> 2>/dev/null
</span></span><span class="line"><span class="cl">ip6tables -t nat -I PREROUTING <span class="m">1</span> -m mac --mac-source <span class="s2">"</span><span class="nv">$PS5_MAC</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  -p tcp --dport <span class="m">443</span> -j REDIRECT --to-ports <span class="s2">"</span><span class="nv">$REDIR_PORT</span><span class="s2">"</span></span></span></code></pre></div></div>
<p>The script has three deliberate limits:</p>
<ol>
<li>It matches one device MAC address only, so other devices are unaffected.</li>
<li>It matches TCP 443 only and leaves UDP 19132 alone.</li>
<li>It deletes the old rule before inserting the new one, so repeated runs do not accumulate duplicates.</li>
</ol>
<p>It is also compatible with a ShellCrash MAC bypass for the PS5: leave the device bypassed from ShellCrash’s general chain. This rule sits at the top of <code>PREROUTING</code> and sends TCP 443 specifically to the redir port; all other traffic still follows the original direct-routing policy.</p>

<h2 class="relative group">Persistence matters more than a temporary success
    <div id="persistence-matters-more-than-a-temporary-success" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#persistence-matters-more-than-a-temporary-success" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>Manually inserted <code>iptables</code> rules disappear after a reboot, firewall reload, or ShellCrash reinitialization. I put the script in ShellCrash’s task directory and called it from both a startup and firewall hook:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">/userdisk/data/ShellCrash/task/ps5-minecraft-hybrid-proxy.sh
</span></span><span class="line"><span class="cl">/userdisk/data/ShellCrash/task/afstart
</span></span><span class="line"><span class="cl">/userdisk/data/ShellCrash/task/affirewall</span></span></code></pre></div></div>
<p>Directory and hook names differ by firmware. The important part is not copying these paths literally: run the script once after ShellCrash starts and once after the firewall reloads.</p>
<p>After each change, verify at least these three things:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">iptables -t nat -vnL PREROUTING
</span></span><span class="line"><span class="cl">ip6tables -t nat -vnL PREROUTING
</span></span><span class="line"><span class="cl">ss -lntp <span class="p">|</span> grep <span class="m">7892</span></span></span></code></pre></div></div>
<p>You should see a PS5-MAC-specific 443 redirect rule and a listening redir port. Then fully exit and reopen Minecraft; reboot the PS5 as well if it is still holding an old session.</p>

<h2 class="relative group">Remove rules that the evidence ruled out
    <div id="remove-rules-that-the-evidence-ruled-out" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#remove-rules-that-the-evidence-ruled-out" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>During diagnosis I tried DNS rewriting, port forwarding, and LAN server redirection. Once they were shown not to be the current cause, they should all be removed instead of being kept “just in case.” In particular, a rule that DNATs UDP 19132 to a LAN host becomes a black hole when that target service is not running, and it looks exactly like a network failure.</p>
<p>The final configuration is one sentence: <strong>proxy the Microsoft control plane; keep Minecraft UDP, DNS, and LAN traffic direct.</strong></p>
<p>This hybrid route is easier to explain and roll back than disabling IPv6 or proxying the whole console. If the symptoms change later, capture traffic first to see whether it is stuck on authorization HTTPS or has reached UDP game traffic, then change the matching layer only.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Growing a Codex Workflow as a Living System: From Session Logs to Skills</title>
      <link>https://blog.ferstar.org/en/posts/codex-workflow-skills-feedback-loop/</link>
      <pubDate>Mon, 22 Jun 2026 12:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/codex-workflow-skills-feedback-loop/</guid>
      <description>Long-term Codex usage accumulates repeated debugging and delivery chores; scan local sessions, identify recurring friction, then turn it into skills, scripts, and cross-machine sync; make the workflow lighter over time.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>A few days ago I did something boring but useful: scanned the Codex sessions in <code>~/.codex</code>.</p>
<p>Not for nostalgia, not for a dashboard. I just wanted to see where I was wasting time on repeat.</p>
<p>No surprise. The expensive part was rarely one hard code change. It was the small glue work I had to do every single day:</p>
<ul>
<li><code>git status</code>, <code>git diff</code>, <code>glab api</code>, <code>glab mr</code></li>
<li>finding the first failed CI job</li>
<li>checking remote SSH, PATH, Tailscale, permissions</li>
<li>deciding which tests to run for a given change</li>
<li>confirming SHA, workflow, artifact before release or deploy</li>
<li>resuming a session and re-sorting the issue, branch, MR</li>
</ul>
<p>These things are too small. Small enough that you never bother to fix them. But because they are small, they keep getting ignored. In the end, you spend your day swimming in manual glue.</p>
<p>The original prompt was short:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Based on my recent Codex projects and threads, suggest ways to simplify project workflows and improve efficiency. Use subagents to analyze in parallel.</span></span></code></pre></div></div>
<p>The first result was still too biased toward a few recent projects, so I added one more instruction:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Not just these projects. Scan all possible sessions under ~/.codex, dispatch multiple subagents to analyze them separately, then summarize.</span></span></code></pre></div></div>
<p>The point was not “ask the model for optimization ideas.” It was changing the source of truth from my memory of recent work to the repeated actions inside real session logs.</p>

<h3 class="relative group">Do not write tools too early
    <div id="do-not-write-tools-too-early" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#do-not-write-tools-too-early" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I used to do this too — see repetition, reach for a script. Later I realized that is often too early.</p>
<p>Most repetition is not about repeated commands. It is about a repeated decision process. When CI fails, the reusable part is not some random <code>gh run view</code>. It is:</p>
<ol>
<li>confirm the run and head SHA</li>
<li>find the first failed job</li>
<li>extract the useful error</li>
<li>then figure out: workflow, dependency, test, or code</li>
</ol>
<p>Turning this straight into a big tool welds your wrong assumptions in place. The lighter move is to write a skill first: when to use it, minimum steps, what not to do, what to output.</p>
<p>A skill is not an encyclopedia. It is a sticky note — so the agent skips one dead end.</p>
<pre class="not-prose mermaid">
flowchart LR
  A[Session history] --> B[Repeated friction]
  B --> C[Small skill]
  C --> D[Run on real tasks]
  D --> E[Script only when repeated]
  E --> C
</pre>

<p>I ended up keeping only these:</p>
<ul>
<li><code>agent-preflight</code>: read the real repo state before starting, no assumptions</li>
<li><code>gitlab-mr-context</code>: use <code>glab api</code> for issues, MRs, pipelines, notes — much more reliable</li>
<li><code>ci-first-failure</code>: find the first real failure before touching code</li>
<li><code>path-verify</code>: pick the smallest check from the changed files</li>
<li><code>release-deploy-preflight</code>: confirm full SHA, workflow, artifact, health check before deploy</li>
<li><code>remote-health</code>: check SSH, PATH, services, locks, and Tailscale on remote hosts first</li>
</ul>
<p>The names are not cool. That is exactly why you know when to use them.</p>

<h3 class="relative group">Skills first, scripts later
    <div id="skills-first-scripts-later" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#skills-first-scripts-later" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Another lesson: do not give every skill a scripts directory on day one.</p>
<p>Most workflows only need a <code>SKILL.md</code>. <code>path-verify</code> is not there to run your tests. It reminds the agent to pick the smallest check based on what files changed. Let it run with the agent on a few real tasks first. Automate later, once the pattern is confirmed.</p>
<p>Scripts are for one kind of thing: stuff that is definitely repeated, mechanical, and low risk.</p>
<p>This time I only added one — linking repo skills into the user skill directory:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">scripts/link-user-skills.sh</span></span></code></pre></div></div>
<p>And a PowerShell version for Windows:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="p">.\</span><span class="n">scripts</span><span class="p">\</span><span class="nb">link-user</span><span class="n">-skills</span><span class="p">.</span><span class="n">ps1</span></span></span></code></pre></div></div>
<p>I tripped on one thing: symlink direction.</p>
<p>The correct direction is: real files in the repo, links in the user directory.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">~/.agents/skills/glab -> /path/to/repo/skills/glab</span></span></code></pre></div></div>
<p>That way the repo has real content, and local Codex can use it. Get it backwards and it is a mess — the repo only has a link to <code>~/.agents</code>, GitHub gets nothing, and Git thinks the original files were deleted.</p>

<h3 class="relative group">Make it work across machines
    <div id="make-it-work-across-machines" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#make-it-work-across-machines" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I switch between macOS, Windows, and remote hosts constantly. If a skill only works on one machine, its value gets cut in half.</p>
<p>So after the local setup, I synced the repo to <code>my-win</code> and ran the same maintenance flow on Windows. The PowerShell script uses directory junctions, not symlinks — creating symlinks on Windows often fights with permissions, and junctions are enough for directories.</p>
<p>Tedious step. But without it, workflow refinement turns back into a one-machine trick.</p>

<h3 class="relative group">How I think about it now
    <div id="how-i-think-about-it-now" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-i-think-about-it-now" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>After this round, a few thoughts hardened.</p>
<p>Find repetition in sessions, not in your imagination. If <code>git status</code>, <code>glab api</code>, <code>ssh</code>, and <code>pnpm test</code> are actually frequent, start there. Do not invent a workflow governance framework nobody asked for.</p>
<p>Keep skills short. One blocks one gap. The only job is to make the agent ask less, search less, guess less. Do not turn it into an encyclopedia.</p>
<p>Scripts do mechanical work — linking skills, collecting CI logs, checking remote health. Product judgment, risk boundaries, deployment decisions still need human confirmation, or at least explicit preflight.</p>
<p>Mistakes need to feed back. I got the symlink direction wrong at first. After fixing it, the lesson cannot just stay in the chat window. It goes into the script and the README. Otherwise I will step on the same rake again.</p>

<h3 class="relative group">What remained
    <div id="what-remained" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-remained" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Not much:</p>
<ul>
<li>a few short skills</li>
<li>one Bash linking script</li>
<li>one PowerShell linking script</li>
<li>one Windows sync check</li>
<li>one rule: real skills in the repo, links in the user directory</li>
</ul>
<p>Good enough.</p>
<p>The more I use AI coding, the more I think the workflow is not about building a big platform. It is about removing the most annoying five minutes, over and over. Each pass makes the system a little lighter. When enough of these small rules pile up, the agent starts working in a real engineering environment — not opening a new trail from scratch every time.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Stopping Codex SQLite Log Growth with a Trigger</title>
      <link>https://blog.ferstar.org/en/posts/codex-sqlite-log-trigger/</link>
      <pubDate>Sat, 20 Jun 2026 16:55:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/codex-sqlite-log-trigger/</guid>
      <description>Codex&#39;s local SQLite log database can grow too fast; a small BEFORE INSERT trigger blocks new log rows, keeps a restore path, and quickly reduces disk IO and WAL growth.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Codex recently started storing local logs in <code>~/.codex/logs_2.sqlite</code>. On my machine that database had already grown past 1GB. The real problem was not the WAL file itself, but the log table: <code>TRACE</code>, <code>DEBUG</code>, and <code>INFO</code> rows kept going into SQLite, creating unnecessary disk usage and IO.</p>
<p>The public configuration surface is limited here. <code>RUST_LOG</code> can reduce verbosity, <code>log_dir</code> only controls the plaintext TUI log, and <code>history.max_bytes</code> only applies to <code>history.jsonl</code>. I could not find a public retention, max-size, or journal-mode option for <code>logs_2.sqlite</code>.</p>
<p>So I used SQLite itself as the stopgap.</p>

<h3 class="relative group">July 2026 update: the upstream issue is not fully fixed
    <div id="july-2026-update-the-upstream-issue-is-not-fully-fixed" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#july-2026-update-the-upstream-issue-is-not-fully-fixed" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Codex <code>0.142.0</code> shipped several changes that reduced a few high-volume log sources, including some <code>target=log</code>, WebSocket, and OpenTelemetry mirror events. Those changes only removed specific sources. They did not make the SQLite log sink honor <code>RUST_LOG</code>, and they did not add a usable log-level, sampling, or retention setting.</p>
<p>Fresh reproductions still exist on <code>0.144.5</code>: one log database grew by about 529MB in a week, while another reached 2.795GB and continued writing 151 rows in 10 seconds. The upstream issue <a href="https://github.com/openai/codex/issues/31142"  target="_blank" rel="noreferrer">#31142</a> remains open. The trigger below is therefore still a useful temporary stopgap, not an obsolete workaround that is safe to remove.</p>

<h3 class="relative group">Block new log rows with one trigger
    <div id="block-new-log-rows-with-one-trigger" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#block-new-log-rows-with-one-trigger" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sqlite3 ~/.codex/logs_2.sqlite <span class="s2">"CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;"</span></span></span></code></pre></div></div>
<p>The trigger is intentionally blunt: whenever something tries to insert into the <code>logs</code> table, SQLite ignores that insert.</p>
<p>Verification is also simple:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sqlite3 ~/.codex/logs_2.sqlite <span class="s2">"
</span></span></span><span class="line"><span class="cl"><span class="s2">SELECT count(*) FROM logs;
</span></span></span><span class="line"><span class="cl"><span class="s2">INSERT INTO logs(ts, ts_nanos, level, target, feedback_log_body, estimated_bytes)
</span></span></span><span class="line"><span class="cl"><span class="s2">VALUES(strftime('%s','now'), 0, 'INFO', 'trigger_test', 'should_not_exist', 1);
</span></span></span><span class="line"><span class="cl"><span class="s2">SELECT count(*) FROM logs;
</span></span></span><span class="line"><span class="cl"><span class="s2">SELECT count(*) FROM logs WHERE target='trigger_test';
</span></span></span><span class="line"><span class="cl"><span class="s2">"</span></span></span></code></pre></div></div>
<p>If the row count stays the same and <code>trigger_test</code> is <code>0</code>, the trigger is working.</p>

<h3 class="relative group">Windows PowerShell version
    <div id="windows-powershell-version" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#windows-powershell-version" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>On Windows, the path is usually:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="nv">$db</span> <span class="p">=</span> <span class="nb">Join-Path</span> <span class="nv">$env:USERPROFILE</span> <span class="s2">".codex\logs_2.sqlite"</span>
</span></span><span class="line"><span class="cl"><span class="n">sqlite3</span> <span class="nv">$db</span> <span class="s2">"CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;"</span></span></span></code></pre></div></div>
<p>I verified this on a remote Windows machine. The test insert did not change the row count:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">trigger: block_log_inserts
</span></span><span class="line"><span class="cl">before: 76387
</span></span><span class="line"><span class="cl">after: 76387
</span></span><span class="line"><span class="cl">trigger_test_rows: 0</span></span></code></pre></div></div>

<h3 class="relative group">Restore log writes
    <div id="restore-log-writes" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#restore-log-writes" aria-label="Anchor">#</a>
    </span>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sqlite3 ~/.codex/logs_2.sqlite <span class="s2">"DROP TRIGGER IF EXISTS block_log_inserts;"</span></span></span></code></pre></div></div>
<p>PowerShell:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="nv">$db</span> <span class="p">=</span> <span class="nb">Join-Path</span> <span class="nv">$env:USERPROFILE</span> <span class="s2">".codex\logs_2.sqlite"</span>
</span></span><span class="line"><span class="cl"><span class="n">sqlite3</span> <span class="nv">$db</span> <span class="s2">"DROP TRIGGER IF EXISTS block_log_inserts;"</span></span></span></code></pre></div></div>

<h3 class="relative group">Compact the old logs too
    <div id="compact-the-old-logs-too" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#compact-the-old-logs-too" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The trigger only blocks new rows. It does not shrink a database that has already grown. After quitting Codex, run a checkpoint and <code>VACUUM</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sqlite3 ~/.codex/logs_2.sqlite <span class="s2">"
</span></span></span><span class="line"><span class="cl"><span class="s2">PRAGMA wal_checkpoint(TRUNCATE);
</span></span></span><span class="line"><span class="cl"><span class="s2">DELETE FROM logs WHERE level IN ('TRACE','DEBUG');
</span></span></span><span class="line"><span class="cl"><span class="s2">DELETE FROM logs WHERE level = 'INFO' AND ts < strftime('%s','now','-3 days');
</span></span></span><span class="line"><span class="cl"><span class="s2">VACUUM;
</span></span></span><span class="line"><span class="cl"><span class="s2">"</span></span></span></code></pre></div></div>
<p>If Codex is still running, SQLite may report <code>database is locked</code>. That is expected. Quit Codex and run it again.</p>

<h3 class="relative group">The limit of this trick
    <div id="the-limit-of-this-trick" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-limit-of-this-trick" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>This does not fix Codex’s logging system. It is just local damage control.</p>
<p>The upside is that it needs no Codex patch, no release wait, and no background cleanup daemon. The downside is that <code>logs_2.sqlite</code> will no longer contain new local logs, which makes local debugging weaker. When you need logs, drop the trigger, reproduce the issue, then add the trigger again.</p>
<p>Long term, Codex should expose log database retention or max-size settings. Until then, one SQLite trigger is enough.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Moving from OrbStack to Apple Container, with PostgreSQL in Tow</title>
      <link>https://blog.ferstar.org/en/posts/orbstack-to-apple-container-postgres/</link>
      <pubDate>Sat, 13 Jun 2026 18:40:39 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/orbstack-to-apple-container-postgres/</guid>
      <description>OrbStack was ready to go, but the local PostgreSQL data had to survive; I moved it to Apple Container, disabled local WAL archiving, and freed about 19GiB of disk space.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>Today I removed OrbStack from my Mac.</p>
<p>Not because it was bad. Quite the opposite: for the past few years, OrbStack has been the least annoying Docker replacement I have used on macOS. But Apple’s own <code>container</code> CLI can now run Linux containers, and the only long-running local service I still had was PostgreSQL. With the dependency surface already this small, it made sense to shrink the runtime too.</p>
<p>The dangerous version of this migration would be: “just delete it and recreate it.” Containers can be recreated. Databases cannot.</p>

<h3 class="relative group">First, check what is actually running
    <div id="first-check-what-is-actually-running" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#first-check-what-is-actually-running" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>There was only one long-running container in OrbStack:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker ps -a --format <span class="s1">'{{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}'</span></span></span></code></pre></div></div>
<p>The result was simple:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">d377e0104620  registry.cheftin.cn/p/postgres17_pd-arm64  scriber_pg  Up 2 weeks (healthy)</span></span></code></pre></div></div>
<p>Then <code>docker inspect</code> exposed the trap: <code>docker-compose.yml</code> mounted <code>./pg17:/var/lib/postgresql/data</code>, but the image actually used <code>PGDATA=/data/data</code>. In other words, the host-side <code>pg17</code> directory was empty, while the real database lived inside the old container under <code>/data</code>.</p>
<p>That almost turned the migration into an incident.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">PGDATA=/data/data
</span></span><span class="line"><span class="cl">/Users/ferstar/myprojects/postgresql/pg17  0B
</span></span><span class="line"><span class="cl">/data                                 7.2G</span></span></code></pre></div></div>
<p>So I could not simply stop OrbStack and remount the same host directory. I had to export the data from the running old container first.</p>

<h3 class="relative group">Backups first
    <div id="backups-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#backups-first" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I made two backups:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker <span class="nb">exec</span> scriber_pg pg_dumpall -U postgres <span class="p">|</span> gzip -9 > pg_dumpall.sql.gz
</span></span><span class="line"><span class="cl">docker <span class="nb">exec</span> scriber_pg tar -C / -cf - data <span class="p">|</span> zstd -T0 -10 > container-data.tar.zst</span></span></code></pre></div></div>
<p>The logical backup was only <code>38M</code>; the physical archive was <code>6.8G</code>. At first I thought the database was huge. It was not.</p>
<p>The largest part of <code>/data</code> was not business data, but the image’s own local WAL archive:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">6865.7M  data/backup/wal
</span></span><span class="line"><span class="cl">293.5M   data/data/base
</span></span><span class="line"><span class="cl">126.7M   data/data/log
</span></span><span class="line"><span class="cl">32.0M    data/data/pg_wal</span></span></code></pre></div></div>
<p>The actual table data was only a few hundred MB.</p>

<h3 class="relative group">Apple Container takes over
    <div id="apple-container-takes-over" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#apple-container-takes-over" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>This machine is on macOS 15.7.3. Apple’s <code>container</code> project is more officially aimed at macOS 26, but Homebrew can already install it:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew install container
</span></span><span class="line"><span class="cl">container system start</span></span></code></pre></div></div>
<p>The first startup installs the default kernel. After a small Alpine test passed, I exported the PostgreSQL image from local Docker and loaded it into Apple Container, avoiding private registry credential issues:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker save registry.cheftin.cn/p/postgres17_pd-arm64:latest -o postgres17_pd-arm64.docker-save.tar
</span></span><span class="line"><span class="cl">container image load -i postgres17_pd-arm64.docker-save.tar</span></span></code></pre></div></div>
<p>The final container is launched like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">container run -d <span class="se">\
</span></span></span><span class="line"><span class="cl">  --name scriber_pg <span class="se">\
</span></span></span><span class="line"><span class="cl">  --memory 4g <span class="se">\
</span></span></span><span class="line"><span class="cl">  --cpus <span class="m">4</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --shm-size 8g <span class="se">\
</span></span></span><span class="line"><span class="cl">  -p 0.0.0.0:5432:5432 <span class="se">\
</span></span></span><span class="line"><span class="cl">  -v /Users/ferstar/myprojects/postgresql/apple-pg17:/data <span class="se">\
</span></span></span><span class="line"><span class="cl">  -e <span class="nv">DEBUG</span><span class="o">=</span><span class="nb">false</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  -e <span class="nv">POSTGRES_PASSWORD</span><span class="o">=</span>... <span class="se">\
</span></span></span><span class="line"><span class="cl">  -e <span class="nv">POSTGRES_HOST_AUTH_METHOD</span><span class="o">=</span>trust <span class="se">\
</span></span></span><span class="line"><span class="cl">  registry.cheftin.cn/p/postgres17_pd-arm64:latest <span class="se">\
</span></span></span><span class="line"><span class="cl">  postgres -c <span class="nv">archive_mode</span><span class="o">=</span>off -c <span class="nv">archive_command</span><span class="o">=</span></span></span></code></pre></div></div>
<p>The last two <code>-c</code> options matter.</p>
<p>This image rewrites <code>postgresql.conf</code> during startup, so editing the file directly inside the data directory gets overwritten. Putting <code>archive_mode=off</code> in PostgreSQL command-line arguments makes the setting source <code>command line</code>, and it stays stable after restart.</p>
<p>Verification:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">archive_command=(disabled) source=command line
</span></span><span class="line"><span class="cl">archive_mode=off source=command line
</span></span><span class="line"><span class="cl">wal_level=logical source=configuration file</span></span></code></pre></div></div>
<p>I left <code>wal_level=logical</code> alone. It was not the source of the local backup growth, and disabling it casually could break logical replication or extensions.</p>

<h3 class="relative group">One more piece for autostart
    <div id="one-more-piece-for-autostart" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#one-more-piece-for-autostart" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Apple Container does not yet feel like Docker Compose with <code>restart: unless-stopped</code>. <code>brew services start container</code> brings up the apiserver at login, but it does not guarantee a specific container starts.</p>
<p>So I added a user LaunchAgent:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">~/Library/LaunchAgents/com.ferstar.apple-container.scriber-pg.plist</span></span></code></pre></div></div>
<p>It runs a tiny script:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">container system start >/tmp/scriber_pg_container_system_start.log 2><span class="p">&</span><span class="m">1</span> <span class="o">||</span> <span class="nb">true</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">if</span> container ls --quiet <span class="p">|</span> grep -Fxq <span class="s1">'scriber_pg'</span><span class="p">;</span> <span class="k">then</span>
</span></span><span class="line"><span class="cl">  <span class="nb">exit</span> <span class="m">0</span>
</span></span><span class="line"><span class="cl"><span class="k">fi</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">container start scriber_pg</span></span></code></pre></div></div>
<p>Not elegant, but enough.</p>

<h3 class="relative group">The final bill
    <div id="the-final-bill" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-final-bill" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Then OrbStack was uninstalled and zapped:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew uninstall --cask --zap orbstack</span></span></code></pre></div></div>
<p>I also removed leftovers under <code>~/.orbstack</code>, <code>~/OrbStack</code>, and related Group Containers directories. Since the local Docker CLI came from OrbStack, the <code>docker</code> command disappeared too. That is fine; daily usage now only needs <code>container</code>.</p>
<p>Cleanup result:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Free space at the tightest point:  6.8GiB
</span></span><span class="line"><span class="cl">After deleting physical rollback archive: 14GiB
</span></span><span class="line"><span class="cl">After uninstalling OrbStack:       26GiB
</span></span><span class="line"><span class="cl">Total freed:                       about 19GiB</span></span></code></pre></div></div>
<p>Current footprint:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Apple Container runtime data: 3.8G
</span></span><span class="line"><span class="cl">New PostgreSQL data directory: 274M
</span></span><span class="line"><span class="cl">Migration logical backups/logs: 76M
</span></span><span class="line"><span class="cl">scriber_pg actual memory: about 148MiB / 4GiB
</span></span><span class="line"><span class="cl">scriber_pg CPU: 0.00%</span></span></code></pre></div></div>
<p>The databases are still there:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">postgres|11</span></span></code></pre></div></div>

<h3 class="relative group">Summary
    <div id="summary" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#summary" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The biggest lesson here was not how to use Apple Container. It was: do not trust the volume path in a compose file at face value. Check the running container’s real <code>PGDATA</code> and mounts first.</p>
<p>The other lesson was to distinguish between WAL that PostgreSQL needs to run and WAL that an image archives elsewhere as backup. The former must stay. The latter should be disabled if local backups are not needed. Otherwise, a few-hundred-MB database can eventually scare you with several GB of archived WAL.</p>
<p>OrbStack is gone. PostgreSQL stays. One fewer always-on runtime for this Mac.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>A 512MB VPS OOM Incident: SSH Closed Instantly, API 521, and the Low-Memory Cleanup Afterward</title>
      <link>https://blog.ferstar.org/en/posts/vps-low-memory-oom-ssh-api-recovery/</link>
      <pubDate>Sat, 13 Jun 2026 15:00:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/vps-low-memory-oom-ssh-api-recovery/</guid>
      <description>A 512MB VPS suddenly returned instant SSH closes and Cloudflare 521 errors; page allocation failures under low memory were fixed with XanMod, swap, zswap, earlyoom, OOMScoreAdjust, and Docker limits.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>This was not a migration. It was what happened after the migration, when a small VPS finally pushed back.</p>
<p>The symptoms looked like a network issue: the local SSH alias closed instantly, the provider web console got stuck at “connecting”, and the API behind Cloudflare turned into a 521. The awkward part was that the proxy service on the same host still worked, so it was not a complete host failure. It also did not fit the usual suspects: floating IP, local TUN proxy, or SSH key problems.</p>
<p>After a reboot, SSH came back and I could inspect the machine. The conclusion was clear: 512MB RAM was too tight, and the system had hit repeated page allocation failures in the network receive path. Nginx stream, SSH, and the API entrypoint were all dragged into a half-broken state.</p>

<h2 class="relative group">Symptoms
    <div id="symptoms" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#symptoms" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>SSH failed before key authentication:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">kex_exchange_identification: Connection closed by remote host</span></span></code></pre></div></div>
<p>That detail mattered. The connection had reached the remote side, but SSH never got to normal authentication. So this was not a changed key, bad file permission, or dirty <code>known_hosts</code>.</p>
<p>The entrypoint design on this host is slightly indirect:</p>
<pre class="not-prose mermaid">
flowchart LR
    Client["client"]
    Nginx["nginx stream :443"]
    SSH["sshd :22"]
    API["api backend :8000"]
    FM["filebrowser"]
    CF["Cloudflare"]

    Client -->|SSH over 443| Nginx
    CF -->|api.example.com| Nginx
    CF -->|fm.example.com| Nginx
    Nginx -->|default stream| SSH
    Nginx -->|SNI api| API
    Nginx -->|SNI fm| FM
</pre>

<p>SSH, the API, and the file service all pass through Nginx stream. If Nginx, the kernel network stack, or local memory pressure goes sideways, the outside world sees it as “SSH is down” and “the API is down” at the same time.</p>

<h2 class="relative group">The real evidence
    <div id="the-real-evidence" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-real-evidence" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After the reboot, the useful kernel log keyword was not <code>sshd</code>. It was this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">journalctl -k --since <span class="s2">"2026-06-13 00:00:00"</span> <span class="p">|</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  egrep -i <span class="s2">"page allocation failure|out of memory|oom|killed process"</span></span></span></code></pre></div></div>
<p>Before the reboot, there had been repeated <code>page allocation failure</code> messages involving processes like:</p>
<ul>
<li><code>containerd-shim</code></li>
<li><code>containerd</code></li>
<li><code>dockerd</code></li>
<li><code>hysteria</code></li>
<li><code>runc</code></li>
<li><code>kswapd0</code></li>
</ul>
<p>The stack traces were concentrated in the receive path, with functions like <code>virtio_net</code>, <code>tcp_gro_receive</code>, and <code>skb_page_frag_refill</code>. So this was not just one application writing too many logs. Low memory had already started affecting how the kernel handled network packets.</p>
<p>That also explains why the failure looked so strange. A TCP port might still accept connections, and a UDP proxy might still appear alive, while SSH handshakes, Nginx stream forwarding, and API upstream traffic fail randomly under memory pressure.</p>

<h2 class="relative group">Round one: clean up the system and kernel
    <div id="round-one-clean-up-the-system-and-kernel" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#round-one-clean-up-the-system-and-kernel" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>First, I put the package and kernel state back into something predictable.</p>
<p>The XanMod source was still using the old form:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">deb <span class="o">[</span>signed-by<span class="o">=</span>/etc/apt/keyrings/xanmod-archive-keyring.gpg<span class="o">]</span> http://deb.xanmod.org releases main</span></span></code></pre></div></div>
<p>For Debian 13, I changed it to the codename-based source:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">deb <span class="o">[</span>signed-by<span class="o">=</span>/etc/apt/keyrings/xanmod-archive-keyring.gpg<span class="o">]</span> http://deb.xanmod.org trixie main</span></span></code></pre></div></div>
<p>Then I installed the current x64v3 XanMod kernel:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">apt update
</span></span><span class="line"><span class="cl">apt install linux-xanmod-x64v3
</span></span><span class="line"><span class="cl">reboot</span></span></code></pre></div></div>
<p>After reboot:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">uname -r
</span></span><span class="line"><span class="cl"><span class="c1"># 7.0.12-x64v3-xanmod1</span></span></span></code></pre></div></div>
<p>Old kernels were removed as well, leaving only the current XanMod packages and avoiding stale boot entries:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">apt autoremove --purge
</span></span><span class="line"><span class="cl">apt clean
</span></span><span class="line"><span class="cl">update-grub</span></span></code></pre></div></div>
<p>I also cleaned journald and unused Docker objects:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">journalctl --vacuum-time<span class="o">=</span>7d
</span></span><span class="line"><span class="cl">docker system prune -af</span></span></code></pre></div></div>
<p>This did not remove Docker volumes. Business data should not be part of a cleanup shortcut.</p>

<h2 class="relative group">Round two: give 512MB RAM a fallback path
    <div id="round-two-give-512mb-ram-a-fallback-path" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#round-two-give-512mb-ram-a-fallback-path" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The machine has only about 454MiB of usable RAM. “Hope the applications behave” is not an operating model. The system needs defined escape routes when memory gets tight.</p>

<h3 class="relative group">Expand swap
    <div id="expand-swap" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#expand-swap" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I expanded swap to 2GB:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">swapoff /swapfile
</span></span><span class="line"><span class="cl">fallocate -l 2G /swapfile
</span></span><span class="line"><span class="cl">chmod <span class="m">600</span> /swapfile
</span></span><span class="line"><span class="cl">mkswap /swapfile
</span></span><span class="line"><span class="cl">swapon /swapfile</span></span></code></pre></div></div>
<p><code>/etc/fstab</code> stays simple:</p>
<div class="highlight-wrapper"><pre tabindex="0"><code class="language-fstab" data-lang="fstab">/swapfile none swap sw 0 0</code></pre></div>

<h3 class="relative group">Change zswap to zstd
    <div id="change-zswap-to-zstd" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#change-zswap-to-zstd" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>zswap was already enabled, but its default compressor was <code>lzo</code>. I checked that the kernel supported zstd:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">grep -i zstd /proc/crypto
</span></span><span class="line"><span class="cl">grep CONFIG_CRYPTO_ZSTD /boot/config-<span class="k">$(</span>uname -r<span class="k">)</span></span></span></code></pre></div></div>
<p>Runtime switch:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> zstd > /sys/module/zswap/parameters/compressor
</span></span><span class="line"><span class="cl">cat /sys/module/zswap/parameters/compressor
</span></span><span class="line"><span class="cl"><span class="c1"># zstd</span></span></span></code></pre></div></div>
<p>Then I made it persistent in GRUB:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">GRUB_CMDLINE_LINUX_DEFAULT</span><span class="o">=</span><span class="s2">"zswap.enabled=1 zswap.compressor=zstd net.ifnames=0 biosdevname=0"</span>
</span></span><span class="line"><span class="cl">update-grub</span></span></code></pre></div></div>

<h3 class="relative group">Leave some room for network and memory pressure
    <div id="leave-some-room-for-network-and-memory-pressure" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#leave-some-room-for-network-and-memory-pressure" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I added <code>/etc/sysctl.d/99-lowmem-network-tuning.conf</code>:</p>
<div class="highlight-wrapper"><pre tabindex="0"><code class="language-conf" data-lang="conf">vm.min_free_kbytes = 16384
vm.swappiness = 30
vm.vfs_cache_pressure = 100
net.core.netdev_max_backlog = 2500</code></pre></div>
<p>I had tried a higher <code>vm.min_free_kbytes</code> first, but on a 512MB host it was too aggressive and squeezed user-space memory. Around 16MB is closer to what this machine can tolerate.</p>

<h2 class="relative group">Round three: decide what should die first
    <div id="round-three-decide-what-should-die-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#round-three-decide-what-should-die-first" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The worst low-memory behavior is everyone fighting for memory until the kernel randomly kills something critical. I wanted the priorities to be explicit.</p>

<h3 class="relative group">Protect entrypoint services
    <div id="protect-entrypoint-services" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#protect-entrypoint-services" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I added a systemd drop-in for <code>ssh</code>, <code>nginx</code>, and <code>supervisor</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-ini" data-lang="ini"><span class="line"><span class="cl"><span class="k">[Service]</span>
</span></span><span class="line"><span class="cl"><span class="na">OOMScoreAdjust</span><span class="o">=</span><span class="s">-700</span></span></span></code></pre></div></div>
<p>In practice, <code>sshd</code> was already at <code>-1000</code>, while Nginx, Supervisor, and gunicorn were at <code>-700</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="k">for</span> pid in <span class="k">$(</span>pgrep -f <span class="s2">"sshd|nginx|supervisord|gunicorn"</span><span class="k">)</span><span class="p">;</span> <span class="k">do</span>
</span></span><span class="line"><span class="cl">  <span class="nb">printf</span> <span class="s2">"%s score=%s adj=%s cmd=%s\n"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    <span class="s2">"</span><span class="nv">$pid</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    <span class="s2">"</span><span class="k">$(</span>cat /proc/<span class="nv">$pid</span>/oom_score<span class="k">)</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    <span class="s2">"</span><span class="k">$(</span>cat /proc/<span class="nv">$pid</span>/oom_score_adj<span class="k">)</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">    <span class="s2">"</span><span class="k">$(</span>tr <span class="s1">'\0'</span> <span class="s1">' '</span> </proc/<span class="nv">$pid</span>/cmdline<span class="k">)</span><span class="s2">"</span>
</span></span><span class="line"><span class="cl"><span class="k">done</span></span></span></code></pre></div></div>
<p>One operational note: if SSH enters through Nginx stream, restarting <code>nginx</code> will cut the SSH session. Reload if possible, or be ready to reconnect.</p>

<h3 class="relative group">Limit containers
    <div id="limit-containers" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#limit-containers" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The proxy and file-service containers got resource limits:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">services</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">hysteria</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">mem_limit</span><span class="p">:</span><span class="w"> </span><span class="l">96m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">memswap_limit</span><span class="p">:</span><span class="w"> </span><span class="l">160m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">pids_limit</span><span class="p">:</span><span class="w"> </span><span class="m">128</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">oom_score_adj</span><span class="p">:</span><span class="w"> </span><span class="m">500</span></span></span></code></pre></div></div>
<p>The final limits were:</p>
<table>
  <thead>
      <tr>
          <th>Container</th>
          <th style="text-align: right">mem_limit</th>
          <th style="text-align: right">memswap_limit</th>
          <th style="text-align: right">pids_limit</th>
          <th style="text-align: right">oom_score_adj</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>hysteria</td>
          <td style="text-align: right">96m</td>
          <td style="text-align: right">160m</td>
          <td style="text-align: right">128</td>
          <td style="text-align: right">500</td>
      </tr>
      <tr>
          <td>hysteria2</td>
          <td style="text-align: right">96m</td>
          <td style="text-align: right">160m</td>
          <td style="text-align: right">128</td>
          <td style="text-align: right">500</td>
      </tr>
      <tr>
          <td>tuic-server</td>
          <td style="text-align: right">64m</td>
          <td style="text-align: right">128m</td>
          <td style="text-align: right">128</td>
          <td style="text-align: right">500</td>
      </tr>
      <tr>
          <td>filebrowser</td>
          <td style="text-align: right">96m</td>
          <td style="text-align: right">160m</td>
          <td style="text-align: right">128</td>
          <td style="text-align: right">500</td>
      </tr>
  </tbody>
</table>
<p>One small trap: the Debian-packaged Docker on this host is <code>26.1.5+dfsg1</code>, and <code>docker update</code> does not support changing <code>--oom-score-adj</code> dynamically:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker update --oom-score-adj <span class="m">500</span> hysteria
</span></span><span class="line"><span class="cl"><span class="c1"># unknown flag: --oom-score-adj</span></span></span></code></pre></div></div>
<p>So <code>oom_score_adj</code> belongs in compose, followed by a container recreation:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker compose up -d --force-recreate</span></span></code></pre></div></div>
<p>Verification:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker inspect hysteria hysteria2 tuic-server filebrowser <span class="se">\
</span></span></span><span class="line"><span class="cl">  --format <span class="s2">"{{.Name}} OOM={{.HostConfig.OomScoreAdj}} Mem={{.HostConfig.Memory}} Swap={{.HostConfig.MemorySwap}} Pids={{.HostConfig.PidsLimit}}"</span></span></span></code></pre></div></div>

<h3 class="relative group">Add earlyoom
    <div id="add-earlyoom" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#add-earlyoom" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Finally, I added earlyoom so something acts before the kernel reaches a real OOM:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">apt install earlyoom</span></span></code></pre></div></div>
<p><code>/etc/default/earlyoom</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">EARLYOOM_ARGS</span><span class="o">=</span><span class="s2">"-m 10,5 -s 20,10 -r 300 --prefer '(^|/)(hysteria|tuic-server|filebrowser)( |</span>$<span class="s2">)' --avoid '(^|/)(sshd|sshd-session|nginx|supervisord|gunicorn|systemd|dockerd|containerd)( |:|</span>$<span class="s2">)'"</span></span></span></code></pre></div></div>
<p>This does not conflict with systemd <code>OOMScoreAdjust</code>. <code>OOMScoreAdjust</code> changes <code>/proc/*/oom_score</code>, and earlyoom also uses those scores by default. <code>--avoid</code> is an extra “do not actively kill these entrypoint services” layer.</p>
<p>The service log shows the policy clearly:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Preferring to kill process names that match regex '(^|/)(hysteria|tuic-server|filebrowser)( |$)'
</span></span><span class="line"><span class="cl">Will avoid killing process names that match regex '(^|/)(sshd|sshd-session|nginx|supervisord|gunicorn|systemd|dockerd|containerd)( |:|$)'
</span></span><span class="line"><span class="cl">sending SIGTERM when mem avail <= 10.00% and swap free <= 20.00%,
</span></span><span class="line"><span class="cl">        SIGKILL when mem avail <=  5.00% and swap free <= 10.00%</span></span></code></pre></div></div>

<h2 class="relative group">Stop logs from eating the disk
    <div id="stop-logs-from-eating-the-disk" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#stop-logs-from-eating-the-disk" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The root disk is small too, so journald and Docker logs need limits.</p>
<p><code>/etc/systemd/journald.conf.d/99-vps-limits.conf</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-ini" data-lang="ini"><span class="line"><span class="cl"><span class="k">[Journal]</span>
</span></span><span class="line"><span class="cl"><span class="na">SystemMaxUse</span><span class="o">=</span><span class="s">128M</span>
</span></span><span class="line"><span class="cl"><span class="na">SystemKeepFree</span><span class="o">=</span><span class="s">512M</span>
</span></span><span class="line"><span class="cl"><span class="na">RuntimeMaxUse</span><span class="o">=</span><span class="s">16M</span>
</span></span><span class="line"><span class="cl"><span class="na">MaxRetentionSec</span><span class="o">=</span><span class="s">7day</span>
</span></span><span class="line"><span class="cl"><span class="na">RateLimitIntervalSec</span><span class="o">=</span><span class="s">30s</span>
</span></span><span class="line"><span class="cl"><span class="na">RateLimitBurst</span><span class="o">=</span><span class="s">1000</span></span></span></code></pre></div></div>
<p>Docker daemon defaults:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"log-driver"</span><span class="p">:</span> <span class="s2">"json-file"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">"log-opts"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"max-size"</span><span class="p">:</span> <span class="s2">"5m"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"max-file"</span><span class="p">:</span> <span class="s2">"2"</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div>
<p>I also disabled UFW logging:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ufw logging off</span></span></code></pre></div></div>
<p>There had been plenty of scan noise producing UFW BLOCK logs. On a small disk and small memory host, that noise is not worth keeping.</p>

<h2 class="relative group">Final checks
    <div id="final-checks" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#final-checks" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The closing checks looked like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">uname -r
</span></span><span class="line"><span class="cl"><span class="c1"># 7.0.12-x64v3-xanmod1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">apt list --upgradable
</span></span><span class="line"><span class="cl"><span class="c1"># Listing...</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">systemctl --failed --no-pager
</span></span><span class="line"><span class="cl"><span class="c1"># 0 loaded units listed.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">systemctl is-active earlyoom ssh nginx supervisor docker containerd
</span></span><span class="line"><span class="cl"><span class="c1"># active</span>
</span></span><span class="line"><span class="cl"><span class="c1"># active</span>
</span></span><span class="line"><span class="cl"><span class="c1"># active</span>
</span></span><span class="line"><span class="cl"><span class="c1"># active</span>
</span></span><span class="line"><span class="cl"><span class="c1"># active</span>
</span></span><span class="line"><span class="cl"><span class="c1"># active</span></span></span></code></pre></div></div>
<p>Memory state:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Mem: 454Mi total, 235Mi available
</span></span><span class="line"><span class="cl">Swap: 2.0Gi total, about 271Mi used</span></span></code></pre></div></div>
<p>Entrypoint checks:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">ssh VPS_ALIAS <span class="s1">'echo ok'</span>
</span></span><span class="line"><span class="cl">curl -sS -o /dev/null -w <span class="s1">'%{http_code}\n'</span> https://api.example.com/
</span></span><span class="line"><span class="cl">curl -sS -o /dev/null -w <span class="s1">'%{http_code}\n'</span> https://fm.example.com/</span></span></code></pre></div></div>
<p>SSH worked. The API returned an application-level 404, and the file service returned 200. The API 404 was a routing result, not Cloudflare 521 and not a dead upstream.</p>
<p>I also checked the kernel log after the tuning:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">journalctl -k --since <span class="s2">"2026-06-13 06:28:32 UTC"</span> --no-pager <span class="p">|</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  egrep -i <span class="s2">"out of memory|oom-kill|page allocation failure|killed process"</span></span></span></code></pre></div></div>
<p>No new OOM or page allocation failures showed up.</p>

<h2 class="relative group">Nine days later
    <div id="nine-days-later" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#nine-days-later" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I checked again on June 22, 2026. The result was better than expected.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">uptime: 9 days, 6:59
</span></span><span class="line"><span class="cl">load average: 0.16, 0.14, 0.16
</span></span><span class="line"><span class="cl">Mem: 454Mi total, 227Mi available
</span></span><span class="line"><span class="cl">Swap: 2.0Gi total, 346Mi used
</span></span><span class="line"><span class="cl">rootfs: 56% used</span></span></code></pre></div></div>
<p>The important services were still alive:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">systemctl is-active earlyoom ssh nginx supervisor docker containerd
</span></span><span class="line"><span class="cl"><span class="c1"># active active active active active active</span></span></span></code></pre></div></div>
<p>Containers were fine too:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">tuic-server  Up 7 days
</span></span><span class="line"><span class="cl">hysteria2    Up 7 days
</span></span><span class="line"><span class="cl">hysteria     Up 7 days
</span></span><span class="line"><span class="cl">filebrowser  Up 9 days (healthy)</span></span></code></pre></div></div>
<p>The important part: no new <code>OOM</code> or <code>page allocation failure</code> in the last seven days, and earlyoom did not actually have to kill anything. SSH, the API, and the file-service entrypoint were all reachable. The API still returned an application-level 404, not Cloudflare 521.</p>
<p>So the boring combination worked: swap plus zswap for fallback, OOMScoreAdjust for entrypoint protection, container limits to draw the boundary, and earlyoom as the last guardrail. 512MB is still 512MB, but at least it is no longer running on luck.</p>

<h2 class="relative group">Summary
    <div id="summary" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#summary" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The main lesson: a 512MB VPS can run services, but it cannot be left on defaults.</p>
<p>This matters even more when SSH enters through Nginx stream and the API shares the same 443 entrypoint. Entrypoint services must be protected. The processes that should give way first are proxy containers, file services, and temporary jobs, not <code>sshd</code>, <code>nginx</code>, or the API supervisor.</p>
<p>Of course, all of this only pushes the boundary of 512MB a little further. The real fix is still upgrading to 1GB RAM. Low-end VPS tuning is useful, but it is not magic.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>ACE Broke, So I Rewrote It: From ace-wrapper to fast-context</title>
      <link>https://blog.ferstar.org/en/posts/ace-wrapper-to-fast-context/</link>
      <pubDate>Mon, 01 Jun 2026 10:35:09 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/ace-wrapper-to-fast-context/</guid>
      <description>After ace-wrapper was written, ACE free tier became unreliable and relay services died one by one; so I reverse-engineered Windsurf&#39;s SWE-grep protocol, added local Semble cache as fallback, and built a hybrid retrieval tool called fast-context.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>In the <a href="/en/posts/ace-wrapper-semantic-search-ai-coding-harness/" >last post</a> I wrote about <code>ace-wrapper</code>: a shell command around ACE (Augment Context Engine) filesystem context search, so the agent could start with semantic retrieval when keywords were fuzzy, then decide which files to read.</p>
<p>Then ACE got flaky.</p>
<p>API keys expired in new ways. Free-tier quota became harder to rely on. And one by one, the relay services died.</p>
<p>I do not really blame anyone. It was a preview feature to begin with. The problem was that semantic search had already become part of my daily workflow: dozens of <code>ace</code> calls in one session. Take it away and the agent is back to guessing keywords.</p>
<p>So I switched approaches:</p>
<p><a href="https://github.com/ferstar/fast-context"  target="_blank" rel="noreferrer">ferstar/fast-context</a></p>
<p>This time I skipped third-party APIs and talked directly to Windsurf’s SWE-grep protocol — the same semantic search backend used by Codex CLI and Windsurf IDE — while layering a local Semble cache on top as fallback.</p>

<h3 class="relative group">The structural difference from ace-wrapper
    <div id="the-structural-difference-from-ace-wrapper" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-structural-difference-from-ace-wrapper" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>ace-wrapper was pure remote: local only sent parameters, everything depended on the ACE service.</p>
<p>fast-context is local and remote working together.</p>
<pre class="not-prose mermaid">
flowchart TB
  subgraph Input
    Q[User query]
  end

  subgraph Local
    S[Semble local prefetch<br/>cached index + chunk search]
    A[Lexical anchors<br/>filename / path / literal hits]
    R["Repo map<br/>(auto-shrink when too large)"]
  end

  subgraph Remote
    WS[Windsurf SWE-grep<br/>agentic verify + expand]
  end

  subgraph Output
    O["Candidate files<br/>line ranges<br/>follow-up terms<br/>(or local chunks when remote fails)"]
  end

  Q --> S
  Q --> A
  Q --> R
  S --> WS
  A --> WS
  R --> WS
  WS -- success --> O
  WS -- auth / rate-limit / timeout --> O
  S -- fallback path --> O
</pre>

<p>The flow:</p>
<ol>
<li><strong>Run Semble locally first</strong> — cached index + chunk search, sub-second</li>
<li><strong>Collect local lexical anchors</strong> — exact filename, path segment, and literal content matches from the query</li>
<li><strong>Generate a repo map</strong> — directory tree, auto-shrunk when it gets too large</li>
<li><strong>Feed all three to Windsurf</strong> — Semble chunks as hints, lexical anchors as pinpoints, repo map as path context</li>
<li><strong>Windsurf verifies and expands</strong> using rg/readfile/tree/ls/glob — agentic tool-call loop</li>
<li><strong>When the remote path fails, return local Semble results</strong> — no empty hands, no blocked workflow</li>
</ol>
<p>That “no empty hands” property matters more than it sounds. With ace-wrapper and ACE, once the service went down, that search was simply gone. Now, when the remote path fails, local cache still returns chunk-level candidates. Lower quality, yes, but the workflow does not just die there.</p>

<h3 class="relative group">Reverse-engineering SWE-grep
    <div id="reverse-engineering-swe-grep" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#reverse-engineering-swe-grep" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Windsurf’s SWE-grep uses Connect-RPC + Protobuf, which is nothing like a normal REST API.</p>
<p>The trickiest part was the Connect framing. Every RPC frame has a 5-byte header (1 flag byte + 4 big-endian length bytes). On top of that, the protocol requires a Connect-Connect frame before the actual payload.</p>
<p>The Protobuf side was worse. Windsurf uses a custom proto schema with no public definition. The field numbers in core data structures had to be inferred from packet captures and known Wireshark decryption configs — call chains look like <code>{1: name, 2: args, 3: id}</code>, variable definitions like <code>{1: name, 2: type, 3: value}</code>. Guess wrong and the whole request fails, with no useful error message.</p>
<p>The encoder looks like this (<a href="https://github.com/ferstar/fast-context/blob/main/src/core.py#L64"  target="_blank" rel="noreferrer">ProtobufEncoder</a>):</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">class</span> <span class="nc">ProtobufEncoder</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="s2">"""Manual protobuf encoder, matching the Windsurf wire format exactly."""</span>
</span></span><span class="line"><span class="cl">    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">        <span class="bp">self</span><span class="o">.</span><span class="n">buf</span> <span class="o">=</span> <span class="nb">bytearray</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="k">def</span> <span class="nf">_varint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bytes</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">        <span class="n">parts</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
</span></span><span class="line"><span class="cl">        <span class="k">while</span> <span class="n">value</span> <span class="o">></span> <span class="mh">0x7F</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">            <span class="n">parts</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">value</span> <span class="o">&</span> <span class="mh">0x7F</span><span class="p">)</span> <span class="o">|</span> <span class="mh">0x80</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">            <span class="n">value</span> <span class="o">>>=</span> <span class="mi">7</span>
</span></span><span class="line"><span class="cl">        <span class="n">parts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span> <span class="o">&</span> <span class="mh">0x7F</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">        <span class="k">return</span> <span class="nb">bytes</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="k">def</span> <span class="nf">_tag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">field</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">wire</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bytes</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_varint</span><span class="p">((</span><span class="n">field</span> <span class="o"><<</span> <span class="mi">3</span><span class="p">)</span> <span class="o">|</span> <span class="n">wire</span><span class="p">)</span></span></span></code></pre></div></div>
<p>Decoding Windsurf’s streaming response is the same story — split frames, read payloads, find the stream-end marker, reconstruct the result. It is much more work than calling a REST API, but the upside is clear: no intermediary dependency, just a direct path to Windsurf’s backend.</p>

<h3 class="relative group">Why local Semble cache works
    <div id="why-local-semble-cache-works" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-local-semble-cache-works" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Before adding Semble I did wonder: does local indexing really help?</p>
<p>Once I ran the benchmark, there was no suspense left.</p>
<p>I ran 40 labeled queries across two repos (fastapi and axios):</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Backend</th>
          <th style="text-align: right">NDCG@10</th>
          <th style="text-align: right">Recall@10</th>
          <th style="text-align: right">Top-1</th>
          <th style="text-align: right">Batch p50</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left">local (Semble only)</td>
          <td style="text-align: right">0.854</td>
          <td style="text-align: right">0.946</td>
          <td style="text-align: right">0.775</td>
          <td style="text-align: right">30 ms</td>
      </tr>
      <tr>
          <td style="text-align: left">remote (Windsurf only)</td>
          <td style="text-align: right">0.453</td>
          <td style="text-align: right">0.467</td>
          <td style="text-align: right">0.450</td>
          <td style="text-align: right">24.4 s</td>
      </tr>
      <tr>
          <td style="text-align: left">hybrid (Semble + Windsurf)</td>
          <td style="text-align: right">0.890</td>
          <td style="text-align: right">0.979</td>
          <td style="text-align: right">0.825</td>
          <td style="text-align: right">28.3 s</td>
      </tr>
  </tbody>
</table>
<p>Local Semble alone hit 94.6% recall with 30 ms p50 latency. Windsurf alone underperformed — only a 52.5% success rate, with the rest lost to throttling or <code>resource_exhausted</code>.</p>
<p>Hybrid mode puts Windsurf after Semble for verification and expansion. NDCG@10 jumped to 0.890, recall to 97.9%.</p>
<p>Two things became clear:</p>
<ul>
<li><strong>Local cache is not a backup; it is the first line of defense.</strong> It handles most common searches in 30 ms. When the remote is down, it is a degradation path, not a dead end.</li>
<li><strong>Windsurf’s value is in verification, not first-pass search.</strong> Asking it to search from scratch risks timeout and throttling. Give it Semble chunk candidates and exact keyword anchors, and it only has to confirm — which succeeds far more often.</li>
</ul>

<h3 class="relative group">Credential handling got more involved
    <div id="credential-handling-got-more-involved" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#credential-handling-got-more-involved" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>ace-wrapper just needed an API key. fast-context uses Windsurf’s session token, stored in <code>state.vscdb</code> (a SQLite database).</p>
<p>The extraction logic lives in <a href="https://github.com/ferstar/fast-context/blob/main/src/extract_key.py"  target="_blank" rel="noreferrer">extract_key.py</a>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Query ItemTable for key='windsurf.api_key'
</span></span><span class="line"><span class="cl">→ if found, return it
</span></span><span class="line"><span class="cl">→ if not, search for rows key containing 'devin-session-token'
</span></span><span class="line"><span class="cl">→ either format works
</span></span><span class="line"><span class="cl">→ can also override with WINDSURF_API_KEY env var</span></span></code></pre></div></div>
<p>Why support two formats? Because Windsurf keeps changing. Earlier versions used standard API keys; newer ones moved to session-style credentials like <code>devin-session-token$...</code>. If the tool does not adapt, it breaks as soon as the user upgrades their IDE.</p>

<h3 class="relative group">The current workflow
    <div id="the-current-workflow" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-current-workflow" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>During the ace-wrapper era, my AGENTS.md looked like this:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Use ace for semantic retrieval → read files → confirm evidence with rg</span></span></code></pre></div></div>
<p>Now it reads:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Use fast-context search (default hybrid) for candidates + line ranges
</span></span><span class="line"><span class="cl">If hybrid times out or returns nothing, try fast-context local-search
</span></span><span class="line"><span class="cl">If a chunk candidate looks promising, use fast-context find-related
</span></span><span class="line"><span class="cl">After reading files, confirm exact evidence with rg/ast-grep</span></span></code></pre></div></div>
<p>There are more branches now, but each one has a clear fallback.</p>
<p>On the remote side, there is a model fallback chain too:</p>
<ol>
<li>Default: <code>MODEL_SWE_1_6_FAST</code></li>
<li>On <code>resource_exhausted</code> or rate-limit: auto-degrade to <code>MODEL_SWE_1_5</code></li>
<li>Custom fallback order via <code>WS_FALLBACK_MODELS</code></li>
</ol>

<h3 class="relative group">Benchmark results
    <div id="benchmark-results" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#benchmark-results" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>With the fair runner (completion-based cooldown, 40 queries):</p>
<ul>
<li><strong>Hybrid non-empty output rate: 100%</strong> — all 40 queries returned useful results</li>
<li><strong>Remote non-empty output rate: only 50%</strong> — the other half timed out or got throttled</li>
<li><strong>Local zero failures</strong> — 100% non-empty, p50 latency 30 ms</li>
</ul>
<p>If the workflow depended purely on remote semantic search, half the queries could get no answer during peak hours. With local Semble backing, the worst case is degraded local chunks, not an empty result.</p>

<h3 class="relative group">What I do not want to tear down and rebuild again
    <div id="what-i-do-not-want-to-tear-down-and-rebuild-again" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-i-do-not-want-to-tear-down-and-rebuild-again" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>A few design choices that held up well:</p>
<ol>
<li><strong>Always keep a degradation path.</strong> Every remote dependency needs a local fallback. I already paid for ignoring that once.</li>
<li><strong>Pure Python is easier to maintain.</strong> ace-wrapper was Python too, but this project grew from a few hundred lines to more than two thousand — protobuf encoder, Connect framing, Semble adapter, benchmark runner. Clear structure matters more than language choice. Python just happens to be what I work fastest in.</li>
<li><strong>Benchmarks should live with the code.</strong> The <a href="https://github.com/ferstar/fast-context/tree/main/benchmarks/"  target="_blank" rel="noreferrer">benchmarks/</a> directory with 40 labeled queries and a runner shows the real gap between backends on every run. Optimization without data is mostly guessing.</li>
<li><strong>Credential extraction should auto-adapt.</strong> The <code>devin-session-token</code> format was unexpected, but the code structure made it easy — try another pattern when the first key is not found, without touching the main flow.</li>
</ol>

<h3 class="relative group">Wrapping up
    <div id="wrapping-up" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#wrapping-up" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>I still use ace-wrapper sometimes — ACE does come back to life once in a while. But I no longer want my workflow tied to it.</p>
<p>The core idea behind fast-context is simple: let local cache carry the baseline, and use the remote path for verification and expansion. Once the upstream gets shaky, a purely remote solution turns into a rope with no backup.</p>
<p>If you have hit the same wall, the code is here: <a href="https://github.com/ferstar/fast-context"  target="_blank" rel="noreferrer">ferstar/fast-context</a></p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>HS8145C5/V5 ONT: One Command to Dump the telecomadmin Password</title>
      <link>https://blog.ferstar.org/en/posts/hs8145c5-v5-telnet-get-admin-password/</link>
      <pubDate>Wed, 27 May 2026 18:30:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/hs8145c5-v5-telnet-get-admin-password/</guid>
      <description>Stuck with useradmin on your ISP-provided ONT? No flashing, no config editing — one display command dumps the encrypted super-admin password, decrypt it, and log in as telecomadmin with full access.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>The HS8145C5 (or V5) ONT from China Telecom ships with only <code>useradmin</code> privileges by default — many settings are hidden. Most tutorials online tell you to modify config files or flash the Huawei firmware. But if all you need is the super-admin password, there is a more direct way.</p>

<h3 class="relative group">Prerequisite: Telnet already enabled
    <div id="prerequisite-telnet-already-enabled" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#prerequisite-telnet-already-enabled" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Newer ONTs have Telnet disabled by default. You will need an <strong>ONT V3-V5 enablement tool</strong> once to turn it on:</p>
<ol>
<li>Unplug all cables from the ONT, only LAN1 connected to your computer</li>
<li>Set your computer IP to <code>192.168.1.x</code> (x ≠ 1)</li>
<li>Open the enablement tool, select V5 enable, pick your network interface, click start</li>
<li>Wait until a green <strong>success</strong> appears in the device list (all ONT LEDs stay lit), click stop, then power-cycle the ONT</li>
</ol>
<p>Telnet stays open after reboot. You only need to do this once — it persists unless the ONT is factory-reset.</p>

<h3 class="relative group">One command to retrieve the super-admin password
    <div id="one-command-to-retrieve-the-super-admin-password" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#one-command-to-retrieve-the-super-admin-password" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Telnet into the ONT and run:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">telnet 192.168.1.1
</span></span><span class="line"><span class="cl">root
</span></span><span class="line"><span class="cl">adminHW
</span></span><span class="line"><span class="cl">su
</span></span><span class="line"><span class="cl">display current-configuration grep telecomadmin</span></span></code></pre></div></div>
<p>The output will show the line containing <code>telecomadmin</code>, something like:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"><X_HW_WebUserInfoInstance InstanceID="2" ModifyPasswordFlag="1" UserName="telecomadmin" Password="$2;xxxxxxxxxxxxxxxxxx$" UserLevel="0" Enable="1" .../></span></span></code></pre></div></div>
<p>The portion between <code>$2;</code> and the trailing <code>$</code> in the <code>Password</code> field is the encrypted admin password.</p>

<h3 class="relative group">Decrypting the $2 ciphertext
    <div id="decrypting-the-2-ciphertext" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#decrypting-the-2-ciphertext" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Copy the entire <code>$2;...$</code> string into a <strong>Huawei configuration decryption tool</strong> (easily found online), use the “decrypt” function, and the plaintext password will be revealed.</p>
<p>Alternatively, search for a local standalone version of the same tool.</p>

<h3 class="relative group">Log in as telecomadmin
    <div id="log-in-as-telecomadmin" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#log-in-as-telecomadmin" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Open <code>192.168.1.1</code> in your browser, enter <code>telecomadmin</code> as the username and the decrypted plaintext as the password. You now have full admin access to the ONT — bridge mode, DMZ, TR069 deletion, any configuration you need.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Putting Semantic Search into an AI Coding Harness: Notes on Open-Sourcing ace-wrapper</title>
      <link>https://blog.ferstar.org/en/posts/ace-wrapper-semantic-search-ai-coding-harness/</link>
      <pubDate>Sat, 09 May 2026 14:38:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/ace-wrapper-semantic-search-ai-coding-harness/</guid>
      <description>Long AI coding tasks often fail because the agent reads the wrong files; use ace-wrapper to put semantic retrieval into Read -&gt; Search -&gt; Change -&gt; Verify; let agents find candidate files first, then verify evidence to reduce blind edits and wasted context.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>In the <a href="/en/posts/ai-coding-harness-engineering-workflow/" >previous post</a> about Harness Engineering, I compressed my default AI coding workflow into a few steps:</p>
<ol>
<li>Read</li>
<li>Search</li>
<li>Change</li>
<li>Verify</li>
<li>Record</li>
</ol>
<p>The easiest one to underestimate is <code>Search</code>.</p>
<p>Many agents fail not because they cannot edit code, but because they read the wrong place first. The user describes a behavior, a bug, or a cross-layer workflow, while the code may not contain a function with the same name. Running <code>rg login</code>, <code>rg upload</code>, or <code>rg session</code> is fast, but it only works when the keyword is already known. If the keyword is unknown, speed just helps the agent drift faster.</p>
<p>So I open-sourced a small layer I have been using recently:</p>
<p><a href="https://github.com/ferstar/ace-wrapper"  target="_blank" rel="noreferrer">ferstar/ace-wrapper</a></p>
<p>It does one narrow thing: wrap Augment Context Engine’s filesystem context search as an <code>ace</code> command, so coding agents can run semantic retrieval from the shell before editing.</p>

<h3 class="relative group">Why this layer exists
    <div id="why-this-layer-exists" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-this-layer-exists" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The target is concrete: make the search action part of the harness.</p>
<p>I used to see this path often:</p>
<pre class="not-prose mermaid">
flowchart LR
  A[User describes behavior] --> B[Agent guesses keywords]
  B --> C[Reads nearby files]
  C --> D[Edits plausible code]
  D --> E[Verification fails]
  E --> B
</pre>

<p>The problem with this loop is that, after failure, the agent often keeps circling around the same wrong files. It can edit code; what it needs is a better entry point into candidate files. Put less politely, it is working hard after entering the wrong door.</p>
<p><code>ace-wrapper</code> is meant to patch this part:</p>
<pre class="not-prose mermaid">
flowchart LR
  A[User describes behavior] --> B[ace semantic retrieval]
  B --> C[Candidate files]
  C --> D[Read returned files]
  D --> E[rg / tests confirm evidence]
  E --> F[Small patch]
  F --> G[Verify]
</pre>

<p>The important part is the order: <code>ace</code> only finds candidate files. Conclusions still require reading files, exact search, and tests. It is not an answer generator; it just helps the agent waste fewer steps.</p>

<h3 class="relative group">Usage is short
    <div id="usage-is-short" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#usage-is-short" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Install it:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">uv tool install ace-wrapper</span></span></code></pre></div></div>
<p>Install a local development checkout:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">uv tool install /path/to/ace-wrapper</span></span></code></pre></div></div>
<p>Search for a workflow when the exact keyword is unknown:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">timeout 60s ace <span class="s2">"user uploads an unsupported file and should see skipped-file feedback"</span> -w /repo
</span></span><span class="line"><span class="cl">rg -n <span class="s2">"unsupported|skipped|upload|file"</span> /repo</span></span></code></pre></div></div>
<p>The first command answers “which files may be relevant.” The second command confirms “which identifiers, events, copy, or tests actually exist in the code.”</p>
<p>I usually put this rule into a project’s <code>AGENTS.md</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Use `timeout 60s ace "<query>" -w <repo-root>` for semantic codebase discovery.
</span></span><span class="line"><span class="cl">Treat `ace` results as candidate files.
</span></span><span class="line"><span class="cl">After it returns results, read the relevant files and use exact search before using them as evidence.</span></span></code></pre></div></div>
<p>These lines work better than “read more context,” because they give the agent a concrete action and a boundary against false conclusions.</p>

<h3 class="relative group">How it works with rg
    <div id="how-it-works-with-rg" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#how-it-works-with-rg" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p><code>ace</code> and <code>rg</code> work better as consecutive steps.</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Scenario</th>
          <th style="text-align: left">Use first</th>
          <th style="text-align: left">Why</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left">You know the behavior but not the implementation location</td>
          <td style="text-align: left"><code>ace</code></td>
          <td style="text-align: left">Behavior descriptions can find candidate entry points across files and naming styles</td>
      </tr>
      <tr>
          <td style="text-align: left">You know the function name, event name, or error text</td>
          <td style="text-align: left"><code>rg</code></td>
          <td style="text-align: left">It is exact, complete, and enumerable</td>
      </tr>
      <tr>
          <td style="text-align: left">You need a structural refactor</td>
          <td style="text-align: left"><code>ast-grep</code></td>
          <td style="text-align: left">AST-level matching is needed; textual proximity falls short</td>
      </tr>
      <tr>
          <td style="text-align: left">You need to confirm whether a feature exists</td>
          <td style="text-align: left"><code>ace</code> + read files + <code>rg</code></td>
          <td style="text-align: left">A semantic hit cannot prove the feature exists</td>
      </tr>
  </tbody>
</table>
<p>I intentionally wrote this boundary into the README: ACE returns candidate files, while evidence still has to come from code and tests. That boundary matters.</p>
<p>Semantic retrieval returns “nearby” things. If you ask about a feature that does not exist, it may still find files that look related. If an agent treats “there are results” as “the feature exists,” it starts inventing a story. A conclusion is only defensible after reading an implementation, test, route, config, or call site.</p>

<h3 class="relative group">Where it fits in Harness Engineering
    <div id="where-it-fits-in-harness-engineering" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#where-it-fits-in-harness-engineering" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p><code>ace-wrapper</code> is small, and I want it to stay that way. It is closer to a small gear in the harness: it turns open-ended code discovery into a repeatable, constrained command.</p>
<p>I now prefer this project rule:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Read -> Search -> Change -> Verify</span></span></code></pre></div></div>
<p>Here, <code>Search</code> means choosing the tool by problem type:</p>
<ul>
<li>Open-ended behavior and cross-layer workflows: use <code>ace</code> first</li>
<li>Exact identifiers, errors, routes, and config keys: use <code>rg</code></li>
<li>Structural replacements: use <code>ast-grep</code></li>
<li>External strategy and industry practice: use web research</li>
<li>Old decisions and repeated lessons: use memory</li>
</ul>
<p>The useful part of this split is reduced agent randomness. The agent first uses semantic retrieval to narrow the reading surface, then uses deterministic tools to confirm facts, and only then changes code. The order is a little more verbose, but it is much cheaper than confidently editing the wrong file.</p>

<h3 class="relative group">The prompt matters most
    <div id="the-prompt-matters-most" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-prompt-matters-most" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>A good <code>ace</code> query describes behavior and avoids keyword piles:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">timeout 60s ace <span class="s2">"frontend sends requestId to backend and starts a processing job"</span> -w /repo
</span></span><span class="line"><span class="cl">timeout 60s ace <span class="s2">"用户拖入不支持的文件后应该显示跳过文件提示"</span> -w /repo
</span></span><span class="line"><span class="cl">timeout 60s ace <span class="s2">"how provider config is persisted and restored after app restart"</span> -w /repo</span></span></code></pre></div></div>
<p>I try to include four kinds of information:</p>
<ul>
<li>User action: click, drag, upload, stop generation</li>
<li>Runtime boundary: frontend to backend, CLI handler to core service</li>
<li>Expected effect: persist config, abort loop, show skipped-file feedback</li>
<li>Known fields: <code>sessionId</code>, <code>requestId</code>, <code>files</code>, <code>workspace</code></li>
</ul>
<p>This is much more stable than only searching <code>upload</code> or <code>provider</code>. It lets the retrieval system look for behavior and data flow, and it reminds the agent that this step is still semantic retrieval, not evidence by itself.</p>

<h3 class="relative group">Why I open-sourced it
    <div id="why-i-open-sourced-it" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-i-open-sourced-it" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p><code>ace-wrapper</code> has very little code. The core is just <code>FileSystemContext.create(str(workspace))</code> plus <code>context.search(args.query)</code>. I wanted to preserve the workflow constraints around those few lines:</p>
<ol>
<li>If the keyword is unknown, start with semantic retrieval</li>
<li>Ask one workflow per query</li>
<li>Treat results as candidate files</li>
<li>Read the files, then use <code>rg</code> to confirm exact evidence</li>
<li>Do not conclude without evidence</li>
</ol>
<p>Once these rules live in the tool README, skill, and agent prompt, they become much more likely to stick. Otherwise every session depends on a human reminding the agent again, which gets old fast.</p>
<p>The previous post said Harness Engineering means putting an engineering track around AI. <code>ace-wrapper</code> is one small piece of that track: it does not make the agent better at writing code; it just helps the agent read the right place first.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>From Vibe Coding to Harness Engineering: How My AI Coding Workflow Changed</title>
      <link>https://blog.ferstar.org/en/posts/ai-coding-harness-engineering-workflow/</link>
      <pubDate>Sat, 09 May 2026 14:19:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/ai-coding-harness-engineering-workflow/</guid>
      <description>AI coding can generate code but long-running delivery drifts easily; use Harness Engineering to control tasks, context, verification, and recovery; turn AI output into an executable, verifiable, reviewable engineering workflow.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote><p>This is the written version of an internal team sharing session. The slides are here:</p>
<p><a href="/slides/harness-engineering-ai-coding/" >From Vibe Coding to Harness Engineering</a></p>
<div style="position:relative;width:100%;aspect-ratio:16/9;margin:1.5rem 0 2rem;border:1px solid rgba(127,127,127,.25);overflow:hidden;">
  <iframe src="/slides/harness-engineering-ai-coding/" title="From Vibe Coding to Harness Engineering" style="position:absolute;inset:0;width:100%;height:100%;border:0;" loading="lazy" allowfullscreen></iframe>
</div>
<p>For a while I kept looking at one question: can AI really take over most of the coding work?</p>
<p>The answer is mostly settled now. When the project context, quality gates, and verification flow are in place, AI-generated code can enter the engineering workflow reliably. Human time moves from “typing the code” to “holding the line”: breaking down requirements, judging architecture, arranging context, checking boundaries, and handling failures.</p>
<p>Recent practice pushed this one step further. The question is no longer how to make the prompt prettier. It is whether the whole workflow can survive long-running tasks. I have stepped on this rake a few times, especially when I open the laptop in the morning, see that the agent ran all night, and still cannot tell which diff should be kept.</p>

<h3 class="relative group">What changed
    <div id="what-changed" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-changed" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Early Vibe Coding solved the entry problem: describe the requirement clearly, put project rules into <code>AGENTS.md</code> / <code>CLAUDE.md</code>, and let tests, lint, and review catch the model output.</p>
<p>That setup is still useful, but it is closer to single-task engineering. Once a task gets longer, a few problems start showing up:</p>
<ul>
<li>Context keeps growing until the model loses the important part</li>
<li>Repeated retries can push the fix further away from the real issue</li>
<li>Without external references, strategy becomes guesswork</li>
<li>After many rounds, it is hard to tell which changes should be kept</li>
<li>User rejection, permission blocks, and empty output need explicit stop semantics</li>
</ul>
<p>So I now prefer calling this layer Harness Engineering: put an engineering track around AI so tasks are executable, results are verifiable, and failures are recoverable. The name sounds a bit grand. In practice, it just means trusting “it will figure it out” a little less and adding a few guardrails.</p>
<pre class="not-prose mermaid">
flowchart LR
  A[Task scope] --> B[Context route]
  B --> C[Agent loop]
  C --> D[Verification gate]
  D --> E[Recovery / memory]
  D -->|failed| F[Patch harness]
  F --> C
</pre>


<h3 class="relative group">The four things I manage first
    <div id="the-four-things-i-manage-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-four-things-i-manage-first" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>The first thing is task boundaries.</p>
<p>Before a medium-sized task starts, I want at least <code>done when</code>, <code>out of scope</code>, the change surface, and the verification command. This does not need to be a long document. Five lines are often enough. The point is to let the executor know when to stop, instead of drifting into “while I am here” changes.</p>
<p>The second thing is context routing.</p>
<p><code>AGENTS.md</code> should not become an encyclopedia. It works better as an index: project rules, entry points, verification commands, things that must not be touched, and where to read the next layer of docs. Long context should be opened on demand, not dumped into the session. When the context gets too full, the model behaves a bit like me with too many browser tabs open: it looks busy, but the focus is gone.</p>
<p>The third thing is the verification loop.</p>
<p>My default order is now:</p>
<ol>
<li>Read: read README, AGENTS, older notes, and key implementation files</li>
<li>Search: use <code>ace</code>, <code>rg</code>, <code>ast-grep</code>, <code>nmem</code>, and Exa to find evidence</li>
<li>Change: apply a small patch and avoid drive-by refactors</li>
<li>Verify: run narrow checks first, then expand by risk</li>
<li>Record: write repeated lessons back into rules, tests, or memory</li>
</ol>
<p>This order is boring in a good way. Reading and searching first reduce model guesswork. Narrow verification avoids one giant change where nobody knows which step broke.</p>
<p>The fourth thing is failure handling.</p>
<p>After a failure, I classify it first: stop, retry, patch the harness, or record it.</p>
<table>
  <thead>
      <tr>
          <th style="text-align: left">Type</th>
          <th style="text-align: left">When to use it</th>
          <th style="text-align: left">Handling</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left">Stop</td>
          <td style="text-align: left">User rejection, permission block, side effect risk, repeated spinning</td>
          <td style="text-align: left">Break the loop and return control</td>
      </tr>
      <tr>
          <td style="text-align: left">Retry</td>
          <td style="text-align: left">Network jitter, fixable parameter, read failure without side effects</td>
          <td style="text-align: left">Retry in small steps and keep logs</td>
      </tr>
      <tr>
          <td style="text-align: left">Patch</td>
          <td style="text-align: left">Same class of error appears twice</td>
          <td style="text-align: left">Add tests, rules, scripts, or logs</td>
      </tr>
      <tr>
          <td style="text-align: left">Record</td>
          <td style="text-align: left">The case will likely happen again</td>
          <td style="text-align: left">Save trigger conditions, verification commands, and evidence entry points</td>
      </tr>
  </tbody>
</table>
<p>I used to treat many failures as “try again.” Now I am more careful: only retry failures that are actually retryable, and stop when the situation says stop. Letting an agent push forward from a wrong premise usually just creates more diff for a human to clean up.</p>

<h3 class="relative group">Where external research fits
    <div id="where-external-research-fits" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#where-external-research-fits" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>In this workflow, Exa or similar web search tools also have a clearer place.</p>
<p>I usually do not search for broad trends. I search for concrete engineering questions:</p>
<ul>
<li>What timeout should be used?</li>
<li>Should this failure be retried?</li>
<li>How should the default strategy be split?</li>
<li>What boundaries do mainstream tools provide?</li>
<li>What failure samples show up in real issues?</li>
</ul>
<p>I still do not copy external answers directly. External material gives me a reference frame, and the final decision has to fit the current repo. Useful conclusions should land in specs, project rules, tests, or scripts. Otherwise I will search for the same thing again next time, which is a very small but reliable way to waste time.</p>

<h3 class="relative group">Autoresearch and Ralph Loop
    <div id="autoresearch-and-ralph-loop" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#autoresearch-and-ralph-loop" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>Autoresearch works best for long loops with a clear metric. Give the agent a goal, a guard, and a verification command first. Each round should allow only one rollback-friendly change. If it drifts, the damage is still contained.</p>
<p>I currently treat Ralph Loop as persistent single-owner execution. The same owner keeps driving the work. PRD and test spec come first, then the agent runs the long task. It cares more about preserving context, judgment, and verification clues than about adding more agents early. Fewer people in the loop can sometimes make ownership much clearer.</p>
<p>Both patterns share the same idea: define the track before letting the agent run. The track needs metrics, boundaries, verification, and rules for what to keep or discard.</p>

<h3 class="relative group">Three steps worth copying first
    <div id="three-steps-worth-copying-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#three-steps-worth-copying-first" aria-label="Anchor">#</a>
    </span>
    
</h3>
<p>If this needs to move into a team workflow, I would not start with platform work. Three steps are enough to copy tomorrow:</p>
<ol>
<li>Write <code>done when</code> and <code>out of scope</code> for every medium-sized task</li>
<li>Ask the agent to list files, evidence, and the change surface before allowing edits</li>
<li>After one failure, patch tests, rules, or scripts before letting the agent continue</li>
</ol>
<p>Once these three steps are in place, AI coding moves a bit from “it can produce output” toward “it can be shipped.” Autoresearch, Ralph Loop, team workers, and memory become easier to reason about after that.</p>
]]></content:encoded>
      
    </item>
    
    <item>
      <title>Who would have thought: still using crontab &#43; HTTP Header for time sync in 6202</title>
      <link>https://blog.ferstar.org/en/posts/crontab-http-header-time-sync/</link>
      <pubDate>Thu, 22 Jan 2026 14:30:00 +0800</pubDate>
      
      <guid isPermaLink="true">https://blog.ferstar.org/en/posts/crontab-http-header-time-sync/</guid>
      <description>An isolated network blocked UDP, NTP/chrony could not sync time, Prometheus reported a 38-second drift, and Teleport handshakes failed; HTTP Date Header plus crontab pulled the nodes back into a usable range.</description><content:encoded><![CDATA[<blockquote><p>I am not a native English speaker; this article was translated by AI.</p>
</blockquote>
<h2 class="relative group">What happened
    <div id="what-happened" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#what-happened" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>On January 21, 2026, the target cluster started alerting.</p>
<p>Prometheus first showed a clock drift warning: <code>Warning: Error fetching server time: Detected 38.116000175476074 seconds time difference between your browser and the server.</code></p>
<p>38 seconds does not sound like much. For Prometheus queries, it is enough to break charts. For something like Teleport, with security checks in the handshake path, it is even worse. target02 was already unreachable at that point: Teleport handshake failed, and SSH was gone with it.</p>

<h2 class="relative group">Checking the network first
    <div id="checking-the-network-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#checking-the-network-first" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>The first suspect was still the network. I tested reachability from target01 to the jump host:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># TCP scan, OK</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> port in <span class="m">22</span> <span class="m">80</span> 8888<span class="p">;</span> <span class="k">do</span> nc -zv -w <span class="m">2</span> 100.64.0.5 <span class="nv">$port</span><span class="p">;</span> <span class="k">done</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># UDP scan, looks OK at first glance, but no packets come back</span>
</span></span><span class="line"><span class="cl">nc -uvz -w <span class="m">2</span> 100.64.0.5 <span class="m">8888</span></span></span></code></pre></div></div>
<p>TCP was fine. UDP looked suspicious. <code>nc -u</code> can easily make this look “connected” when nothing useful actually reached the other side, so I had to capture packets.</p>
<p>I started tcpdump on the jump host and sent one UDP packet from target01:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># jump-host</span>
</span></span><span class="line"><span class="cl">sudo tcpdump -i any udp port <span class="m">8888</span> -n
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># target01</span>
</span></span><span class="line"><span class="cl">nc -u 100.64.0.5 <span class="m">8888</span> <span class="o"><<<</span> <span class="s2">"test"</span></span></span></code></pre></div></div>
<p>The jump host saw nothing. That was enough to confirm UDP was blocked somewhere in the isolated network.</p>
<p>I also checked port 8888 while I was there:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -v http://100.64.0.5:8888
</span></span><span class="line"><span class="cl"><span class="c1"># < Proxy-Agent: gost/2.12.0</span></span></span></code></pre></div></div>
<p>That port was a gost proxy, mostly for TCP tunnels. UDP was not wired through it, so it was not going to keep NTP alive.</p>

<h2 class="relative group">It came down to clock drift
    <div id="it-came-down-to-clock-drift" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#it-came-down-to-clock-drift" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After all that, the actual issue was still clock drift:</p>
<ul>
<li>target01 was about 38 seconds behind, enough to make Prometheus queries and charts go weird.</li>
<li>target02 had drifted further, and Teleport rejected the handshake outright.</li>
</ul>
<p>NTP could not get out of the isolated environment. chrony was running, but only in the sense that it was repeatedly failing. The normal path was dead, so I needed something reachable inside the environment that could still act as a time reference.</p>
<p>The jump host’s port 80 was reachable, and HTTP responses have a <code>Date</code> header.</p>

<h2 class="relative group">Using HTTP Date to recover first
    <div id="using-http-date-to-recover-first" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#using-http-date-to-recover-first" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>I stopped chrony first so it would not keep fighting the manual correction:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">systemctl stop chronyd
</span></span><span class="line"><span class="cl">systemctl disable chronyd</span></span></code></pre></div></div>
<p>Then I pulled <code>Date</code> from the jump host’s HTTP header and fed it straight into <code>date -s</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">HTTP_DATE</span><span class="o">=</span><span class="k">$(</span>curl -sI http://100.64.0.5 <span class="p">|</span> grep -i <span class="s2">"^Date:"</span> <span class="p">|</span> cut -d<span class="s2">" "</span> -f2-<span class="k">)</span>
</span></span><span class="line"><span class="cl"><span class="o">[</span> -n <span class="s2">"</span><span class="nv">$HTTP_DATE</span><span class="s2">"</span> <span class="o">]</span> <span class="o">&&</span> date -s <span class="s2">"</span><span class="nv">$HTTP_DATE</span><span class="s2">"</span></span></span></code></pre></div></div>
<p>It is crude. Precision is only seconds. But the goal at that moment was not elegance; it was getting Teleport back within handshake tolerance. After running it, the Prometheus clock drift warning cleared, and target02 became reachable again.</p>
<p>Yes, it is 2026 and I am still syncing clocks with <code>curl</code> + <code>date -s</code>. The last time I remember doing this was probably on OpenWrt.</p>

<h2 class="relative group">Making it stick with crontab
    <div id="making-it-stick-with-crontab" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#making-it-stick-with-crontab" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>After the quick recovery, I still needed to stop the nodes from drifting again. I put the same sync into crontab and ran it hourly:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="o">(</span>crontab -l 2>/dev/null<span class="p">;</span> <span class="nb">echo</span> <span class="s1">'0 * * * * HTTP_DATE=$(curl -sI http://100.64.0.5 | grep -i "^Date:" | cut -d" " -f2-) && [ -n "$HTTP_DATE" ] && date -s "$HTTP_DATE"'</span><span class="o">)</span> <span class="p">|</span> crontab -</span></span></code></pre></div></div>
<p>It is not pretty, but it works well enough in this environment. It only needs HTTP. As long as the jump host is reachable, the nodes stay within an acceptable time window.</p>

<h2 class="relative group">Notes for next time
    <div id="notes-for-next-time" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none">
        <a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#notes-for-next-time" aria-label="Anchor">#</a>
    </span>
    
</h2>
<p>A few things worth writing down:</p>
<ol>
<li>Do not assume NTP works in isolated networks. Once UDP 123 is blocked, chrony can look alive while syncing nothing.</li>
<li>Do not trust <code>nc -u</code> too much. UDP has no handshake, so a success message does not mean the remote side received anything.</li>
<li>Prometheus and Teleport are both sensitive to clock drift. A few dozen seconds can easily create symptoms that look like network failures.</li>
</ol>
<p>If I deploy into a similar environment again, I will probably turn this HTTP Date sync into a small systemd timer. crontab is fine for firefighting; long term, it deserves something slightly less feral.</p>
]]></content:encoded>
      
    </item>
    
  </channel>
</rss>
