headroom/docs
Shubham Srivastava 17d60dce1f
docs(troubleshooting): document Windows Defender ast-grep-cli false positive + workarounds (#2200) (#2237)
## Description

On Windows, `uv tool install "headroom-ai[all]"` (and `pip install`)
fails while installing the `ast-grep-cli` wheel because Windows Defender
quarantines the bundled `sg.exe` as `Trojan:Win64/Lazy!MTB` (`os error
225`). This is a **known upstream false positive** in the `ast-grep-cli`
wheel
([ast-grep/ast-grep#2799](https://github.com/ast-grep/ast-grep/issues/2799)),
not a Headroom-introduced problem — but because `ast-grep-cli` is a base
dependency, the local install path is blocked on affected Windows
machines.

The issue (#2200) explicitly asks: "At minimum, please document a
supported workaround." This adds a troubleshooting entry with
safest-first workarounds. `ast-grep` is used only for optional AST-based
Read-output outlining and Headroom degrades gracefully without it, so
the impact is purely the install-time quarantine.

Closes #2200

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

`docs/content/docs/troubleshooting.mdx` only — a new `### Windows:
Defender blocks ast-grep-cli (sg.exe) during install` subsection under
the existing `## Installation Issues` section, following the file's
`**Symptom**` / `**Cause**` / workarounds pattern:

- **Symptom** — the exact `uv tool install` failure text (`os error
225`, `Trojan:Win64/Lazy!MTB`, `sg.exe`) so users match it by search.
- **Cause** — known upstream `ast-grep-cli` wheel false positive
(linked); base dependency so it hits `[proxy]` too; `ast-grep` is
optional at runtime and Headroom runs without it.
- **Workarounds, safest first:** (1) run the proxy in Docker (no local
wheel → no AV trigger); (2) restore `sg.exe` from Defender quarantine
and retry (no persistent change); (3) a temporary, *scoped* Defender
exclusion for `uv tool dir` during install, framed as a known false
positive with a caution not to disable Defender wholesale; (4) report
the false positive to Microsoft for a durable signature fix.

Explicitly out of scope: making `ast-grep-cli` optional (a
dependency-policy change requiring maintainer justification per
CONTRIBUTING). No code change.

## Testing

- [ ] Unit tests pass (`pytest`)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [ ] New tests added for new functionality
- [x] Manual testing performed

### Test Output

Docs-only; verification is fact cross-check + MDX sanity:

```text
$ grep -n "ast-grep-cli>=" pyproject.toml
60:    "ast-grep-cli>=0.30.0",       # AST-aware code slicing (CodeCompressor); binary wheel
# → confirms ast-grep-cli is a base dependency (affects [proxy] too)

$ sed -n '6,7p' headroom/proxy/interceptors/astgrep.py
followed by an elided body marker. Falls back to the original text if
ast-grep isn't available, the extension isn't supported, or there are fewer
# → confirms graceful degradation: Headroom runs without a working sg.exe

$ uv tool dir
C:\Users\<user>\AppData\Roaming\uv\tools
# → the directory the scoped-exclusion workaround targets (via `uv tool dir`, not a hardcoded path)

# MDX sanity: balanced code fences (even count), well-formed headings, links close.
```

## Real Behavior Proof

- **Environment:** Windows 11 (the affected platform), the docs source
inspected against the current `main` base.
- **Exact command / steps:** Issue #2200 contains a complete, exact
reproduction (command `uv tool install "headroom-ai[all]"`, the `os
error 225` / `Trojan:Win64/Lazy!MTB` failure on `sg.exe`, `ast-grep-cli
0.44.1`, `uv 0.11.16`, Windows 11). The documented facts are verified
against the tree: base-dependency declaration (`pyproject.toml:60`) and
graceful degradation (`headroom/proxy/interceptors/astgrep.py:6-7`). The
`uv tool dir` command used in the exclusion workaround resolves
correctly on this machine.
- **Observed result:** The troubleshooting note accurately describes the
failure and gives valid Windows/Defender workarounds, ordered
safest-first.
- **Not tested:** I deliberately did **not** run `uv tool install
"headroom-ai[all]"` to force a live Defender quarantine — doing so is
disruptive (it can quarantine real files and pulls the full dependency
set) and machine-specific. The reproduction in the issue is complete and
corroborated by the upstream ast-grep report.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] I have updated the CHANGELOG.md if applicable

## Screenshots (if applicable)

N/A (troubleshooting prose addition).

## Additional Notes

- Test/tests-added and CHANGELOG checklist items are N/A —
documentation-only change (kept to a single file, matching the merged
#2031 precedent).
- The durable fix for the underlying false positive belongs upstream
(ast-grep) and/or with Microsoft's signature update; this PR documents
supported workarounds in the meantime, as the issue requested.
- Making `ast-grep-cli` an optional dependency would remove the install
blocker at the source, but that's a dependency-policy change for
maintainers to weigh (the interceptor already tolerates its absence) —
intentionally not attempted here.
2026-07-15 19:57:55 +00:00
..
app docs: improve discoverability for AI agents and search crawlers 2026-05-13 17:36:06 -07:00
components tokens saved grid 2026-04-12 13:42:20 +06:00
content/docs docs(troubleshooting): document Windows Defender ast-grep-cli false positive + workarounds (#2200) (#2237) 2026-07-15 19:57:55 +00:00
lib docs(ci): add CI/CD flow diagrams (#1062) 2026-06-16 23:05:15 -07:00
overrides fix: repair release and docs pipelines 2026-04-16 12:53:51 -05:00
screenshots Merge pull request #147 from JerrettDavis/feat/anthropic-usage-insights 2026-04-12 10:54:22 -07:00
.gitignore new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
bun.lock fix(deps): remediate dependency CVEs and publish SBOM (#1509) 2026-06-27 15:28:12 -07:00
claude-code-bedrock-headroom.md fix(bedrock): route ARNs via converse, named AWS profiles, and au. re… (#1456) 2026-07-02 22:51:05 -05:00
next.config.mjs new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
observability.md fix(observability): G3 remediation — bound cardinality + wire dead metrics 2026-05-24 10:41:56 -07:00
package-lock.json fix: add Vercel deploy config and workflow for docs site (#1739) 2026-07-14 13:25:18 -04:00
package.json fix: add Vercel deploy config and workflow for docs site (#1739) 2026-07-14 13:25:18 -04:00
platform-feature-matrix.json fix: harden persistent install startup (#1851) 2026-07-10 00:40:34 -04:00
platform-stabilization.md fix: harden persistent install startup (#1851) 2026-07-10 00:40:34 -04:00
postcss.config.mjs new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
proxy.ts new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
README.md new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
rtk-architecture.md fix(observability): wire Phase G PR-G3 RTK + proxy metrics (H-blocker) 2026-05-22 13:18:42 -07:00
source.config.ts docs(ci): add CI/CD flow diagrams (#1062) 2026-06-16 23:05:15 -07:00
tsconfig.json new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
vercel.json fix: add Vercel deploy config and workflow for docs site (#1739) 2026-07-14 13:25:18 -04:00

docs

This is a Next.js application generated with Create Fumadocs.

Run development server:

npm run dev
# or
pnpm dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Explore

In the project, you can see:

  • lib/source.ts: Code for content source adapter, loader() provides the interface to access your content.
  • lib/layout.shared.tsx: Shared options for layouts, optional but preferred to keep.
Route Description
app/(home) The route group for your landing page and other pages.
app/docs The documentation layout and pages.
app/api/search/route.ts The Route Handler for search.

Fumadocs MDX

A source.config.ts config file has been included, you can customise different options like frontmatter schema.

Read the Introduction for further details.

Learn More

To learn more about Next.js and Fumadocs, take a look at the following resources: