Skip to main content

mcp-benchmark-hygiene

Deterministic detection of pytest config-leakage that silently corrupts agent-benchmark / function grading.

No LLM. No network. One question, answered reliably:

If I run python -m pytest <tests> inside this workspace, will it inherit a host coverage/abort gate that mis-scores passing code as failed?


The bug this catches

Automated agent-evaluation harnesses often run python -m pytest <hidden_tests> inside the target's workspace. If that workspace nests under a repo root carrying pytest addopts — e.g.:

[tool.pytest.ini_options]
addopts = "--cov=harness --cov-report=term-missing:skip-covered --cov-fail-under=80"

...pytest resolves that host pyproject.toml as its rootdir, inherits the addopts, and fails on the host's own coverage gate (harness collected at 0% → below threshold → non-zero exit). The harness then records functionally PASSING code as FAILED.

This is exactly the bug documented in sudo-ai-git/vulcanbench-findings: VulcanBench's declarative grader mis-scored every functional task as 0.0 for this reason; with -o addopts= neutralizing the leak, the same workspaces passed 10/10.

The fix it hands you

When a workspace is flagged CORRUPTED, the tool returns the corrected command:

python -m pytest -o addopts= <tests>

-o addopts= strips inherited coverage/abort gates. (Or run the grader from outside the repo root.)

Tools

tool purpose
inspect_workspace(path) full analysis: ini chain, effective addopts, CLEAN/CORRUPTED/UNKNOWN verdict + corrected command
check_addopts(path) thin boolean: corrupted + reasons
summarize(analysis) one-line actionable summary string

Deterministic core (no deps)

The analysis walks the workspace directory up to filesystem root, reading pyproject.toml / pytest.ini / tox.ini / setup.cfg in pytest's first-found order, and extracts addopts. Flags:

  • coverage gates--cov, --cov-fail-under, --cov-report, --cov-config
  • abort/strict gates--maxfail, -x, --strict, --strict-markers, --pdb, --ff

Only gates that change exit codes / abort grading are flagged. A harmless addopts is reported CLEAN with the exact string.

Install & run (MCP stdio)

{ "mcpServers": {
    "benchmark-hygiene": { "command": "python3", "args": ["/abs/path/to/mcp_server.py"] }
}}

Requires the official mcp python package (pip install mcp). The deterministic core (inspect_workspace / check_addopts / summarize) imports and runs with zero dependencies — the mcp package is only needed for the stdio server.

Streamable HTTP (remote/Smithery-publishable)

python3 mcp_server.py --http --port 8137   # serves on http://<host>:8137/mcp/

Run with --http to serve over Streamable HTTP (a remote MCP endpoint) instead of stdio. This is the transport smithery mcp publish <url> expects for URL-based publishing — so once a Smithery service token exists, the server deploys as-is.

Example

inspect_workspace(path="/home/runner/vulcanbench/workspace/task-1")
→ {
    "ok": true,
    "workspace": "/home/runner/vulcanbench/workspace/task-1",
    "ini_chain": [{"file": "/home/runner/vulcanbench/pyproject.toml",
                   "addopts": "--cov=harness ... --cov-fail-under=80"}],
    "effective_addopts": "--cov=harness ... --cov-fail-under=80",
    "will_corrupt_grading": true,
    "verdict": "CORRUPTED",
    "fixed_command": ["python3", "-m", "pytest", "-o", "addopts=", "<tests>"],
    "reasons": ["coverage gate(s) present: ['--cov', '--cov-fail-under']"]
}

Verification

  • python3 test_detector.py — 5/5 core detection checks (root gate, nested inheritance, clean, abort gate, pyproject-no-pytest)
  • python3 test_e2e.py — drives the real MCP stdio transport (initialize → tools/call) and asserts CORRUPTED / CLEAN thread through the wire

License & provenance

MIT. Independently derived from the documented VulcanBench #79 finding; no endorsement by or affiliation with morganlinton/VulcanBench implied.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_benchmark_hygiene-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_benchmark_hygiene-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_benchmark_hygiene-1.0.0.tar.gz.

File metadata

  • Download URL: mcp_benchmark_hygiene-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for mcp_benchmark_hygiene-1.0.0.tar.gz
Algorithm Hash digest
SHA256 29794f8d43f3abf032ff77bd264d1c80ac35c0a48e26938b5363d9d184d60158
MD5 dc799bf69540d13a29c1638990f41a5e
BLAKE2b-256 f82b3f92c2b45582d038bcab1da5a4878d7080a0d4b0666835016a7865a6e907

See more details on using hashes here.

File details

Details for the file mcp_benchmark_hygiene-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_benchmark_hygiene-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff547df215fc21d21920483805d6d60e237fa90cb0aa1c9d6049332965214d19
MD5 ee95598cf6dc8ae92bc8a474ca8d7814
BLAKE2b-256 34679978279f39249b1c499cb5f05ddd051f3d543169c28e260dc5fdaa9f23bd

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

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