dsh-culprit: Bisecting Git History with Criteria to Locate Regression Culprit Commits

Preface

When developing agents or workflows in DeepSeek Harness (DSH), the model often needs to answer “since which commit did this behavior start breaking.” Line-based or history-based blame tools can explain who wrote a specific line, but they cannot replace “actually running the command on a specific commit”—problems like dependency installation failures, test timeouts, or runtime-only issues cannot be guessed by merely reading history.

dsh-culprit is a workflow plugin (SkillHub category: workflow) published by community maintainer ca610. It accepts a predicate command that exits non-zero when a bug is present, performs a binary search on the repository’s --first-parent history, returns the culprit commit, diff, and step-by-step detection evidence, and restores the working tree to its original state upon completion. This article introduces its positioning, installation, usage, and constraints; facts are based on the GitHub repository README and package.json.

What is this

In one sentence: Treat “tests turning red” as an executable, bisectable fact, repeatedly running the predicate on historical commits to find the first commit that introduced the failure.

Item Description
Package Name dsh-culprit
Version 0.1.0 (Source: package.json)
License MIT
Maintainer ca610
Directory Page https://www.skillhub.cn/plugins/ca610/dsh-culprit
Source Code https://github.com/ca610/dsh-culprit
Node >=22

Unlike slow-stack/euthyna in the ecosystem, which uses line/history-based analysis to determine “who introduced this line,” this plugin must checkout and execute the predicate on various commits. The cost is that it modifies the working tree; therefore, engineering-wise, it emphasizes dirty tree rejection, mutual exclusion with ongoing git bisect, and restoration of HEAD/branch in finally blocks.

Core Functions

The plugin registers the tool regression_culprit to DSH. Main capabilities include:

  1. Automatic or Specified Good/Bad Points: The default bad point is HEAD; you can pass goodRef to skip automatic discovery; it can also automatically search history for a healthy baseline.
  2. Bisection and Evidence Chain: Records the predicate exit code, duration, and semantics (good/bad/skip) at each step. After convergence, provides result.culprit, changed file statistics, and diffs.
  3. Predicate Semantics Aligned with git bisect run: 0 means healthy, non-zero means problematic; 125 and timeouts are treated as skipped (timeouts are deliberately not considered “bad” to avoid mistaking “dependency installation failure” for the culprit).
  4. HEAD Self-Check: Requires that the bad point actually fails on the current HEAD by default; if the predicate passes (is green) on HEAD, returns not-reproduced rather than forcing a conclusion.
  5. Checkpoint Resume: Saves state to disk after every probe step (default %TEMP%\dsh-culprit); can continue with resume: true when the budget is exhausted; mode: "status" lists unfinished states in read-only mode.
  6. Safety Boundaries: Rejects dirty working trees (dirty); rejects if a bisect is already in progress (bisect-in-progress); no reset --hard / clean / stash; strictly follows --first-parent history.

Return statuses include: found, not-reproduced, no-good-baseline, budget-exhausted, inconclusive, dirty, not-a-repo, bisect-in-progress, invalid-args. Only found provides result.culprit; budget-exhausted deliberately does not provide a culprit to avoid treating the “most likely” candidate from an unconverged search as a conclusion.

Installation and Activation

The DSH community directory (SkillHub) has no official affiliation with DeepSeek / High-Flyer; please review the source code and MIT license yourself before installing. The plugin executes git checkout and predicate subprocesses under the permissions of the current DSH process, equivalent to you running similar commands in your local terminal.

Standard Path (User-Managed Profile)

The README explains calling the plugin manager via the agent to install a local bundle (the repository needs to be placed locally first; the README example points to the directory after cloning):

plugin_manager(action: "install_bundle", target: "C:\\path\\to\\dsh-culprit")

After installation, you must restart the profile / DSH: plugins are only loaded at startup, with no hot updates. Use remove_bundle to uninstall.

Windows Desktop Edition

The desktop profile is exclusively managed by the Electron application; dsh plugin --profile desktop add will be rejected. The manual connection method documented in the README involves three steps: a junction under the profile’s node_modules pointing to the repository, dependencies in package.json using link:<absolute repository path>, and appending the package name to dsh.profile.bundles (otherwise cordis.patch.yml will not be read). It is recommended to back up package.json before modifying it.

Confirming Installation

The README provides two layers of self-check (the script exits with code 2 if the host runtime is missing; skipping is not considered passing):

node test/profile-install.mjs
node test/host-dispatch.mjs

The former only reads the profile to resolve links, bundles, junctions, and patches; the latter dispatches the tool once in a real cordis context to verify the output schema and working tree restoration.

Typical Usage

Simplest call: Only fill in the predicate; the tool finds the good point, performs bisection, and restores the working tree itself.

regression_culprit(predicate: "npm test -- src/clamp.test.js")

If a known healthy version exists, specify goodRef, which is usually faster and more accurate:

regression_culprit(predicate: "node --test calc.test.mjs", goodRef: "v2.1.0")

Before running, it is recommended to execute the predicate on your local HEAD once to confirm that it is currently red. The predicate syntax is the same as git bisect run; on Windows, PowerShell squashes non-zero exit codes, so the plugin wraps the predicate to preserve semantics like 125 (see README “Known Limitations” for details).

Common Parameters (Excerpt)

Parameter Description
predicate Required, the predicate command
goodRef / badRef Good/bad commits or tags; bad point defaults to HEAD
root Repository path, defaults to session working directory
mode bisect (default) or status
resume Resume unfinished intervals
maxSteps Maximum number of probes, default 16 (max 40)
timeoutPerStep Per-step timeout in milliseconds, default 120000
totalBudgetMs Total budget in milliseconds, default 600000

In-repository demo (creates a bug repo in a temp directory, deletes it after running):

node examples/demo.mjs

Configuration (Optional)

Default values can be overridden in the bundle config within cordis.patch.yml, for example:

- insert:
    - id: culprit
      name: dsh-culprit
      config:
        maxSteps: 24
        timeoutPerStep: 300000

Other items include workdir, maxHistoryScan, maxAutoProbes, skipLimit, stateDir, allowDirty, shell, firstParent, requireBadAtStart, keepState, etc. See the README configuration table for meanings and default values.

Applicable Scenarios and Notes

Suitable for: Regression issues with scriptable predicates (tests, builds, single-line repro commands); need to structurally return “which commit broke it” (including diff and detection traces) within an agent workflow.

Not suitable for or Cautions: If the culprit change is internal to a merged branch, the result may fall on a merge commit (the plugin will warn); if old commit environments cannot run, it leads to many skips and inconclusive results—you can narrow the range or provide a closer goodRef; if combined diffs for merge commits are unavailable, it falls back to git diff <sha>^1 <sha>.

If no host is available locally, you can run unit tests:

node test/culprit.test.mjs

Conclusion

dsh-culprit treats “predicate pass/fail in history” as the single source of truth, using bisection plus step-by-step evidence to answer “since which commit did it break,” and strives to restore the working tree without harming uncommitted changes. For plugin details and category access, see the SkillHub Directory Page; for installation, parameters, safety guarantees, and Windows exit code details, see the GitHub README.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye