Summary
headroom._core.detect_content_type() hangs on Windows with headroom-ai 0.24.0 and Python 3.13. This makes headroom_compress unusable for any content large enough to enter the real compression path.
This appears related to #713 / #575, but I am filing a new issue because this is still reproducible on the current 0.24.0 Windows wheel and a newer Python 3.13 environment.
Environment
- OS: Windows 10
10.0.19045
- Python:
3.13.13 CPython win_amd64
- headroom-ai:
0.24.0
- Wheel:
headroom_ai-0.24.0-cp313-cp313-win_amd64.whl
- Shell: PowerShell
Minimal Reproduction
python -c "from headroom._core import detect_content_type; print(detect_content_type('short headroom mcp smoke test'))"
Actual Result
The process hangs. In my test it did not return within 60 seconds.
This is not caused by large input. The input above is a short plain-text string.
Expected Result
detect_content_type() should return quickly, for example as plain text.
Related Checks
The Rust extension itself imports and other exported functions return immediately:
python -c "from headroom._core import hello; import time; t=time.perf_counter(); print(hello(), round(time.perf_counter()-t,3))"
Output:
python -c "from headroom._core import is_json_array_of_dicts; import time,json; content=json.dumps([{'a':1}]); t=time.perf_counter(); print(is_json_array_of_dicts(content), round(time.perf_counter()-t,3))"
Output:
The pure Python fallback detector returns immediately:
python -c "from headroom.transforms.content_detector import detect_content_type; import time; content='short headroom mcp smoke test'; t=time.perf_counter(); r=detect_content_type(content); print(r, round(time.perf_counter()-t,3))"
Output:
DetectionResult(content_type=<ContentType.PLAIN_TEXT: 'text'>, confidence=0.5, metadata={}) 0.0
Impact
headroom_compress through MCP only works for very small content because it exits via router:noop.
For larger content:
- MCP
headroom_compress wraps the content as a tool message.
headroom.compress.compress() enters ContentRouter.
ContentRouter._detect_content() calls headroom._core.detect_content_type().
- The call hangs.
- MCP eventually times out after 120 seconds.
headroom perf also showed proxy optimization overhead around 30 seconds per request with 0 tokens saved before I stopped using proxy mode.
Request
Please either:
- Fix the Windows deadlock/hang in
_core.detect_content_type(), or
- Provide a supported opt-out to force the Python detector, for example an environment variable such as
HEADROOM_DETECT_BACKEND=python / regex.
Without such a fallback, Headroom MCP on Windows cannot reliably compress large tool outputs.
Summary
headroom._core.detect_content_type()hangs on Windows withheadroom-ai 0.24.0and Python 3.13. This makesheadroom_compressunusable for any content large enough to enter the real compression path.This appears related to #713 / #575, but I am filing a new issue because this is still reproducible on the current
0.24.0Windows wheel and a newer Python 3.13 environment.Environment
10.0.190453.13.13CPython win_amd640.24.0headroom_ai-0.24.0-cp313-cp313-win_amd64.whlMinimal Reproduction
Actual Result
The process hangs. In my test it did not return within 60 seconds.
This is not caused by large input. The input above is a short plain-text string.
Expected Result
detect_content_type()should return quickly, for example as plain text.Related Checks
The Rust extension itself imports and other exported functions return immediately:
Output:
Output:
The pure Python fallback detector returns immediately:
Output:
Impact
headroom_compressthrough MCP only works for very small content because it exits viarouter:noop.For larger content:
headroom_compresswraps the content as a tool message.headroom.compress.compress()entersContentRouter.ContentRouter._detect_content()callsheadroom._core.detect_content_type().headroom perfalso showed proxy optimization overhead around 30 seconds per request with0tokens saved before I stopped using proxy mode.Request
Please either:
_core.detect_content_type(), orHEADROOM_DETECT_BACKEND=python/regex.Without such a fallback, Headroom MCP on Windows cannot reliably compress large tool outputs.