DEV Community

Arthur
Arthur

Posted on

How to Catch Silent Regressions Before Upgrading Your Coding Agent (A/B Sandbox Harness in Stdlib Python)

How to Catch Silent Regressions Before Upgrading Your Coding Agent (A/B Sandbox Harness in Stdlib Python)

When we switched an autonomous Python coding scaffold between prompt variants and model fallbacks, overall unit test pass rates looked fine on the surface. Inside the diffs, however, subtle regressions crept in:

  • Swallowed exceptions (except Exception: pass or returning 0.0 on division by zero)
  • Unbounded Path(root) / user_rel joins that allowed ../ traversal
  • Hidden SSRF holes accepting http://169.254.169.254/latest or 127.0.0.1
  • Module-level regex compilation breaking import-time instrumentation fences

None of those are tested by standard algorithmic coding puzzles. Every one of them passes naive happy-path tests while silently degrading production safety.

Why Candidate Patches Need Disposable Sandboxes

Never evaluate candidate coding-agent edits directly inside your live working tree:

  1. An accepted patch mutates the repository for every subsequent task, making task 5 depend on task 2.
  2. Failed or partial writes leave orphan modules or corrupt syntax behind.
  3. Without clean A/B comparison against a baseline arm, you cannot measure regressions separately from net pass rate.

In zmb_eval_suite, every single sample executes inside a fresh tempfile.TemporaryDirectory:

  1. Pre-screen the generated source with ast.parse() and an AST handler check that rejects silent except: pass blocks before running anything.
  2. Write the candidate module and its verification unit test into the isolated temp directory.
  3. Run the isolated test subprocess with a strict 10-second timeout.
  4. Compute unbiased pass@k, wall-clock latency, net delta (Arm B vs Arm A), improvements, and exact regressions.

15 Real Agent Failure-Mode Tasks

Instead of synthetic toy puzzles, EVAL_TASKS pins concrete engineering invariants observed across autonomous coding loops:

  • AST & Dead-Code Safety: rejecting silent except: pass, spotting unreferenced orphan modules, detecting top-level compile() calls, rejecting syntax-empty stubs
  • Security & Secret Hygiene: path containment (relative_to), public-only URL validation blocking localhost/link-local metadata IPs, secret token redaction, HTML escaping
  • Operations & Governance: Windows hidden-console process flags (0x08000200), fail-closed file-path push classification, bounded exponential backoff, schema-safe JSONL parsing, and cross-link extraction

Running --demo against the built-in buggy baseline arm vs the hardened reference arm outputs a clean Markdown table and self-contained dark-mode HTML scorecard ready for PR reviews.

If you want the turnkey zero-dependency zmb_eval_suite package (all 15 tasks, BenchmarkRunner, pass@k, and HTML/Markdown scorecards) for EUR 24:

Get the LLM Coding Agent A/B Regression Suite

Top comments (0)