Skip to main content

FlareBisect 🔥

PyPI CI License: MIT

FlareBisect finds the commit that made your tests flaky, not just the one that broke them: it bisects on flake-rate drift instead of pass/fail, then flares the culprit with an AI-written root cause.

git bisect gives you confidently wrong answers when the test you're bisecting on is flaky — it treats every run as a clean pass/fail signal, so a test that was already unstable before you started bisecting can point straight at an innocent commit.

flarebisect bisects on flake rate, not pass/fail. It runs each candidate commit's test N times in parallel, computes a failure rate, and finds the commit where that rate jumps — then asks an LLM to explain, in plain English, whether the commit broke the test cleanly or made it flakier.

12 commits in range · 20 runs per commit · parallel worktrees

commit   flake rate                                  result  status
a1b2c3                                                  5/5  good
4f9e21                                                  5/5  stable
7d3aa0   ███████                                        4/5  wobbling
9c1f88   ████████████████████████████                   1/5  flare
HEAD     ████████████████████████████                   1/5  bad

╭────────────────────────────────────────────────────────────────╮
│ ✦ culprit found · commit 9c1f88                                    │
│                                                                        │
│ flake rate jumped 20% → 80% at this commit                             │
│ "add request counter for rate limiting"                                │
│                                                                        │
│   💡 likely cause — shared counter incremented without a lock.        │
│   concurrent test workers race on the same variable.                   │
╰────────────────────────────────────────────────────────────────╯
⏱ 8.4s    ⚡ 5 checked    ⚙ 4 parallel workers

Install

pip install flarebisect

For local development:

pip install -e ".[dev]"
pytest -q

Works on Linux, macOS, and Windows — the only external dependency is git on your PATH. Every candidate commit runs in its own git worktree under a temp directory; your actual working tree and index are never touched.

AI provider setup

The root-cause explanation step works with Claude, OpenAI, Gemini, or a local model — anything speaking an OpenAI-compatible chat API (Ollama, LM Studio, llama.cpp server, vLLM, and similar all qualify).

# cloud
flarebisect config set-key anthropic sk-ant-...
flarebisect config set-key openai sk-...
flarebisect config set-key google AI...

# local, no key needed - just have Ollama running
flarebisect config use ollama
flarebisect config set-model ollama llama3.1

# or let flarebisect pick a model sized to your GPU and pull it for you
flarebisect models detect   # shows detected GPU/VRAM + recommended model
flarebisect models pull     # downloads it and sets it active (run with no args)

# any other OpenAI-compatible endpoint
flarebisect config use custom
flarebisect config set-base-url custom http://localhost:8080/v1
flarebisect config set-key custom sk-local

Run flarebisect config with no arguments for a guided setup wizard — for Ollama it detects your GPU/VRAM, prefills a right-sized model, and offers to pull it on the spot.

flarebisect config show lists the active provider and stored settings (keys are masked). Config lives in a JSON file under the OS config dir (~/.config/flarebisect/config.json on Linux/macOS, %APPDATA% on Windows), written with owner-only permissions.

Per-run overrides skip the config file entirely:

flarebisect run ... --provider openai --model gpt-4o-mini --api-key sk-...
flarebisect run ... --provider ollama --base-url http://localhost:11434/v1

Env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY) work too, as a fallback under whatever's in the config file.

Usage

flarebisect run \
  --repo /path/to/repo \
  --good <known-good-sha> \
  --bad <known-bad-sha> \
  --test "pytest -k my_flaky_test" \
  --runs 20 \
  --threshold 0.3
  • --runs — test executions per commit (default 20), run in parallel (capped at your core count so it doesn't oversubscribe). Lower counts are faster but noisier — a low sample can misattribute the culprit near the threshold boundary.
  • --threshold — flake-rate jump (0-1) vs. the good baseline required to call a commit the culprit (default 0.3).
  • --no-explain — skip the LLM root-cause call entirely (fully offline).

Demo

See demo/ for a self-contained, seeded-flaky-bug repo you can bisect against with no network access required for the bisection itself.

How it works

  1. Measure the flake rate at good and bad as baselines.
  2. Binary-search the commit range between them.
  3. At each candidate, run the test N times in an isolated worktree and compute failed / N.
  4. The culprit is the first commit whose flake rate jumps by >= threshold over the good baseline.
  5. Verdict: clean break (rate goes ~0% → ~100%) vs. flakiness regression (rate goes ~0% → somewhere in between).
  6. The configured LLM gets the culprit's diff + the flake-rate evidence and returns a short root-cause read (race condition, shared mutable state, timing assumption, etc.).

Binary search assumes the flake rate is roughly monotonic across the range, same as ordinary git bisect assumes pass/fail is. At low --runs counts a noisy sample can occasionally violate that near the threshold boundary — bump --runs if a result looks off.

Releasing

Version is single-sourced from src/flarebisect/__init__.py. Bump it, commit, tag (vX.Y.Z), and cut a GitHub Release — .github/workflows/publish.yml builds and publishes to PyPI via trusted publishing (OIDC, no stored token).

License

MIT

Metadata

Release files for flarebisect 1.0.0

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

Source distribution (sdist)

Source distribution for flarebisect 1.0.0
File Size Uploaded Provenance
flarebisect-1.0.0.tar.gz 15.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 35.0 kB

Release files / flarebisect-1.0.0.tar.gz

Download URL flarebisect-1.0.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fd2f7f37f2ab14306305c8fdc6591bc25e5fae62d5966529474aed6a1b7299db
BLAKE2b-256 checksum
How to use checksums
8c5de13bade45d4da257a36eb216637d7a509ce4db49ec37f5a66962b4873eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 26, 2026.

Transparency log

Release files / flarebisect-1.0.0-py3-none-any.whl

Download URL flarebisect-1.0.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8fbb0ebb273f704e5f14a095d4fbcac50898e0d4aecda383d7881fc2a02ba21
BLAKE2b-256 checksum
How to use checksums
1a2d3706081ffc4c4a4f123442faca98bccab5d37839c8c77ee26bf91f511414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 26, 2026.

Transparency log

Security for flarebisect 1.0.0

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flarebisect-1.0.0.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 Jul 26, 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

1.0.0 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