mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
## Description
Adds first-class Grok Build support to Headroom so Grok CLI sessions can
route through the local proxy for context compression and savings
tracking.
This PR introduces `headroom wrap grok-build` / `headroom unwrap
grok-build`, a `grok_build` provider slice, Grok MCP registrar support,
and install/telemetry wiring so Grok traffic is attributed correctly in
the proxy and dashboard.
Review follow-up (`9368c413`): when users already own
`[model.grok-build]` in `~/.grok/config.toml`, wrap rewrites `base_url`
in that table in place instead of appending a duplicate header (invalid
TOML).
## Type of Change
- [x] New feature (non-breaking change that adds functionality)
## Changes Made
- Added `headroom/providers/grok_build/` with runtime helpers,
reversible `~/.grok/config.toml` injection, and install env builders.
- Added `headroom wrap grok-build` and `headroom unwrap grok-build` CLI
commands.
- Added `GrokRegistrar` for Headroom MCP registration in Grok config.
- Wired `grok_build` into install planner/registry, agent savings,
telemetry, and proxy client detection (`grok/` user agent).
- **Review fix:** rewrite `base_url` inside an existing user-owned
`[model.grok-build]` table in place (`# was: …` metadata).
- Added regression tests + docs (`grok-build.mdx`, `proxy.mdx`) and
CHANGELOG entry.
## Testing
- [x] Unit tests pass (`pytest`)
- [x] New tests added for new functionality
- [x] Manual testing performed
### Test Output
```text
$ pytest -q tests/test_provider_grok_build.py tests/test_mcp_registry/test_grok_registrar.py
============================== 12 passed in 1.13s ==============================
```
See **Screenshots** below for terminal captures (pytest, review-fix
in-place rewrite, proxy `/readyz`, unwrap).
## Real Behavior Proof
- Environment: macOS, Python 3.11.12 venv, feat/grok-build @ `9368c413`,
isolated `GROK_HOME` temp dirs, proxy port 8799
- Exact command / steps: see screenshot evidence (wrap/unwrap, in-place
table rewrite, `/readyz`)
- Observed result: see screenshots — 12 tests pass; single
`[model.grok-build]` table after wrap on pre-existing config; proxy
healthy; unwrap restores backup
- Not tested: Live interactive Grok chat with xAI auth through the proxy
## 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
- [x] 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
- [x] I have updated the CHANGELOG.md if applicable
## Screenshots (if applicable)
Terminal captures from local verification (`9368c413`). Assets hosted on
fork prerelease only — **not** in the source tree.
**1. Pytest — 12 passed (incl. review-fix regression)**

**2. Review fix — in-place `[model.grok-build]` rewrite (single table,
`# was:` metadata)**

**3. Proxy health — `/readyz` healthy on port 8799**

**4. Unwrap — restores pre-wrap backup**

## Additional Notes
Screenshot assets:
https://github.com/aashishtamsya/headroom/releases/tag/pr-1629-evidence
(temporary prerelease; safe to delete after merge).
---------
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
268 lines
4.1 KiB
Text
268 lines
4.1 KiB
Text
# fastembed model cache (auto-downloaded ONNX weights, ~30 MB+).
|
|
# Should NEVER be committed — bloats the repo significantly.
|
|
.fastembed_cache/
|
|
**/.fastembed_cache/
|
|
|
|
# Local Kompress ONNX export artifacts (scripts/export_kompress_v2_onnx.py).
|
|
# Hundreds of MB each — published to HuggingFace, never committed.
|
|
/onnx/
|
|
|
|
# Private scripts (contain credentials). Allowlist checked-in helpers below.
|
|
scripts/
|
|
!scripts/
|
|
scripts/*
|
|
!scripts/install.sh
|
|
!scripts/install.ps1
|
|
!scripts/version-sync.py
|
|
!scripts/sync-plugin-versions.py
|
|
!scripts/changelog-gen.py
|
|
!scripts/verify-versions.py
|
|
!scripts/pr-governance.py
|
|
!scripts/bootstrap-windows-dev.ps1
|
|
!scripts/build_npm_release_assets.mjs
|
|
!scripts/build_python_release_smoke.py
|
|
!scripts/release_smoke_all.py
|
|
!scripts/verify_npm_release_assets.mjs
|
|
!scripts/tests/
|
|
!scripts/README.md
|
|
!scripts/repro_codex_replay.py
|
|
!scripts/eval_output_shaper.py
|
|
!scripts/fixtures/
|
|
!scripts/fixtures/*.json
|
|
!scripts/record_fixtures.py
|
|
!scripts/build_rust_extension.sh
|
|
!scripts/install-git-hooks.sh
|
|
!scripts/smoke_issue_327.py
|
|
!scripts/refresh_model_limits.sh
|
|
!scripts/audit_wheel_glibc_symbols.py
|
|
!scripts/replay_codex_ws_load.py
|
|
!scripts/export_kompress_v2_onnx.py
|
|
|
|
# Rust / Cargo build artifacts
|
|
/target/
|
|
**/target/
|
|
Cargo.lock.bak
|
|
|
|
# Swift SDK (separate repo)
|
|
swift/
|
|
|
|
# Local planning docs (never commit)
|
|
ENTERPRISE_HARDENING.md
|
|
|
|
# Audit/scan outputs (contain security findings — never commit)
|
|
bandit_result.txt
|
|
pip_audit_result.txt
|
|
ruff_result.txt
|
|
reqs.txt
|
|
|
|
# Byte-compiled / optimized / DLL files
|
|
__pycache__/
|
|
*.py[cod]
|
|
*$py.class
|
|
|
|
# C extensions
|
|
*.so
|
|
|
|
# Distribution / packaging
|
|
.Python
|
|
build/
|
|
develop-eggs/
|
|
dist/
|
|
downloads/
|
|
eggs/
|
|
.eggs/
|
|
lib/
|
|
lib64/
|
|
parts/
|
|
sdist/
|
|
var/
|
|
wheels/
|
|
share/python-wheels/
|
|
*.egg-info/
|
|
.installed.cfg
|
|
*.egg
|
|
MANIFEST
|
|
|
|
# PyInstaller
|
|
*.manifest
|
|
*.spec
|
|
|
|
# Installer logs
|
|
pip-log.txt
|
|
pip-delete-this-directory.txt
|
|
|
|
# Unit test / coverage reports
|
|
htmlcov/
|
|
.tox/
|
|
.nox/
|
|
.coverage
|
|
.coverage.*
|
|
.cache
|
|
nosetests.xml
|
|
coverage.xml
|
|
*.cover
|
|
*.py,cover
|
|
.hypothesis/
|
|
.pytest_cache/
|
|
pytest_cache/
|
|
|
|
# Translations
|
|
*.mo
|
|
*.pot
|
|
|
|
# Environments
|
|
.env
|
|
.env.*
|
|
!.env.act.example
|
|
!.env.example
|
|
.venv
|
|
env/
|
|
venv/
|
|
ENV/
|
|
env.bak/
|
|
venv.bak/
|
|
.python-version
|
|
|
|
# Node.js dependencies (never commit vendored deps)
|
|
node_modules/
|
|
|
|
# Local release smoke outputs
|
|
release-assets-local/
|
|
|
|
# Secrets and API keys - NEVER commit these
|
|
*.pem
|
|
*.key
|
|
secrets.json
|
|
credentials.json
|
|
.secrets
|
|
api_keys.txt
|
|
.anthropic
|
|
.openai
|
|
|
|
# IDE and editors
|
|
.idea/
|
|
.vscode/
|
|
*.swp
|
|
*.swo
|
|
*~
|
|
.project
|
|
.pydevproject
|
|
.settings/
|
|
*.sublime-project
|
|
*.sublime-workspace
|
|
.spyproject
|
|
.spyderproject
|
|
|
|
# Jupyter Notebook
|
|
.ipynb_checkpoints
|
|
*.ipynb
|
|
|
|
# macOS
|
|
.DS_Store
|
|
.AppleDouble
|
|
.LSOverride
|
|
._*
|
|
|
|
# Thumbnails
|
|
Icon?
|
|
._*
|
|
|
|
# Windows
|
|
Thumbs.db
|
|
ehthumbs.db
|
|
Desktop.ini
|
|
|
|
# Linux
|
|
*~
|
|
|
|
# Local configuration
|
|
local_settings.py
|
|
*.local.py
|
|
*.local.json
|
|
*.local.yaml
|
|
|
|
# Database files
|
|
*.db
|
|
*.sqlite
|
|
*.sqlite3
|
|
|
|
# Log files
|
|
*.log
|
|
logs/
|
|
log/
|
|
|
|
# Temporary files
|
|
tmp/
|
|
temp/
|
|
*.tmp
|
|
*.bak
|
|
*.swp
|
|
|
|
# Benchmark results (keep framework, not results)
|
|
.benchmarks/
|
|
benchmark_results.json
|
|
benchmark_results/
|
|
|
|
# DeepEval cache
|
|
.deepeval/
|
|
|
|
# Headroom specific
|
|
.headroom/
|
|
headroom.db
|
|
headroom_*.db
|
|
*.jsonl
|
|
!tests/fixtures/*.jsonl
|
|
docker/differential-network-capture/captures/
|
|
|
|
# Documentation build
|
|
docs/_build/
|
|
site/
|
|
|
|
# mypy
|
|
.mypy_cache/
|
|
.dmypy.json
|
|
dmypy.json
|
|
|
|
# Ruff
|
|
.ruff_cache/
|
|
|
|
# pyright
|
|
pyrightconfig.json
|
|
|
|
# Editor backup files
|
|
*~
|
|
\#*\#
|
|
.\#*
|
|
|
|
# Local git worktrees (isolated feature branches)
|
|
.worktrees/
|
|
|
|
# Local development configuration
|
|
CLAUDE.md
|
|
|
|
# Vitals provenance data
|
|
.vitals/
|
|
|
|
# Separate private repos — never commit here
|
|
headroom-managed/
|
|
|
|
# Local act testing (never commit test tokens)
|
|
/.env.act
|
|
.actrc.local
|
|
|
|
# Release metadata artifact
|
|
.releaseetadata
|
|
|
|
# uv lockfile: regenerated locally; not committed
|
|
uv.lock
|
|
|
|
# Rust extension `.so` symlinks placed by `scripts/build_rust_extension.sh`
|
|
# into the `headroom/` package dir for local development. The real binary
|
|
# lives in `crates/headroom-py/python/headroom/`; this is the dev overlay
|
|
# that lets `import headroom._core` resolve when the source `headroom/`
|
|
# package shadows the maturin overlay on sys.path.
|
|
/headroom/_core.*.so
|
|
/headroom/_core.so
|
|
.tokensave
|
|
|
|
.codebase-memory/
|