gabriel / muse public
bisect.md markdown
98 lines 3.2 KB
Raw
sha256:18b983389ee1b55900fcd799bfbb496552d2e3ecded9d18cefbfef188947a12e chore: remove blob-debug test marker file Sonnet 4.6 1 day ago

muse bisect — binary search for regressions

muse bisect is a regression-hunting power tool for humans and agents alike. Given a commit where a bug first appears (bad) and a commit where it was not present (good), it performs a binary search through the history between them — cutting the search space in half at each step — until the exact commit that introduced the bug is isolated.

For a 1,000-commit range, muse bisect needs at most 10 steps. For 1,000,000, it needs 20.

Subcommands

Command Description
muse bisect start Begin a bisect session
muse bisect bad [ref] Mark a commit as bad (bug present)
muse bisect good [ref] Mark a commit as good (bug absent)
muse bisect skip [ref] Skip a commit that cannot be tested
muse bisect run <cmd> Automatically bisect using a shell command
muse bisect log Show the bisect session log
muse bisect reset End the session and clean up state

Manual workflow

# 1. Start the session with the bad and good bounds:
muse bisect start --bad HEAD --good v1.0.0

# 2. Muse suggests a midpoint:
# Next to test: a1b2c3d4ef56  (32 remaining, ~5 steps left)

# 3. Test that commit and report the result:
muse bisect good    # or: muse bisect bad

# 4. Repeat until the first bad commit is found:
# ✅ First bad commit found: deadbeef1234…
# Run 'muse bisect reset' to end the session.

# 5. Clean up:
muse bisect reset

Automated workflow (muse bisect run)

The run subcommand fully automates the search. The command you provide is run at each bisect step; the exit code determines the verdict:

Exit code Verdict
0 good — bug not present
125 skip — commit untestable (e.g. build fails)
1–124, 126–255 bad — bug present
muse bisect start --bad HEAD --good v1.0.0
muse bisect run "pytest tests/test_regression.py -x -q"

Muse will automatically advance until the first bad commit is found.

State file

The bisect session is stored at .muse/BISECT_STATE.toml:

bad_id = "deadbeef…"
good_ids = ["aabbccdd…"]
skipped_ids = []
remaining = ["a1b2c3…", "d4e5f6…", …]
log = ["deadbeef… bad 2026-03-19T14:22:01+00:00", …]
branch = "main"

The state file is rebuilt at every step so it survives interruptions.

Multiple good commits

You can specify multiple --good bounds to narrow the search range from multiple known-good ancestors:

muse bisect start --bad HEAD --good v1.0.0 --good v1.1.0 --good v1.2.0

Agent workflow

# Fully autonomous regression hunt:
muse bisect start --bad HEAD --good "$LAST_GREEN_CI_COMMIT"
muse bisect run "./ci/test.sh"
# Agent reads the result and files a bug report with the first-bad commit.

Exit codes

Code Meaning
0 Success
1 No bisect session active, or ref not found

Interaction with other commands

  • muse bisect operates on existing commits in the store — it does not check out files automatically. For file-level testing, use muse bisect run with a script that reads state/ directly.
  • After muse bisect reset, all bisect state is removed and the normal branch workflow resumes.
File History 7 commits
sha256:18b983389ee1b55900fcd799bfbb496552d2e3ecded9d18cefbfef188947a12e chore: remove blob-debug test marker file Sonnet 4.6 1 day ago
sha256:e452ad9a6ace6ccc6d875a35e06caf9da5576a970c1c36133b69a891ce5fefa8 chore: prebuild timing test Sonnet 4.6 8 days ago
sha256:0008ab6695e3e064b3e236b24fd19e538fef6a588eb0d211622f4466d919c0b1 merge: pull staging/dev — advance to 0.2.0rc12 Sonnet 4.6 patch 10 days ago
sha256:9c33d61749fff814c5226d5386aa2af7064c2c02788594a25fdd709358132eea fix: _PROPOSAL_PREFIX_RESOLVE_LIMIT 200 → 100 to match hub … Sonnet 4.6 21 days ago
sha256:36c3cb3e76619d4c30a6d9bf81b5ec4ff148e30dcfed913e3114ca7b43b81c7e fix: rename objects→blobs in push client and all stale test… Sonnet 4.6 patch 24 days ago
sha256:c06a9b9b9fee26c68ea725b44d54b2c0a171301ce9de746d5b656617b4463a9a fix: repair four test failures from post-migration audit Sonnet 4.6 patch 30 days ago
sha256:1900655993c83c4107067375548a7be823e471d2515830842f1a12cba4bd3cdf fix: unified object store migration — idempotent writes, JS… Sonnet 4.6 minor 30 days ago