Preface¶
In DSH, the common approach to have an agent “modify code, then run tests, and keep modifying based on failures” is to directly execute npm test or pytest and dump the entire terminal output into the conversation. Failures often only occupy a few dozen lines, while the traceback may span hundreds; the model also has to find “which file, which line, which assertion failed” by itself among thousands of lines. Similar auto-test-and-fix capabilities already exist in other AI coding tools (e.g., Aider’s --test-cmd, Cline’s test-and-fix, Cursor Automations, etc.), whereas the DSH ecosystem previously lacked a solution that turns “run tests + structured failures + fix loop” into an agent tool. DSH Test AutoFix (npm package name dsh-test-autofix, GitHub repo 1250589385/DSH-Test-Autofix) is published by maintainer 1250589385, categorized as workflow. Its core is registering a run_tests tool for the agent: automatically recognizing common test frameworks, running tests, compressing failures into JSON (file, line number, assertion info), and automatically stopping when the same failure repeatedly occurs, to avoid burning tokens in an infinite loop.
What is this¶
In one sentence: Run tests → structured failure extraction → hand precise failure points to the agent for fixing, instead of dumping the entire log blob.
The plugin registers the tool run_tests to DSH through a Cordis patch, which the agent invokes autonomously (different from the slash command /test in the same ecosystem, @mkaliezz/dsh-test-runner: the latter requires you to inject the run adapter yourself, while this plugin has built-in execution and framework detection). The two have different namespaces and can coexist.
Core Features¶
Structured failure output¶
When tests fail, the tool returns a structure like the following (example from the README), rather than the complete raw output:
{
"status": "failed",
"framework": "pytest",
"passed": 2,
"failed": 1,
"failures": [
{
"file": "tests/test_math.py",
"test": "test_divide",
"line": 12,
"message": "ZeroDivisionError: division by zero",
"detail": "def test_divide():\n> assert divide(1, 0) == 0\nE ZeroDivisionError: division by zero"
}
]
}
To save tokens: each failure detail is capped at about 14 lines (the known limitations section says a single failure detail is capped at 16 lines), and at most 20 failures are returned; when passing, no raw output is included; when failing, only the last 40 lines of the raw output are kept as a fallback.
Automatic test framework detection¶
| Project characteristics | Uses |
|---|---|
pyproject.toml / pytest.ini / setup.cfg / tox.ini |
pytest |
Cargo.toml |
cargo test |
go.mod |
go test ./... |
package.json + vitest dependency |
vitest |
package.json + jest dependency |
jest |
package.json + test script |
npm test |
You can also use the framework parameter to force a specific framework. On the Node side, launchers are chosen by availability (node_modules/.bin, npx, pnpm exec, yarn, npm test); for pytest, interpreters capable of import pytest are probed in the order of virtual environments, DSH_PYTHON, python on PATH, etc. On Windows, PYTHONIOENCODING / PYTHONUTF8 and decoding fallbacks mitigate garbled Chinese assertion messages.
Supported frameworks include pytest, jest / vitest, cargo, go (depending on each framework’s default output format; custom reporters may cause parsing to fail and fall back to raw_tail).
Infinite loop protection¶
Signatures are computed for failures (file + test name + error message, deliberately ignoring line numbers). When the same signature exceeds the configured threshold, it returns status: "loop", prompting the agent to stop repeatedly editing and report the blocker to the user. The default repeatLimit is 2 (meaning the same failure repeated for the 3rd time will trigger a stop; the README example text says 3 times).
Installation and activation¶
--profile is required; replace <your profile> with your own profile (you can check it with the environment variable DSH_PROFILE; desktop is common for the desktop client, web is common for the web client).
Method 1: Install from npm (recommended)
dsh plugin --profile <your profile> add dsh-test-autofix
Method 2: Install from GitHub
dsh plugin --profile <your profile> add github:1250589385/DSH-Test-Autofix
Method 3: Local source directory (development)
# macOS / Linux example
dsh plugin --profile web add /home/you/DSH-Test-Autofix
Method 4: DSH web “Add plugin”
In the input box, only enter the package name dsh-test-autofix (or a Git address, or a local path); do not paste the entire dsh plugin ... command.
After installation, restart DSH and the agent will be able to see run_tests. The current npm version is 0.1.3, license MIT.
Optional configuration is written in the profile’s cordis.patch.yml:
- id: test-autofix
name: DSH-Test-Autofix
config:
repeatLimit: 2 # How many repetitions of the same failure count as a loop (default 2)
timeoutMs: 300000 # Default timeout 5 minutes
Typical usage¶
The model can directly invoke the tool, e.g.:
run_tests() # Auto-detect and run all tests
run_tests(framework="pytest") # Force pytest
run_tests(path_filter="test_math") # Only run matching tests
run_tests(timeout_ms=60000) # 60 second timeout
You can also request in natural language: “Run the tests and fix the failures” — the agent will go through run_tests and the subsequent editing loop.
Use cases and notes¶
Who it’s for: Developers doing TDD or a “modify code—run tests—fix failures” closed loop in DSH; multi-stack repositories (Python / Node / Rust / Go) where you want the agent to guess fewer commands and swallow less logs.
Important notes:
- The plugin executes child processes to run tests with the current DSH process’s permissions; before installing, it is recommended to read the GitHub source code and the MIT license to confirm it meets your security policy.
- It does not replace lint / typecheck; the parser is bound to default terminal formats; for special Python deployments, you can set
DSH_PYTHON. - Parameter errors, missing runners, etc. will return structured results and
notes, and do not disguise failures as test failures.
Community directory page: DSH-Test-Autofix @ SkillHub (independent community site, with no official affiliation with DeepSeek / HF). DSH’s philosophy is “everything is a plugin”; if you only need to parse your existing test output, consider @mkaliezz/dsh-test-runner; if you want the agent to run, inspect, and fix by itself, this plugin is more suitable.
Conclusion¶
DSH Test AutoFix consolidates “run tests + precise failures + loop stop-loss” into an agent-side run_tests, filling in the test auto-fix step in the DSH workflow. For details and updates, see the GitHub repo; for a directory introduction, see the SkillHub plugin page.