Gating Deploys in CI: Fail-Closed Per-Category Regression Prevention for AI Agents and Language Model Systems
Quickstart | Why weir? | Global Score Mirage Table | Author Reviews | Feature Matrix | How Soft Factory Uses weir | The Complete TideOS Eval Kit | Contributing
In modern autonomous software engineering and generative AI workflows, models, prompts, tools, and retrieval pipelines are iterated daily. A fundamental flaw in existing CI pipelines is Global Score Masking:
"Run the eval suite on every PR that touches prompts, models, tools, or retrieval config. Set per-category thresholds instead of one global score, so a big win in one area cannot hide a regression in another. Fail the build on a regression."
When teams use a single scalar score (e.g. "PR increased benchmark accuracy from 82% to 85%"), they suffer silent production catastrophic failures. A +15% improvement in generic conversational fluency masks a -20% regression in critical Supabase Row-Level Security checks, MCP tool argument parsing, or context attribution.
weir acts as an automated waterflow gate in CI:
- PR Trigger Detection: Instantly scans changed files against configured trigger globs (
prompts/**,**/models.toml,tools/**,retrieval/**). If no eval-sensitive paths changed, CI finishes in milliseconds. - Zero Global Score Masking: Evaluates categories independently. Every category must satisfy its floor and maximum allowable drop. If ANY single category regresses, the gate fails closed.
- Paired Exact Significance: Employs exact McNemar discordance testing on paired evaluation IDs. Distinguishes genuine model regressions from small-sample statistical noise.
- Actionable PR Feedback: Automatically generates Markdown step summaries and PR comments for GitHub Actions (
$GITHUB_STEP_SUMMARY).
flowchart TD
PR["Pull Request / Commit"] --> TRIG{"Touch Gated Paths?\n(prompts/**, models.toml, tools/**, retrieval/**)"}
TRIG -->|No| SKIP["Skip Gate (0ms Exit 0)"]
TRIG -->|Yes| EVAL["Run Evaluation Suite\n(Outputs JSONL or Envelope)"]
EVAL --> WEIR["weir gate\n(Exact McNemar + Per-Category Thresholds)"]
WEIR --> CATS{"Category Audits:\n1. Retrieval (Floor: 90%, Drop <= 1%)\n2. Tool Use (Floor: 85%, Drop <= 2%)\n3. Prompt Fidelity (Floor: 85%, Drop <= 2%)"}
CATS -->|All Pass| SHIP["[PASS] Deployment Approved\nUpdate Step Summary"]
CATS -->|Any Regress| FAIL["[BLOCKED] CI Build Failed\nPost Diagnostics & Block Merge"]
Consider a real-world candidate PR modifying studio prompt builder templates and model temperatures:
| Evaluation Category | Baseline Pass Rate | Candidate Pass Rate | Category Delta | Naive Global Eval | Weir Gating Decision | Production Consequence |
|---|---|---|---|---|---|---|
| Retrieval & RLS | 96.0% (24/25) | 76.0% (19/25) | -20.0% | Ignored | BLOCKED (Floor Breach & Regression) | Catastrophic data leaks in production |
| Tool Use & MCP | 92.0% (23/25) | 100.0% (25/25) | +8.0% | Averaged | PASS | Valid tool calling improvements |
| Prompt Fidelity | 88.0% (22/25) | 100.0% (25/25) | +12.0% | Averaged | PASS | Enhanced prompt adherence |
| GLOBAL COMPOSITE | 92.0% (69/75) | 92.0% (69/75) | 0.0% | PASSED (No Change) | BUILD FAILED CLOSED | Naive CI deploys broken retrieval |
Under a naive single score, the PR is merged because the composite score remained unchanged (92.0%). Under weir, the build is failed closed because retrieval breached its 90.0% floor and suffered a statistically significant 20.0% drop.
weir is designed to satisfy the rigorous standards of three key software and evaluation engineering philosophies:
- Sub-2 MB Standalone Static Binary: Compiles to a
1.76 MBstatic binary withopt-level = "z",lto = true, andstrip = true. - Zero Python/Node Runtime & Sub-5ms Offline Execution: Eliminates massive Python/Node dependency chains in CI runners. Runs as a single native binary with zero Docker overhead.
- Fail-Fast Trigger Detection:
weir changedexecutes in under 2ms. If a PR touches only documentation or frontend styling, it skips long eval jobs immediately. - Developer-First Terminal & CI UX: Renders beautiful, clean ANSI terminal tables locally, and native GitHub Actions Markdown summaries (
$GITHUB_STEP_SUMMARY) in CI.
- W3C OpenTelemetry / OpenInference Export: Generates compliant trace spans (
weir.gate_evaluation,weir.category.<name>) capturing pass rates, deltas, and diagnostics for enterprise dashboards. - Flywheel Ingestion for Multi-Agent Harnesses: Ingests session evaluations directly from
agent-harness/runsand outputs standardHarnessEnvelope<T>. - Incident Prevention Economics: Models the tangible economic value of blocking deployment regressions (e.g. preventing a $15,000 production outage) versus the trivial cost of evaluation tokens.
"In production agent applications, a prompt change that improves conversational elegance often breaks structured tool calling or retrieval filters.
weirconnects directly to CI pull requests, enforcing strict per-category regression barriers so high scores in easy tasks never hide failures in hard ones."
-
Zero Hand-Waving Metrology: Replaces naive normal approximations on small discordant samples with exact cumulative Binomial distribution testing under
$H_0: p=0.5$ . - Wilson Score Intervals: Computes continuity-sound 95% Wilson score confidence bounds on every category pass rate, preventing sample size illusions.
-
Closed State Machine Verdicts: Gating uses an exhaustive, non-leaky enum (
Pass,Regression,FloorBreach,InsufficientData,MissingCategory,WarningRegression,NewCategory). -
sha256-framed-v1 Cryptographic Lockfiles: Implements domain-separated, length-prefixed SHA-256 lockfiles (
weir lock/weir verify), guaranteeing that evaluation criteria, baselines, and floors cannot be silently relaxed in PRs.
| Capability | weir (TideOS) |
Naive Global CI Gates | Promptfoo | LangSmith / Tracing | Custom CI Scripts |
|---|---|---|---|---|---|
| Per-Category Regression Gating | Yes (Independent) | No (Global average) | Partial | No (Observability only) | Fragile bash |
| Exact Binomial McNemar Test | Yes (Exact log-gamma) | No | No | No | Rare |
| Zero Global Score Masking | Strictly Enforced | No (Vulnerable) | No | No | Rare |
| PR Trigger Path Detection | Yes (weir changed) |
No | No | No | Manual shell |
| sha256-framed-v1 Lockfile | Yes (Cryptographic) | No | No | No | No |
| GitHub Step Summary Native | Yes (Markdown) | Partial | HTML | Web UI | Custom curl |
| W3C OTel / OpenInference | Yes (Built-in) | No | No | Proprietary | Manual |
| Single Standalone Static Binary | Pure Rust (1.76 MB) | CI Shell script | Node.js | Python / Cloud | Python / Node |
Install from source or prebuilt binary:
cargo install --path Tools/weir
# Or run with the PowerShell wrapper:
.\Tools\weir\weir.ps1 --helpGenerate a starter weir.toml:
weir initIn your GitHub Actions workflow:
weir changed --base origin/mainweir gate \
--spec weir.toml \
--baseline packs/fixtures/baseline.jsonl \
--candidate candidate_results.jsonl \
--markdown step_summary.mdWhen a new model release is approved, update the baseline and sign the cryptographic lockfile:
weir baseline --from candidate_results.jsonl --output packs/fixtures/baseline.jsonlInside Alex Cinovoj's Soft Factory development environment at TechTide AI:
- An ensemble of specialized coding agents (Muse, Claude Code, Codex, Cursor, OpenCode, and Antigravity) collaborate inside
Apps/vertical-series-platform(Throughline Studio). - Prompts, tool declarations, and retrieval settings are iterated constantly:
apps/studio-api/src/adaptation-studio/prompts.tsapps/studio-worker/licensed/adaptationStudioPromptBuilder.cjspackages/contracts/src/agent-package-evaluation.ts
- Before
weir, agents could inadvertently improve creative dialogue generation while degrading tool schema serialization or retrieval vector relevance. - With
weirintegrated into GitHub Actions and local harness scripts:- Every PR touching prompt or model configurations executes narrow vitest/node benchmarks.
weir gateingests the results, runs exact McNemar discordance tests across each category, and renders rich Markdown step summaries.- If any category drops beyond its configured tolerance (e.g. 1% for retrieval), the deployment is halted immediately.
For paired evaluation benchmarks where both candidate and baseline evaluate identical case IDs (
-
$a$ : Baseline Pass, Candidate Pass (Concordant Pass) -
$b$ : Baseline Pass, Candidate Fail (Candidate Regression) -
$c$ : Baseline Fail, Candidate Pass (Candidate Improvement) -
$d$ : Baseline Fail, Candidate Fail (Concordant Fail)
The total discordant pairs
Continuity-corrected Edwards chi-squared:
A regression is declared statistically significant only when
For category pass rate proportions weir computes the 95% Wilson score interval:
Ensuring robust estimation even with moderate sample sizes (
weir completes Tool 12 in the complete TideOS evaluation and harness stack:
| Tool # | Binary / Dir | Crate Name | Companion Skill | Release Binary | Core Responsibility |
|---|---|---|---|---|---|
| 1 | reval |
reval |
trace-error-analysis |
2.07 MB |
Trace Error Analysis (Open/Axial Coding), Rubric Gates, MCP Server |
| 2 | gild |
gild |
golden-dataset-contract |
2.46 MB |
Golden Dataset Governance, Schema Validation & Versioning |
| 3 | tessel |
tessel-eval |
synthetic-eval-dimensions |
1.97 MB |
Combinatorial Synthetic Scenario Generator (Pairwise Covering Arrays) |
| 4 | assay |
assay-eval |
deterministic-assertions-first |
2.09 MB |
Deterministic Assertions First (Layers 1-5) & In-Memory RLS |
| 5 | tide-rill |
tide-rill |
offline-retrieval-faithfulness |
1.54 MB |
Offline Retrieval Ranking & Context Faithfulness |
| 6 | keel |
keel-eval |
trajectory-evals |
1.91 MB |
Agent Trajectory Alignment & Step Efficiency (14 vs 3 calls) |
| 7 | temper |
temper-eval |
pass-k-reliability |
0.89 MB |
Multi-Trial Reliability (pass@k vs pass^k at Real Temperature) |
| 8 | parley |
parley-eval |
simulated-user-evals |
1.77 MB |
Simulated Users for Multi-Turn State, Memory & Policy Evals |
| 9 | gavel |
gavel-eval |
llm-judge-calibration |
1.78 MB |
Classifier-Calibrated LLM Judge, TPR/TNR & Rogan-Gladen Debiasing |
| 10 | poise |
poise-eval |
pairwise-judge-bias |
1.89 MB |
Pairwise A/B Position Bias Control, Length Capping & LC-WinRate |
| 11 | plumb |
plumb-eval |
paired-statistical-significance |
0.85 MB |
Paired Statistical Significance, Bootstrap BCa, Exact McNemar & TOST |
| 12 | weir |
weir-eval |
eval-harness |
1.76 MB |
CI Deployment Regression Gate, Per-Category Thresholds & PR Reporting |
| 13 | eddy |
eddy-eval |
online-evals-production |
< 2.0 MB |
Online Production Evals, Hash Sampling, CUSUM Drift & Shadow Replay |
- Zero Unsafe: Entire crate compiled under
#![forbid(unsafe_code)]. - Zero FFI: Pure Rust dependencies only (
anyhow,clap,regex,serde,serde_json,sha2,thiserror,toml). - Binary Footprint: Stripped release binary budgeted under 2.0 MB (currently 1.76 MB).
- Universal JSON Envelope: All commands support
--jsonemitting canonicalHarnessEnvelope<T>. - Zero Em-Dash Rule: Strictly enforces zero em-dashes and zero en-dashes across all code and documentation.
weir is developed by Alex Cinovoj and the engineering team at TechTide AI as part of the TideOS Eval Kit.
For enterprise evaluations, custom agent harnesses, and autonomous development infrastructure, visit techtideai.io.
MIT License. Copyright (c) 2026 TechTide AI.