mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-23 02:49:17 +08:00
fix/plugin-launcher-isolated-python
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0fe0a597c1 |
fix(opencode): do not rewrite an OpenCode config that fails to parse (#4424)
## Description
`_parse_json_loose` returned `{}` for any parse failure, and
`inject_opencode_provider_config` / `apply_provider_scope` then wrote
the whole file back with only the Headroom provider, dropping every user
key. A leading UTF-8 BOM was one trigger, a syntax error another. This
PR ignores a leading BOM when parsing, and raises a `ClickException` for
a non-empty config that still cannot be parsed instead of overwriting
it. A file holding only a BOM (or a BOM and whitespace) counts as empty.
Fixes #4415
## Type of Change
- [x] 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)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)
## Changes Made
- `headroom/providers/opencode/config.py`: new `_try_parse_json_loose`
(strips a leading U+FEFF, returns `None` on failure);
`_parse_json_loose` keeps its `{}` contract on top of it; new
`load_user_opencode_config` raises `click.ClickException` for non-empty
unparseable text; `inject_opencode_provider_config` uses it for both
parse sites.
- `headroom/providers/opencode/install.py`: `apply_provider_scope` uses
`load_user_opencode_config`.
- Tests: BOM config keeps user keys, BOM-only and BOM-plus-whitespace
configs are treated as empty, unparseable config is left byte-identical
(config and install paths).
- Second commit (`ffef07a7`) addresses a review comment: the emptiness
check in `load_user_opencode_config` now runs after the BOM is removed.
## Testing
- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed
### Test Output
With only the source change reverted (new tests kept),
`tests/test_providers_opencode_config.py
tests/test_providers_opencode_install.py`:
```text
FAILED tests/test_providers_opencode_config.py::test_inject_provider_config_keeps_user_keys_with_bom
FAILED tests/test_providers_opencode_config.py::test_inject_provider_config_leaves_unparseable_config_untouched
FAILED tests/test_providers_opencode_install.py::test_apply_provider_scope_leaves_unparseable_config_untouched
======================== 3 failed, 102 passed in 1.81s ========================
```
With only the second commit's source change reverted
(`tests/test_providers_opencode_config.py`):
```text
FAILED tests/test_providers_opencode_config.py::test_inject_provider_config_treats_bom_only_config_as_empty[]
FAILED tests/test_providers_opencode_config.py::test_inject_provider_config_treats_bom_only_config_as_empty[
]
========================= 2 failed, 68 passed in 1.15s =========================
```
With the fix, plus the neighbouring files
(`tests/test_providers_opencode_config.py
tests/test_providers_opencode_install.py
tests/test_providers_opencode_plugin_path.py
tests/test_mcp_registry_opencode.py`):
```text
============================= 155 passed in 1.94s ==============================
```
```text
$ ruff check headroom/providers/opencode tests/test_providers_opencode_config.py tests/test_providers_opencode_install.py
All checks passed!
$ ruff format --check headroom/providers/opencode tests/test_providers_opencode_config.py tests/test_providers_opencode_install.py
6 files already formatted
```
`mypy headroom/providers/opencode` reports one error, in
`headroom/providers/model_metadata.py:79`, which this PR does not touch;
nothing in the changed files.
## Real Behavior Proof
- Environment: WSL2 Ubuntu on Windows 11, Python 3.12.15, branch based
on upstream/main `e995eb9f`; `headroom/_core.abi3.so` taken from the
official headroom-ai 0.41.0 wheel (untracked, not committed). Throwaway
HOME under `/var/tmp`, never a real user config.
- Exact command / steps: write `opencode.json` into the throwaway HOME,
then run the real CLI `headroom wrap opencode --prepare-only --no-mcp
--no-serena --port 18900` (entry `from headroom.cli import main`), then
read the file. Case A: BOM + `{"model": "gpt-4o", "keybinds": {"leader":
"ctrl+x"}}`. Case B: `{"model": "gpt-4o" "oops": 1}`. Case C: the file
holds only the three BOM bytes `ef bb bf`. Each run on the code without
the fix, then with it (case C: without the second commit's change, then
with it).
- Observed result: Case A without the fix: exit 0, file holds only
`provider.headroom`; `model` and `keybinds` are gone. Case A with the
fix: exit 0, `model` and `keybinds` kept, `provider.headroom` added (the
file is written without the BOM). Case B without the fix: exit 0, file
replaced by the Headroom-only block. Case C without the second commit:
exit 1, `Error: could not parse OpenCode config at <path>; leaving it
unchanged.`, file still the three BOM bytes. Case C with it: exit 0,
`provider.headroom` written (same as a zero-byte file). Case B with the
fix: exit 1, `Error: could not parse OpenCode config at <path>; leaving
it unchanged. Fix the JSON/JSONC syntax and retry.`, file still
`{"model": "gpt-4o" "oops": 1}`.
- Not tested: the MCP registrar (`mcp_registry/opencode.py`), which has
its own parser and still reports a BOM config as not valid JSON (it
refuses to write and leaves the file unchanged; checked by calling
`register_server` directly, so the default `wrap opencode` run without
`--no-mcp` was not run); a real `opencode` binary reading the result;
Windows paths or a real Windows editor producing the BOM; JSONC comments
combined with a BOM (comment stripping runs after the BOM strip, only
unit-level reasoning); the `headroom install` flow end to end (only
`apply_provider_scope` via a unit test); the MCP registry parser in
`mcp_registry/opencode.py` (unchanged).
Output, case A (stderr line about the retired MCP cleanup is from the
unchanged registry code):
```text
without the fix:
"provider": { "headroom": { ... } } # only key in the file
with the fix:
"model": "gpt-4o", "keybinds": { "leader": "ctrl+x" }, "provider": { "headroom": { ... } }
```
Output, case B with the fix:
```text
exit: 1
Error: could not parse OpenCode config at .../.config/opencode/opencode.json; leaving it unchanged. Fix the JSON/JSONC syntax and retry.
--- after wrap
{"model": "gpt-4o" "oops": 1}
```
## Runtime Rollout Safety
- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: yes, narrowly: `wrap opencode` and
the OpenCode provider-scope install now stop with an error on an
unparseable non-empty config instead of overwriting it; a BOM config is
now merged instead of replaced
- Kill switch / disable path: none; fix the config file syntax, or
remove the file
- Unsafe override required: no
- Qualification impact: none expected
- Rollback path: revert this commit
## 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
- [ ] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)
## Screenshots (if applicable)
N/A
## Additional Notes
N/A items: documentation (no user-facing doc describes this failure
mode), mypy (one existing error elsewhere, see above). Behavior change
to review: refusing to write is stricter than before; a file that was
silently replaced earlier now needs a manual syntax fix.
Produced with AI assistance (Claude Code) operated by me (HetCreep); the
reproduction was run on my machine on a clone of the repository.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
|
||
|
|
40955b0eef |
fix(install): preserve OpenCode edits during reactivation (#4022)
## Description Reapply, restart, and automatic recovery temporarily remove the Headroom provider before reactivating it. They must not restore the original backup and erase user configuration added after installation. Final removal must still restore the original snapshot. Closes #4016. ## Type of Change - [x] Bug fix - [x] Documentation update ## Changes Made - Separate transient provider deactivation from final backup restoration, and propagate the intent through the existing install registry/manifest lifecycle. - During reactivation and activation rollback, remove only Headroom's provider; retain unrelated providers, MCP settings, theme, and the original backup. - On true removal, restore and delete the original backup as before. - Associate backups with the actual selected `opencode.json` or `opencode.jsonc` filename, and pin edited writes to LF. - Persist snapshot ownership independently of active mutations, including activation persistence failures and stop/reload/final-remove. - Migrate historical JSONC backup names (including custom config names) before snapshotting/restoration in installer and wrapper callers; do not claim a sibling JSON installation's backup. - Accept JSONC comments/trailing commas without erasing user settings; retain quoted URLs and delimiters. - Restore the snapshot when a successful replacement drops OpenCode, but retain it on replacement failure. - Document preservation during reapply/restart/recovery and original-snapshot behavior on final removal. ## Testing - [x] Unit tests pass (`pytest`), including JSON/JSONC and all three reactivation paths. - [x] Changed-file lint, configured pre-commit mypy and manual real-filesystem checks pass. ### Test Output Real filesystem smoke output for both config suffixes: ```json [{"final_removal_deletes_backup": true, "final_removal_restores_original": true, "headroom_reactivated": true, "original_backup_unchanged": true, "suffix": ".json", "theme": "edited-after-install", "user_mcp_preserved": true, "user_provider_preserved": true}, {"final_removal_deletes_backup": true, "final_removal_restores_original": true, "headroom_reactivated": true, "original_backup_unchanged": true, "suffix": ".jsonc", "theme": "edited-after-install", "user_mcp_preserved": true, "user_provider_preserved": true}] ``` The mandatory pre-push `make ci-precheck` passed: workspace Rust fmt/clippy/tests, native extension build/import verification, the complete configured Python gate, and Commitlint. The native gate explicitly used the installed CPU `libonnxruntime.so.1.26.0` via `ORT_DYLIB_PATH`, with cached-model assertions enabled. ```text [build_rust_extension] headroom._core build + install + verify: OK ================== 177 passed, 4 skipped, 1 warning in 6.31s =================== ✅ ci-precheck PASSED — safe to push. ``` ```sh python -m pytest -q tests/test_providers_opencode_install.py tests/test_cli/test_install_cli.py tests/test_install/test_providers.py ``` Original lifecycle suite: **121 passed**. After the review corrections, the combined provider/config/wrapper/install-CLI/recovery suite passed **240 tests in 8.32s**: ```sh python -m pytest -q tests/test_providers_opencode_install.py tests/test_providers_opencode_config.py tests/test_cli/test_wrap_opencode.py tests/test_cli/test_install_cli.py tests/test_install/test_providers.py tests/test_install_tool_env_reconcile.py ``` The regression suite checks real original bytes and persisted recovery ownership, not mocked call order or incidental error wording. The obsolete JSONC-trailing-comma rejection expectation was removed. Changed-file Ruff, formatting, installed pre-commit `mypy headroom`, and Commitlint hooks passed. Full-tree Ruff remains blocked locally by executable permissions on five unchanged OAuth2 plugin files (tracked 100644). A separate full dev-environment mypy run found an unchanged optional LangChain `truthy-function` error; the configured isolated pre-commit hook passed. Unrelated code/permissions were not modified. ## Real Behavior Proof - Environment: Linux x86_64, CPython 3.13.14; unchanged `dea9092e19385f286b7f67a64f4d85de2708d756` and this branch, real temporary config files and real installer mutation helpers, no mocked file mutation or service installed on the workstation. - Exact command / steps: for each suffix `.json` and `.jsonc`, write an original theme/provider/MCP config; activate a provider-scoped OpenCode manifest with `_activate_deployment_mutations`; edit the theme and add a user provider plus remote MCP; call `_deactivate_deployment_mutations` then `_activate_deployment_mutations`; inspect real files and the original backup; finally invoke `revert_mutations(..., restore_backup=True)`. - Before: theme reset to `original`; added provider and MCP disappeared. JSONC's actual-name backup was absent. - Observed result: after the fix, theme remains `edited-after-install`; both user additions survive; Headroom is active again; both actual-name backups remain byte-identical to the original. Final removal restores the original bytes and deletes the backup for both suffixes. - Review correction proof against published head `4bc8e50c`: actual temporary files and persisted manifests cover stop/reload/final-remove for JSON and JSONC, legacy backup migration for default and custom filenames, JSONC trailing commas and quoted `//`/`,}` text, successful target removal, and activation-persistence failure followed by reload/removal. All eight scenario outcomes pass after the correction; the published baseline leaves or consumes the wrong snapshots and loses JSONC edits. The actual `headroom unwrap opencode --no-stop-proxy` command also restores the historical JSONC snapshot byte-for-byte and consumes its backup. Only external process/service management and the explicit persistence-fault boundary are substituted; config, manifest and snapshot IO are real. - Second review correction against `1c0855c4`: all four new findings reproduced on real temporary config/backup files and persisted manifests. After the fix, failed addition consumes its newly created snapshot (a later install restores the later user edit); changed config selection restores the recorded original path; an existing canonical JSONC snapshot wins without deleting the ambiguous legacy backup; and restoration failure retains ownership in the active replacement so a retry after reload finishes restoration. Seven permanent boundary cases initially gave **6 failures and 1 passing control**; the complete affected suite now gives **247 passed**. OS supervisor calls and explicit persistence/restoration faults are the only substituted boundaries. - Not tested: a real launchd/systemd supervisor or Windows process on this Linux host. CLI regression tests exercise apply/restart/recovery boundaries while replacing service management; the filesystem mutation smoke uses real production helpers. ## Runtime Rollout Safety - Rollout-managed feature(s): none; lifecycle data-preservation fix. - Minimum rollout channel: stable; no rollout-managed feature is enabled. - Stable/default behavior changed: transient reactivation stops reverting unrelated user edits. Final uninstall still restores the original snapshot. - Kill switch / disable path: remove the persistent OpenCode installation using its existing removal flow; no new flag. - Unsafe override required: no. - Qualification impact: provider-scoped OpenCode configuration only; other providers retain their existing removal semantics. - Rollback path: revert the commits; no deployment manifest schema change. Backup ownership uses the existing artifact record, and legacy JSONC snapshots migrate to the selected config's canonical filename. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] Existing registry/lifecycle interfaces reused; persistent-install docs updated. - [x] Consumer-visible regressions cover edits, original-backup invariants, both config suffixes, three reactivation paths, and final removal. - [x] `CHANGELOG.md` not edited; Conventional Commit title supplied. Remote CI results are reported by GitHub, not assumed from local tests. --------- Co-authored-by: JD Davis <mxjerrett@gmail.com> |
||
|
|
6c83790680 |
fix(opencode): write local MCP config (#1381)
## Description Fixes the OpenCode config corruption reported in #1380 for wrap, MCP registration, and provider-scope install paths. OpenCode MCP entries are local stdio servers, not remote HTTP endpoints. This changes Headroom's OpenCode MCP serialization to write `type: "local"` with `command: ["headroom", "mcp", "serve"]`, uses OpenCode's `environment` field for MCP env vars, and still reads the older `env` key for compatibility. This also stops provider-only OpenCode config injection from creating a fake `http://127.0.0.1:<port>/mcp` entry, so `headroom wrap opencode --no-mcp` no longer leaves `mcp.headroom` behind. Finally, the install CLI/docs now accept and document `--target opencode` with provider scope. This does not change the broader `headroom mcp status/uninstall` behavior from #1380; that looks like a separate follow-up. ## Type of Change - [x] 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 - Write OpenCode MCP entries as local stdio config instead of remote `/mcp` config. - Use `environment` for OpenCode MCP env vars while continuing to read legacy `env` entries. - Stop OpenCode provider injection/persistent provider install from adding MCP config. - Keep `--no-mcp` from writing `mcp.headroom` while preserving other MCP entries such as Serena. - Allow `headroom install apply --target opencode` at the CLI layer. - Update OpenCode docs and changelog. ## Testing - [x] Focused unit tests pass - [x] Linting passes (`ruff check .`) - [x] Formatting passes (`ruff format --check .`) - [x] Type checking passes (`mypy headroom`) - [x] New tests added for the fixed behavior - [x] Manual testing performed ### Test Output ```text $ pytest tests/test_mcp_registry_opencode.py tests/test_cli/test_wrap_opencode.py tests/test_providers_opencode_config.py tests/test_providers_opencode_install.py tests/test_cli/test_install_cli.py tests/test_install/test_providers.py Pytest: 164 passed $ uvx ruff check . All checks passed! $ uvx ruff format --check . 986 files already formatted $ uvx mypy --config-file pyproject.toml headroom Success: no issues found in 398 source files ``` ## Real Behavior Proof - Environment: macOS local worktree at `/Users/vinaygupta/Desktop/git/headroom-fix-opencode-mcp-config`; branch `fix-opencode-mcp-config`; commit `aea96208`. - Exact command / steps: ran the focused OpenCode/installer regression suite plus Ruff lint/format checks and mypy commands shown above. - Observed result: the focused tests pass and cover OpenCode MCP serialization as `type: "local"`, `command: ["headroom", "mcp", "serve"]`, `environment` env vars, `--no-mcp` not writing `mcp.headroom`, provider-scope install not adding MCP config, and `install apply --target opencode` being accepted. - Not tested: full `pytest` locally, because collection requires the native `headroom._core` extension in this worktree. Attempting the project runner hit a local native build failure first: `esaxx-rs` failed compiling `src/esaxx.cpp` with `fatal error: 'cstdint' file not found`. The broader generic `headroom mcp status/uninstall` behavior from #1380 is intentionally left for a follow-up. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review Scope note: generic `mcp status/uninstall` support from #1380 is intentionally left as a separate follow-up PR. |
||
|
|
487aa71a3c |
ci: restore green lint (reformat for ruff 0.15.17, fix mypy no-any-return, pin linters) (#1295)
## Description
The CI lint job (`ruff check .` → `ruff format --check .` → `mypy
headroom`) was red on `main`
and therefore on every open PR, for two unrelated reasons that the early
ruff failure was masking:
1. **ruff**: the lint job installs `ruff` unpinned, and ruff 0.15.17
began enforcing import-block
sorting (`I001`) and formatting that older ruff accepted → `ruff check
.` / `ruff format --check .`
fail on files nobody touched.
2. **mypy**: `headroom/providers/opencode/config.py` had two `return
json.loads(...)` statements in
a function declared `-> dict[str, Any]`; `json.loads` is typed `Any`, so
`mypy headroom` fails
with `no-any-return` (reproduced on mypy 1.20.2 — not a version-specific
quirk).
This restores a green lint baseline and pins both linters so a future
release can't silently break
CI again.
## Type of Change
- [x] Bug fix (non-breaking change that fixes an issue)
## Changes Made
- `.github/workflows/ci.yml`: pin `ruff==0.15.17` and `mypy==1.20.2` in
the lint job.
- Applied `ruff check --fix .` (6 `I001` import-sort fixes) and `ruff
format .` (10 files) across
the repo — import ordering and whitespace only, no behavior change.
- `headroom/providers/opencode/config.py`: narrow both
`_parse_json_loose` return sites with an
`isinstance(parsed, dict)` guard, so the `dict[str, Any]` annotation is
true at runtime
(non-dict JSON falls back to `{}`) and mypy's `no-any-return` is
resolved.
## Testing
- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`, `ruff format --check .`, `mypy
headroom --ignore-missing-imports`)
### Test Output
```text
$ python -m ruff check .
All checks passed!
$ python -m ruff format --check .
913 files already formatted
$ python -m mypy headroom/providers/opencode/config.py --ignore-missing-imports
Success: no issues found in 1 source file
$ python -m pytest tests/test_providers_opencode_config.py -q
37 passed
```
## Real Behavior Proof
- Environment: Windows 11, Python 3.13, ruff 0.15.17, mypy 1.20.2,
branch ci/fix-ruff-lint off
headroomlabs-ai/main
- Exact command / steps: reproduced the red lint (latest ruff: 6 `I001`
+ 10 unformatted files;
the mypy failure was read from the #1295 CI lint log —
`config.py:125,133 no-any-return`, and
re-confirmed locally on mypy 1.20.2). Applied the ruff auto-fix/format,
added the dict guard,
pinned both linters, and re-ran each lint step.
- Observed result: `ruff check .` → "All checks passed!"; `ruff format
--check .` → "913 files
already formatted"; `mypy` on the fixed file → "Success: no issues
found"; full `mypy headroom`
reports only Unix `fcntl` attributes that don't exist on this Windows
box (present on the Linux
CI runner, where the prior run showed exactly the two now-fixed errors).
37 opencode-config
tests pass.
- Not tested: did not run the full OS/Python test matrix — the change is
formatting + two CI
dependency pins + a two-line type-narrowing guard, with no runtime
behavior change for dict JSON.
## Review Readiness
- [x] I have performed a self-review
- [x] This PR is ready for human review
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|
|
b4571cc346 |
feat: headroom wrap opencode / unwrap opencode CLI (#1105)
## Summary This PR implements transparent `headroom wrap opencode` support without asking users to edit OpenCode provider URLs, choose an extra CLI flag, or maintain a static provider list. The wrapper now lives at the runtime transport boundary: OpenCode keeps its user/provider config, while Headroom intercepts outbound provider traffic in-process and routes it through the local Headroom proxy. ## What changed ### Transparent OpenCode wrapping - `headroom wrap opencode` injects the `headroom-opencode` plugin through `OPENCODE_CONFIG_CONTENT`. - Existing OpenCode provider URLs are preserved. We do not rewrite user config URLs to point at Headroom. - Existing `OPENAI_BASE_URL` and `ANTHROPIC_BASE_URL` env vars are preserved. - Local OpenCode traffic, localhost traffic, and Headroom proxy traffic bypass the shim to avoid loops. ### Runtime transport interception - Added an OpenCode plugin transport shim that wraps: - `globalThis.fetch` - `http.request` / `http.get` - `https.request` / `https.get` - External provider calls are routed to the local Headroom proxy. - The original upstream origin is passed through `x-headroom-base-url`, so the proxy can forward to the real provider without changing OpenCode config. - External `http2.connect` is blocked loudly instead of allowing direct provider traffic to leak outside Headroom. ### Live provider additions Provider coverage is no longer based on a static config scan. Because routing happens at outbound request time, providers added mid-session are routed through Headroom automatically as long as they use the covered Node transport paths. ### Subagent and child-process coverage - The parent OpenCode plugin sets a packaged Node preload shim through `NODE_OPTIONS=--import=.../hook-shim/handler.js`. - The transport shim patches `child_process.spawn`, `exec`, `execFile`, and `fork` so child Node processes receive the Headroom preload even when OpenCode passes a custom `env`. - The child-process shim fails closed if it loads without `HEADROOM_OPENCODE_TRANSPORT_PROXY_URL`. - This closes the subagent leak path where a child Node process could otherwise start without Headroom transport interception. ## Why this goes beyond PR #1089 PR #1089 improves OpenCode provider registration, but it still focuses on provider config shape. This PR moves the enforcement boundary to runtime transport interception. This PR goes further because: - No provider URL rewriting is required. - New providers added mid-session are covered automatically. - Subagents and child Node processes inherit the Headroom transport shim. - Direct external HTTP/2 paths fail loudly instead of leaking. - The wrap remains transparent to the user's OpenCode provider config. - The wrapper is fail-closed for unsupported child-process preload state. ## Additional robustness fixes While validating the change in Docker, the full Python suite exposed unrelated Linux/container robustness issues. These are fixed in this PR so the suite is green: - Binary cache handling now treats cache paths under a non-writable existing parent as unavailable, including when tests run as root in Docker. - `release_version.py` honors `MANUAL_VER` before git calls so direct script execution works outside a `.git` checkout. - Test logger isolation now resets relevant Headroom child loggers so proxy logging setup cannot poison later `caplog` tests. - The scanner missing-path test now uses a guaranteed missing `tmp_path` child instead of relying on `/nonexistent/path`. ## Validation All implementation validation was run inside Docker. - Full Python suite from a fresh Docker copy: `6605 passed, 523 skipped`. - Ruff on changed Python/OpenCode paths: passed. - OpenCode plugin typecheck: passed. - OpenCode plugin tests: `9 passed`. - OpenCode plugin build: passed. - Hook shim preload smoke test: passed. ## Notes This PR intentionally does not add a CLI option. `headroom wrap opencode` means full wrap. Either Headroom wraps OpenCode transparently, or the path fails loudly instead of silently leaking provider traffic. --------- Co-authored-by: Rudimar Ronsoni <6081613+rudironsoni@users.noreply.github.com> |