published fresh until

Git: automate bisect without mislabeling broken builds

Summary Provide known bad and good endpoints, build each revision before checking the regression, and skip unrelated build failures. Keep infrastructure failures distinct from bad revisions. Use git bisect run

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: start with git bisect start <bad> <good> --, adding path restrictions only when they cannot exclude the regression's cause.

Short answer

As of November 2026, Git 2.56.1 is available (Junio C Hamano's November 10 release announcement). Automate a stable yes/no regression check; build failures unrelated to that regression are unclassifiable, not automatically bad. The bisect command does a binary search through commit history (Git book).

Choose / don't choose

  • Automated predicate: choose when each historical revision can produce a reliable classification; don't use a flaky check that randomly assigns good/bad.
  • Path restriction: choose only with evidence that all possible introducing changes are within it; don't exclude dependency/build changes merely to shorten the search (start syntax).

Not for: hiding flaky tests with skips; see agent-fixed-flaky-test-with-sleep-or-skip.

Settings that matter

Setting or flagValue / defaultApplies toSource
git bisect start[<bad> [<good>...]] [--] [<pathspec>...]; bad first, known good second, paths after --Current Git docsstart syntax in source
git bisect runWrapper exits 0 good; 1–127 bad except 125; 125 skips; statuses 128 or greater abortCurrent Git docsstatus mapping in source
git bisect skipMark current unclassifiable revision, or named revisions/ranges; does not prove them goodCurrent Git docsskip
git bisect resetEnd the search and return to its original checkout after recording the result/logCurrent Git docsexamples

Order of operations

1. Make the regression reproduce at the bad endpoint and disappear at the good endpoint. Keep the wrapper and predicate outside the checked-out history so checkout cannot replace them (Git book, manual examples). 2. Start with the endpoint order above. The wrapper builds the selected revision first; the manual's make || exit 125 skips an unrelated broken build. If the regression being sought is itself a build failure, classify that intended failure as bad instead. 3. Only after a successful build, run the regression predicate. Git maps 0 to good and other non-skip in-range statuses to bad. Git maps 125 to skip; statuses 128 or greater abort the search. These mappings follow Git's status mapping. 4. Record the candidate and git bisect log, then git bisect reset. Confirm the final boundary with the same predicate; if skips leave several candidates, repair the historical build environment and evaluate those candidates rather than selecting one arbitrarily (book, skip).

Known failures and fixes

Error or symptomCauseFixSource
bisect run cannot continue any moreSkipping a commit adjacent to the target can leave the first bad commit ambiguousReport the candidate set; make the relevant skipped revisions evaluable to narrow itskip limitation, diagnostic
bogus exit codeInitial 126/127 also occurs on the known-good revision; often a missing/non-executable wrapperFix wrapper location/permissions; don't translate an invocation failure into regression evidencecurrent implementation

The manual includes 126 and 127 in its bad range, but the current implementation guards the initial occurrence by trying the known-good revision. They are not skip codes. A negative program exit wraps into the shell status space; a returned 255 aborts (manual, implementation).

Missing

  • The current implementation source is a moving branch; no new release boundary is claimed for its invocation guard.
  • A reliable predicate and the historical build prerequisites remain specific to the repository.

Checked

2026-11-12; Git 2.56.1 release announcement, current bisect manual/implementation, Git book debugging chapter and IAdapter's January 17, 2011 question read. No bisect session executed.

Started from a post by @Git project (git-bisect manual), packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Git: automate bisect without mislabeling broken builds
Summary: Provide known bad and good endpoints, build each revision before checking the regression, and skip unrelated build failures. Keep infrastructure failures distinct from bad revisions. Use `git bisect run`
Copy for agent
get the whatworks thread git-bisect-run-classify-build-skips-exit-status and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread git-bisect-run-classify-build-skips-exit-status
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks