Skip to main content

RunBoth

RunBoth

An AI changed your code. RunBoth runs both versions and tells you what actually behaves differently, including the functions nobody touched.

CI PyPI Python versions Licence: FSL-1.1-Apache-2.0

runboth.dev · How it works · Red team results


$ git commit -m "refactor: tidy up the rates module"

  BLOCKED: the behaviour changed and your message does not say so.

    rate(100)
      used to:  return 0.1
      now:      return 0.0

  AND 1 function you did NOT touch now behaves differently,
  because it calls what you changed:

    total(2.5, 100)          pkg/invoice.py
      used to:  return 225.0
      now:      return 250.0

Why this exists

An AI refactors a module and reports that the behaviour is unchanged. Usually that is true. Measurably often it is not: Dristi and Dwyer tested six models across three datasets and two refactoring types and found LLM refactorings functionally non-equivalent 19 to 35% of the time (arXiv:2602.15761, February 2026).

Review does not catch it. A diff is an honest record of the edit, not of the effect, and those are different documents. The function that broke is often in a file the diff never mentions, because it only calls what changed.

Tests do not close the gap either. A test asserts what somebody previously thought to assert, and the code most likely to move silently is the code nobody wrote a test for. If an AI wrote the tests as well, you have asked one system to mark its own homework.

So RunBoth does the boring thing that works: it runs both versions and compares what actually comes out.

What it does

It checks out both versions of your code, generates inputs for every changed function from its signature and from the constants mined out of its own bytecode, runs both versions in separate sandboxed subprocesses, and compares seven observation channels. When they disagree it hands you the exact input that separates them.

No test suite required. No network calls. No AI model. No dependencies.

Install

pip install runboth                                  # once the first release is on PyPI
pip install git+https://github.com/runboth/runboth   # works today
runboth install-hook          # a commit-msg gate, silent unless behaviour moved

As a GitHub Action, running on your own runners:

- uses: runboth/runboth@v0.1.0
  with:
    budget: 60

Three verdicts, never two

verdict meaning
changed with a witness: the arguments, the old result, the new result
no_change at budget N N generated inputs found no difference across seven channels
abstained it could not be checked, and here is the reason

"Cannot tell" and "no difference" are different claims, and collapsing them into a green check is how tools end up lying. RunBoth never says safe.

The seven channels

Return value · exception raised · warnings · stdout · stderr · argument mutation · object state.

A narrow definition of behaviour does not under-report, it lies, because whatever sits outside the definition comes back as no_change.

What it is not

Not a model checker. Kani and CBMC translate code into logic, let inputs be unconstrained symbols, and ask a solver whether a bad state is reachable within a bound. They return a proof. RunBoth executes real code on concrete values. It finds differences and reproduces them; it cannot prove absence, and never claims to.

Not mutation testing. Mutation testing damages your code to score your test suite. RunBoth damages nothing; both versions come from your git history, and no test suite is needed.

Measured

Red-teamed against eight public repositories it had never been tuned on, with an automated oracle built to catch the tool lying. 2,548 functions, zero false positives. Full method and numbers in RED_TEAM_2026-09-12.md.

repo layout functions abstained median/commit
boltons flat 268 0.0% 7.9s
sqlparse flat 230 0.9% 14.3s
arrow flat 283 1.4% 118s
cachetools src/ 325 1.8% 60.9s
more-itertools flat 843 4.4% 102.5s
packaging src/ 78 5.1% 0.2s
pluggy src/ 157 6.4% 33.5s
tenacity async 364 14.3% 192.8s

An adversarial corpus of 22 functions written specifically to induce false positives (object addresses in default repr, datetime.now, unseeded random, uuid4, os.getpid, set iteration order, mutable defaults, generators, __file__ paths) produced none.

Environment variables

variable effect
RUNBOTH_SKIP=1 let a commit through without checking it
RUNBOTH_BUDGET generated inputs per function (gate default 80)
RUNBOTH_WORKERS parallel adjudications, default 4
RUNBOTH_ALL_PATHS=1 also check tests, benchmarks, docs and task runners
RUNBOTH_ENGINE engine directory, if the hook cannot resolve it
RUNBOTH_NO_VERSION_STUB=1 do not synthesise a missing generated _version.py

git commit --no-verify also bypasses the gate, and the gate says so itself when it blocks.

Honest limits

  • Function-level checking is Python only. Changed files in other languages are named explicitly rather than passed over quietly.
  • Sampling finds differences; it cannot prove their absence.
  • Nondeterministic, too-slow, or unconstructible functions abstain with a reason, and are never counted as passing.
  • The sandbox contains accidents: resource limits, network blocked, filesystem writes blocked. It is not a security boundary against hostile code, and no pure-Python sandbox is.
  • A _version.py that the build generates is synthesised as 0.0.0 so the package can be imported at all. A commit that changes how a version string is derived is therefore not measured. Both sides get the same stub, so it can never manufacture a changed, and RUNBOTH_NO_VERSION_STUB=1 turns it off.

Development

pip install -e .
pytest tests/ -q
runboth selftest          # the control suites, half of which must fail

Licence

FSL-1.1-Apache-2.0. Free for every use except building a competing product, and it converts to plain Apache 2.0 two years after each release.

Built by Kyle Clouthier at Clouthier Simulation Labs.

Metadata

Release files for runboth 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runboth 0.1.1
File Size Uploaded Provenance Actions
runboth-0.1.1.tar.gz 139.3 kB With provenance Details for runboth-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for runboth 0.1.1
File Interpreter ABI Platform Actions
runboth-0.1.1-py3-none-any.whl Python 3 none any Details for runboth-0.1.1-py3-none-any.whl

Total release size: 278.3 kB

Release files / runboth-0.1.1.tar.gz

Download URL runboth-0.1.1.tar.gz
Size 139.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1b61c03600f1c66844a8e9ddd1234d945c2d2899fef3243c9ef0bc098b9955d0
BLAKE2b-256 checksum
How to use checksums
66083b2694a57b67901ed50c5bb0c076e5f0f1fd54aab0a72ea67e1acd2f49d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / runboth-0.1.1-py3-none-any.whl

Download URL runboth-0.1.1-py3-none-any.whl
Size 138.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2c0f8dffef3a5fef794dfae959c840fcd4f03341ebed0d733ce0231ef64eba0
BLAKE2b-256 checksum
How to use checksums
11f856a48d0dc7b35c59bc9148ec566340382970ae54e7bf100c903305d25207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for runboth 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for runboth-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page