<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DAGU</title>
    <description>The latest articles on DEV Community by DAGU (@_088d9c6b7211315f6e47be).</description>
    <link>https://dev.to/_088d9c6b7211315f6e47be</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4261265%2F985fed59-d0fd-4032-8c4d-7b2ade39dab3.jpg</url>
      <title>DEV Community: DAGU</title>
      <link>https://dev.to/_088d9c6b7211315f6e47be</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_088d9c6b7211315f6e47be"/>
    <language>en</language>
    <item>
      <title>Stop Letting AI Agents Approve Their Own Code</title>
      <dc:creator>DAGU</dc:creator>
      <pubDate>Tue, 24 Nov 2026 09:38:31 +0000</pubDate>
      <link>https://dev.to/_088d9c6b7211315f6e47be/stop-letting-ai-agents-approve-their-own-code-two-repo-split-cross-model-review-and-a-40-cloud-2g36</link>
      <guid>https://dev.to/_088d9c6b7211315f6e47be/stop-letting-ai-agents-approve-their-own-code-two-repo-split-cross-model-review-and-a-40-cloud-2g36</guid>
      <description>&lt;p&gt;I run up to 4 AI coding agents in parallel on a 16 GB MacBook. Whenever two of them launched full &lt;code&gt;pytest&lt;/code&gt; runs at the same time, macOS hit swap immediately and froze. Worse, when I let the same agent edit code, run tests, and report success, it sometimes relaxed assertions to make a failing test pass or returned an &lt;code&gt;exit 0&lt;/code&gt; from stale artifacts left in a shared directory.&lt;/p&gt;

&lt;p&gt;Telling an LLM in a prompt to "be careful" or "don't touch unrelated files" stops working once the context window fills up. I replaced prompt-based discipline with hard repository boundaries, cross-model code review, and a shared cloud test runner. This setup currently backs my personal quantitative research codebase with nearly 7,000 tests, and every piece of it works just as well for any Python or backend project.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Split the Repo in Two: Scheduling vs. Computation
&lt;/h2&gt;

&lt;p&gt;When all my code lived in one repository, an agent fixing a data loader bug could casually edit the task scheduler or read out-of-sample validation data from an exploratory script. No amount of Markdown instructions stopped that reliably.&lt;/p&gt;

&lt;p&gt;I split the system into two separate Git repositories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Control repo (&lt;code&gt;task_manager&lt;/code&gt;)&lt;/strong&gt;: Handles the task queue, state machine, budgets, out-of-sample data locks, and an append-only run ledger. It never runs numerical calculations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution repo (&lt;code&gt;quantation_factor_database&lt;/code&gt;)&lt;/strong&gt;: Handles market data, metrics, and artifact exports. It only exposes a narrow CLI (&lt;code&gt;tools.agent_harness.cli&lt;/code&gt;) and has zero scheduling privileges.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvq0k3nc2z4f9x3u2yah5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvq0k3nc2z4f9x3u2yah5.png" alt="Two-repo architecture showing task_manager control plane separated from quantation_factor_database execution plane via a single CLI boundary" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Risk of Cross-Module Edits&lt;/th&gt;
&lt;th&gt;Concurrent Merge Conflicts&lt;/th&gt;
&lt;th&gt;Trade-Off You Accept&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Single repo + prompt rules&lt;/td&gt;
&lt;td&gt;High after long sessions&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Constant manual cleanup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Monorepo with folder rules&lt;/td&gt;
&lt;td&gt;Medium (direct imports still work)&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Painful to split out public code later&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Two separate Git repos&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Low (process and repo boundary)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Low (independent test suites)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Must maintain a strict CLI and JSON contract&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Splitting into two repos does add overhead. Every cross-repo change requires updating the CLI flags and JSON schema on both sides, and we use Copybara to export allowlisted parts of the execution repo to our public open-source project &lt;a href="https://github.com/GSX-Eis/jq-factor-lab" rel="noopener noreferrer"&gt;&lt;code&gt;GSX-Eis/jq-factor-lab&lt;/code&gt;&lt;/a&gt;. In return, an agent working on computation can never touch scheduling rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Never Let the Same Model Write and Review Code
&lt;/h2&gt;

&lt;p&gt;Letting one model write a patch and verify it is an easy way to get false positives. A single model has blind spots around its own assumptions, and when a test fails, it often tries to work around the failure by loosening an assertion or returning a default value so the process exits with &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I also ran into silent cache bugs where a script exited &lt;code&gt;0&lt;/code&gt; after writing an empty file, or a wrapper read an old report left behind in a shared output folder.&lt;/p&gt;

&lt;p&gt;To stop both failure modes, I split work across four steps and different model families:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Leader scopes the task&lt;/strong&gt;: A coordinating agent checks the read-only baseline, breaks work into non-overlapping tasks, and lists the exact files each task may touch. Multica gives each task its own Git &lt;code&gt;worktree&lt;/code&gt;, so 4 agents never overwrite each other's files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Builder implements&lt;/strong&gt;: The builder works only inside its &lt;code&gt;worktree&lt;/code&gt;, runs commands through &lt;code&gt;tools.agent_harness.cli&lt;/code&gt; instead of raw internal scripts, and runs changed tests in the cloud before submitting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A different model reviews&lt;/strong&gt;: A reviewer from another model family reads the diff line by line. It specifically looks for weakened assertions, missing error handling, and unclosed locks, sending the branch back if negative tests are missing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temp-tree merge and full regression&lt;/strong&gt;: The leader merges via &lt;code&gt;--no-ff&lt;/code&gt; in a temporary &lt;code&gt;worktree&lt;/code&gt; and runs the full 12-shard suite before closing the task.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd2twuepjln2z13m5mi3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd2twuepjln2z13m5mi3w.png" alt="Four-stage workflow from Leader task split and isolated Git worktrees to cross-model review and full 12-shard regression" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resolving Doc Conflicts
&lt;/h3&gt;

&lt;p&gt;When human planning docs and code disagree, agents often copy stale commands from an outdated README. I added a strict precedence rule in &lt;code&gt;AGENTS.md&lt;/code&gt; at the repo root:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Live &lt;code&gt;CLI --help&lt;/code&gt; output (highest authority)&lt;/li&gt;
&lt;li&gt;Runtime config files and typed schemas (&lt;code&gt;schemas/&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Operator flows in &lt;code&gt;README.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Historical planning notes (&lt;code&gt;.planning/&lt;/code&gt;, background only, never copy commands from here)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Exit Code 0 Is Not Enough
&lt;/h3&gt;

&lt;p&gt;Our CLI wrapper separates "the subprocess didn't crash" from "the output is valid." Every invocation gets a fresh &lt;code&gt;execution_id&lt;/code&gt;, writes to &lt;code&gt;attempts/&amp;lt;execution_id&amp;gt;/result.json&lt;/code&gt;, and checks the SHA-256 hash of the source config. If the file is missing or the hash doesn't match, the wrapper blocks the run with exit code &lt;code&gt;4&lt;/code&gt; even if the child process returned &lt;code&gt;0&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;EXIT_SUCCESS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;       &lt;span class="c1"&gt;# Process exited 0 and schema + SHA-256 checks passed&lt;/span&gt;
&lt;span class="no"&gt;EXIT_PRECONDITION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;  &lt;span class="c1"&gt;# Missing config or boundary violation before start&lt;/span&gt;
&lt;span class="no"&gt;EXIT_EXECUTION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;     &lt;span class="c1"&gt;# Subprocess crashed, timed out, or killed by signal&lt;/span&gt;
&lt;span class="no"&gt;EXIT_QUALITY_GATE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;  &lt;span class="c1"&gt;# Subprocess returned 0, but output is missing or tampered&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;verify_bound_result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expected_run_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config_sha256&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Read only from this invocation's execution_id folder to avoid stale artifacts&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;read_json_strict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"run_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;expected_run_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ContractGateError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"run_id mismatch: refusing stale artifact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;EXIT_QUALITY_GATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"source_config_sha256"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;config_sha256&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ContractGateError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"config hash mismatch: evidence tampered"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;EXIT_QUALITY_GATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Moving 418 Test Files Off a 16GB Laptop Onto a $40/mo Spot VM
&lt;/h2&gt;

&lt;p&gt;Once the execution repo grew to &lt;strong&gt;418 test files across 12 shards&lt;/strong&gt; (nearly 7,000 tests), running suites locally on a 16 GB MacBook became unusable. I banned local &lt;code&gt;pytest&lt;/code&gt; runs completely and moved all unit, shard, and full regression runs to a single &lt;strong&gt;GCP Spot VM (&lt;code&gt;8 vCPU / 32 GiB RAM / 100 GB disk&lt;/code&gt;)&lt;/strong&gt; with a hard &lt;strong&gt;$40/month&lt;/strong&gt; budget.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiomw2a4d5x729nxr6ocp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiomw2a4d5x729nxr6ocp.png" alt="Shared GCP Spot VM workflow showing local lock, auto-start, rsync, remote flock with dcor warmup, 12 pytest shards, and 20-minute idle shutdown" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Not GitHub Actions or One VM Per Agent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions&lt;/strong&gt;: Some frozen test fixtures and private samples don't belong on hosted CI, and cold-starting Numba, DuckDB, and PyArrow on every run was too slow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One VM per agent&lt;/strong&gt;: Blows past the $40 monthly budget and creates environment drift across machines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sharing one Spot VM behind a lock queue means only one full regression runs at a time, and concurrent worktrees either wait or exit with code &lt;code&gt;75&lt;/code&gt; to retry. In exchange, the environment stays identical and cheap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Two-Layer Locking and Thread Caps
&lt;/h3&gt;

&lt;p&gt;Before syncing code, the local runner acquires &lt;code&gt;quantation-gcp.lock&lt;/code&gt; across worktrees. On the VM, every run goes through &lt;code&gt;/usr/local/bin/cloud-test-lease-run.sh&lt;/code&gt; (a kernel &lt;code&gt;flock&lt;/code&gt; lease) and locks numerical libraries to a single thread so 6 &lt;code&gt;pytest-xdist&lt;/code&gt; workers don't oversubscribe 8 vCPUs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;REMOTE_THREAD_ENV&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"OPENBLAS_NUM_THREADS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"OMP_NUM_THREADS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"VECLIB_MAXIMUM_THREADS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"MKL_NUM_THREADS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"NUMBA_NUM_THREADS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build_leased_remote_cmd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lease_cmd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lease_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_cmd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Keep fd 8 open for stdin (such as rsync filter rules) when the lease wrapper backgrounds&lt;/span&gt;
    &lt;span class="n"&gt;restore_stdin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"exec \"$@\" &amp;lt;&amp;amp;8"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"exec 8&amp;lt;&amp;amp;0; exec {lease_cmd} {lease_id} -- sh -c '{restore_stdin}' sh {target_cmd}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Two Real Pitfalls on the Cloud VM
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Idle auto-shutdown colliding with SSH&lt;/strong&gt;: To stay under $40/month, &lt;code&gt;quant-idle.timer&lt;/code&gt; checks active leases and SSH sessions every 5 minutes and powers off the VM after 20 minutes of idle time (agents are forbidden from running manual shutdown commands). Twice, a merge run hit SSH timeouts because the VM happened to be shutting down right as the job started. We fixed this in &lt;code&gt;CloudRunner&lt;/code&gt; by checking instance state first and calling &lt;code&gt;gcloud compute instances start&lt;/code&gt; when the VM is &lt;code&gt;TERMINATED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Six &lt;code&gt;xdist&lt;/code&gt; workers crashing Numba on &lt;code&gt;dcor&lt;/code&gt;&lt;/strong&gt;: Turning up concurrency to 6 workers caused random collection-phase aborts when multiple workers imported &lt;code&gt;dcor&lt;/code&gt; at the same time and raced on the Numba/LLVM cache. Warming up &lt;code&gt;dcor&lt;/code&gt; serially once inside the lease before launching &lt;code&gt;xdist&lt;/code&gt; fixed it cleanly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Deleting SQLite So Agents Can't Pick the Wrong Database
&lt;/h2&gt;

&lt;p&gt;Humans leave fallback code around for backwards compatibility, but fallback paths give AI agents extra ways to fail. When SQLite and DuckDB coexisted in our repo, agents occasionally wrote results to the wrong backend inside an exception handler.&lt;/p&gt;

&lt;p&gt;I removed SQLAlchemy, SQLite loaders, and automatic &lt;code&gt;auto&lt;/code&gt; backend detection completely, leaving &lt;strong&gt;DuckDB + Parquet&lt;/strong&gt; as the only storage path, guarded by static contract tests that fail if anyone re-imports old database drivers.&lt;/p&gt;

&lt;p&gt;On the scheduling side, &lt;code&gt;quality_gate.sh&lt;/code&gt; runs a 10-step check before every merge, including Ruff, type checks, package boundary linting, and an isolated contract check in a temporary directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Hard gate: verify package boundaries and run contract checks in an isolated temp dir&lt;/span&gt;
&lt;span class="s2"&gt;"$python_bin"&lt;/span&gt; -m task_manager.tools.arch_linter --boundary --json &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;GATE_FAILED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1

&lt;span class="s2"&gt;"$python_bin"&lt;/span&gt; - &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'PY'&lt;/span&gt;
import sqlite3
from pathlib import Path
from tempfile import TemporaryDirectory

&lt;span class="c"&gt;# Test schema contracts in an OS temp dir so we never touch the live workspace state/&lt;/span&gt;
with TemporaryDirectory&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"contract_gate_"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; as tmp_dir:
    root &lt;span class="o"&gt;=&lt;/span&gt; Path&lt;span class="o"&gt;(&lt;/span&gt;tmp_dir&lt;span class="o"&gt;)&lt;/span&gt;.resolve&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    init_schema&lt;span class="o"&gt;(&lt;/span&gt;sqlite3.connect&lt;span class="o"&gt;(&lt;/span&gt;root / &lt;span class="s2"&gt;"state.db"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    raise SystemExit&lt;span class="o"&gt;(&lt;/span&gt;run_cli&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"--task-root"&lt;/span&gt;, str&lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="s2"&gt;"--json"&lt;/span&gt;, &lt;span class="s2"&gt;"check"&lt;/span&gt;, &lt;span class="s2"&gt;"contracts"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
PY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Current Numbers, Six Hard Rules, and Open Problems
&lt;/h2&gt;

&lt;p&gt;Here's where both repositories stand on our latest verified runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Execution repo (GCP Spot, all 12 shards / 418 files)&lt;/strong&gt;: &lt;strong&gt;6,884 passed&lt;/strong&gt;, 32 existing baseline failures, 11 skipped, &lt;strong&gt;0 collection errors&lt;/strong&gt; in &lt;strong&gt;749.25 seconds&lt;/strong&gt; (~12.5 minutes). Daily &lt;code&gt;--changed --fast&lt;/code&gt; runs finish in 1 to 2 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control repo (&lt;code&gt;quality_gate.sh&lt;/code&gt;)&lt;/strong&gt;: &lt;strong&gt;2,954 passed&lt;/strong&gt;, 43 existing failures, 36 skipped, &lt;strong&gt;0 collection errors&lt;/strong&gt;, ~80% coverage on core modules, and 0 boundary violations.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure Mode&lt;/th&gt;
&lt;th&gt;Prompt-Only Fix (Fails)&lt;/th&gt;
&lt;th&gt;Engineering Constraint (Works)&lt;/th&gt;
&lt;th&gt;Cost You Pay&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Agents edit unrelated core modules&lt;/td&gt;
&lt;td&gt;"Don't touch other files"&lt;/td&gt;
&lt;td&gt;Two separate repos + &lt;code&gt;arch_linter&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Must maintain CLI/JSON contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same model loosens test assertions&lt;/td&gt;
&lt;td&gt;"Check edge cases carefully"&lt;/td&gt;
&lt;td&gt;Separate author and reviewer models&lt;/td&gt;
&lt;td&gt;Extra review turn and tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;exit 0&lt;/code&gt; returned from empty/stale files&lt;/td&gt;
&lt;td&gt;Trust process exit code&lt;/td&gt;
&lt;td&gt;Fresh &lt;code&gt;execution_id&lt;/code&gt; dir + config SHA-256&lt;/td&gt;
&lt;td&gt;Extra schema check in wrapper&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Concurrent &lt;code&gt;pytest&lt;/code&gt; freezes 16GB Mac&lt;/td&gt;
&lt;td&gt;Ask agents to run sequentially&lt;/td&gt;
&lt;td&gt;Ban local &lt;code&gt;pytest&lt;/code&gt;, route to Spot VM&lt;/td&gt;
&lt;td&gt;Must maintain &lt;code&gt;rsync&lt;/code&gt; filter rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worktrees overwrite remote workspace&lt;/td&gt;
&lt;td&gt;Coordinate manually in chat&lt;/td&gt;
&lt;td&gt;Local lock + remote &lt;code&gt;flock&lt;/code&gt; lease&lt;/td&gt;
&lt;td&gt;One heavy suite runs at a time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agents pick stale docs or wrong DB&lt;/td&gt;
&lt;td&gt;Patch the prompt repeatedly&lt;/td&gt;
&lt;td&gt;Strict doc order + delete SQLite path&lt;/td&gt;
&lt;td&gt;Must clean up legacy fallbacks&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two limitations remain open. First, as I spin up more concurrent branches, queue wait times on a single 8-vCPU Spot VM may become a bottleneck. Second, both repos still carry pre-existing test failures (43 in control, 32 in execution) that we gate on "zero new failures" while paying down the backlog.&lt;/p&gt;

&lt;p&gt;When you run multiple AI coding agents in parallel, what breaks first in your workflow: stale context, tests passing on weak assertions, or agents stepping on each other's environments?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I built and run this system myself, verified every command, exit code, and test count against the actual repositories, and used AI tools to help draft and tighten the English prose.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
