Commit Graph
389 Commits
Author SHA1 Message Date
ShiYuan XiongandJerrettDavis 4ee616453f fix(router): keep small shell results verbatim (#3590) (#4426)
## Description

Fixes #3590. Small shell tool results (default: shorter than 2000
characters) now bypass lossy compression. Byte-lossless folds such as
search grouping may still apply. File reads and searches were already
protected; shell output is deliberately compressible, but a short `ls
-la`, `git status`, or JSON dump is not worth the accuracy loss
described in #3590.

The real proxy-level before/after evidence is in Real Behavior Proof. A
live Claude Code session is still untested.

## 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

- Added `HEADROOM_SHELL_RESULT_MIN_CHARS` (default `2000`) and
`_is_small_shell_result()`, applied to OpenAI `role:"tool"`, legacy
`role:"function"`, top-level text-block tool messages, and Anthropic
`tool_result` string/list-form paths after the lossless search fold and
before lossy compression.
- Normalized `ContentRouterConfig.bash_tool_names` once and extended it
with the shell aliases already in `headroom.learn._shared` (`shell`,
`local_shell`, `run_shell_command`, `execute_command`, `exec_command`,
`terminal`, `run_command`, `run_terminal_command`).
- Measure a top-level text-block shell result using the combined text
length, so a large result cannot bypass compression merely by splitting
into small blocks.
- Added boundary coverage for both tool/function block shapes, positive
threshold overrides and custom case-insensitive shell names; documented
the combined-length contract in `docs/content/docs/proxy.mdx`.
- Updated the existing proxy-level Bash regression to assert both sides
of the 2000-character floor, fixing the hosted shard-4 failure. Added
kill-switch, malformed/empty-value and diagnostic coverage.
- Carried dependency security remediation requested in review: certifi
and the OpenTelemetry family, three patched Rust crates, and patched npm
locks for docs, SDK, OpenCode and E2E tooling. These use existing
packages, explicit security floors and targeted dependency overrides;
libc platform constraints remain intact.

## Testing

- [x] Hosted CI passes on the current head, including all four Python
test shards
- [x] Changed Python tests passed Ruff in the preceding regression
revision; no Python runtime source changed in this dependency follow-up
- [ ] Full local Python type check passes (Windows/test-double baseline
limitations)
- [x] Regression and dependency-interface coverage added
- [x] Real proxy proof and isolated CLI smoke evidence recorded

### Test Output

Latest follow-up: Windows, Python 3.11 / Node 22.20.0 for the OpenCode
suite, and portable official Node 24.22.1 for E2E CLI qualification. The
portable Node archive's SHA-256 matched nodejs.org's published checksum.

```text
Python shell-floor/web-tool/router/alias/tracing + OpenClaw wrapper/bridge selection:
119 passed, 2 warnings in 10.37s

uv lock --check
Resolved 262 packages

uv tree --locked --python-version 3.10 --package filelock
filelock v4.1.0
uv tree --locked --python-version 3.12 --package filelock
filelock v4.2.4

FileLock 4.2.4 process smoke:
contention times out, release permits next process

cd plugins/opencode
npm test
Test Files  4 passed (4)
Tests       60 passed (60)
npm run typecheck
> node node_modules/@typescript/native/bin/tsc --noEmit
npm run build
DTS Build success
npm audit --package-lock-only --audit-level=low --registry=https://registry.npmjs.org
found 0 vulnerabilities

After merging current upstream main (including #4453):

cd e2e/wrap/tools
node node_modules/openclaw/openclaw.mjs --version
OpenClaw 2026.10.6
npm audit --package-lock-only --audit-level=low --registry=https://registry.npmjs.org
2 vulnerabilities (1 moderate, 1 high)
# limited to npm's bundled copies:
# GHSA-rxp7-6hxx-x8q5 — node_modules/npm/node_modules/ip-address 10.7.2
# GHSA-4qv8-2p9j-2685 and GHSA-xjj6-f33q-929c — node_modules/npm/node_modules/undici 6.29.0
# exact scoped exceptions expire 2026-11-15; no OpenClaw path is excepted

production-lock pip-audit:
No known vulnerabilities found
```

- The Python native extension remains the existing 0.41.0 Windows
wheel's `_core.pyd`; all Python source under test comes from this PR
checkout. No native rebuild or Torch/model inference qualification is
claimed.
- The 3 new OpenCode compatibility tests exercise the actual upstream
`tool.schema` interface and Effect `Primitive.fileParse` TOML
success/error channels, mocking only filesystem I/O. They accompany the
explicit Zod/TOML overrides.
- E2E CLI checks used isolated `OPENCLAW_STATE_DIR` /
`OPENCLAW_CONFIG_PATH`, with no model request or modification of the
user's normal OpenClaw configuration. E2E dependencies were installed
with lifecycle scripts disabled. The full Docker/model E2E suite was not
run locally.
- Earlier unchanged docs/SDK lock remediation passed: SDK **351 passed,
33 skipped** plus typecheck/build; docs typecheck/build with 185 static
pages; both npm audits were zero. The previous head also passed the
hosted Rust security audit.
- Full local Python suite was not rerun. The earlier remote-timeout
float-boundary failure remains outside this change.

## Real Behavior Proof

- Environment: Windows 10 x64, Python 3.11.0, Headroom source `main` at
`e995eb9` (0.41.1-dev), native `_core` from the 0.41.0 wheel because no
Rust toolchain is available locally. `HEADROOM_DISABLE_KOMPRESS=1` keeps
the strategy deterministic; the guard sits before strategy selection, so
the same path applies when Kompress is enabled.
- Exact command / steps: local harness (not committed) `python
proof-3590/run_proof.py` starts the source-tree proxy in `--mode token`
with `HEADROOM_MIN_TOKENS=0` and a local OpenAI-compatible upstream, and
sends a chat request containing a Bash `ps aux` tool result (1719 chars)
followed by later turns. The upstream records the transformed request
body.
- Observed result: `HEADROOM_SHELL_RESULT_MIN_CHARS=0` produced
`compressed=1`, `router:tabular:0.85`, 802 -> 697 tokens (saved 105),
and upstream received a 1455-char schema representation. Default `2000`
produced `shell_small_result: 1`, `compressed=0`, 802 -> 802 tokens, and
upstream received the original 1719-char output byte-for-byte.
- Review follow-up proof: `python proof-3590/run_block_review.py` ran
the real proxy against the same local upstream without replacing its
compressor. A 1719-character shell result split into two text blocks
stayed unchanged; a 3438-character result split into two 1719-character
blocks remained compressible. The previous PR revision incorrectly
protected both large-result fragments. This harness is local, not part
of the PR.
- Not tested: a live `headroom wrap claude` session; the ML Kompress
path; Linux/macOS; the full suite (one pre-existing baseline failure).

## Runtime Rollout Safety

- Rollout-managed feature(s): none; ContentRouter default path.
- Minimum rollout channel: default proxy.
- Stable/default behavior changed: yes. Shell results between
`min_chars_for_block_compression` (500) and
`HEADROOM_SHELL_RESULT_MIN_CHARS` (2000) now stay verbatim instead of
taking lossy compression. At ~1500 chars (~375 tokens), this keeps
roughly 325 extra tokens per result for the life of the context.
- Kill switch / disable path: `HEADROOM_SHELL_RESULT_MIN_CHARS=0`.
- Unsafe override required: no.
- Qualification impact: compression ratio may decrease for small shell
outputs; no API or correctness changes.
- Rollback path: revert this commit or set
`HEADROOM_SHELL_RESULT_MIN_CHARS=0`.

## 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
- [x] 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
- [ ] 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 — no UI changes.

## Additional Notes

This follows the [dependency-remediation
review](https://github.com/headroomlabs-ai/headroom/pull/4426#pullrequestreview-5636487191).
It does not disable audits, ignore advisories, reduce audit severity, or
use `npm audit fix --force`.

- **Python:** certifi/OpenTelemetry/Rust fixes from the prior revision
remain. This follow-up raises setuptools to **84.1.0** for the Windows
wheel namespace traversal advisory and uses FileLock **4.2.4** on Python
≥3.11. The universal lock remains resolvable with the published Python
≥3.10 contract. **Python 3.10 now selects FileLock 4.1.0, but it remains
below the 4.2.1 security floor** because fixed releases require ≥3.11;
this is not presented as all-interpreter remediation.
- **OpenCode:** pin security overrides **Zod 4.6.7** and **TOML 5.0.1**
without downgrading the plugin or replacing its pinned Effect version.
TOML crosses a major version (4.3.0 → 5.0.1); its Node ≥20 floor and
consumed `parse(content)` API are unchanged. The added tests validate
the exercised schema and Effect parsing contracts, not every possible
TOML consumer. This override needs normal maintainer dependency review.
- **E2E:** the original remediation moved OpenClaw to 2026.10.5; the
upstream sync now brings **OpenClaw 2026.10.6** with **Undici 8.12.3**
and a Node floor of **≥24.22.1 <25 or ≥26.12.1**. The only remaining raw
npm findings are npm's published bundled copies, handled by the exact,
expiring E2E-only exception policy described below.
- Dependency packages and runtime floors were checked against the
upstream registry metadata. Locks use public registries and retain
existing libc platform constraints.

### Security qualification after upstream sync

Merge commit `e09d37c9274c812f26e994d01a623542a4a7ec31` brings this
branch to upstream `main` through `a616232`, including
[#4453](https://github.com/headroomlabs-ai/headroom/pull/4453). That
upstream change establishes the repository's current security policy for
the dependency cases that previously blocked this PR:

- **Production Python lock:** Python ≥3.11 resolves Pillow 13.0.0 and
FileLock 4.2.4. The current lock passes `uv lock --check`; an equivalent
export of the production `all` set passes `pip-audit 2.10.1 --no-deps
--disable-pip` with **no known vulnerabilities**.
- **Published-package resolution:** FastEmbed still caps Pillow below 13
when ordinary pip resolves package metadata. Upstream now disables image
decoding on Pillow below 13 and separately audits the pip-resolved set,
accepting only Pillow findings covered by that tested decoder guard.
This is a bounded runtime mitigation, not a claim that the older Pillow
release has no advisories.
- **E2E npm lock:** OpenClaw 2026.10.6 uses fixed Undici 8.12.3. Raw npm
audit now reports only npm 12.2.1's bundled Undici 6.29.0 and ip-address
10.7.2 copies. Because npm does not allow overrides to replace its
published bundled contents and no newer release is available, upstream
accepts only the three exact advisory/path/version pairs in
`e2e/wrap/tools/npm-audit-exceptions.json`, only for the non-shipping
E2E harness, and only until **2026-11-15**. The workflow fails on any
extra finding, version/path mismatch, stale exception or expiry.
- **Python 3.10:** the lock now selects FileLock 4.1.0, but it remains
below the 4.2.1 security floor because fixed releases require Python
≥3.11. This supported-interpreter limitation is documented by the
upstream policy and is not represented as universal remediation.

The earlier OpenCode standalone-wheel mismatch remains fixed by
`dee73be75cf81bb67a73573861f1b3ed4067a2bf`: typecheck, build, all 60
plugin tests and the standalone build passed locally, both generated
artifacts matched their Python-shipped paths byte-for-byte, and the
shipped bundle imported with the expected `headroom` id and both
`server`/`setup` entry points.

### Current merge status

- Current head `ab93d7917a6660c704069bb87b6c02f9c744cebc` is mergeable;
all router/documentation inline review threads are resolved.
- JerrettDavis approved this head on 2026-10-24, superseding the earlier
security-related change requests.
- All 12 pull-request workflows on this head completed successfully,
including
[CI](https://github.com/headroomlabs-ai/headroom/actions/runs/40122163824)
(all four Python test shards),
[Security](https://github.com/headroomlabs-ai/headroom/actions/runs/40122163777),
wheel builds/import smoke tests, OpenCode, docs, and Docker E2E checks.
The workflows are no longer awaiting approval.
- The PR remains open, awaiting maintainer merge.
- A live Claude Code/model session, the ML Kompress path, a native
rebuild and the full Docker/model E2E suite remain unverified locally;
the hosted results above are separate from the recorded local
qualification.

Implemented and verified with AI assistance.

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-28 23:31:00 -05:00
18a588b3f0 fix(proxy): keep deferred tool loads out of the prefix-tracker lineage key (#4204)
## Description

The Anthropic handler keys a conversation's prefix-tracker lineage on
`segment_fingerprint({model, tools, tool_choice, thinking,
output_config})` (#2917, for #2671), with the whole `tools` array in it.
Claude Code appends every tool its ToolSearch loads to `tools`, still
marked `defer_loading: true`, and Anthropic keeps deferred tools out of
the prompt it caches. So the provider's cache key stays the same on a
load while Headroom's lineage key changes: the request after a load
starts a new lineage at frozen=0, the pipeline re-runs the whole
history, and the history comes out with different bytes (token mode
compresses Read results it had forwarded verbatim while they were
recent; cache mode forwards history raw that it had compressed). The
provider then re-writes the whole message tier. On one machine over 5
days, the request right after a deferred load had a large cache miss
21.9% of the time against 0.4% for every other request: 53 misses, 9.2M
tokens, 12% of all cache writes.

This PR leaves `defer_loading` tools out of the lineage key, the same
way Anthropic leaves them out of its cache key, but only when they reach
the provider still deferred. On a third-party Anthropic upstream the
handler's tool-search downgrade strips `defer_loading`, and a
translating backend sends every tool as a plain function; there a load
does change the provider's key, so the lineage key keeps counting them,
as on main. The decision reuses the downgrade's own predicate, now
computed once before the lineage key. Any tool the prompt renders still
starts a new lineage, as before.

### This is a trade

The reset was not pure waste: re-running the history at frozen=0 also
compressed old history that the freeze policy otherwise keeps verbatim.
Keeping the lineage gives that up. Both sides, measured 2026-10-13 on
one scripted 16-turn Claude Code session with two deferred loads, run
through a scratch proxy with the change on and off (same filter applied
downstream to the 0.39.0 wheel, not this branch):

| | main (lineage resets on a load) | this change |
|---|---|---|
| cache writes | 345k tokens | 121k tokens |
| cache reads | 1.36M tokens | 1.72M tokens |
| `tok_saved/tok_before` | 12.1% | 5.7% |
| net input cost | baseline | -43% (5-minute writes) to -50% (1-hour
writes) |

So for sessions that load deferred tools, tokens saved and the
list-priced `compression_savings_usd` go DOWN while the provider bill
goes down more. Anyone judging this change on `tok_saved/tok_before`
alone will read it as a regression; check `cache_read` per request (or
`cache_read/forwarded`) next to it.

The repro below shows the mechanics on one request (token mode,
tracker-estimated tokens): with the reset, turn 10 forwards 33,133
tokens, all of them written; with this change it forwards 55,456, of
which 55,441 are read and 15 written. At 0.1x for reads and 1.25x for
5-minute writes that is 41,416 against 5,563 base-input tokens (66,266
against 5,574 with 2x 1-hour writes). The reset's smaller history saves
2,232 base-input tokens on each later turn, so it pays back after 16
more turns (5-minute writes) or 27 (1-hour writes), and only if no other
deferred load resets it again first.

Closes #4203

## 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/cache/prefix_tracker.py`: new `cache_key_tools(tools)`
returns the tools without the entries whose `defer_loading` is set. A
non-list passes through unchanged and the input is never mutated. It
reads no environment: the handler decides when to apply it.
`segment_fingerprint` itself is unchanged; its docstring now says it
hashes what it is given and that callers pass only what the provider
keys its cache on.
- `headroom/proxy/runtime_env.py`: `HEADROOM_DEFERRED_TOOL_AFFINITY` is
a registered knob in `RUNTIME_ENV_KNOBS`, read per request through
`runtime_env.getenv` in the Anthropic handler, so a reusing `headroom
wrap` pushes it to the running proxy and `POST /admin/runtime-env` sets
it with no restart. Listed in the `security-model.mdx` allowlist.
- `headroom/proxy/handlers/anthropic.py`:
- The tool-search downgrade predicate, `_third_party_anthropic_upstream
= provider_name == "anthropic" and not
anthropic_first_party_tool_search_supported(upstream_base_url or
self.ANTHROPIC_API_URL)`, moved from the downgrade (main L3199-3202) to
just before the lineage key, and the downgrade reuses it. Neither input
changes between the two points.
- `affinity_tools` goes through `cache_key_tools` only when that
predicate is false and `self.anthropic_backend` is None, the backend
condition Headroom's own tool-search injector already uses (main L3239).
Otherwise every tool counts, as on main.
- The forwarded `tools` are untouched; the change is affinity metadata
only. `segment_fingerprint` has no other caller.
- A tool whose `defer_loading` is cleared (the client un-defers it) is
rendered into the prompt, so it counts again and starts a new lineage,
as Anthropic's key does.
- Tests: `tests/test_anthropic_deferred_tool_lineage.py` drives the real
handler (`create_app` + `TestClient`; the upstream is replaced by a
model of Anthropic's prompt cache over the forwarded bytes, deferred
tools unkeyed) through 9 turns of Read results and a 10th that adds a
tool. The requests are in the shape Claude Code 2.1.296 sends while it
defers tools: its client-side `ToolSearch` tool, a
`DeferredToolPlaceholder` that is deferred on every request, and on the
load turn ToolSearch's `tool_result` with a `tool_reference` plus the
loaded tool appended to `tools`, still deferred.
- `test_deferred_tool_load_keeps_the_lineage_and_its_cached_prefix`:
same tracker, frozen count kept (19), forwarded history byte-identical,
the provider reads the whole previous turn back, the loaded tool and its
`tool_reference` are forwarded intact, and no
`tool_search_deferred_orphan` warning is logged.
-
`test_deferred_tool_load_sent_eagerly_starts_a_new_lineage[third-party-upstream]`
(`anthropic_api_url` set to a gateway) and `[translating-backend]` (an
`anthropic_backend` that sends tools as plain functions): the forwarded
tools carry no `defer_loading`, the load gets a new tracker at frozen=0,
and the provider reads 0 tokens back either way.
- `test_kill_switch_keys_deferred_tools_again`: with
`HEADROOM_DEFERRED_TOOL_AFFINITY=0` the deferred load resets the lineage
as on main, and the provider reads 0 tokens back (the cost this fixes,
so the cache model is not vacuous).
- `test_eager_tool_still_starts_a_new_lineage`: a non-deferred tool
still gets a new tracker at frozen=0.
- `test_cache_key_tools_drops_only_deferred_tools`: `defer_loading:
false` is kept, the input is not mutated, `None` passes through, the
kill switch returns the list as given.
- The file points `HEADROOM_SAVINGS_EVENTS_PATH` at `tmp_path`, so its
proxied requests do not append to the developer's real savings ledger.
It also sets `HEADROOM_CLIENT_TOOL_SEARCH_NAMES=ToolSearch`: Headroom
does not recognize Claude Code's client-side `ToolSearch` by default, so
this request shape logs `tool_search_deferred_orphan` on main too (see
Additional Notes). Naming it is the documented remedy and changes
nothing on the lineage path.
- Commits: 426a45ec (the fix), af23a94e (Claude Code's tool-search shape
in the test), 2cca8abe (deferred tools still count where they reach the
provider eagerly).

### Interactions checked (line numbers on main f1bc2609)

- **Third-party upstreams (tool-search downgrade).**
`strip_first_party_tool_search_tools_for_third_party_upstream` (L3205)
removes `tool_search_tool_*` entries and strips `defer_loading` from
every tool when `_third_party_anthropic_upstream` holds (provider
`anthropic`, target base URL whose host is not `api.anthropic.com`, from
`x-headroom-base-url` or `--anthropic-api-url`). Those requests reach
the provider with every tool eager, so the lineage key now counts
deferred tools for them, exactly as on main. The predicate is the
downgrade's own variable, computed earlier, not a copy.
- **Translating backends.** Every non-None `anthropic_backend` (litellm,
any-llm) converts tools with `_convert_anthropic_tool`, which drops
`defer_loading`. Deferred tools count in the key there too, as on main.
- **Per-request route advice (not covered).** An extension can pick a
translating backend per request through `request.state.headroom_route`;
the handler resolves it at dispatch (L3666), well after the key, and
resolving it has side effects (it rewrites `body["model"]`). Such a
request with the default first-party backend keeps deferred tools out of
the key although the chosen backend sends them eagerly. Same outcome as
main's behaviour for a tool change on that path would need the advice
resolved before the key; left out.
- **Vertex.** Its routes pass a Vertex provider name, so the downgrade
does not run and the tools are forwarded with `defer_loading` as the
client sent them. They stay out of the key, which matches what is
forwarded.
- **Headroom's own tool-search deferral.** `inject_tool_search_deferral`
(L3254) runs after the fingerprint (L1663) on the same request, so the
fingerprint always sees the client's tools: tools Headroom defers still
count in the key, exactly as on main, and this change only drops tools
the CLIENT sent deferred. Once any client tool carries `defer_loading`,
`request_already_defers_tools` stands Headroom's injector down, so on
every load after the first one Headroom defers nothing on either side of
the load.
- Edge case, the first load: if Headroom's injector was deferring on the
turns before it (12+ tools and no deferral signal; checked with Claude
Code's 14 built-in tools, where it defers WebSearch, NotebookEdit,
ExitPlanMode and KillShell and adds `tool_search_tool_regex_20251119`),
the client's first deferred tool makes it stand down, so the forwarded
`tools` change and Anthropic's key changes with them. This change keeps
the lineage on that turn too. The provider re-writes the history once
either way; with this change it re-writes the same bytes instead of a
recompressed history, the same trade as above on one turn. Matching this
exactly would need the fingerprint taken after the injector, which runs
well after the tracker is needed.
- Not covered: a client that adds a tool which Headroom's injector then
defers still starts a new lineage although Anthropic's key may not
change. Whether Headroom defers depends on the whole array
(`_TOOL_SEARCH_MIN_TOOLS = 12`, the resident set); left for a follow-up
if it shows up in data.
- **#4056** (turn hooks ignore `defer_loading` when measuring a hook's
tool delta). Same view of the flag, no interaction: turn hooks run at
L3337, after the fingerprint. A hook that un-defers a tool
(headroom-tool-search's hot tools) changes the forwarded tools but never
reached the lineage key. `without_deferral_flags` is not reusable here:
it keeps the tool and drops the flag, this needs the tool dropped.
- **#4172** (tool-search cache-marker relocation mutates the client's
tools). No interaction with the lineage key: the mutation happens after
the fingerprint, each request parses a fresh body, and
`segment_fingerprint` drops `cache_control` anyway. `cache_key_tools`
builds a new list.
- **Other lineage keys.** The OpenAI chat and Gemini handlers call
`resolve_tracker` without `cache_affinity`, the Responses handler
resolves no lineage at all (it only computes a session id), and
`compute_session_id` does not hash tools, so none of them has this bug.
- **INPUT_RECEIVED extensions** can replace `tools` before the
fingerprint (L1197). A tool an extension marks `defer_loading` there is
now left out of the key too, which matches what is forwarded unless a
later stage changes it.

## Testing

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

Unit tests: the new file plus every test file that touches
`segment_fingerprint`, `cache_affinity`, `resolve_tracker`,
`defer_loading` or #2671, not the whole suite. Lint and types: `ruff
check`, `ruff format --check` and `mypy` on the changed files, not the
whole tree. Every run used a throwaway `HOME` (`HOME=$(mktemp -d)
HEADROOM_BEACON=off`), since `tests/conftest.py` clears `HEADROOM_*` and
does not redirect the savings ledger.

### Test Output

The new tests with only `headroom/proxy/handlers/anthropic.py` swapped
back, first to main f1bc2609, then to the first commit of this PR
(426a45ec, before the downgrade gate):

```text
$ git show upstream/main:headroom/proxy/handlers/anthropic.py > headroom/proxy/handlers/anthropic.py
$ python -m pytest tests/test_anthropic_deferred_tool_lineage.py -q -p no:cacheprovider
E   assert <headroom.cache.prefix_tracker.PrefixCacheTracker object at 0x...> is <headroom.cache.prefix_tracker.PrefixCacheTracker object at 0x...>
FAILED tests/test_anthropic_deferred_tool_lineage.py::test_deferred_tool_load_keeps_the_lineage_and_its_cached_prefix
========================= 1 failed, 5 passed in 3.94s ==========================

$ git show 426a45ec:headroom/proxy/handlers/anthropic.py > headroom/proxy/handlers/anthropic.py
$ python -m pytest tests/test_anthropic_deferred_tool_lineage.py -q -p no:cacheprovider
E   assert <headroom.cache.prefix_tracker.PrefixCacheTracker object at 0x...> is not <headroom.cache.prefix_tracker.PrefixCacheTracker object at 0x...>
FAILED tests/test_anthropic_deferred_tool_lineage.py::test_deferred_tool_load_sent_eagerly_starts_a_new_lineage[third-party-upstream]
FAILED tests/test_anthropic_deferred_tool_lineage.py::test_deferred_tool_load_sent_eagerly_starts_a_new_lineage[translating-backend]
========================= 2 failed, 4 passed in 3.76s ==========================
```

With the fix (2cca8abe):

```text
$ HOME=$(mktemp -d) HEADROOM_BEACON=off python -m pytest tests/test_anthropic_deferred_tool_lineage.py tests/test_anthropic_fork_lineage_cache.py tests/test_issue_2671_block_growth_cache.py tests/test_cache/test_prefix_tracker.py tests/test_proxy_anthropic_cache_stability.py tests/test_tool_search_client_deferral.py tests/test_issue_746_tool_search.py tests/test_hook_tool_deferral_accounting.py tests/test_tool_schema_savings_policy.py tests/test_openai_tool_search_deferral.py tests/test_proxy_openai.py tests/test_proxy_openai_cache_stability.py tests/test_cache_mode_cold_start.py tests/test_cold_start_fast_pass.py tests/test_anthropic_pre_upstream_backpressure.py tests/test_anthropic_stage_timings.py tests/gateway/test_native_deferral.py tests/gateway/test_kong_integration.py -q -p no:cacheprovider
======================= 459 passed, 5 skipped in 31.33s ========================

$ ruff check headroom/cache/prefix_tracker.py headroom/proxy/handlers/anthropic.py tests/test_anthropic_deferred_tool_lineage.py && ruff format --check <same 3 files>   # ruff 0.16.8
All checks passed!
3 files already formatted

$ mypy headroom/cache/prefix_tracker.py headroom/proxy/handlers/anthropic.py
Success: no issues found in 2 source files
```

## Real Behavior Proof

- Environment: macOS 27.0.1 arm64, Python 3.11.13, main f1bc2609 versus
this branch (2cca8abe) in the same venv. The main run was repeated on
the released 0.40.0 wheel (Python 3.12.13) with the same outcome (new
lineage, 0 read / 27,457 written on turn 10).
- Exact command / steps: the script below builds the real proxy with
`create_app(ProxyConfig(optimize=True, mode=...,
anthropic_api_url=...))` and posts 10 `/v1/messages` requests through
`TestClient`, in the shape Claude Code 2.1.296 sends while it defers
tools (client-side `ToolSearch`, a deferred `DeferredToolPlaceholder`):
9 turns of Read results, then the turn that carries ToolSearch's
`tool_reference` with the loaded MCP tool appended as `defer_loading:
true`. A control run appends a normal tool on a plain 10th turn instead.
Only `_retry_request` is replaced, by a model of Anthropic's prompt
cache that keys on the forwarded non-deferred tools, the system prompt
and the messages (cache markers ignored) and returns
`cache_read_input_tokens`/`cache_creation_input_tokens` so the tracker
freezes as it would live. A spy on `resolve_tracker` records which
tracker each request got and its frozen count. All state goes to a temp
dir, the beacon is off, nothing leaves the machine.
`PYTHONPATH=<checkout> LITELLM_LOCAL_MODEL_COST_MAP=True python
repro_deferred_tool_lineage.py`, again with `REPRO_MODE=cache
REPRO_TOOL=Bash`, and again with
`REPRO_UPSTREAM=https://gateway.example.com/anthropic` (third-party
upstream, never dialled).
- Observed result: first-party, main resets the lineage on the deferred
load in both modes and the provider reads nothing back; this branch
keeps the lineage, its frozen count and the forwarded bytes, and the
provider reads the whole previous turn. Third-party, both reset, because
the provider gets the loaded tool eagerly and its key changes anyway.
The control resets everywhere, as it should.

Token mode, Read results, first-party (`lineage` numbers trackers in
order of first use; `prefix_bytes` compares the forwarded history with
the previous turn's; token counts are the tracker's estimate):

```text
=== main f1bc2609
defer_loading tool added (ToolSearch load)
  turn  tools                      lineage  frozen  prefix_bytes  cache_read  cache_write
     1  Read                             0       0             -           0         6169
     2  Read                             0       3          same        6169         6159
   ...
     9  Read                             0      17          same       49282         6159
    10  Read+defer_loading               1       0       CHANGED           0        33133
  -> turn 10: NEW lineage, frozen=0, provider read 0 / wrote 33133 tokens
eager tool added (control)
    10  Read+eager                       1       0       CHANGED           0        39277
RESULT: deferred load resets lineage=True; eager tool resets lineage=True

=== this branch
defer_loading tool added (ToolSearch load)
     9  Read                             0      17          same       49282         6159
    10  Read+defer_loading               0      19          same       55441           15
  -> turn 10: same lineage, frozen=19, provider read 55441 / wrote 15 tokens
eager tool added (control)
    10  Read+eager                       1       0       CHANGED           0        39277
RESULT: deferred load resets lineage=False; eager tool resets lineage=True
```

Turns 1-9 are identical on both. On main, turn 10's reset compresses the
7 Read results that had aged out of the read-protection window (24,786
-> 10,828 bytes each); those bytes were cached verbatim, so the provider
re-writes everything. That compression is the side of the trade this
change gives up.

Token mode, third-party upstream
(`REPRO_UPSTREAM=https://gateway.example.com/anthropic`), identical on
main and this branch:

```text
    10  Read+defer_loading               1       0       CHANGED           0        33133
  -> turn 10: NEW lineage, frozen=0, provider read 0 / wrote 33133 tokens
RESULT: deferred load resets lineage=True; eager tool resets lineage=True
```

Cache mode, Bash results (`REPRO_MODE=cache REPRO_TOOL=Bash`),
first-party:

```text
=== main f1bc2609
    10  Bash+defer_loading               1       0       CHANGED           0        55456
  -> turn 10: NEW lineage, frozen=0, provider read 0 / wrote 55456 tokens
=== this branch
    10  Bash+defer_loading               0      19          same       52252           15
  -> turn 10: same lineage, frozen=19, provider read 52252 / wrote 15 tokens
```

In cache mode the reset gives no compression in exchange in this run:
the new lineage forwards the first tool result raw again (10,828 ->
24,786 bytes) and compresses nothing in its place, so main forwards and
writes 55,456 tokens where this branch reads 52,252 and writes 15.

- Not tested: no live Anthropic traffic from this branch. The 5-day miss
rates and the 16-turn A/B above were measured with the same filter
applied to the 0.39.0 wheel downstream, without the third-party/backend
gate (that machine talks to api.anthropic.com directly), not with this
branch. Streaming requests, a real Bedrock/litellm backend, Vertex, and
Linux/Windows were not run; the backend case is covered only by the
handler test's stand-in backend. Headroom's own tool-search injector
does not run in the repro (it sends fewer than 12 tools); its stand-down
on a client-deferred tool was checked by calling
`inject_tool_search_deferral` directly on Claude Code's 14 built-in
tools with and without one deferred MCP tool.

<details>
<summary>repro_deferred_tool_lineage.py</summary>

```python
"""Repro: a deferred tool load resets the Anthropic prefix-tracker lineage.

Drives the real proxy app (create_app -> /v1/messages -> AnthropicHandlerMixin)
through FastAPI's TestClient. Only the upstream call is replaced, by a model of
Anthropic's prompt cache that leaves defer_loading tools out of its key.

Session, in the shape Claude Code 2.1.296 sends while it defers tools: tools =
[Read, ToolSearch (client-side), DeferredToolPlaceholder (defer_loading)].
Turns 1-9 are Read results; turn 10 carries ToolSearch's tool_result with a
tool_reference to one MCP tool, which is appended to `tools` with
defer_loading: true. A control run adds a normal tool on a plain turn 10.

Usage: PYTHONPATH=<checkout> LITELLM_LOCAL_MODEL_COST_MAP=True python repro_deferred_tool_lineage.py
       REPRO_MODE=token|cache (default token), REPRO_TOOL=Read|Bash (default Read),
       REPRO_UPSTREAM=<base url> (default first-party api.anthropic.com).
       Token mode keeps recent Read results verbatim and compresses older ones.
"""

from __future__ import annotations

import copy
import json
import os
import sys
import tempfile

# Keep every file and network side effect away from the real ~/.headroom.
_tmp = tempfile.mkdtemp(prefix="dta-repro-")
os.environ.update(
    {
        "HOME": _tmp,
        "HEADROOM_WORKSPACE_DIR": os.path.join(_tmp, "ws"),
        "HEADROOM_CONFIG_DIR": os.path.join(_tmp, "cfg"),
        "HEADROOM_SAVINGS_EVENTS_PATH": os.path.join(_tmp, "savings_events.jsonl"),
        "HEADROOM_SAVINGS_PATH": os.path.join(_tmp, "proxy_savings.json"),
        "HEADROOM_SETTINGS_PATH": os.path.join(_tmp, "settings.json"),
        "HEADROOM_TOIN_PATH": os.path.join(_tmp, "toin.json"),
        "HEADROOM_CCR_BACKEND": "memory",
        "HEADROOM_BEACON": "off",
        "DO_NOT_TRACK": "1",
        "HEADROOM_HARD_WATCHDOG_SECS": "0",
        "HEADROOM_PORT_DISCOVERY": "0",
    }
)

import logging  # noqa: E402

logging.disable(logging.WARNING)

import httpx  # noqa: E402
from fastapi.testclient import TestClient  # noqa: E402

import headroom  # noqa: E402
from headroom.cache.prefix_tracker import PrefixCacheTracker  # noqa: E402
from headroom.proxy.server import ProxyConfig, create_app  # noqa: E402

MODEL = "claude-sonnet-4-5-20250929"
SYSTEM = [{"type": "text", "text": "You are a coding agent. " * 40}]
TOOL_NAME = os.environ.get("REPRO_TOOL", "Read")
READ = {"name": TOOL_NAME, "input_schema": {"type": "object"}}
TOOL_SEARCH = {
    "name": "ToolSearch",
    "description": "Search for tools by name or description.",
    "input_schema": {"type": "object", "properties": {"query": {"type": "string"}}},
}
PLACEHOLDER = {
    "name": "DeferredToolPlaceholder",
    "description": "Reserved placeholder that keeps deferred tool loading active.",
    "input_schema": {"type": "object"},
    "defer_loading": True,
}
TOOLS = [READ, TOOL_SEARCH, PLACEHOLDER]
DEFERRED = {
    "name": "mcp__docs__search",
    "input_schema": {"type": "object"},
    "defer_loading": True,
}
UPSTREAM = os.environ.get("REPRO_UPSTREAM") or None
EAGER = {"name": "WebFetch", "input_schema": {"type": "object"}}


def strip(obj):
    if isinstance(obj, dict):
        return {k: strip(v) for k, v in obj.items() if k != "cache_control"}
    if isinstance(obj, list):
        return [strip(v) for v in obj]
    return obj


def history(turns):
    messages = [{"role": "user", "content": [{"type": "text", "text": "Audit the repo."}]}]
    for i in range(turns):
        tid = f"toolu_{i:02d}"
        rows = [{"path": f"src/m{i}/f{j}.py", "size": 1000 + j, "ok": True} for j in range(400)]
        messages += [
            {
                "role": "assistant",
                "content": [
                    {
                        "type": "tool_use",
                        "id": tid,
                        "name": TOOL_NAME,
                        "input": {"file_path": f"/repo/m{i}.json"},
                    }
                ],
            },
            {
                "role": "user",
                "content": [
                    {"type": "tool_result", "tool_use_id": tid, "content": json.dumps(rows)}
                ],
            },
        ]
    messages[-1]["content"][-1]["cache_control"] = {"type": "ephemeral"}
    return messages


def after_tool_search(turns):
    """Turn 10 of the deferred run: ToolSearch's result loads DEFERRED."""
    messages = history(turns)
    del messages[-1]["content"][-1]["cache_control"]
    messages += [
        {
            "role": "assistant",
            "content": [
                {"type": "tool_use", "id": "toolu_ts", "name": "ToolSearch", "input": {"query": "docs"}}
            ],
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "tool_result",
                    "tool_use_id": "toolu_ts",
                    "content": [{"type": "tool_reference", "tool_name": DEFERRED["name"]}],
                    "cache_control": {"type": "ephemeral"},
                }
            ],
        },
    ]
    return messages


class PromptCache:
    """Anthropic's prompt cache at message granularity; deferred tools unkeyed."""

    def __init__(self):
        self.written = set()

    def request(self, body):
        messages = body["messages"]
        tools = [t for t in body.get("tools") or [] if not t.get("defer_loading")]
        head = json.dumps(strip([tools, body.get("system")]), sort_keys=True)
        keys = [
            head + json.dumps(strip(messages[: i + 1]), sort_keys=True)
            for i in range(len(messages))
        ]
        hit = max((i for i in range(len(messages)) if keys[i] in self.written), default=-1)
        self.written.add(keys[-1])
        tokens = PrefixCacheTracker._estimate_message_tokens(messages)
        return sum(tokens[: hit + 1]), sum(tokens[hit + 1 :])


def run(added):
    app = create_app(
        ProxyConfig(
            optimize=True,
            mode=os.environ.get("REPRO_MODE", "token"),
            disable_kompress=True,
            rate_limit_enabled=False,
            cost_tracking_enabled=False,
            log_requests=False,
            anthropic_api_url=UPSTREAM,
        )
    )
    cache = PromptCache()
    seen = []
    with TestClient(app) as client:
        proxy = client.app.state.proxy
        store = proxy.session_tracker_store
        resolve = store.resolve_tracker

        def spy(*args, **kwargs):
            tracker = resolve(*args, **kwargs)
            seen.append({"tracker": tracker, "frozen": tracker.get_frozen_message_count()})
            return tracker

        store.resolve_tracker = spy

        async def upstream(method, url, headers, body, stream=False, **kwargs):
            read, write = cache.request(body)
            seen[-1].update(forwarded=copy.deepcopy(body["messages"]), read=read, write=write)
            usage = {
                "input_tokens": 10,
                "output_tokens": 2,
                "cache_read_input_tokens": read,
                "cache_creation_input_tokens": write,
            }
            return httpx.Response(
                200,
                json={
                    "id": "msg_x",
                    "type": "message",
                    "role": "assistant",
                    "model": MODEL,
                    "content": [{"type": "text", "text": "ok"}],
                    "stop_reason": "end_turn",
                    "usage": usage,
                },
            )

        proxy._retry_request = upstream
        last = after_tool_search(9) if added is DEFERRED else history(10)
        requests = [(TOOLS, history(n)) for n in range(1, 10)] + [([*TOOLS, added], last)]
        for tools, messages in requests:
            r = client.post(
                "/v1/messages",
                headers={"x-api-key": "k", "anthropic-version": "2023-06-01"},
                json={
                    "model": MODEL,
                    "max_tokens": 64,
                    "system": SYSTEM,
                    "tools": tools,
                    "messages": messages,
                },
            )
            assert r.status_code == 200, r.text[:300]
    return seen


def report(label, seen):
    ids = {}
    print(f"\n{label}")
    print("  turn  tools                      lineage  frozen  prefix_bytes  cache_read  cache_write")
    for i, s in enumerate(seen):
        lineage = ids.setdefault(id(s["tracker"]), len(ids))
        same = "-"
        if i:
            prev = seen[i - 1]["forwarded"]
            same = "same" if strip(s["forwarded"][: len(prev)]) == strip(prev) else "CHANGED"
        tools = TOOL_NAME if i < len(seen) - 1 else (TOOL_NAME + "+" + label.split()[0])
        print(
            f"  {i + 1:>4}  {tools:<25}  {lineage:>7}  {s['frozen']:>6}  {same:>12}"
            f"  {s['read']:>10}  {s['write']:>11}"
        )
    before, after = seen[-2], seen[-1]
    reset = after["tracker"] is not before["tracker"]
    print(
        f"  -> turn 10: {'NEW lineage' if reset else 'same lineage'}, frozen={after['frozen']},"
        f" provider read {after['read']} / wrote {after['write']} tokens"
    )
    return reset


print(
    f"headroom from {os.path.dirname(headroom.__file__)}, mode={os.environ.get('REPRO_MODE', 'token')},"
    f" tool={TOOL_NAME}, upstream={UPSTREAM or 'first-party'}"
)
deferred_reset = report("defer_loading tool added (ToolSearch load)", run(DEFERRED))
eager_reset = report("eager tool added (control)", run(EAGER))
print(
    f"\nRESULT: deferred load resets lineage={deferred_reset}; "
    f"eager tool resets lineage={eager_reset}"
)
sys.exit(0)
```

</details>

## Runtime Rollout Safety

- Rollout-managed feature(s): none. This is a fix in lineage selection,
not a feature in `headroom/rollout.py`.
- Minimum rollout channel: n/a (applies on every channel).
- Stable/default behavior changed: yes, for first-party Anthropic
requests with no translating backend whose `tools` differ from the
previous turn's only by `defer_loading` tools (in practice, the Claude
Code request after a ToolSearch load). They keep the conversation's
lineage and frozen prefix instead of starting at frozen=0.
- Token mode: cache reads up, cache writes down, and tokens saved per
request down, because old history stays verbatim instead of being
recompressed on each load (see the trade table).
- Cache mode: history no longer goes back to its raw form on the load
turn; cache reads up, cache writes down, no compression given up in the
repro.
- Unchanged: third-party Anthropic upstreams and translating backends
(deferred tools reach the provider eagerly, so they still count); any
change to a tool the prompt renders, `tool_choice`, `thinking`,
`output_config` or model; OpenAI, Responses and Gemini; the forwarded
request bytes of every request that did not reset.
- Kill switch / disable path: `HEADROOM_DEFERRED_TOOL_AFFINITY=0` (or
`false`/`no`/`off`), a runtime-env knob read per request: set it in the
proxy environment, let a reusing `headroom wrap` push it, or `POST
/admin/runtime-env` (no restart). Restores main's key exactly
(`test_kill_switch_keys_deferred_tools_again`,
`test_runtime_env_override_keys_deferred_tools_again`).
- Unsafe override required: no.
- Qualification impact: for Claude Code sessions that load deferred
tools against first-party Anthropic, expect `tok_saved/tok_before` and
the list-priced `compression_savings_usd` to FALL (12.1% -> 5.7% in the
A/B) while `cache_read` per request rises and cache writes fall (345k ->
121k), net input cost -43% to -50%. Judge it on both sides; either ratio
alone misleads.
- Rollback path: set `HEADROOM_DEFERRED_TOOL_AFFINITY=0` (no restart
needed), or revert these commits. No persisted state or schema changes.

## 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
- [x] 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, no UI change.

## Additional Notes

- Documentation: no page documents the lineage key or the neighbouring
lineage kill switches (`HEADROOM_TRANSIENT_SYSTEM_LINEAGE`,
`HEADROOM_STABLE_BOUNDARY_BREAKPOINT`), so none was changed; the kill
switch is documented in `cache_key_tools`'s docstring.
- Follow-ups, not in this PR: tools that Headroom's own injector defers
still count in the key, and a per-request route-advice backend is not
seen by the key (see "Interactions checked").
- Separate finding, not in this PR: Claude Code 2.1.296's deferred-tools
shape (client-side `ToolSearch` plus a deferred
`DeferredToolPlaceholder`) carries no search tool Headroom recognizes,
so on default settings every such session logs
`tool_search_deferred_orphan` (at most hourly) although nothing is
wrong. One machine's proxy logs show it on real Claude Code traffic (for
example `deferred=7
names=DeferredToolPlaceholder,Monitor,WebFetch,WebSearch,...`). The
`_CLIENT_TOOL_SEARCH_NAMES` comment says Claude Code sends the
server-side shape when it genuinely defers; this version does not.
- Test hygiene, not in this PR: `tests/conftest.py` clears `HEADROOM_*`
but does not redirect the savings ledger, so handler-level tests that
post through `create_app` (for example
`tests/test_anthropic_fork_lineage_cache.py`) append every proxied
request to the developer's real `~/.headroom/savings_events.jsonl`. The
new test file redirects it itself.
- Review fix 5b83c2ec: the kill switch is a registered runtime-env knob
(see Changes Made), so the rollback reaches a proxy that `headroom wrap`
reuses. `cache_key_tools` stays a pure filter, so `headroom.cache` takes
no dependency on `headroom.proxy`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
Co-authored-by: Tejas Chopra <tejas@headroomlabs.ai>
2026-10-28 17:55:44 -05:00
09b7e8c1e4 fix(packaging): rename the sandbox extra to lean and correct SECURITY.md claims (#3727)
**Revised 2026-10-05 after review:** tests now patch the deployment root
directly (never HOME) and assert POSIX modes only where enforced, the
supported-versions test follows the latest-release policy, and runner
scripts are recreated rather than truncated so a key is never written at
an old 0755 mode.

## Description

Security-remediation item A-10 (P-21, P-22). Renames the misleading
`sandbox` extra to `lean` (keeping `sandbox` as a deprecated alias for
one release, so `pip install "headroom-ai[sandbox]"` keeps working; not
a breaking change), corrects SECURITY.md's credential claims, and makes
the `headroom install --env` credential-persistence path owner-only and
documented. Details below.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- `pyproject.toml`: `sandbox` extra renamed to `lean`; `sandbox =
["headroom-ai[lean]"]` deprecated alias; `uv.lock` regenerated (`uv lock
--check` clean).
- CI `python-314-wheels`, `run-all-plugins.sh` and the installation
guide now use `[lean]`.
- SECURITY.md: latest-release support policy (from main); discloses the
Copilot OAuth token and the `install --env` persistence path with its
modes.
- `headroom/install/paths.py`: `chmod_owner_only` verifies and reports
the mode it set.
- `headroom/install/state.py`: profile dir 0700 / manifest 0600 on every
save; warns if the directory cannot be narrowed.
- `headroom/install/supervisors.py`: runner scripts 0700 (`.ps1` 0600),
created fresh (old file removed first, so `O_TRUNC` cannot keep a 0755
mode while secrets are written), fail closed on POSIX if the mode cannot
be set.
- Tests: deployment writes are routed through a monkeypatched deploy
root; POSIX-mode assertions are skipped where modes are not enforced
(Windows).

## 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

```text
$ LITELLM_LOCAL_MODEL_COST_MAP=True uv run --frozen --extra dev --extra proxy pytest -q \
    tests/test_packaging_extras_and_security_docs.py tests/test_install/ tests/test_optional_dependencies.py
209 passed, 7 skipped
$ ruff check / ruff format --check (touched files)   -> clean
$ uv lock --check                                    -> Resolved 251 packages
```

Fail-before (2026-10-05 revision):

```text
test_rewriting_an_old_script_never_writes_secrets_at_its_old_mode   (fix reverted) FAILED assert 493 == 448 (0755 != 0700)
test_security_policy_supports_the_latest_release_without_a_version_number
                                                     (pinned 0.39.x table restored) FAILED
test_unrestrictable_profile_dir_warns_and_still_saves with Path.home() forced to ignore $HOME (as on Windows):
  previous version wrote <fake-home>/.headroom/deploy/default/manifest.json; new version writes nothing outside tmp_path
```

## Real Behavior Proof

- Environment: macOS (Darwin 25.6), CPython 3.14 via `uv run --frozen`,
branch head after merging main.
- Exact command / steps: with `HEADROOM_WORKSPACE_DIR` pointed at a temp
dir containing a pre-existing 0755 `deploy/default/` and 0755
`run-headroom.sh` (simulating a profile from an earlier version), ran
the real `build_manifest(..., extra_env={"ANTHROPIC_API_KEY": ...})` ->
`save_manifest` -> `render_runner_scripts`, then `stat` on every file.
- Observed result: `default/` 0700, `manifest.json` 0600,
`run-headroom.sh` 0700, `ensure-headroom.sh` 0700. `uv.lock` records
`headroom-ai[lean]` under marker `extra == 'sandbox'`, so the alias
resolves.
- Not tested: Windows end-to-end (ACL behaviour; mode assertions are
skipped there by design), a real `pip install "headroom-ai[sandbox]"`
from a published wheel, supervisor registration (launchd/systemd).

## Runtime Rollout Safety

- Rollout-managed feature(s): none.
- Minimum rollout channel: n/a (install-time file modes and packaging
metadata).
- Stable/default behavior changed: yes - deployment profile dirs and
runner scripts are owner-only after the next `headroom install apply`
(see release note below). `[sandbox]` keeps installing the same
dependencies.
- Kill switch / disable path: none; re-running an older version restores
old modes.
- Unsafe override required: no.
- Qualification impact: none.
- Rollback path: revert the PR; existing files keep their narrowed
modes, which is harmless.

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

History of the change and the earlier review rounds follows.

---

Security-remediation item **A-10** (P-21, P-22). Two documentation
defects, each of which leads a reader to a false premise about the
product.

## 1. The `sandbox` extra promises isolation it does not provide

`headroom-ai[sandbox]` is a **dependency profile** — a torch-free subset
of `[all]`. It provides no isolation, no confinement and no privilege
reduction of any kind. The name invites exactly the wrong assumption,
and "we run it in the sandbox extra" is the kind of sentence that ends
up in someone's control narrative.

Renamed to **`lean`**, which describes what it actually is. `sandbox` is
kept as a deprecated alias forwarding to `[lean]` for one release,
because our own `python-314-wheels` CI job installs it
(`.github/workflows/ci.yml:218`) and so may customers. The alias
forwards rather than duplicating the dependency list, so the two cannot
drift.

## 2. SECURITY.md is stale and overclaims

- **Supported-versions table sat at 0.27.x** while the code ships 0.38.0
— four minor releases behind. A lagging table is worse than none: it
tells a reporter their release is unsupported when it is the current
one.
- **"No credential storage: We never store or log API keys"** is broader
than the code supports. `headroom/copilot_auth.py:646` persists the
GitHub Copilot OAuth refresh token to `~/.headroom/copilot_auth.json`.
It does so correctly — `chmod 0600` at `:648` — but it *is* stored, and
a blanket denial is the sort of claim a customer's security reviewer
checks.

The replacement says what is actually true: provider API keys are read
from the environment and forwarded without being written to disk; the
Copilot OAuth token is the one deliberate exception; and
request/response bodies may reach the runtime log when logging is
enabled, so that log is sensitive.

## Tests (original revision)

`tests/test_packaging_extras_and_security_docs.py` — four tests, all
failing before and passing after:

```
FAILED test_sandbox_alias_still_resolves_to_the_lean_profile
FAILED test_lean_profile_stays_torch_free
FAILED test_security_policy_supported_versions_match_the_shipped_version
FAILED test_security_policy_does_not_claim_blanket_no_credential_storage
4 failed  ->  4 passed
```

Method: commit, `git checkout origin/main -- pyproject.toml SECURITY.md`
(keeping the new tests), run, restore.

The version-table test is the one that matters most — main now documents
"latest release on PyPI" as the supported version, and the test (renamed
`test_security_policy_supports_the_latest_release_without_a_version_number`)
pins that and fails if a hard-coded version row returns, so **the table
cannot silently rot again**. That drift, not the wrong number, is the
actual defect.

`test_lean_profile_stays_torch_free` guards the profile's whole reason
for existing: adding a torch-pulling extra to it now fails the build by
name.

## Not done here

The backlog pairs this with a deprecation *warning* on the old extra
name. pip has no mechanism to warn on an extra at install time, so the
alias plus the comment is the available remedy; removal is noted for
after 0.39.x.

Ruff 0.16.7 `check` + `format --check` clean.

---

## Follow-up: the credential-persistence path (review of this PR)

@JerrettDavis blocked the first version because the SECURITY.md
*correction* was
itself inaccurate — it claimed provider API keys are not written to
disk, which
`headroom install --env KEY=VALUE` falsifies. Addressed in 3da8b955 by
disclosing the path accurately **and** narrowing its permissions.

What the trace found: `--env` values are merged into
`DeploymentManifest.base_env`
and persisted verbatim — into `manifest.json` *and*, as cleartext
`export` lines,
into the generated `run-headroom.sh` / `ensure-headroom.sh`. The
manifest was
already 0600, but only incidentally (via `mkstemp`), with nothing
pinning it. The
runner scripts were **0755** and the profile directory **0755** — a live
API key
in a world-readable file.

Persistence is kept: supervisors start from a bare environment, so
`--env` is the
only channel that reaches a supervised proxy. Redacting secret-valued
entries
would leave existing installs starting a proxy with no credential — a
silent 401
after upgrade. Instead: manifest 0600, runner scripts 0700 (0600 for the
`.ps1`),
profile directory 0700, applied on every save so pre-existing profiles
are
narrowed too; scripts created via `os.open(..., mode)` so no
world-readable window
exists between write and chmod.

SECURITY.md now names the files, the modes, that owner-only is not
encryption,
that rotation means re-running `install apply`, and that the Docker
runtime also
places the value in the container command line (`ps`-visible). The
`--env` help
text says the same.

The policy test now drives the real path — `build_manifest` →
`save_manifest` →
`render_runner_scripts` with a provider key against a fake `$HOME` —
asserts the
key really lands in both files, and **parses the documented octal modes
back out
of SECURITY.md** to compare against `stat()`, so the document and the
code cannot
drift apart again.

```
FAILED test_install_env_persists_a_provider_key_exactly_as_the_policy_describes
FAILED test_security_policy_discloses_the_persistent_install_credential_path
FAILED test_save_manifest_writes_owner_only
FAILED test_save_manifest_narrows_a_profile_directory_created_before_this_change
FAILED test_render_runner_scripts_are_owner_only_because_they_export_secrets
       (run-headroom.sh is 0755, exposing an API key)
FAILED test_render_unix_runner_narrows_a_script_written_by_an_earlier_version
6 failed  ->  315 passed
```

### ⚠️ Release note — behaviour change

Existing deployment profiles are **re-permissioned on the next `headroom
install
apply`**: `~/.headroom/deploy/<profile>/` and its runner scripts drop
group and
other bits (0755 -> 0700). Anyone reading or executing `run-headroom.sh`
as a
different, non-root user must now do so as the owner. No supported
supervisor
configuration does this — user scope runs as the installing user, system
scope as
root — but it changes the mode of files that already exist on customer
machines.
`--env` itself is unchanged: no value is dropped, redacted or relocated.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3727"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 14:56:54 -07:00
8d5dde7765 fix(docker): install the redis extra in every image (#4514)
## Description

The 0.42 images ship the replica-shared compress session store, but no
published variant installs the `redis` client. Setting
`HEADROOM_COMPRESS_SESSION_STORE=redis://...` stopped startup with
`ConfigurationError`, and `HEADROOM_CCR_BACKEND=redis` degraded to the
per-process store. This PR adds the `redis` extra to the Dockerfile
default and to all nine `docker-bake.hcl` targets. It locks the
invariant with a release test. It also documents the session fields of
`/v1/compress` and the shared session store.

Closes #4513

## Type of Change

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

## Changes Made

- `Dockerfile`, `docker-bake.hcl`: `HEADROOM_EXTRAS` gains `redis` in
the default and in all nine bake targets.
- `tests/test_release_workflows.py`: new
`test_every_docker_variant_includes_the_redis_extra` guards the
Dockerfile default, the bake targets, and the `pyproject.toml` extra.
- `docs/content/docs/installation.mdx`: new `redis` extras row. The
Docker tag table shows the new extras.
- `docs/content/docs/proxy.mdx`, `wiki/proxy.md`: documented the
`session` response fields, `HEADROOM_COMPRESS_SESSION_STORE`, its
failure behavior, and the `session_affinity` interaction.

## Testing

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

### Test Output

```text
$ python -m pytest tests/test_release_workflows.py -q
Pytest: 55 passed

$ uvx ruff@0.17.0 check .
All checks passed!
```

## Real Behavior Proof

- Environment: macOS worktree of this repository, Python 3.13.
- Exact command / steps: `python -m pytest
tests/test_release_workflows.py -q` and `uvx ruff@0.17.0 check .`.
- Observed result: 55 tests passed, ruff clean. The new test fails
against the pre-change `Dockerfile`, because its `ARG HEADROOM_EXTRAS`
line lacked `redis`.
- Not tested: the Docker images were not built. The release test asserts
the build args statically, as the sibling Bedrock test does.

## Runtime Rollout Safety

- Rollout-managed feature(s): none. The change touches build args, docs,
and a test.
- Minimum rollout channel: not applicable.
- Stable/default behavior changed: every published image now installs
the `redis` client. With the extra installed,
`HEADROOM_COMPRESS_SESSION_STORE=redis://...` starts instead of failing,
and `HEADROOM_CCR_BACKEND=redis` uses Redis instead of the per-process
fallback.
- Kill switch / disable path: drop `redis` from `HEADROOM_EXTRAS` at
build time, or unset the two environment variables at runtime.
- Unsafe override required: no.
- Qualification impact: none. No runtime code path changed. The `redis`
import stays lazy, so deployments that do not set the variables are
unaffected.
- Rollback path: revert this PR and rebuild.

## Review Readiness

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

## Checklist

- [x] My code follows the project's style guidelines
- [x] I performed a self-review of my code
- [x] I commented my code, particularly in hard-to-understand areas
- [x] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I 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, and a CI guard
enforces this.

## Screenshots (if applicable)

Not applicable.

## Additional Notes

The full test suite and `mypy headroom` were not run. This PR changes no
file under `headroom/`, so I ran the affected suite
(`tests/test_release_workflows.py`) and lint only. The docs half also
answers part of #3184 (documentation of the storage backends). The CI
half of #3184 stays open, and PR #3282 covers it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4514"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
Co-authored-by: Tejas Chopra <tejas@headroomlabs.ai>
2026-10-28 11:29:27 -07:00
Tejas ChopraandClaude Opus 5.5 4288fbd903 docs(teams): replace the 3-months-free perk with a talk-to-us pitch (#4524)
## Description

Removes the "3 months free with a 12-month plan" offer and every
headroom-perks.vercel.app link. Each place now says: not seeing the
savings you want? Headroom OSS is a framework built to show what's
possible, so it saves less; Headroom Enterprise saves more and adds more
cost savings, tokens secured, on premise deployment, deep attribution
and many more features. Teams and enterprises: talk to us at
hello@headroomlabs.ai or https://headroomlabs.ai.

## 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

- README banner (`.github/assets/enterprise-perk.svg`): redrawn simple,
in the `hero.svg` type scale (title 42/700, lead 14.5, eyebrow 10.5); no
animation or chips.
- README "Headroom for teams" section and docs Teams page: the
OSS-vs-Enterprise table is replaced by the pitch, feature list and
contact.
- Docs site banner (`docs/app/layout.tsx`): new copy and link; new
banner id so people who dismissed the old one see it.
- Local dashboard offer (unlicensed installs only): new copy and link;
new localStorage dismissal key (`headroom-teams-contact-dismissed`) so
people who dismissed the old offer see the new one.
- Release-notes footer (`release.yml`) and `llms.txt`: same pitch, email
and site.
- `tests/test_dashboard_teams_perk.py`: asserts the contact email
instead of the perks URL.

## Testing

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

### Test Output

```text
$ pytest -q tests/test_dashboard_teams_perk.py -k "not route"
4 passed, 4 deselected in 0.49s
$ ruff check headroom/dashboard tests/test_dashboard_teams_perk.py
All checks passed!
```

The 4 `/dashboard` route tests fail locally with `CancelledError` at
proxy startup; they fail the same way on unmodified `main` in the same
venv, so CI is the judge for those.

## Real Behavior Proof

- Environment: macOS, Python venv of this repo, headless Chrome.
- Exact command / steps: rendered
`get_dashboard_html(licensed=False/True)` and checked the offer block;
rendered the banner with `Google Chrome --headless=new --screenshot
--window-size=900,220 file://.github/assets/enterprise-perk.svg`; `grep
-rn "headroom-perks\|3 months"` over README, docs, llms.txt, headroom/
and .github/.
- Observed result: unlicensed: offer shown, contact email present, no
perks link, new dismissal key. Licensed: offer removed. Banner renders
cleanly within 880×200 with text in the hero font. The grep finds
nothing.
- Not tested: the docs site build (`docs/`) and the release-notes footer
step (runs only on release).

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: only the text and link of the
dashboard offer on unlicensed installs
- Kill switch / disable path: setting `HEADROOM_LICENSE` removes the
offer, as before
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this PR

## 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
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

No test was added for the new dismissal key: it is browser localStorage
read by Alpine, which the Python tests do not run. Past release notes
still carry the old footer; editing them is a separate one-off.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 10:27:33 -07:00
dependabot[bot] f10725e6b9 deps: Bump the npm-minor-patch group across 2 directories with 14 updates (#4455)
Bumps the npm-minor-patch group with 13 updates in the /docs directory:

| Package | From | To |
| --- | --- | --- |
| [fumadocs-core](https://github.com/fuma-nama/fumadocs) | `16.17.1` |
`16.17.7` |
| [fumadocs-mdx](https://github.com/fuma-nama/fumadocs) | `15.4.7` |
`15.4.9` |
| [fumadocs-twoslash](https://github.com/fuma-nama/fumadocs) | `4.0.2` |
`4.0.3` |
| [fumadocs-typescript](https://github.com/fuma-nama/fumadocs) | `5.5.1`
| `5.5.2` |
| [fumadocs-ui](https://github.com/fuma-nama/fumadocs) | `16.17.1` |
`16.17.7` |
|
[lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)
| `1.55.0` | `1.61.0` |
| [react](https://github.com/react/react/tree/HEAD/packages/react) |
`19.3.0` | `19.3.1` |
|
[react-dom](https://github.com/react/react/tree/HEAD/packages/react-dom)
| `19.3.0` | `19.3.1` |
|
[@ai-sdk/openai](https://github.com/vercel/ai/tree/HEAD/packages/openai)
| `4.0.91` | `4.0.99` |
|
[@anthropic-ai/sdk](https://github.com/anthropics/anthropic-sdk-typescript)
| `0.133.0` | `0.137.0` |
| [ai](https://github.com/vercel/ai/tree/HEAD/packages/ai) | `7.0.137` |
`7.0.148` |
| [openai](https://github.com/openai/openai-node) | `7.32.0` | `7.39.0`
|
| [postcss](https://github.com/postcss/postcss) | `8.5.29` | `8.5.31` |

Bumps the npm-minor-patch group with 1 update in the /e2e/wrap/tools
directory:
[@openai/codex](https://github.com/openai/codex/tree/HEAD/codex-cli).

Updates `fumadocs-core` from 16.17.1 to 16.17.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-core's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.17.7</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.7</li>
<li>fumadocs-core@16.17.7</li>
<li>fumadocs-ui@16.17.7</li>
</ul>
<h3>Imports across Windows drives</h3>
<ul>
<li><code>remarkImage</code> and generated <code>.source</code> files
import files on another drive or a UNC path by their absolute path.</li>
<li>Generated imports of files in dot-folders are prefixed with
<code>./</code>.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3723">#3723</a></p>
<h2>fumadocs@16.17.6</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.6</li>
<li>fumadocs-core@16.17.6</li>
<li>fumadocs-ui@16.17.6</li>
</ul>
<h3>i18n <code>parser: 'none'</code></h3>
<ul>
<li><code>parser: 'none'</code> no longer parses locales from file
paths, files without a <code>locale</code> belong to the default
language.</li>
</ul>
<h3>Generated pages in every language</h3>
<ul>
<li>Virtual files accept a <code>locale</code>, <code>$</code> for every
language, instead of parsing it from their path.</li>
<li>Pages from <code>staticSource()</code> and
<code>dynamicSource()</code> of OpenAPI, AsyncAPI and GraphQL are shared
with every language of <code>loader()</code>.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3720">#3720</a></p>
<h2>fumadocs@16.17.5</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.5</li>
<li>fumadocs-core@16.17.5</li>
<li>fumadocs-ui@16.17.5</li>
</ul>
<h3>Faster API pages and search indexes</h3>
<ul>
<li>Schema UI generates the schemas it shows when they open, instead of
every schema reachable from the root.</li>
<li>Inline schemas are identified by their position, links to their
properties copied before this version no longer open them.</li>
<li>TypeScript definitions of bodies are generated when copied.</li>
<li>Search indexes take breadcrumbs from one walk of the page tree,
instead of a search for each page.</li>
</ul>
<h2>fumadocs@16.17.4</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.4</li>
<li>fumadocs-core@16.17.4</li>
<li>fumadocs-ui@16.17.4</li>
</ul>
<h3>Keyboard-scrollable MDX tables</h3>
<ul>
<li>Tables of <code>defaultMdxComponents</code> are focusable, so
keyboard users can scroll wide tables in Safari.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3706">#3706</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3e8f5f3a1a52674f47e02653825fe308b89c1f71"><code>3e8f5f3</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3725">#3725</a>
from fuma-nama/tegami/version-packages</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/75647a2e03d01fbfee86d10b07ad9a2f2f3d5e5c"><code>75647a2</code></a>
fix(json-schema): improve all of merging</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/91db24c1db8b5ccedfb36932c441ad7140b8f3a5"><code>91db24c</code></a>
fix(core): improve absolute windows path</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7e47d07e16700bbc0ae74bf60ce4128051d0da8b"><code>7e47d07</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3715">#3715</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5af6a321d1b57b0f83861fdaaa2764cd4124dcf1"><code>5af6a32</code></a>
docs: mention pele</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/fb45f0bf2e3696f1aa174dcfa7036c3a470f206d"><code>fb45f0b</code></a>
docs: add example for pele</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/61fbafb3fd0b621a1bbac248b37d1c88f9eb90db"><code>61fbafb</code></a>
fix(api-docs): improve file generation logics</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b65aad1d1fc80f2b341fbef3e111d665d705a3fc"><code>b65aad1</code></a>
refactor(preview): pass AI chat prompt as <code>instructions</code> (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3721">#3721</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/825107f2a7a8543af275f819a4454dbe8561c6aa"><code>825107f</code></a>
Redesign GraphQL (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3718">#3718</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7b2b93d9623d64e44a48a41bf6ec7e7798defa64"><code>7b2b93d</code></a>
fix(ui): hide decorative GitHub navigation icons (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3716">#3716</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.17.1...fumadocs@16.17.7">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-mdx` from 15.4.7 to 15.4.9
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-mdx's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-mdx@15.4.9</h2>
<h3>Turbopack loader warnings</h3>
<ul>
<li>Next.js 16.4 builds no longer warn <code>Module not found: Can't
resolve &lt;dynamic&gt;</code> for the config imports of the
loaders.</li>
</ul>
<h2>fumadocs-mdx@15.4.8</h2>
<h3>Imports across Windows drives</h3>
<ul>
<li><code>remarkImage</code> and generated <code>.source</code> files
import files on another drive or a UNC path by their absolute path.</li>
<li>Generated imports of files in dot-folders are prefixed with
<code>./</code>.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3723">#3723</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/895475ec3fc4195a2994442ee0a59a3cbe71e085"><code>895475e</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3729">#3729</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/9e3d36cd83e8cfffcec87fe6f8f63052bdd6663d"><code>9e3d36c</code></a>
fix(mdx): fix new Turbopack warnings</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/2431b5dfefea4b75361af3cdbe06e936407804c1"><code>2431b5d</code></a>
chore: bump deps</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/882bed84e278673556b860c80af3c507d39a6a05"><code>882bed8</code></a>
docs: improve load speed</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/0b7fb68b4867c179cb5635f8b79d085e208e2e59"><code>0b7fb68</code></a>
feat(openapi,graphql,asyncapi): optimize page load payload</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/dde61d7e6347bf8406caf4babf1e27a1f115ca1a"><code>dde61d7</code></a>
fix(twoslash): show each call's own signature on hover (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3728">#3728</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3e8f5f3a1a52674f47e02653825fe308b89c1f71"><code>3e8f5f3</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3725">#3725</a>
from fuma-nama/tegami/version-packages</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/75647a2e03d01fbfee86d10b07ad9a2f2f3d5e5c"><code>75647a2</code></a>
fix(json-schema): improve all of merging</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/91db24c1db8b5ccedfb36932c441ad7140b8f3a5"><code>91db24c</code></a>
fix(core): improve absolute windows path</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7e47d07e16700bbc0ae74bf60ce4128051d0da8b"><code>7e47d07</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3715">#3715</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-mdx@15.4.7...fumadocs-mdx@15.4.9">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-twoslash` from 4.0.2 to 4.0.3
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-twoslash's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-twoslash@4.0.3</h2>
<h3>Hover signatures of repeated calls</h3>
<p>Hovering a call shows that call's own resolved signature again.
Repeated calls of the same function, such as two
<code>z.enum([...])</code> calls with different values, all showed the
first call's signature, since the hover cache did not tell call sites
apart.</p>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3727">#3727</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/895475ec3fc4195a2994442ee0a59a3cbe71e085"><code>895475e</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3729">#3729</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/9e3d36cd83e8cfffcec87fe6f8f63052bdd6663d"><code>9e3d36c</code></a>
fix(mdx): fix new Turbopack warnings</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/2431b5dfefea4b75361af3cdbe06e936407804c1"><code>2431b5d</code></a>
chore: bump deps</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/882bed84e278673556b860c80af3c507d39a6a05"><code>882bed8</code></a>
docs: improve load speed</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/0b7fb68b4867c179cb5635f8b79d085e208e2e59"><code>0b7fb68</code></a>
feat(openapi,graphql,asyncapi): optimize page load payload</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/dde61d7e6347bf8406caf4babf1e27a1f115ca1a"><code>dde61d7</code></a>
fix(twoslash): show each call's own signature on hover (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3728">#3728</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3e8f5f3a1a52674f47e02653825fe308b89c1f71"><code>3e8f5f3</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3725">#3725</a>
from fuma-nama/tegami/version-packages</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/75647a2e03d01fbfee86d10b07ad9a2f2f3d5e5c"><code>75647a2</code></a>
fix(json-schema): improve all of merging</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/91db24c1db8b5ccedfb36932c441ad7140b8f3a5"><code>91db24c</code></a>
fix(core): improve absolute windows path</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7e47d07e16700bbc0ae74bf60ce4128051d0da8b"><code>7e47d07</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3715">#3715</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-twoslash@4.0.2...fumadocs-twoslash@4.0.3">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-typescript` from 5.5.1 to 5.5.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-typescript's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-typescript@5.5.2</h2>
<h3>Code blocks in type tables</h3>
<ul>
<li><code>remarkAutoTypeTable()</code> of <code>@fumadocs/satteri</code>
highlights the code blocks in descriptions.</li>
<li>Code blocks of unknown languages in descriptions are shown as plain
text, instead of failing the build.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/abe12092fa27d4d61209944d5c95052e50dde101"><code>abe1209</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3690">#3690</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/854d9315c3abd1e3963c35237503ae4fb0dbb143"><code>854d931</code></a>
fix(satteri,typescript): handle unknown langs in codeblocks</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/17aa70b84efa7e865b489b8fb7afaa9fba6827da"><code>17aa70b</code></a>
feat(changelog): support changelog</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/4b5a5465f49eba8e2b1beccf8a044098e8773c49"><code>4b5a546</code></a>
feat(registry): blog integration</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/26db0ca10a358ea4e4be2be907ba4fe04a9fb822"><code>26db0ca</code></a>
docs: add community Git Changelog integration (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3687">#3687</a>)</li>
<li>See full diff in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-typescript@5.5.1...fumadocs-typescript@5.5.2">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-ui` from 16.17.1 to 16.17.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-ui's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.17.7</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.7</li>
<li>fumadocs-core@16.17.7</li>
<li>fumadocs-ui@16.17.7</li>
</ul>
<h3>Imports across Windows drives</h3>
<ul>
<li><code>remarkImage</code> and generated <code>.source</code> files
import files on another drive or a UNC path by their absolute path.</li>
<li>Generated imports of files in dot-folders are prefixed with
<code>./</code>.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3723">#3723</a></p>
<h2>fumadocs@16.17.6</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.6</li>
<li>fumadocs-core@16.17.6</li>
<li>fumadocs-ui@16.17.6</li>
</ul>
<h3>i18n <code>parser: 'none'</code></h3>
<ul>
<li><code>parser: 'none'</code> no longer parses locales from file
paths, files without a <code>locale</code> belong to the default
language.</li>
</ul>
<h3>Generated pages in every language</h3>
<ul>
<li>Virtual files accept a <code>locale</code>, <code>$</code> for every
language, instead of parsing it from their path.</li>
<li>Pages from <code>staticSource()</code> and
<code>dynamicSource()</code> of OpenAPI, AsyncAPI and GraphQL are shared
with every language of <code>loader()</code>.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3720">#3720</a></p>
<h2>fumadocs@16.17.5</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.5</li>
<li>fumadocs-core@16.17.5</li>
<li>fumadocs-ui@16.17.5</li>
</ul>
<h3>Faster API pages and search indexes</h3>
<ul>
<li>Schema UI generates the schemas it shows when they open, instead of
every schema reachable from the root.</li>
<li>Inline schemas are identified by their position, links to their
properties copied before this version no longer open them.</li>
<li>TypeScript definitions of bodies are generated when copied.</li>
<li>Search indexes take breadcrumbs from one walk of the page tree,
instead of a search for each page.</li>
</ul>
<h2>fumadocs@16.17.4</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.4</li>
<li>fumadocs-core@16.17.4</li>
<li>fumadocs-ui@16.17.4</li>
</ul>
<h3>Keyboard-scrollable MDX tables</h3>
<ul>
<li>Tables of <code>defaultMdxComponents</code> are focusable, so
keyboard users can scroll wide tables in Safari.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3706">#3706</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3e8f5f3a1a52674f47e02653825fe308b89c1f71"><code>3e8f5f3</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3725">#3725</a>
from fuma-nama/tegami/version-packages</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/75647a2e03d01fbfee86d10b07ad9a2f2f3d5e5c"><code>75647a2</code></a>
fix(json-schema): improve all of merging</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/91db24c1db8b5ccedfb36932c441ad7140b8f3a5"><code>91db24c</code></a>
fix(core): improve absolute windows path</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7e47d07e16700bbc0ae74bf60ce4128051d0da8b"><code>7e47d07</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3715">#3715</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5af6a321d1b57b0f83861fdaaa2764cd4124dcf1"><code>5af6a32</code></a>
docs: mention pele</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/fb45f0bf2e3696f1aa174dcfa7036c3a470f206d"><code>fb45f0b</code></a>
docs: add example for pele</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/61fbafb3fd0b621a1bbac248b37d1c88f9eb90db"><code>61fbafb</code></a>
fix(api-docs): improve file generation logics</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b65aad1d1fc80f2b341fbef3e111d665d705a3fc"><code>b65aad1</code></a>
refactor(preview): pass AI chat prompt as <code>instructions</code> (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3721">#3721</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/825107f2a7a8543af275f819a4454dbe8561c6aa"><code>825107f</code></a>
Redesign GraphQL (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3718">#3718</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7b2b93d9623d64e44a48a41bf6ec7e7798defa64"><code>7b2b93d</code></a>
fix(ui): hide decorative GitHub navigation icons (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3716">#3716</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.17.1...fumadocs@16.17.7">compare
view</a></li>
</ul>
</details>
<br />

Updates `lucide-react` from 1.55.0 to 1.61.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/lucide-icons/lucide/releases">lucide-react's
releases</a>.</em></p>
<blockquote>
<h2>Version 1.61.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>circle-chevrons-down</code>,
<code>circle-chevrons-left</code>, <code>circle-chevrons-right</code>
and 1 more icons by <a
href="https://github.com/ypotti"><code>@​ypotti</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5025">lucide-icons/lucide#5025</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/ypotti"><code>@​ypotti</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5025">lucide-icons/lucide#5025</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.60.0...1.61.0">https://github.com/lucide-icons/lucide/compare/1.60.0...1.61.0</a></p>
<h2>Version 1.60.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>tombstone</code> icon by <a
href="https://github.com/ryck"><code>@​ryck</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4929">lucide-icons/lucide#4929</a></li>
<li>feat(icons): added <code>smartphone-user-round</code> icon by <a
href="https://github.com/hitanshu-machhi"><code>@​hitanshu-machhi</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4586">lucide-icons/lucide#4586</a></li>
<li>feat(icons): added <code>bacon</code> icon by <a
href="https://github.com/devkamani9313-lab"><code>@​devkamani9313-lab</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4694">lucide-icons/lucide#4694</a></li>
<li>fix(site): Fix build by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5033">lucide-icons/lucide#5033</a></li>
<li>chore(docs): Update icon count comparison with Feather Icons by <a
href="https://github.com/noahweidig"><code>@​noahweidig</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5022">lucide-icons/lucide#5022</a></li>
<li>feat(icons): added <code>letter-spacing</code> icon by <a
href="https://github.com/madebyoz"><code>@​madebyoz</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3038">lucide-icons/lucide#3038</a></li>
<li>chore(deps): bump the vue-deps group with 2 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5027">lucide-icons/lucide#5027</a></li>
<li>chore(deps-dev): bump react-native from 0.87.1 to 0.88.0 in the
react-native-deps group by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5030">lucide-icons/lucide#5030</a></li>
<li>feat(icons): added <code>line-height</code> icon by <a
href="https://github.com/madebyoz"><code>@​madebyoz</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3039">lucide-icons/lucide#3039</a></li>
<li>chore(deps-dev): bump the svelte-deps group across 1 directory with
2 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5028">lucide-icons/lucide#5028</a></li>
<li>chore(deps): bump the react-deps group across 1 directory with 2
updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5026">lucide-icons/lucide#5026</a></li>
<li>feat(icons): added <code>brain-off</code> icon by <a
href="https://github.com/ej52"><code>@​ej52</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3535">lucide-icons/lucide#3535</a></li>
<li>feat(icons): added <code>graph-hub</code> icon by <a
href="https://github.com/Carlito-la-banane"><code>@​Carlito-la-banane</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4974">lucide-icons/lucide#4974</a></li>
<li>feat(svelte): export __iconData and __iconNode across per-icon
modules (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4936">#4936</a>)
by <a
href="https://github.com/ronitgupta138"><code>@​ronitgupta138</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4957">lucide-icons/lucide#4957</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/hitanshu-machhi"><code>@​hitanshu-machhi</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4586">lucide-icons/lucide#4586</a></li>
<li><a
href="https://github.com/devkamani9313-lab"><code>@​devkamani9313-lab</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4694">lucide-icons/lucide#4694</a></li>
<li><a
href="https://github.com/noahweidig"><code>@​noahweidig</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5022">lucide-icons/lucide#5022</a></li>
<li><a href="https://github.com/madebyoz"><code>@​madebyoz</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3038">lucide-icons/lucide#3038</a></li>
<li><a href="https://github.com/ej52"><code>@​ej52</code></a> made their
first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3535">lucide-icons/lucide#3535</a></li>
<li><a
href="https://github.com/Carlito-la-banane"><code>@​Carlito-la-banane</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4974">lucide-icons/lucide#4974</a></li>
<li><a
href="https://github.com/ronitgupta138"><code>@​ronitgupta138</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4957">lucide-icons/lucide#4957</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.59.0...1.60.0">https://github.com/lucide-icons/lucide/compare/1.59.0...1.60.0</a></p>
<h2>Version 1.59.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(docs): Adds search field to docs pages by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5012">lucide-icons/lucide#5012</a></li>
<li>fix(icons): changed <code>chess-queen</code> icon by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4613">lucide-icons/lucide#4613</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.58.0...1.59.0">https://github.com/lucide-icons/lucide/compare/1.58.0...1.59.0</a></p>
<h2>Version 1.58.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(docs): add third-party package lucide-jte by <a
href="https://github.com/sgruendel"><code>@​sgruendel</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5000">lucide-icons/lucide#5000</a></li>
<li>chore(integration-tests): Add Svelte integration tests for
<code>@ucide/svelte</code> by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5005">lucide-icons/lucide#5005</a></li>
<li>chore(deps-dev): bump the angular-deps group across 1 directory with
10 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/5004">lucide-icons/lucide#5004</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/lucide-icons/lucide/commit/fa238cf2787d64393b74121631b518cee0c909c2"><code>fa238cf</code></a>
chore(deps): bump the react-deps group across 1 directory with 2 updates
(<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/5026">#5026</a>)</li>
<li><a
href="https://github.com/lucide-icons/lucide/commit/3f1255ecfa1b5b3a231e4aeb027781761204e187"><code>3f1255e</code></a>
chore(deps-dev): bump <code>@​vitejs/plugin-react</code> (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4995">#4995</a>)</li>
<li>See full diff in <a
href="https://github.com/lucide-icons/lucide/commits/1.61.0/packages/lucide-react">compare
view</a></li>
</ul>
</details>
<br />

Updates `react` from 19.3.0 to 19.3.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/react/react/releases">react's
releases</a>.</em></p>
<blockquote>
<h2>19.3.1 (October 14th, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Improve transport protocol (<a
href="https://redirect.github.com/facebook/react/pull/37845">#37845</a>
by <a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a> and
<a href="https://github.com/eps1lon"><code>@​eps1lon</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/react/react/commit/61aa00df822d0eb76d0362eb8b6fdd3527693efe"><code>61aa00d</code></a>
[19.3.x][Flight] Improve transport protocol (<a
href="https://github.com/react/react/tree/HEAD/packages/react/issues/37845">#37845</a>)</li>
<li>See full diff in <a
href="https://github.com/react/react/commits/v19.3.1/packages/react">compare
view</a></li>
</ul>
</details>
<br />

Updates `react-dom` from 19.3.0 to 19.3.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/react/react/releases">react-dom's
releases</a>.</em></p>
<blockquote>
<h2>19.3.1 (October 14th, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Improve transport protocol (<a
href="https://redirect.github.com/facebook/react/pull/37845">#37845</a>
by <a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a> and
<a href="https://github.com/eps1lon"><code>@​eps1lon</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/react/react/commit/61aa00df822d0eb76d0362eb8b6fdd3527693efe"><code>61aa00d</code></a>
[19.3.x][Flight] Improve transport protocol (<a
href="https://github.com/react/react/tree/HEAD/packages/react-dom/issues/37845">#37845</a>)</li>
<li>See full diff in <a
href="https://github.com/react/react/commits/v19.3.1/packages/react-dom">compare
view</a></li>
</ul>
</details>
<br />

Updates `@ai-sdk/openai` from 4.0.91 to 4.0.99
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ai/blob/main/packages/openai/CHANGELOG.md">@​ai-sdk/openai's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.99</h2>
<h3>Patch Changes</h3>
<ul>
<li>39a776b: Add a shared encodePathSegment helper and use it to encode
provider-returned identifiers in credentialed follow-up request
paths.</li>
<li>c787919: Defer construction of provider validation schemas until
first use to reduce package import time.</li>
<li>0257b47: feat(openai): support 12h prompt cache writes and cache
prewarming</li>
<li>Updated dependencies [b089ce8]</li>
<li>Updated dependencies [39a776b]
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.65</li>
</ul>
</li>
</ul>
<h2>4.0.98</h2>
<h3>Patch Changes</h3>
<ul>
<li>0c2a9de: Add <code>maxOutputTokens</code> and <code>reasoning</code>
to experimental decision calls and forward them to language-model-backed
decisions. Language-model adapters keep reasoning disabled when omitted.
Native decision providers warn when either setting is unsupported.</li>
<li>8b728ec: fix(openai): preserve detected language codes in
transcription responses</li>
<li>3cb1dae: fix(openai): forward shell_call timeout_ms and
max_output_length to the shell tool and round-trip
max_output_length</li>
<li>Updated dependencies [0c2a9de]</li>
<li>Updated dependencies [200c47f]
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.31</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.64</li>
</ul>
</li>
</ul>
<h2>4.0.97</h2>
<h3>Patch Changes</h3>
<ul>
<li>acbc819: Add an optional <code>modelId</code> setting to Azure
OpenAI language-model factories for
accurate telemetry and capability detection with custom deployment
names. Keep
the deployment ID for API routing and preserve existing behavior when
the model
ID is omitted.</li>
<li>60cc252: feat(perplexity): add decisions api support</li>
<li>Updated dependencies [60cc252]
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.30</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.63</li>
</ul>
</li>
</ul>
<h2>4.0.96</h2>
<h3>Patch Changes</h3>
<ul>
<li>2be133e: chore(openai): deprecate 'webSearchPreview()' tool</li>
<li>fa98094: feat(openai): support ordered 'additional_tools' from tool
results</li>
<li>Updated dependencies [0957554]
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.29</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.62</li>
</ul>
</li>
</ul>
<h2>4.0.95</h2>
<h3>Patch Changes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/ai/commit/e6230e43ba9def164550eea562c457e23be9efa6"><code>e6230e4</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23638">#23638</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/0257b47857e2f24807d5b2cab0b56bbdab28809f"><code>0257b47</code></a>
feat(openai): support 12h prompt cache writes and cache prewarming (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23635">#23635</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/c787919a961bf20301d2b1284e6d5548e62a36de"><code>c787919</code></a>
perf(openai): defer schema construction until first use (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23667">#23667</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/39a776bba0a3f7b7c2ee9d78d422320dcdd495a8"><code>39a776b</code></a>
fix: share URL path segment encoding (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23679">#23679</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/0a5c786ef65bcd835328fb543685f6d8ef233dae"><code>0a5c786</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23572">#23572</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/0c2a9de5de76570cc2ad0281382aa90cbd199d43"><code>0c2a9de</code></a>
feat: add <code>maxOutputTokens</code> and <code>reasoning</code> to
<code>decide</code> (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23590">#23590</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/8b728ec363e6f461611c2c1f0dc53f7a69a52f51"><code>8b728ec</code></a>
fix(openai): preserve detected language codes in transcription responses
(<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23">#23</a>...</li>
<li><a
href="https://github.com/vercel/ai/commit/3cb1dae6af24966f23a0de1447db9f81220b0530"><code>3cb1dae</code></a>
fix(openai): forward shell call execution controls and round-trip
max_output_...</li>
<li><a
href="https://github.com/vercel/ai/commit/eec6f494170ddef332e7c5e51f53fb973f535482"><code>eec6f49</code></a>
fix(ci): package tsdown config (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23564">#23564</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/92d9e2d1d721533981b67f8671d745d194facd9f"><code>92d9e2d</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/23472">#23472</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/ai/commits/@ai-sdk/openai@4.0.99/packages/openai">compare
view</a></li>
</ul>
</details>
<br />

Updates `@anthropic-ai/sdk` from 0.133.0 to 0.137.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/releases">@​anthropic-ai/sdk's
releases</a>.</em></p>
<blockquote>
<h2>sdk-v0.137.0</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add org webhook endpoints and user profile
enforcement events</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> run the changelog check on a standard
runner</li>
<li><strong>tests:</strong> make credential tests independent of the
caller's environment</li>
</ul>
<h2>sdk-v0.136.0</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add data_refreshed_at and has_more to
analytics report pages</li>
<li><strong>api:</strong> add workspace rate-limit updates to the Admin
API</li>
<li><strong>api:</strong> make User Profiles generally available</li>
<li><strong>client:</strong> yield server-sent events with unrecognized
event names</li>
<li><strong>tools:</strong> accept every tool definition field in the
tool helpers</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> treat x-amz-security-token as a sensitive
header</li>
<li><strong>tools:</strong> keep $ sequences literal in memory tool
str_replace</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> skip the changelog check on draft pull
requests</li>
<li><strong>docs:</strong> add credential expiry descriptions to the
Managed Agents API reference</li>
<li><strong>docs:</strong> add Messages API request descriptions</li>
<li><strong>docs:</strong> correct plugin manifest_version and reach
descriptions</li>
<li><strong>docs:</strong> improve Managed Agents memory store
descriptions</li>
<li><strong>docs:</strong> improve Managed Agents vault and credential
descriptions</li>
<li><strong>internal:</strong> bump playwright-core in the browser
ecosystem tests</li>
<li><strong>tests:</strong> cover OpenTelemetry failures, propagation
and environment variables</li>
</ul>
<h2>sdk-v0.135.0</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add between_tools to thinking types in model
capabilities</li>
<li><strong>api:</strong> add the speed parameter and usage.speed to
Messages</li>
<li><strong>api:</strong> return a Console organization's usage-tier
spend cap as a read-only spend limit</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> close streams dropped without being read to
the end</li>
<li><strong>client:</strong> keep an unread JSONL response open while it
is held</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/blob/main/CHANGELOG.md">@​anthropic-ai/sdk's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.136.0...sdk-v0.137.0">0.137.0</a>
(2026-10-20)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add org webhook endpoints and user profile
enforcement events</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> run the changelog check on a standard
runner</li>
<li><strong>tests:</strong> make credential tests independent of the
caller's environment</li>
</ul>
<h2><a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.135.0...sdk-v0.136.0">0.136.0</a>
(2026-10-20)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add data_refreshed_at and has_more to
analytics report pages</li>
<li><strong>api:</strong> add workspace rate-limit updates to the Admin
API</li>
<li><strong>api:</strong> make User Profiles generally available</li>
<li><strong>client:</strong> yield server-sent events with unrecognized
event names</li>
<li><strong>tools:</strong> accept every tool definition field in the
tool helpers</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> treat x-amz-security-token as a sensitive
header</li>
<li><strong>tools:</strong> keep $ sequences literal in memory tool
str_replace</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> skip the changelog check on draft pull
requests</li>
<li><strong>docs:</strong> add credential expiry descriptions to the
Managed Agents API reference</li>
<li><strong>docs:</strong> add Messages API request descriptions</li>
<li><strong>docs:</strong> correct plugin manifest_version and reach
descriptions</li>
<li><strong>docs:</strong> improve Managed Agents memory store
descriptions</li>
<li><strong>docs:</strong> improve Managed Agents vault and credential
descriptions</li>
<li><strong>internal:</strong> bump playwright-core in the browser
ecosystem tests</li>
<li><strong>tests:</strong> cover OpenTelemetry failures, propagation
and environment variables</li>
</ul>
<h2><a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.134.0...sdk-v0.135.0">0.135.0</a>
(2026-10-15)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add between_tools to thinking types in model
capabilities</li>
<li><strong>api:</strong> add the speed parameter and usage.speed to
Messages</li>
<li><strong>api:</strong> return a Console organization's usage-tier
spend cap as a read-only spend limit</li>
</ul>
<h3>Bug Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/9c6562472002aa451b6f672acafd6d454e31840f"><code>9c65624</code></a>
release: 0.137.0</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/04151dbe194842210ee5e54c1f8b17806940bc92"><code>04151db</code></a>
Merge pull request <a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/970">#970</a>
from anthropics/synced/published</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5aae8cebbb01a89d831d61b56d081002ff7157b2"><code>5aae8ce</code></a>
feat(api): add org webhook endpoints and user profile enforcement
events</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/261ead07e61b409236d54f63254a1cce4f98adc8"><code>261ead0</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/20d7c14e5a511aed782647fedb84f4bab619d2a6"><code>20d7c14</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/a7736e616eb03c8d8e1dd28f7adc8bc8177d9e42"><code>a7736e6</code></a>
chore(ci): run the changelog check on a standard runner</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/48ecaa4c723299fbe8bfa8f55ed87f510c134564"><code>48ecaa4</code></a>
Merge branch 'main'</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/accbdd899218b49fcb3b5124319e99b64d51de90"><code>accbdd8</code></a>
release: packages/aws-sdk 0.9.0, packages/bedrock-sdk 0.36.0,
packages/vertex...</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b00aefc99f4ee24bfa6438674249edeee996af63"><code>b00aefc</code></a>
Merge pull request <a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/968">#968</a>
from anthropics/synced/published</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/521ffc1f886a5f7a2dbd0f0734fb508af080ee3a"><code>521ffc1</code></a>
Merge branch 'main'</li>
<li>Additional commits viewable in <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.133.0...sdk-v0.137.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `ai` from 7.0.137 to 7.0.148
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ai/blob/main/packages/ai/CHANGELOG.md">ai's
changelog</a>.</em></p>
<blockquote>
<h2>7.0.148</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies [b089ce8]</li>
<li>Updated dependencies [39a776b]</li>
<li>Updated dependencies [f1b550e]
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.65</li>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.121</li>
</ul>
</li>
</ul>
<h2>7.0.147</h2>
<h3>Patch Changes</h3>
<ul>
<li>66e74dc: fix(ai): preserve repaired tool names in streamed UI
message parts</li>
<li>Updated dependencies [9bec2c3]
<ul>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.120</li>
</ul>
</li>
</ul>
<h2>7.0.146</h2>
<h3>Patch Changes</h3>
<ul>
<li>0c2a9de: Add <code>maxOutputTokens</code> and <code>reasoning</code>
to experimental decision calls and forward them to language-model-backed
decisions. Language-model adapters keep reasoning disabled when omitted.
Native decision providers warn when either setting is unsupported.</li>
<li>3785b2e: fix(ai): remove orphaned reasoning, including consecutive
summary and reasoning-file parts, when pruning tool calls</li>
<li>ab8eb61: Fix optional tools adding an incorrect
<code>undefined</code> member to tool call, result, error, denied
output, and execution event types.</li>
<li>Updated dependencies [9d13c4d]</li>
<li>Updated dependencies [0c2a9de]</li>
<li>Updated dependencies [200c47f]
<ul>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.119</li>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.31</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.64</li>
</ul>
</li>
</ul>
<h2>7.0.145</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies [1c47fee]
<ul>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.118</li>
</ul>
</li>
</ul>
<h2>7.0.144</h2>
<h3>Patch Changes</h3>
<ul>
<li>60cc252: feat(perplexity): add decisions api support</li>
<li>0ed59e2: Fix <code>streamText</code> return types for reusable
options and <code>ReturnType</code> by moving low-memory streaming to
<code>experimental_streamTextLowMemory</code>. Replace experimental
<code>streamText({ experimental_lowMemory: true, ...options })</code>
calls with <code>experimental_streamTextLowMemory(options)</code>.</li>
<li>Updated dependencies [60cc252]</li>
<li>Updated dependencies [6b7fb8f]
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.30</li>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.117</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.63</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/ai/commit/e6230e43ba9def164550eea562c457e23be9efa6"><code>e6230e4</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23638">#23638</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/bb40cf03c5b68a4acee867d4fef9a65f71703c47"><code>bb40cf0</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23596">#23596</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/b72707487d6c754f8ac7075b588a4506d095832e"><code>b727074</code></a>
docs(ai): fix JSDoc typo in choice output spec (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/15575">#15575</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/66e74dcd53c3baffa608445a4b18f6bc146c595e"><code>66e74dc</code></a>
fix: signed approvals fail after a streamed tool call is repaired to a
differ...</li>
<li><a
href="https://github.com/vercel/ai/commit/0a5c786ef65bcd835328fb543685f6d8ef233dae"><code>0a5c786</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23572">#23572</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/0c2a9de5de76570cc2ad0281382aa90cbd199d43"><code>0c2a9de</code></a>
feat: add <code>maxOutputTokens</code> and <code>reasoning</code> to
<code>decide</code> (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23590">#23590</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/ab8eb61bb228d7bb3b12cd3c71ab9c84acb40089"><code>ab8eb61</code></a>
fix(ai): remove option tools from union types (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23473">#23473</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/3785b2e1c2a5456808d99a22f2465e24a017d111"><code>3785b2e</code></a>
fix: pruneMessages leaves orphaned reasoning after pruning associated
tool ca...</li>
<li><a
href="https://github.com/vercel/ai/commit/be27becffe7bbc9861fbf959c3a1359e88ca4969"><code>be27bec</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23565">#23565</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/eec6f494170ddef332e7c5e51f53fb973f535482"><code>eec6f49</code></a>
fix(ci): package tsdown config (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/23564">#23564</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/ai/commits/ai@7.0.148/packages/ai">compare
view</a></li>
</ul>
</details>
<br />

Updates `openai` from 7.32.0 to 7.39.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/openai/openai-node/releases">openai's
releases</a>.</em></p>
<blockquote>
<h2>v7.39.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.38.0...v7.39.0">7.39.0</a>
(2026-10-18)</h2>
<h3>Features</h3>
<ul>
<li><strong>realtime:</strong> add opt-in bounded connection recovery
(<a
href="https://redirect.github.com/openai/openai-node/issues/2968">#2968</a>)
(<a
href="https://github.com/openai/openai-node/commit/64872e51eb0624c7cdee8378fba8a6b848fcd8e7">64872e5</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> use neutral moderation examples (<a
href="https://redirect.github.com/openai/openai-node/issues/2969">#2969</a>)
(<a
href="https://github.com/openai/openai-node/commit/3a3b8521a9278d68120c9256a0de4075acb82d80">3a3b852</a>)</li>
</ul>
<h2>v7.38.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.37.0...v7.38.0">7.38.0</a>
(2026-10-17)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add typed Live sideband events (<a
href="https://redirect.github.com/openai/openai-node/issues/2964">#2964</a>)
(<a
href="https://github.com/openai/openai-node/commit/4be6e7285439b84d97a075358659aade97eb878c">4be6e72</a>)</li>
</ul>
<h2>v7.37.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.36.0...v7.37.0">7.37.0</a>
(2026-10-17)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add degraded external storage status (<a
href="https://redirect.github.com/openai/openai-node/issues/2963">#2963</a>)
(<a
href="https://github.com/openai/openai-node/commit/e0fe092414395b9b4643a88b354fdda1be9b25f5">e0fe092</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> add shutdown notices for GPT-4 model aliases
(<a
href="https://redirect.github.com/openai/openai-node/issues/2959">#2959</a>)
(<a
href="https://github.com/openai/openai-node/commit/648cd0a410e91834e5b5d60d19d6290504fe5d64">648cd0a</a>)</li>
</ul>
<h3>Refactors</h3>
<ul>
<li><strong>realtime:</strong> use generated Translation bindings (<a
href="https://redirect.github.com/openai/openai-node/issues/2961">#2961</a>)
(<a
href="https://github.com/openai/openai-node/commit/bb024d41522d0b5a6b6c64055471111068811ccd">bb024d4</a>)</li>
</ul>
<h2>v7.36.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.35.0...v7.36.0">7.36.0</a>
(2026-10-16)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add safety identifiers to image requests and
responses (<a
href="https://redirect.github.com/openai/openai-node/issues/2957">#2957</a>)
(<a
href="https://github.com/openai/openai-node/commit/c95ccafbd9eeb2de3159a813d40f175afa5c8748">c95ccaf</a>)</li>
</ul>
<h2>v7.35.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.34.0...v7.35.0">7.35.0</a>
(2026-10-16)</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/openai/openai-node/blob/main/CHANGELOG.md">openai's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.38.0...v7.39.0">7.39.0</a>
(2026-10-18)</h2>
<h3>Features</h3>
<ul>
<li><strong>realtime:</strong> add opt-in bounded connection recovery
(<a
href="https://redirect.github.com/openai/openai-node/issues/2968">#2968</a>)
(<a
href="https://github.com/openai/openai-node/commit/64872e51eb0624c7cdee8378fba8a6b848fcd8e7">64872e5</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> use neutral moderation examples (<a
href="https://redirect.github.com/openai/openai-node/issues/2969">#2969</a>)
(<a
href="https://github.com/openai/openai-node/commit/3a3b8521a9278d68120c9256a0de4075acb82d80">3a3b852</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.37.0...v7.38.0">7.38.0</a>
(2026-10-17)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add typed Live sideband events (<a
href="https://redirect.github.com/openai/openai-node/issues/2964">#2964</a>)
(<a
href="https://github.com/openai/openai-node/commit/4be6e7285439b84d97a075358659aade97eb878c">4be6e72</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.36.0...v7.37.0">7.37.0</a>
(2026-10-17)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add degraded external storage status (<a
href="https://redirect.github.com/openai/openai-node/issues/2963">#2963</a>)
(<a
href="https://github.com/openai/openai-node/commit/e0fe092414395b9b4643a88b354fdda1be9b25f5">e0fe092</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> add shutdown notices for GPT-4 model aliases
(<a
href="https://redirect.github.com/openai/openai-node/issues/2959">#2959</a>)
(<a
href="https://github.com/openai/openai-node/commit/648cd0a410e91834e5b5d60d19d6290504fe5d64">648cd0a</a>)</li>
</ul>
<h3>Refactors</h3>
<ul>
<li><strong>realtime:</strong> use generated Translation bindings (<a
href="https://redirect.github.com/openai/openai-node/issues/2961">#2961</a>)
(<a
href="https://github.com/openai/openai-node/commit/bb024d41522d0b5a6b6c64055471111068811ccd">bb024d4</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.35.0...v7.36.0">7.36.0</a>
(2026-10-16)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add safety identifiers to image requests and
responses (<a
href="https://redirect.github.com/openai/openai-node/issues/2957">#2957</a>)
(<a
href="https://github.com/openai/openai-node/commit/c95ccafbd9eeb2de3159a813d40f175afa5c8748">c95ccaf</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.34.0...v7.35.0">7.35.0</a>
(2026-10-16)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add Decisions prompt caching options (<a
href="https://redirect.github.com/openai/openai-node/issues/2956">#2956</a>)
(<a
href="https://github.com/openai/openai-node/commit/468b54eb4f3bd23468ec146c2fc6119134ecc2e2">468b54e</a>)</li>
<li><strong>api:</strong> add prompt-based voice creation (<a
href="https://redirect.github.com/openai/openai-node/issues/2955">#2955</a>)
(<a
href="https://github.com/openai/openai-node/commit/e9f788ebfb1b6e2f5aa59022eee3da202110390e">e9f788e</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/openai/openai-node/commit/c3e69cdabaa5a03be6f3c5ae89449aa2c950dd75"><code>c3e69cd</code></a>
release: 7.39.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2970">#2970</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/64872e51eb0624c7cdee8378fba8a6b848fcd8e7"><code>64872e5</code></a>
feat(realtime): add opt-in bounded connection recovery (<a
href="https://redirect.github.com/openai/openai-node/issues/2968">#2968</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/3a3b8521a9278d68120c9256a0de4075acb82d80"><code>3a3b852</code></a>
chore(api): use neutral moderation examples (<a
href="https://redirect.github.com/openai/openai-node/issues/2969">#2969</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/e989fc07033981150d68c4e06e8600452b46494c"><code>e989fc0</code></a>
test: cover WebSocket handshakes across API helpers (<a
href="https://redirect.github.com/openai/openai-node/issues/2967">#2967</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/1535aa2d65c55db282373a795857235e43c627f1"><code>1535aa2</code></a>
release: 7.38.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2965">#2965</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/305d2c0393c046ead4a3a405577b8b56bce9615c"><code>305d2c0</code></a>
feat(api): add ultrafast service tier for Agents (<a
href="https://redirect.github.com/openai/openai-node/issues/2966">#2966</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/4be6e7285439b84d97a075358659aade97eb878c"><code>4be6e72</code></a>
feat(api): add typed Live sideband events (<a
href="https://redirect.github.com/openai/openai-node/issues/2964">#2964</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/9a84a0d3d0153ef2744081dac479b42ca86500f4"><code>9a84a0d</code></a>
release: 7.37.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2960">#2960</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/e0fe092414395b9b4643a88b354fdda1be9b25f5"><code>e0fe092</code></a>
feat(api): add degraded external storage status (<a
href="https://redirect.github.com/openai/openai-node/issues/2963">#2963</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/bb024d41522d0b5a6b6c64055471111068811ccd"><code>bb024d4</code></a>
refactor(realtime): use generated Translation bindings (<a
href="https://redirect.github.com/openai/openai-node/issues/2961">#2961</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/openai/openai-node/compare/v7.32.0...v7.39.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `postcss` from 8.5.29 to 8.5.31
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/postcss/postcss/releases">postcss's
releases</a>.</em></p>
<blockquote>
<h2>8.5.31</h2>
<ul>
<li>Fix better source map on <code>&lt;/style&gt;</code> escaping (by <a
href="https://github.com/firefoxic"><code>@​firefoxic</code></a>).</li>
</ul>
<h2>8.5.30</h2>
<ul>
<li>Fix broken map on <code>&lt;/style&gt;</code> escaping (by <a
href="https://github.com/Rufflet"><code>@​Rufflet</code></a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/postcss/postcss/blob/main/CHANGELOG.md">postcss's
changelog</a>.</em></p>
<blockquote>
<h2>8.5.31</h2>
<ul>
<li>Fix better source map on <code>&lt;/style&gt;</code> escaping (by <a
href="https://github.com/firefoxic"><code>@​firefoxic</code></a>).</li>
</ul>
<h2>8.5.30</h2>
<ul>
<li>Fix broken map on <code>&lt;/style&gt;</code> escaping (by <a
href="https://github.com/Rufflet"><code>@​Rufflet</code></a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/postcss/postcss/commit/d1908579d6af4155ee5f759030184fb4c2b575ec"><code>d190857</code></a>
Release 8.5.31 version</li>
<li><a
href="https://github.com/postcss/postcss/commit/4ef6d8cc0307df09c21a63b5521285657966ece3"><code>4ef6d8c</code></a>
Update dependencies</li>
<li><a
href="https://github.com/postcss/postcss/commit/6abd674231f7867d1c37e6b71bc8d6e00165fd27"><code>6abd674</code></a>
Call the builder with every node when the output is escaped (<a
href="https://redirect.github.com/postcss/postcss/issues/2175">#2175</a>)</li>
<li><a
href="https://github.com/postcss/postcss/commit/f1aca7ec68ab0cfb96cc9e69520a87f641c5a9e4"><code>f1aca7e</code></a>
Release 8.5.30 version</li>
<li><a
href="https://github.com/postcss/postcss/commit/9d8344589299ca90f4ec0a4fab899e357995eaad"><code>9d83445</code></a>
Update dependencies</li>
<li><a
href="https://github.com/postcss/postcss/commit/6c9bc73d9d2ad2c9c8e998ace707ebe067bc8425"><code>6c9bc73</code></a>
Fix invalid source map mapping on escaping before new line (<a
href="https://redirect.github.com/postcss/postcss/issues/2169">#2169</a>)</li>
<li><a
href="https://github.com/postcss/postcss/commit/1fd8f881875330b284d65961c2c158f61d4e3bab"><code>1fd8f88</code></a>
Add missed changes in changelog</li>
<li>See full diff in <a
href="https://github.com/postcss/postcss/compare/8.5.29...8.5.31">compare
view</a></li>
</ul>
</details>
<br />

Updates `@openai/codex` from 0.162.1 to 0.163.0

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4455"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-27 17:28:43 -07:00
AlessandroSpallinaandClaude Opus 5.5 a90421083a feat(proxy): report the same tool savings on gateway /v1/compress as the proxy path (#4467)
## Description

Gateway-mode `/v1/compress` now reports the same savings as the proxy
path. The why is in #4466.

Closes #4466

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [x] Documentation update

## Changes Made

Two commits, one per gap:

1. **`fix(proxy): count tool-schema compaction ...`**
- The gateway turn counts the tool definitions before and after
compaction.
- The handler adds both counts to `tokens_before` / `tokens_after`, with
the proxy path's guard (`0 < after < before`).
   - Tools the client already marked `defer_loading` are skipped.
2. **`feat(proxy): report tool_tokens_saved and tool_tokens_deferred
...`**
- Gateway-mode answers add `tool_tokens_saved` (from the tags `/stats`
sums) and `tool_tokens_deferred` (the estimated share).
   - Docs: `proxy.mdx`, `wiki/proxy.md`.

Non-gateway and fail-open answers do not change.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`, on the changed files)
- [x] Type checking passes (`mypy`, on the changed files)
- [x] New tests added for new functionality

```text
$ pytest -q tests/gateway/ tests/test_gateway_turn_unit.py tests/test_proxy_compress_endpoint.py
380 passed, 5 skipped
```

The tests also pass on the first commit alone (`tests/gateway/`: 280
passed). The new test for client-deferred tools fails without its fix.

## Real Behavior Proof

- Environment: macOS, Python 3.12. Before: image
`headroom:0.41.0-nonroot`. After: this branch, `HEADROOM_OFFLINE=1
headroom proxy`.
- Exact command / steps: start each build, then send it the same
gateway-mode `POST /v1/compress` — one message plus 5 tools whose
schemas carry `title` / `examples` / `default` (the annotation keys
schema compaction strips), with `"gateway": {"can_redrive": false,
"can_relay_response": false}` so the request is a single call. Read
`tokens_before`, `tokens_after`, `tokens_saved` and the `tool_*` fields
out of the JSON answer. No provider is contacted.
- Observed result: same request, same tools. On 0.41.0 the tool
definitions are invisible to the counts, so `tokens_saved` is 0 and
neither `tool_*` field is present. On this branch the compaction is
counted, so `tokens_before` / `tokens_after` carry the tool bytes and
`tokens_saved` is the 240 tokens compaction stripped
(`tool_tokens_saved` / `tool_tokens_deferred` stay 0 here: no
tool-search extension ran, and the extension is what books deferral).

```text
0.41.0:  tokens_before 13,  tokens_after 13,  tokens_saved 0    (no tool_* fields)
branch:  tokens_before 830, tokens_after 590, tokens_saved 240, tool_tokens_saved 0, tool_tokens_deferred 0
```

- Not tested: a live run with the headroom-tool-search extension
(deferral is covered by unit tests), and Responses-API bodies.

## Runtime Rollout Safety

- Rollout-managed feature(s): None gate this change — the gateway
`/v1/compress` accounting is not behind a registry feature. One
interaction: `proxy_output_shaper` (registry feature, available
`stable`, deliberately not default-enabled) consumes the augmented
count. `tokens_before` is folded at
`headroom/proxy/handlers/openai.py:11064` and then handed to the turn at
`:11083`, which passes it as `input_tokens` to `shape_gateway_body`
(`headroom/proxy/gateway_extension.py:213`) → `stratum_key` →
`input_bucket`. A turn whose tool definitions push it across one of the
2k / 8k / 32k / 128k boundaries therefore lands in a bigger stratum,
which picks a different output-savings baseline. The chat path already
has this coupling.
- Minimum rollout channel: n/a — no channel gate, so the change takes
effect wherever gateway mode is served, on every channel.
- Stable/default behavior changed: Yes, gateway-mode answers only.
`tokens_before` / `tokens_after` now include the tool definitions before
and after schema compaction, so `tokens_saved` covers the compaction
saving the same way the chat handlers already do, and two fields are
added. Non-gateway and fail-open answers are byte-identical.
- Kill switch / disable path: None. Without compaction there is nothing
to fold, and the two fields are additive on answers; a gateway that does
not want them ignores them.
- Unsafe override required: No. Nothing crosses a channel boundary.
- Qualification impact: None. No registry entry is added, so
`registry_digest` and `snapshot_digest` are unchanged. The gateway
`tokens_saved` figure itself changes, which a benchmark comparing arms
across this commit will see.
- Rollback path: Revert the two commits.

## Review Readiness

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

## Checklist

- [x] I have made corresponding changes to the documentation
- [x] I have added tests that 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`

## Additional Notes

- The fields are emitted for any claimed compress turn. Only the gateway
extension claims turns today.
- If a response-half hook rewrote the tool tags during a re-drive,
`/stats` would no longer match the answer. Core has no such hook.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:45:53 -07:00
3fef15d376 fix(offline): keep litellm's pricing table local under HEADROOM_OFFLINE (#4242)
## Description

`HEADROOM_OFFLINE=1` still lets litellm reach GitHub. `import litellm`
downloads `model_prices_and_context_window.json` from
`raw.githubusercontent.com` during the import (three attempts) unless
`LITELLM_LOCAL_MODEL_COST_MAP` is `true`. Headroom imports litellm from
24 places, among them the pricing helpers, the LiteLLM provider and
backend, the proxy's cost and savings trackers, and both Headroom Cloud
integrations. With the air-gap switch on, the first of those imports
dialled out.

Nothing in the chokepoint suite caught it, because no Headroom-built
client is involved, so no `guard_egress` site can dominate it.
`TestHeadroomCloudCompressionOffline` only passed when an earlier test
had already imported litellm. Run on its own (`pytest
tests/test_offline_egress_chokepoint.py -k HeadroomCloud`), it fails on
`main` with `SocketOpened: ... ('raw.githubusercontent.com', 443)`.

The only lever is the env var, and litellm reads it once, during its own
import. So:

- `pin_litellm_cost_map_local()` in `headroom/offline.py` sets
`LITELLM_LOCAL_MODEL_COST_MAP=True` while `HEADROOM_OFFLINE` is on.
- Every litellm import in `headroom/` calls it first, in the same scope.
A pin only at package import would miss a switch turned on later:
`is_offline()` is read when checked, and
`create_app(ProxyConfig(offline=True))` sets it after `import headroom`.
- The pin is Headroom's, so it is undone: called with the switch off, it
restores the value it replaced if the variable still holds the pin. A
process that leaves offline mode before its first litellm import gets
the online pricing refresh back.
- It overwrites the variable rather than using `setdefault`. litellm
only accepts `true`, so an operator value of `1` (the form every
Headroom switch takes), `False` or an empty string would otherwise
reopen the fetch.
- A meta-test fails the build for any litellm import without a preceding
pin, the same pattern as the existing site scanner.

No tracking issue; found while chasing a test that only failed when run
on its own.

Review found a second import-time leak on the same path:
`headroom/integrations/__init__.py` imports the CrewAI integration
whenever CrewAI is installed, and `import crewai` requests a Scarf pixel
from `api.scarf.sh` on a background thread unless
`CREWAI_DISABLE_TELEMETRY` is `true`. So `import
headroom.integrations.litellm_callback` still dialled out under the
switch. `pin_crewai_telemetry_off()` handles it the same way, through a
shared `_OfflineEnvPin`, and the meta-test now covers `crewai` imports
too.

## 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

- `headroom/offline.py`: new `pin_litellm_cost_map_local()` (a no-op
unless `HEADROOM_OFFLINE` is on), documented in the module's list of
refused egress.
- All 24 litellm import sites call it immediately before importing:
`pricing/`, `providers/` (litellm, anthropic, openai, cohere, google),
`backends/litellm.py`, `proxy/` (cost, savings_tracker, route_advice),
`integrations/litellm_callback.py`, `telemetry/session.py`,
`perf/analyzer.py`, `learn/analyzer.py`, `cli/` (evals, learn) and
`evals/`.
- `pin_crewai_telemetry_off()` forces `CREWAI_DISABLE_TELEMETRY=true`
while offline (restored the same way), called before the one `crewai`
import (`headroom/integrations/crewai/agents.py`). Both pins share
`_OfflineEnvPin`.
- `headroom/__init__.py` also calls it, which covers a host that imports
litellm itself after importing Headroom.
- `tests/test_offline_egress_chokepoint.py`, new
`TestLiteLLMCostMapOffline`:
- subprocess probes (litellm only fetches on its first import, which an
earlier test usually did already) for four litellm-backed modules, with
the switch set both before and after `import headroom`;
  - operator values `1`, `False` and empty;
- leaving offline mode restores the replaced value (absent or `False`),
and an operator change made after the pin is kept;
  - `test_every_litellm_import_is_pinned_first`, the AST meta-test;
- the `offline` fixture now restores `LITELLM_LOCAL_MODEL_COST_MAP` at
teardown.
- `TestCrewAITelemetryOffline`: a stand-in `crewai` package with crewai
1.6.1's import-time tracking (no extra or CI job installs CrewAI),
probed early and late for `headroom.integrations.crewai` and
`headroom.integrations.litellm_callback`, plus operator values, a
restore test, the same probes against a real CrewAI when installed, and
`test_every_crewai_import_is_pinned_first`. A sanity test checks that
the stand-in does dial when online.
- `docs/metrics-technical-guide.md` and `docs/content/docs/proxy.mdx`
add the refresh and CrewAI's tracking to the refused list. The guide
also states the limits: a host that imports litellm *before* Headroom
has already made the fetch and must set the variable itself, and offline
prices come from the table bundled with the installed litellm release.

## Testing

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

### Test Output

```text
$ pytest -q tests/test_offline_egress_chokepoint.py tests/test_proxy_hardening.py
216 passed, 3 skipped, 1 warning in 38.44s

$ pytest -q --continue-on-collection-errors tests/test_providers tests/test_proxy tests/test_pricing* tests/test_perf* \
    tests/test_telemetry* tests/test_learn* tests/test_route_advice* tests/test_backend* tests/test_litellm* tests/test_cost* \
    tests/test_savings* tests/test_counterfactual* tests/test_evals* tests/test_integrations*
1742 passed, 337 skipped, 6 warnings, 1 error in 65.33s
# the 1 error is test_langchain_1x_compat.py failing collection (NameError: tool) because langchain_core
# is not installed in my venv; it fails identically on main df11f274

$ ruff check headroom tests/test_offline_egress_chokepoint.py tests/test_proxy_hardening.py   # ruff 0.17.0
All checks passed!
$ ruff format --check headroom tests/test_offline_egress_chokepoint.py tests/test_proxy_hardening.py
573 files already formatted
$ mypy <the 23 changed headroom/ files>
Success: no issues found in 23 source files

# The new tests fail without the fix: removing one pin call, and reverting to setdefault, gives
FAILED ...::test_operator_value_cannot_reopen_the_fetch[1]       assert ['raw.githubusercontent.com', ...] == []
FAILED ...::test_operator_value_cannot_reopen_the_fetch[False]
FAILED ...::test_operator_value_cannot_reopen_the_fetch[]
FAILED ...::test_every_litellm_import_is_pinned_first           names the unpinned import in headroom/backends/litellm.py
```

## Real Behavior Proof

- Environment: macOS arm64, Python 3.10.18 venv, litellm 1.101.0 (the
`uv.lock` version), `main` at df11f274 in a worktree vs this branch, the
same venv for both, `LITELLM_LOCAL_MODEL_COST_MAP` unset unless shown.
- Exact command / steps: a probe script replaces
`socket.create_connection` with a trap that records the address and
raises, runs `import headroom`, sets `HEADROOM_OFFLINE=1` before
(`early`) or after (`late`) that import, then imports the module and
prints the recorded attempts. Run with `HEADROOM_OFFLINE=1 python
probe2.py early headroom.integrations.asgi`, then the same for
`headroom.backends.litellm`, then `python probe2.py late
headroom.backends.litellm`, then `HEADROOM_OFFLINE=1
LITELLM_LOCAL_MODEL_COST_MAP=1 python probe2.py early
headroom.providers.litellm`.
- Observed result: main df11f274 gives `attempts=3
['raw.githubusercontent.com:443']` for all four runs; this branch gives
`attempts=0 []` for all four, with litellm loaded in every case.
- CrewAI: in a venv with crewai 1.6.1 + litellm 1.101.0 (the review
setup) and CrewAI telemetry at its default, `pytest
tests/test_offline_egress_chokepoint.py -k 'LiteLLMCostMap or CrewAI'`
gives 28 passed, including both real-CrewAI imports. Without the
`agents.py` pin, 10 CrewAI checks fail with `attempts=['api.scarf.sh']`.
- Not tested: a live proxy on an air-gapped host. The probe covers the
import paths; the proxy's lazy imports (`proxy/cost.py`,
`proxy/savings_tracker.py`, `proxy/route_advice.py`) are covered by the
meta-test, not by a running proxy.

## Runtime Rollout Safety

- Rollout-managed feature(s): none.
- Minimum rollout channel: stable.
- Stable/default behavior changed: only with HEADROOM_OFFLINE set;
litellm then uses its bundled pricing table, which is what it already
fell back to after the three failed fetches. Without the switch nothing
changes.
- Kill switch / disable path: unset HEADROOM_OFFLINE.
- Unsafe override required: none.
- Qualification impact: none.
- Rollback path: revert this PR.

## 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
- [x] 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 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

- A host process that imports litellm before Headroom (a LiteLLM proxy
that loads the Headroom callback) has already fetched by the time any
Headroom code runs. That connection isn't Headroom's, so the docs state
the condition instead of claiming it.
- `HF_HUB_OFFLINE` and `TRANSFORMERS_OFFLINE` keep their `setdefault` in
`apply_offline_env()`: the Hub path is protected by `guard_egress` in
`onnx_runtime.py`, not by those variables.
- Possible follow-up, not in this PR: show which cost map litellm loaded
(litellm's `get_model_cost_map_source_info()`) in the offline startup
banner or `headroom doctor`.

---------

Co-authored-by: Kenneth Wong <17061293+KennethWKZ@users.noreply.github.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-24 08:45:38 -07:00
Mansurshakh Japarov 8c07cf4a0f fix(memory): bound retrieval queries before embedding (#4244)
## Description

Closes #4223.

The proxy now embeds a bounded, user-first retrieval query instead of
concatenating entire tool outputs into a deadline-limited lookup. The
raw `MemoryQuery` and its default SDK rendering still retain the full
sources.

Memory failures use the exception representation, so an empty
`TimeoutError` is no longer a blank warning. The existing Anthropic
deadline is unchanged and documented; this does not promise that a cold
model or slow embedding server will finish within it.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- Bound proxy embedding input to 4096 characters, including delimiters;
spend the budget on the latest user question and recent context tails.
- Reserve question and context space inside the active local tokenizer's
window, rather than relying on a character cap to prevent truncation.
- Keep the full-fidelity SDK behavior when no budget is requested.
- Make generic memory errors identifiable in the shared handler and
provider handlers.
- Cover Unicode, newest-context precedence, zero character budget and
actual tokenizer-window retention; keep the full-fidelity SDK tests.

## Testing

- [ ] Unit tests pass (pytest) — all 67 affected query, memory-handler
and tokenizer-window regressions passed locally, not the entire Python
suite.
- [ ] Linting passes (ruff check .) — normal changed-file Ruff hooks
passed.
- [ ] Type checking passes (mypy headroom) — normal mypy hook passed.
- [x] Manual testing performed

### Test Output

```text
Affected query/native-memory/tool/auto-tail/tokenizer suites: 67 passed, 1 warning
Ordinary make ci-precheck: PASS (181 critical Python tests, 6 warnings)
```

The focused-suite warning concerns assertion rewriting of the
already-imported `asyncio` name; it was not suppressed. All five
installed pytest plugins were loaded explicitly. Normal Ruff
formatting/checking, mypy and commitlint hooks passed on `8eb10bfd`. The
ordinary full pre-push gate passed on that same commit, including Rust
workspace checks/tests, the native build and critical Python suites; the
normal fast-forward fork push completed without a bypass.

## Real Behavior Proof

- Environment: Linux x86-64, Python 3.13.14, the actual local ONNX
model/session, SQLite and vector retrieval. The optional
sentence-transformers CPU backend was also exercised in a separate
complete CPU-wheel environment; no project dependency changes.
- Exact command / steps: save a SQLite-corruption memory and an
unrelated cooking memory through the real `LocalBackend`. Call
`MemoryHandler.search_and_format_context` under a two-second
`asyncio.wait_for` with the same long repeated question and SQLite tool
error before and after the change. Record the real ONNX session's input
IDs/attention mask without replacing inference; decode those IDs to
check the final question and tool error. Verify the original
`MemoryQuery` fields stay intact.
- Observed result: both fragments now reach the model and the relevant
memory is retrieved. Same synthetic input and default cache behavior; no
fake embedding or search result:

| Measurement | Before | After |
| --- | ---: | ---: |
| Submitted characters | 2594 | 1146 |
| Tokens before model truncation | 560 | 256 |
| Question tail and tool error reach model | No | Yes |
| Relevant memory retrieved | No | Yes |
| Warm lookup seconds | 0.076 | 0.241 |

A separately configured 96-token ONNX model also retained both
fragments. The real sentence-transformers CPU model and a previously
uninitialized local ONNX backend passed the same retention check and
generated real embeddings. The legacy messages-only path still submitted
4096 characters; the empty-timeout diagnostic still logged
`TimeoutError()` and failed open.

- Not tested: the reporter's Granite embedding server, cold-start
deadlines or network latency, arbitrary remote tokenizer windows, live
provider requests, Windows/macOS or GPU/MPS. Only the diagnostic failure
was injected; successful persistence, embeddings and retrieval used real
backends.

## Runtime Rollout Safety

- Rollout-managed feature(s): existing automatic memory lookup; no new
feature gate.
- Minimum rollout channel: unchanged.
- Stable/default behavior changed: proxy lookups use the bounded
representation; the SDK's default full rendering is unchanged.
- Kill switch / disable path: existing `--no-memory-context` or memory
configuration.
- Unsafe override required: no.
- Qualification impact: actual retrieval, raw-input preservation and
diagnostics checked locally.
- Rollback path: revert the fix; no schema migration.

## 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
- [x] I have made corresponding changes to the documentation
- [x] I did not edit CHANGELOG.md — release-please owns it

## Additional Notes

AI-assisted; no subagents.
2026-10-24 08:45:33 -07:00
Mansurshakh JaparovandJerrettDavis 023dd1bc54 fix(logs): count omitted levels from dropped lines (#4141)
## Description

Closes #4070.

The omission marker previously counted severities in the whole input,
including retained errors. It now counts ERROR/FAIL/WARN/INFO only on
dropped line identities. Selection and whole-input result.stats are
unchanged. If no dropped line has a recognized severity, the marker is
simply `[N lines omitted]`, not a severity breakdown. CCR retains the
exact original.

## Type of Change

- [x] Bug fix (non-breaking)
- [x] Documentation update

## Changes Made

- Keep the existing retained-line identity set and a single-pass fixed
stack histogram; no omitted-line collection or repeated full scans.
- Restore complete structured-marker assertions in Rust and Python,
including bounded failure names, repeated ids, whole-input totals, and
non-severity omissions.
- Restore parity fixture `3bc015edc0a36387.json` using its original
input, explicit configuration and input digest. Output and compression
ratio were re-recorded through the freshly built native extension rather
than manually copied. New runtime-frame defaults remain implicit in the
legacy configuration.
- Remove the constructor-only result-copy test; retain consumer behavior
regressions.
- Document omitted-versus-input counts and the exact bare-marker form in
the existing text/log guide. No manual changelog change.

## Testing

- [x] Scoped Rust and Python tests passed
- [x] Normal touched-file Ruff and repository mypy hooks passed
- [x] Actual native recorder and parity CLI exercised

Head `6c472f6b` includes upstream main `f1bc2609`.

- Focused Rust log-compressor tests: **41 passed**.
- Python public-transform tests: **11 passed**, using the freshly built
native extension.
- Actual parity CLI: **20 matched, 0 skipped, 0 differences**, including
the restored original-input fixture:

```text
cargo run --locked -p headroom-parity --bin parity-run -- run --fixtures tests/parity/fixtures --only log_compressor
[log_compressor  ] total=20 matched=20 skipped=0 diffed=0
```

## Real Behavior Proof

- Environment: Linux x86_64, Python 3.13.14, native extension freshly
built from this worktree.
- Exact command / steps: Re-record the original log fixture through
LogCompressor.compress with its original explicit configuration, then
run the actual parity CLI shown above.
- Observed result: The real native recorder produced `[297 lines
omitted: 297 INFO]` while whole-input statistics remained 300 INFO / one
ERROR / 305 total / eight selected. The exact original was unchanged and
the measured compression ratio is `0.024777201057682892`. The original
fixture digest remains
`3bc015edc0a36387194d075139845c120a308afb314bae436ab454906b431d84`.

Normal commit and full pre-push hooks passed without bypass: Rust
formatting, warnings-as-errors Clippy, workspace tests, native editable
rebuild/import verification, **181 critical Python tests**, and
branch-range commitlint. The critical Python run reported five
dependency/provider warnings, no failures. These local results do not
claim that hosted checks have finished.

- Not tested: New Windows/macOS runs, live-provider sessions and the
full Python suite.

Earlier before/after actual-native CCR qualification showed the retained
ERROR was not counted as omitted, whole-input totals stayed unchanged,
and retrieval recovered the exact original. That historical
implementation evidence is in the review discussion; the explicit
results above qualify this follow-up head. No new Windows/macOS or
live-provider qualification is claimed.

## Runtime Rollout Safety

- Rollout-managed feature(s): Existing LogCompressor and CCR; no new
feature or gate.
- Minimum rollout channel: Unchanged (stable); no channel promotion.
- Stable/default behavior changed: Yes, omitted-severity accounting is
corrected; selection and stored originals remain unchanged.
- Kill switch / disable path:
ContentRouterConfig(enable_log_compressor=False) disables the log route;
existing CCR settings disable retrieval separately.
- Unsafe override required: No.
- Qualification impact: The scoped native/Python/parity proof and
required normal push gate above cover this marker path. No new
platform/live-provider qualification is claimed.
- Rollback path: Revert the fix; no schema or stored-original migration.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review
- [x] Existing style and documentation conventions followed
- [x] Consumer-visible regressions and actual native/CLI paths exercised
- [x] Normal hooks passed; no bypass
- [x] No manual CHANGELOG edit

AI-assisted: omp / GPT-6.1 Sol. This review follow-up was completed
without subagents. No manual human-validation or full Python-suite
claim; scoped tests and the required push gate are reported separately.

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-24 08:45:24 -07:00
Mansurshakh JaparovandJD Davis 89545fbdf3 fix(ccr): recognize client-owned MCP retrieval aliases (#4165)
## Description

Fixes #4159.

OpenCode exposes `headroom_headroom_retrieve`, but the proxy only checks
the bare `headroom_retrieve` when deciding whether the client already
owns retrieval. It therefore adds a second, unavailable client tool.
Retrieval-only proxy turns can be intercepted internally; mixed
retrieval + Read turns are forwarded to the client, which cannot execute
the bare spelling.

## Type of Change

- [x] Bug fix
- [x] Documentation update

## Changes Made

- Share one ownership selector between session-sticky injection and the
per-request `CCRToolInjector` fallback. Accept the bare canonical name
and the three supported default-Headroom-server client spellings.
- Do not treat another MCP server's `headroom_retrieve` suffix as
ownership of Headroom's cache. Existing broader compression-exclusion
matching is unchanged.
- Optional system instructions use the executable registered retrieval
name in the legacy path and both Anthropic/OpenAI handlers.
- Preserve client-owned aliases and bare-only proxy interception; do not
alter mixed-tool response handling or add execution of client tools.
- Add namespace/provider regressions across cold, compressed and later
turns, plus real-store instruction and foreign-server boundaries.
- Delete the incidental tool-description-size assertion and
error-message wording pin, retaining real eager/lazy/cache-stability
validation.
- Document default-server ownership, alias-only forwarding and
mixed-call behavior explicitly.

## Testing

- [x] Relevant CCR/API tests pass: 161 cases across the seven suites
below
- [x] Changed Python source/test Ruff format and check pass
- [x] Failing-before/passing-after behavioral regressions added
- [x] Actual CLI/HTTP/native before-and-after smoke performed

### Test Output

All **6** initial alias/provider regressions fail against exact upstream
main `976aa714ef3e19174dc0cb586cee7b20d064e4ef` because unavailable bare
retrieval is injected. All **10** first review regressions and **2**
additional actual-API regressions fail against immutable first-PR commit
`7601252be7e8b02297e342e2775bb153927e2fe9`: instructions name an
unavailable tool, or a foreign MCP server displaces proxy retrieval.
Current fixed result: **161 passed, 1 existing Starlette TestClient
deprecation warning** across:

```text
tests/test_ccr_tool_injection_cache_stability.py
tests/test_ccr_tool_always_on.py
tests/test_ccr_tool_injection.py
tests/test_issue_728_empty_tools_injection.py
tests/test_corrupt_golden_bytes_recovery.py
tests/test_proxy_anthropic_cache_stability.py
tests/test_proxy_openai_cache_stability.py
```

Ruff format/check passed for the four changed Python sources and three
regression files. A genuine-module-preloaded, coverage-instrumented CCR
run passed all 110 cases (four warnings); an additional instrumented API
run passed both new API regressions and measured both changed handler
instruction calls as executed. Import-time coverage is incomplete in
those local runs, so they are not whole-package or CI patch-coverage
claims. Whole-repository pytest and whole-package mypy are not claimed
by these scoped results.

## Real Behavior Proof

- Environment: Linux x86_64, Python 3.13.14; genuine installed
development/proxy extras and editable Rust extension, actual ONNX
Runtime 1.26.0 via `ORT_DYLIB_PATH`. Independent baseline/fixed
worktrees. Beacon off, isolated settings, stateless proxy, no live
credentials. Provider is a controlled local Anthropic-shaped HTTP
upstream; request model string is `claude-sonnet-4-20250514`, not a live
model run.

- Exact command / steps: start `headroom proxy --port 18858` for
baseline and `--port 18859` for fixed source, each with
`--anthropic-api-url http://127.0.0.1:45111` and:

```text
--stateless --no-cache --no-rate-limit --no-subscription-tracking
--disable-kompress --disable-kompress-fallback --no-read-lifecycle --no-telemetry
```

Optimization and CCR remain enabled. Both genuine CLI startups report
`event=rust_core_loaded`. POST the same `/v1/messages` request to each
with model above, `max_tokens: 128`, `system: "Use the available
tools."`, user text `Retrieve the original compressed data and read the
related file.`, and these client tool schemas:

```json
[
  {"name":"headroom_headroom_retrieve","description":"Retrieve original Headroom content through the client MCP server","input_schema":{"type":"object","properties":{"hash":{"type":"string"}},"required":["hash"]}},
  {"name":"Read","description":"Read a local file","input_schema":{"type":"object","properties":{"file_path":{"type":"string"}},"required":["file_path"]}}
]
```

The controlled upstream observes the actual advertised tools, selects
bare retrieval if advertised (otherwise the available alias), and
returns a mixed retrieval + Read response.

**Observed before:** upstream tools are `Read`,
`headroom_headroom_retrieve`, **`headroom_retrieve`**. HTTP 200 forwards
mixed `headroom_retrieve` + `Read`, leaving one returned tool
unavailable in the client's registry.

- Observed result: after the fix, upstream tools are only `Read`,
`headroom_headroom_retrieve`. HTTP 200 forwards mixed
**`headroom_headroom_retrieve`** + `Read`; zero unavailable returned
names. No mixed-call suppression or response rewriting hides the
problem.

- Not tested: live Anthropic, installed OpenCode end-to-end, actual CCR
hash/payload recovery, Windows or native Gemini HTTP. Per-request
fallback is exercised directly by regressions. Controlled-upstream
behavior alone is not offered as proof: this ran the real baseline/fixed
proxy CLI, HTTP path and native extension.

### Additional review behavior proof

The first PR SHA and corrected source each ran the actual proxy app
through its full lifespan, with the genuine native extension loaded,
actual `CompressionStore` and real HTTP to a controlled upstream at
`127.0.0.1:45112`. Requests entered the genuine Anthropic and OpenAI
ASGI routes, not patched handlers; this additional check was not an
external CLI socket or live-provider run.

Construct `ProxyConfig` with `ccr_inject_system_instructions=True`,
`stateless=True`, no caching/rate limiting/subscription tracking/read
lifecycle/Kompress, Anthropic URL `http://127.0.0.1:45112`, and OpenAI
URL `http://127.0.0.1:45112/v1`. After startup, store
original/compressed content in the actual in-memory store and use its
returned hash in `<<ccr:HASH 1_rows_offloaded>>`. Send a valid assistant
tool call and matching tool result to each provider endpoint, once with
only `headroom_headroom_retrieve` registered and once with only
`mcp__other__headroom_retrieve` registered. Anthropic uses
tool-use/tool-result blocks and model `claude-sonnet-4-20250514`; OpenAI
uses function tool-calls/tool messages and model `gpt-4o`. The upstream
records advertised names and names invoked by the actual injected system
instructions, then returns a normal final text response.

All eight before/after requests returned HTTP 200. Before: both
providers instructed bare `headroom_retrieve` while neither registry
contained it. After: the Headroom alias is retained alone and
instructions invoke it; a foreign server's tool is retained alongside
proxy-owned bare retrieval and instructions invoke the bare tool. **Zero
unavailable instruction names** in all four corrected requests. The
upstream and both apps were stopped afterwards.

The permanent API regressions reuse the existing full-lifespan provider
`TestClient` fixtures and a real isolated in-memory store. Only the
upstream response boundary supplies fixed provider-shaped JSON; the CCR
injector, instruction generation and ownership selector are real. Both
tests fail on the first PR SHA because the instructions name unavailable
bare retrieval, then pass after the fix. They assert executable-name and
real-hash invariants, not that a helper received forwarded arguments.
Scoped coverage measured the previously untested instruction calls in
both handlers as executed.

## Runtime Rollout Safety

- Rollout-managed feature(s): existing CCR tool-injection paths and
opt-in retrieval instructions; tool ownership and instruction naming
only.
- Minimum rollout channel: unchanged; no feature is enabled by this
patch.
- Stable/default behavior changed: stop injecting a duplicate bare
schema when the client already owns a supported retrieval alias.
- Kill switch / disable path: existing controls unchanged; no new
switch.
- Unsafe override required: none.
- Qualification impact: alias/provider/cold-to-compressed regressions,
foreign-server and actual-store boundaries, CLI/native proof and
both-provider ASGI/native/HTTP proof above; no widened rollout.
- Rollback path: revert this Python bug fix.

## Review Readiness

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

## Checklist

- [x] One shared ownership selector, broader compression exclusions
unchanged, no new dependency
- [x] Documentation updated
- [x] Consumer-visible failing-before/passing-after regressions included
- [x] Relevant new and existing tests pass locally
- [x] Did not edit generated `CHANGELOG.md`

## Mandatory Local Push Gates

Normal `git push fork fix/issue-4159-client-retrieval-alias-20261011`
executed the installed pre-push hook and **`make ci-precheck` passed**:

- `cargo fmt --all -- --check`
- `cargo clippy --workspace -- -D warnings`
- `cargo test --workspace`
- Genuine editable Rust extension build, install and import verification
- Critical Python/native parity suite: **177 passed, 4 skipped, 1
warning**
- Conventional commit validation through commitlint

The warning is the existing no-client Anthropic tokenizer approximation
reported by `test_relevance_with_query_context`; it was not suppressed.
The earlier cold-build push timed out. Retrying with the real shared
Cargo
build cache and two build jobs completed all gates and pushed normally;
no bypass flag or skipped hook was used.

The review update `440fd96aaa11c0ea9263d9628ccc2b5f8b3865d4` also
passed every normal pre-push gate above, including 177 critical Python
tests. This run used `RUST_TEST_THREADS=2`: the preceding
default-parallel
attempt failed the unchanged native
`expired_get_does_not_wipe_concurrent_refresh` test's final-live
assertion
with a 20 ms TTL. Baseline/current native source hashes are identical.
No Rust fix is claimed; no tests or gates were filtered or bypassed.

The API regression update `c5c36ba0e7074cbd815498d00ee8f394bd7287bc`
again passed all normal local push gates above with the same bounded
test/build concurrency, genuine native rebuild/import and 177 critical
Python tests. The two additional API regressions and complete
seven-suite
161-test run are separate measured verification, not mocked CCR
plumbing.

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-24 08:45:20 -07:00
f89c9282a8 fix(proxy): accept HEADROOM_MEMORY_INJECTION_MODE=tool (#4395)
## Description

`memory_decision.py` handles mode `tool`, but
`resolve_memory_injection_mode` rejected it with `ValueError`, so the
value could not be used. The resolver now accepts `tool`; the
configuration docs list it.

Second commit, after review (Devin, comment 4348232164): in `tool` mode
the old `MemoryDecision` returned `inject=False`, and the handlers gate
the memory tool definitions on that same flag, so the agent would have
had no `memory_search` to call. The intent of `tool` (commit 71d5a7b5:
no auto-injected context, the model calls the memory tools itself) is
now implemented: the decision stays open for `tool`, and
`MemoryHandler.search_and_format_context` skips the context lookup, as
it already did for `MemoryMode.TOOL`.

Fixes #4391

## 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

- `headroom/proxy/memory_injection_mode_policy.py`: add `"tool"` to the
literal type and the accepted values; update the error text.
- `headroom/proxy/helpers.py`: comment documents `tool`.
- `docs/content/docs/configuration.mdx`: list `tool` for
`HEADROOM_MEMORY_INJECTION_MODE`.
- `tests/test_memory_injection_mode_policy.py`: resolver accepts `tool`
(case/space insensitive); `get_memory_injection_mode()` returns `tool`
from the env var.
- `headroom/proxy/memory_decision_policy.py`, `memory_decision.py`:
`tool` no longer produces a skip (`mode_tool` removed); `inject` stays
True so the handlers register the memory tools.
- `headroom/proxy/memory_handler.py`: `search_and_format_context`
returns None when `HEADROOM_MEMORY_INJECTION_MODE=tool` (before any
backend lookup).
- `tests/test_memory_decision.py`,
`tests/test_memory_decision_policy.py`: `tool` expectations changed to
`inject=True`, no skip reason; new test in
`test_memory_injection_mode_policy.py` covers the context skip and the
open decision.

## Testing

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

### Test Output

```text
# with the policy change reverted (tests/test_memory_injection_mode_policy.py)
E   ValueError: Invalid HEADROOM_MEMORY_INJECTION_MODE='tool'; expected 'live_zone_tail' or 'disabled'
FAILED tests/test_memory_injection_mode_policy.py::test_resolve_memory_injection_mode_accepts_known_values_case_insensitively
FAILED tests/test_memory_injection_mode_policy.py::test_get_memory_injection_mode_accepts_tool_from_env
2 failed, 2 passed

# second commit: new test with the src changes of that commit reverted
E   assert decision.inject is True / MemoryDecision(inject=False, skip_reason='mode_tool', ...)
1 failed, 4 passed
# second commit applied
$ pytest tests/test_memory_injection_mode_policy.py tests/test_memory_decision.py tests/test_memory_decision_policy.py tests/test_memory_handler_concurrent_init.py
37 passed, 1 skipped

# first commit, the four files listed under Real Behavior Proof
6 failed, 25 passed  (all 6 failures in test_proxy_system_prompt_immutable.py, same 6 on unmodified upstream/main)

$ ruff check <changed py files>
All checks passed!
$ ruff format --check <changed py files>
3 files already formatted
```

## Real Behavior Proof

- Environment: Linux (WSL2), Python 3.12.15, the real proxy server
(`run_server`) with persistent memory on (local backend, ONNX embedder),
Rust core from the headroom-ai 0.41.0 wheel, a local stub upstream on
127.0.0.1
- Exact command / steps: seed one memory for a test user, start the
proxy with `HEADROOM_MEMORY_INJECTION_MODE=tool`, send one non-streaming
`POST /v1/messages` that declares one client tool; repeat on
upstream/main and with `live_zone_tail` as controls (details below)
- Observed result: upstream/main returns HTTP 500 (`ValueError` from the
mode resolver); this branch returns HTTP 200, the stub receives the five
memory tools and the user message without a `## Relevant Memories` block
- Not tested: real Anthropic, streaming, the OpenAI/Gemini handlers and
the WebSocket path, `use_native_tool`, a memory tool-call round trip, a
Rust core built from this checkout

Details:

Setup: WSL2 Ubuntu (Linux 6.18 x86_64), Python 3.12.15, uvicorn 0.54.0,
fastapi 0.158.1, starlette 1.9.0, numpy 2.5.4, sqlite-vec 0.1.9,
onnxruntime (memory deps installed into a side directory, not the repo).
Worktree at PR head `9744d2a1` (base `e995eb9f`).
`headroom/_core.abi3.so` was copied (untracked, not committed) from the
official `headroom_ai-0.41.0-cp310-abi3-manylinux_2_28_x86_64.whl`
because the checkout has no built Rust core.

Stub upstream (`stub_mem.py`, 127.0.0.1:18796): answers every `POST
/v1/messages` with a normal 200 message and logs the tool names and the
last user message it received.
Proxy: the real server (`run_server`) with `memory_enabled=True`,
`memory_storage_mode="global"`, local backend with the ONNX embedder,
`ANTHROPIC_TARGET_API_URL=http://127.0.0.1:18796`,
`HEADROOM_MEMORY_INJECTION_MODE=tool`, port 18795, `--no-cache
--no-rate-limit` equivalents. (`headroom proxy --memory` was not used:
the CLI needs the optional `mcp` package, which is not installed in this
environment. `mem_proxy.py` builds the same `ProxyConfig` and calls
`run_server`.)
Memory content: before each run, `mem_seed.py` saves one memory for user
`proofuser` ("The user prefers PostgreSQL 16 with pgvector for every
database.") through the real `MemoryHandler`/`LocalBackend`; a search
for it returns 1 hit.
Client (`mem_client.py`): one non-streaming `POST /v1/messages` with
`x-headroom-user-id: proofuser`, the message "Which database do I
prefer?" and one client tool `get_weather` (the memory tools are
injected only when the client declares tools).

Before = `upstream/main` (`e995eb9f`). After = PR head (`9744d2a1`).

### Before (upstream/main)

```
git head: e995eb9f  HEADROOM_MEMORY_INJECTION_MODE=tool
client: HTTP 500 Internal Server Error
ERROR - event=proxy_inbound_request_aborted ... path=/v1/messages reason=ValueError
ValueError: Invalid HEADROOM_MEMORY_INJECTION_MODE='tool'; expected 'live_zone_tail' or 'disabled'
--- stub upstream received
(nothing received)
```

Every request fails at `get_memory_injection_mode()`
(`headroom/proxy/helpers.py:267` ->
`memory_injection_mode_policy.py:19`) and never reaches the upstream.

### After (PR head 9744d2a1)

```
git head: 9744d2a1  HEADROOM_MEMORY_INJECTION_MODE=tool
client: HTTP 200 {"id": "msg_ok", "type": "message", "role": "assistant", "model": "claude-sonnet-4-5", "content": [{"type": "text", "text": "ok"}], "stop_reason": "end_turn", "usage": {"input_tokens": 10, "output_tokens": 2}}
INFO - event=memory_mode_skip mode=tool user_id=proofuser reason=tool_mode_no_auto_injection
INFO - [hr_1792672967_000001] Memory: Injected tools: ['memory_save', 'memory_search', 'memory_update', 'memory_delete', 'memory_list']
--- stub upstream received
STUB-UPSTREAM POST /v1/messages tools=['get_weather', 'headroom_retrieve', 'memory_delete', 'memory_list', 'memory_save', 'memory_search', 'memory_update']
STUB-UPSTREAM last_user_content="Which database do I prefer?"
```

The request succeeds, the upstream receives the five memory tool
definitions next to the client's own tool, and the user message is
forwarded unchanged (no `## Relevant Memories` block; `grep -c "Relevant
Memories"` on the stub log = 0).

### Control 1: default mode on the PR head (shows the seeded memory is
retrievable)

Same setup, `HEADROOM_MEMORY_INJECTION_MODE=live_zone_tail`:

```
INFO - event=memory_inject user=proofuser scope=global count=1 chars=793 budget_tokens=1024
INFO - event=memory_injection ... decision=injected_live_zone_tail bytes_injected=793
STUB-UPSTREAM ... tools=['get_weather', 'headroom_retrieve', 'memory_delete', 'memory_list', 'memory_save', 'memory_search', 'memory_update']
STUB-UPSTREAM last_user_content="Which database do I prefer?\n\n## Relevant Memories (scope: global)\n\nThese are READ-ONLY entries recalled from prior sessions ..."
```

So with the same memory and the same request, `live_zone_tail` injects
the memory context into the user message, and `tool` does not.

### Control 2: only the first commit (62ec86b5, "accept tool")

Same setup, `HEADROOM_MEMORY_INJECTION_MODE=tool`:

```
git head: 62ec86b5  HEADROOM_MEMORY_INJECTION_MODE=tool
client: HTTP 200 {...}
STUB-UPSTREAM POST /v1/messages tools=['get_weather', 'headroom_retrieve']
STUB-UPSTREAM last_user_content="Which database do I prefer?"
```

The request no longer fails, but the memory tool definitions are
missing. This is the case the second commit (`9744d2a1`) fixes.

### Commands

```
python -P mem_seed.py <db>                     # PYTHONPATH=.:deps-mem, seeds one memory for proofuser
python -P stub_mem.py 18796 stub.log &
HEADROOM_MEMORY_INJECTION_MODE=tool ANTHROPIC_TARGET_API_URL=http://127.0.0.1:18796 PYTHONPATH=.:deps-mem \
  python -P mem_proxy.py 18795 <db> &
python -P mem_client.py 18795
```

Scripts and raw outputs: `/var/tmp/cb-pub/proof/` (WSL): `run_mem.sh`,
`mem_proxy.py`, `mem_seed.py`, `stub_mem.py`, `mem_client.py`,
`mem_{before,after,control,commit1}.proxy.log`,
`mem_{before,after,control,commit1}.stub.log`, `before_mem.out`,
`after_mem.out`, `control_mem.out`, `commit1_mem.out`.

### Not tested

- Real Anthropic API (stub upstream only).
- Streaming requests, the OpenAI Chat/Responses handlers, Gemini, and
the WebSocket path; only Anthropic `POST /v1/messages` non-streaming was
run.
- `use_native_tool` (native `memory_20250818` tool) and
`ProxyConfig.memory_mode="tool"`; only the env var was exercised.
- Memory tool execution (a `memory_save` call round trip) in tool mode.
- The Rust core is the 0.41.0 wheel's, not one built from this checkout.
- `headroom proxy --memory` via the CLI (the `mcp` package is not
installed here).

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: no (default stays `live_zone_tail`;
only a previously rejected value is accepted)
- Kill switch / disable path: unset the env var
- Unsafe override required: no
- Qualification impact: none expected
- Rollback path: revert the 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
- [x] 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
- [ ] New and existing unit tests pass locally with my changes (6
existing failures in test_proxy_system_prompt_immutable.py are identical
on unmodified upstream/main in my environment)
- [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

If maintainers would rather drop `tool` than support it, the alternative
is removing it from the resolver and the docs.

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>
2026-10-24 08:44:42 -07:00
Radhakrishnan PachyappanandJD Davis 47288d67e9 docs(troubleshooting): explain the frozen ghcr.io/chopratejas/headroom image (#4069)
## Description

Documents why `ghcr.io/chopratejas/headroom` stays frozen at `0.27.0`
forever: GHCR doesn't redirect packages across an org move, and the
project moved from the `chopratejas` personal account to
`headroomlabs-ai` (already fixed for the install path itself in #1867).
Anyone still referencing the old path — an old script, tutorial, or a
`HEADROOM_DOCKER_IMAGE` override saved from before the move — gets a
permanently stale image with no error to explain why.

Closes #4065

## Type of Change

- [x] Documentation update

## Changes Made

- Added a "Docker image frozen at an old version" entry to
`docs/content/docs/troubleshooting.mdx`, next to the existing "pipx
installs an older Headroom version" entry (same root cause pattern: a
stale package reference).

## Testing

- [x] Manual testing performed

### Test Output

```text
Confirmed both images resolve on GHCR (public, read-only manifest inspect, no daemon needed):

$ docker manifest inspect ghcr.io/chopratejas/headroom:latest
  -> resolves; still live, frozen since the org move (matches the reported 0.27.0 symptom)

$ docker manifest inspect ghcr.io/headroomlabs-ai/headroom:latest
  -> resolves; this is the actively-published current image

Confirmed current docs (README.md, docker-install.mdx, installation.mdx, troubleshooting.mdx)
already reference only ghcr.io/headroomlabs-ai/headroom — no other stale references found.
```

## Real Behavior Proof

- Environment: local clone, no Docker daemon needed (registry manifest
reads only)
- Exact command / steps: `docker manifest inspect
ghcr.io/chopratejas/headroom:latest` vs
`ghcr.io/headroomlabs-ai/headroom:latest`
- Observed result: both resolve; old path is the dead/frozen one
described in #1867's CHANGELOG entry, new path is current
- Not tested: did not have a Docker daemon available to run `headroom
--version` inside each container directly; relied on manifest-level
confirmation plus the existing CHANGELOG entry for #1867 describing the
exact same symptom

## Runtime Rollout Safety

- Rollout-managed feature(s): N/A (docs only)
- Minimum rollout channel: N/A
- Stable/default behavior changed: No
- Kill switch / disable path: N/A
- Unsafe override required: No
- Qualification impact: None
- Rollback path: Revert the docs change

## 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
(N/A, docs only)
- [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 (N/A, docs only)
- [ ] New and existing unit tests pass locally with my changes (N/A,
docs only)
- [x] I did **not** edit `CHANGELOG.md`

## Additional Notes

This doesn't fix #4065's install itself (that was already fixed in #1867
— the reporter is likely on a stale script/tutorial/env override). It's
aimed at preventing the next duplicate report of the same symptom by
making the cause and fix self-discoverable in the troubleshooting doc.
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4069"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-24 08:43:44 -07:00
Radhakrishnan PachyappanandJerrettDavis 125a703a65 fix(security): restrict the Windows runtime log via NTFS ACL, not just warn (#4135)
## Description

Windows never got the owner-only guarantee POSIX mode bits give the
proxy log, its rotated backups, and the JSONL request log — `os.chmod`
there only toggles the read-only attribute and leaves the real access
control (the ACL) untouched. The prior fix (#3728) correctly scoped that
gap and warned about it, but the warning text read as cryptic to at
least one user (reported here and on Discord), and closing the gap was
explicitly left as a follow-up pending a Windows CI runner to verify
against.

This implements that follow-up.

Closes #4058

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- `headroom/_fileperms_windows.py` (new): the NTFS ACL implementation
via `ctypes` (no `pywin32` dependency) — a DACL with exactly one entry,
the calling user with full control, built fresh rather than merged with
the inherited entries that made the file readable in the first place,
applied with `PROTECTED_DACL_SECURITY_INFORMATION` so those inherited
entries are dropped.
- `headroom/fileperms.py`:
`restrict_fd_to_owner`/`restrict_path_to_owner` go through the new
module on Windows instead of giving up immediately; added
`verify_owner_only(path)`, which re-reads the actual DACL rather than
trusting a static platform flag — the ACL call can fail for reasons
unrelated to this code (a non-NTFS volume, a missing privilege).
- `headroom/proxy/helpers.py`: the startup warning now fires only when
`verify_owner_only` reports failure (not unconditionally on Windows),
and the wording says plainly that other accounts may be able to read the
file instead of the more technical original phrasing.
- `tests/test_cache_breakpoint_diagnostics.py`: new Windows-specific
tests exercising the ACL path directly (mirroring the existing POSIX
mode-bit tests), plus updates to the two tests whose assumption
("Windows protection is impossible") this PR deliberately changes.
- `docs/content/docs/proxy.mdx`: updated the "Who can read the logs"
section to describe the ACL instead of "Headroom does not restrict the
log file."
- `.github/workflows/ci.yml`: added a `windows-file-permissions` job
(same lightweight pattern as the existing
`windows-tool-result-interceptors` job) so this is exercised on a real
Windows runner going forward, addressing the maintainer's own "I'd want
a Windows runner in CI first" from #3728's review thread.

Deliberately **not** extended to the sqlite-backed memory/CCR stores
(`ensure_private_file`/`connect_private_sqlite`) or `private_dir` —
those remain unenforced on Windows, same as before this change, to keep
this PR scoped to what #4058 is actually about.

## Testing

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

### Test Output

```text
$ pytest tests/test_cache_breakpoint_diagnostics.py tests/test_private_state_files.py tests/test_proxy_handler_helpers.py -q
99 passed, 49 skipped in 13.50s

$ ruff check headroom/fileperms.py headroom/_fileperms_windows.py headroom/proxy/helpers.py tests/test_cache_breakpoint_diagnostics.py
All checks passed!

$ ruff format --check <same files>
4 files already formatted

$ mypy headroom/fileperms.py headroom/_fileperms_windows.py --ignore-missing-imports --platform linux
Found 1 error in 1 file (checked 2 source files)
# that 1 error is in headroom/providers/model_metadata.py, pre-existing and
# unrelated -- confirmed via `git stash` against main before these changes.

$ actionlint .github/workflows/ci.yml
# clean, no output
```

## Real Behavior Proof

- Environment: actual Windows 11 machine (not simulated/mocked) — this
is the one part of #3728 the original author explicitly could not do ("I
cannot execute or test on this machine")
- Exact command / steps: created a file, called the new
`restrict_handle`/`restrict_path`, then independently verified the
result with `icacls <path>` (a separate tool, not my own code checking
its own work)
- Observed result:
  ```
  C:\Users\...\Temp\acl_proto_test.txt LAPTOP-...\<user>:(F)
  Successfully processed 1 files; Failed processing 0 files
  ```
Exactly one ACE, granting the current user full control — no `Everyone`,
no `Users`, no leftover inherited entries. Also ran the full
`test_cache_breakpoint_diagnostics.py` suite on this same machine,
including the new Windows-specific tests
(`test_runtime_log_is_owner_only_via_acl_with_previews_off`,
`test_rotated_backups_are_owner_only_via_acl`) which were previously
impossible to exercise without a Windows box.
- Not tested: a non-NTFS volume or a locked-down-privilege environment
(the failure paths `verify_owner_only` is meant to catch) — those fall
back to the warning, covered by the existing simulated test, but I don't
have a non-NTFS Windows volume handy to exercise for real.

## Runtime Rollout Safety

- Rollout-managed feature(s): N/A
- Minimum rollout channel: N/A
- Stable/default behavior changed: Only on Windows — the runtime log is
now actually restricted instead of warned-about; POSIX behavior is
unchanged.
- Kill switch / disable path: None needed — this only adds protection
where there was none; a failure falls back to the pre-existing
warning-only behavior automatically via `verify_owner_only`.
- Unsafe override required: No
- Qualification impact: None
- Rollback path: Revert; Windows returns to warn-only, same as before
this PR.

## 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
- [x] 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 did **not** edit `CHANGELOG.md`

## Additional Notes

Scope boundary, stated explicitly rather than left implicit: this does
not touch `ensure_private_file`/`connect_private_sqlite`/`private_dir`,
which stay unenforced on Windows as before. Extending ACL protection
there would be a reasonable follow-up but is a separate, larger piece of
surface (sqlite main file + `-wal`/`-shm`/`-journal` sidecars) than what
#4058 asked about.
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4135"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-24 08:39:05 -07:00
2a70d12819 fix(proxy): drop web_search_call history from a Responses request with no web_search tool (#4202)
## Description

Codex on a custom model provider (how `headroom wrap codex` configures
it) compacts locally: it resends the whole history to `/v1/responses`
with `tools: []`. When that history holds a hosted `web_search_call`
item, the ChatGPT backend answers 200 and then sends the in-band error
"response protection is unavailable". Codex ignores in-band `error`
events and reports "stream closed before response.completed". It retries
five times, then runs the same compaction before every later prompt, so
the session never answers again. Headroom forwards that body unchanged
today, on HTTP and on the Codex WebSocket.

The backend behaviour comes from a user report. A compaction body
captured from the failing session held 10 `web_search_call` items. Sent
straight to `chatgpt.com/backend-api/codex/responses`, with no Headroom
in the path, it failed every time. The same body completed with the 10
items removed, and also completed with `tools: [{"type":
"web_search"}]`. A normal turn on the same history, which declares the
tool, is unaffected.

The same failure appears without Headroom:
- openai/codex#51962: Codex's built-in provider, remote compaction of a
resumed history. Removing only the `web_search_call` items fixes it
there too.
- openai/codex#52016: the same two error strings with direct ChatGPT
login.

This PR drops `web_search_call` items from a Responses `input` when the
request declares no web_search tool, before the body leaves the proxy,
and marks the body mutated so the edited bytes are sent. Only the search
action (query or URL) leaves the history. The search results were never
in it. The answer the model gave afterwards is a separate `message`
item, and it stays. A bypass request (`x-headroom-bypass: true`) is left
untouched. Every other body is forwarded exactly as before.

This works around a backend behaviour; it does not fix a Headroom bug.
It should be removed once the backend accepts such a body.

Closes #4201

## 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

- **The drop.** `_drop_undeclared_web_search_calls(payload)`
(`headroom/proxy/handlers/openai.py`, next to
`_ensure_chatgpt_responses_store_false`) drops every `web_search_call`
item from `input`. It logs `event=web_search_history request_id=...
dropped=N reason=no_web_search_tool`. It does nothing in these cases:
- A tool whose `type` starts with `web_search` is declared
(`web_search`, `web_search_preview`, the dated variants), in top-level
`tools` or in a Codex `additional_tools` input item. Codex 0.149 and
later sends tools that way, with no top-level `tools` (#3185). Without
this check a normal Codex turn would lose its search history.
- The request continues a `previous_response_id`, because its
declarations may live server-side.
  - `input` is not a list, or holds no `web_search_call`.
  - `HEADROOM_WEB_SEARCH_HISTORY=0`.
- **HTTP `/v1/responses`** (`handle_openai_responses`): the drop runs
before the handler first reads `input`, so compression, memory and
telemetry see the same body that is sent. It is skipped when `_bypass`
is set (`x-headroom-bypass: true` or `x-headroom-mode: passthrough`). A
drop marks the `BodyMutationTracker` with
`responses_web_search_history`, and both the stream and the buffered
forwarder pick canonical bytes from that flag. With no drop, the
client's bytes go out verbatim, as before.
- **Codex WebSocket `/v1/responses`:** the drop is called from
`_normalize_ws_response_create_for_upstream`. Every `response.create`
frame passes through there on its way upstream: the first frame, the
WS-to-HTTP fallback that replays it, later frames, and memory
continuations.
- On a bypass session (`_ws_bypass`, the same header check on the
WebSocket handshake headers) the drop is skipped and every frame goes
out as the client sent it.
- `_ws_bypass` is now resolved just before that helper is defined,
instead of a few lines later, so the helper can read it. Its value and
log line are unchanged.
- `_drop_undeclared_web_search_calls_from_frame` returns the same string
object unless it dropped something. A frame is parsed only if it holds
the literal `"web_search_call"` or any `\u` escape, since JSON can spell
the type as `"web_search\u005fcall"` and a letter or underscore can only
be escaped that way; other frames skip the parse.
- **With `optimize` off:** the drop still runs, like the forced
`store=false`, because it is a repair the request needs in order to
succeed, not an optimization.
- **Kill switch:** `HEADROOM_WEB_SEARCH_HISTORY=0`, read per request
through `runtime_env.getenv`.
- It is registered in `RUNTIME_ENV_KNOBS`, so `headroom wrap` pushes it
to a reused proxy through `POST /admin/runtime-env`, and `/health`
reports it under `config.runtime_env`.
- The allowlist table in `docs/content/docs/security-model.mdx` gets the
matching row.
- **Tests in `tests/test_openai_responses_web_search_history.py` (22
tests):**
- The decision. Drops when `tools` is empty, absent, function-only, or
holds a function named `web_search`. Keeps with each web_search type
spelling, with a web_search tool in `additional_tools`, with
`previous_response_id`, with string `input`, with no search history, and
under the kill switch.
- The frame helper: wrapped and flattened frames, and the same object
back for anything it leaves alone.
  - Through the app:
- HTTP stream and buffered: upstream receives the body minus those
items, and the outbound log names the reason.
- HTTP byte-identical passthrough for a declared tool and for a history
with no searches.
- HTTP bypass, stream and buffered: byte-identical, no
`web_search_history` line.
- WS first frame, and a WS later frame after a normal turn that is
forwarded unchanged.
    - WS bypass session: first and later frame unchanged.
    - The WS-to-HTTP fallback.
- **Test in `tests/test_runtime_env.py`:**
`test_override_disables_web_search_history_drop_without_env` checks that
a runtime-env override of `0` turns the drop off with no environment
variable set, and that `explicit_env` puts the knob in the wrap payload.

## Testing

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

What was run:
- Unit tests: the new file, `tests/test_runtime_env.py`, and every
existing test file for the Responses handler, the Codex WebSocket, Codex
routing and byte-faithful forwarding. Not the whole suite.
- Lint and types: `ruff check`, `ruff format --check` (ruff 0.16.8, the
pre-commit pin) and `mypy` on the changed files. Not the whole tree.
- Every run used a temporary `HOME`, with `HEADROOM_SAVINGS_EVENTS_PATH`
in that directory and `HEADROOM_BEACON=off`.

### Test Output

With the two drop call sites removed from `openai.py`, which is upstream
`main` behaviour (the helpers stay so the test module imports):

```text
$ python -m pytest tests/test_openai_responses_web_search_history.py -q -p no:cacheprovider
FAILED tests/test_openai_responses_web_search_history.py::test_http_compaction_request_reaches_upstream_without_web_search_calls[stream]
FAILED tests/test_openai_responses_web_search_history.py::test_http_compaction_request_reaches_upstream_without_web_search_calls[buffered]
FAILED tests/test_openai_responses_web_search_history.py::test_ws_first_frame_reaches_upstream_without_web_search_calls
FAILED tests/test_openai_responses_web_search_history.py::test_ws_later_frame_reaches_upstream_without_web_search_calls
FAILED tests/test_openai_responses_web_search_history.py::test_ws_http_fallback_gets_the_frame_without_web_search_calls
=================== 5 failed, 17 passed, 1 warning in 2.17s ====================
```

With the bypass gates and the knob registration removed, which is this
PR's first revision, 45d134db:

```text
$ python -m pytest tests/test_openai_responses_web_search_history.py tests/test_runtime_env.py -q -p no:cacheprovider
E   assert b'{"model":"g...store":false}' == b'{\n  "model...re": false\n}'
E   assert b'{"model":"g...store":false}' == b'{\n  "model...re": false\n}'
E   assert ['{"type": "r...re": false}}'] == ['{"type": "r...re": false}}']
E   AssertionError: assert 1 == 0
FAILED tests/test_openai_responses_web_search_history.py::test_http_bypass_request_is_forwarded_byte_identical[stream]
FAILED tests/test_openai_responses_web_search_history.py::test_http_bypass_request_is_forwarded_byte_identical[buffered]
FAILED tests/test_openai_responses_web_search_history.py::test_ws_bypass_session_frames_reach_upstream_unchanged
FAILED tests/test_runtime_env.py::test_override_disables_web_search_history_drop_without_env
=================== 4 failed, 42 passed, 1 warning in 3.54s ====================
```

With the fix (418faa61):

```text
$ python -m pytest tests/test_openai_responses_web_search_history.py tests/test_runtime_env.py -q -p no:cacheprovider
======================== 46 passed, 1 warning in 8.57s =========================

$ python -m pytest tests/test_openai_responses_web_search_history.py tests/test_runtime_env.py tests/test_proxy_byte_faithful_forwarding.py tests/test_ccr_response_handler_openai_responses.py tests/test_codex_responses_passthrough_bytes.py tests/test_codex_responses_waste_signals.py tests/test_codex_ws_compression_scheduler.py tests/test_codex_ws_per_frame_memory.py tests/test_codex_ws_savings_deferral.py tests/test_openai_codex_routing.py tests/test_openai_codex_ws_lifecycle.py tests/test_openai_codex_ws_timings.py tests/test_openai_responses_additional_tools.py tests/test_openai_responses_buffered_sse.py tests/test_openai_responses_compression_units.py tests/test_openai_responses_context_compaction.py tests/test_openai_responses_null_arguments.py tests/test_openai_responses_output_shaper.py tests/test_openai_responses_read_protection.py tests/test_openai_responses_t3_replay_regression.py tests/test_openai_responses_traffic_learner.py tests/test_output_shaper_responses.py tests/test_provider_codex_responses.py tests/test_provider_openai_responses.py tests/test_proxy_openai_cache_key_integration.py tests/test_proxy_openai_cache_stability.py tests/test_proxy_openai_rate_limit_key.py tests/test_proxy_openai_responses_bypass.py tests/test_proxy_openai_responses_integration.py tests/test_proxy_openai_responses_stream_ccr.py tests/test_proxy_openai.py tests/test_responses_cross_turn_dedup.py tests/test_responses_pyo3_compression.py tests/test_responses_savings_denominator.py tests/test_responses_ws_pyo3_compression.py -q -p no:cacheprovider
================= 552 passed, 14 skipped, 2 warnings in 24.94s =================

$ ruff check headroom/proxy/handlers/openai.py headroom/proxy/runtime_env.py tests/test_openai_responses_web_search_history.py tests/test_runtime_env.py && ruff format --check headroom/proxy/handlers/openai.py headroom/proxy/runtime_env.py tests/test_openai_responses_web_search_history.py tests/test_runtime_env.py   # ruff 0.16.8
All checks passed!
4 files already formatted

$ mypy headroom/proxy/handlers/openai.py headroom/proxy/runtime_env.py
Success: no issues found in 2 source files
```

## Real Behavior Proof

- Environment: macOS 27.0.1 arm64, Python 3.11.13, a temporary `HOME`.
Upstream `main` f1bc2609 (exported with `git archive`) compared with
this branch at 418faa61, in the same venv.
- Exact command / steps: `repro_web_search_history.py` (below), run as
`PYTHONPATH=<tree> LITELLM_LOCAL_MODEL_COST_MAP=True python
repro_web_search_history.py`.
- It boots the real app with `create_app(ProxyConfig(optimize=False,
openai_api_url=<mock>))` inside a lifespan `TestClient`.
- The OpenAI upstream points at a local mock that records the bytes it
receives: an HTTP server for the POST and a `websockets` server for the
WebSocket.
- It sends a Codex-shaped compaction body (`tools: []`, two
`web_search_call` items, one `search` and one `open_page`) over HTTP
`POST /v1/responses` (stream) and over the Codex WebSocket.
- Each transport also gets two controls: the same history with `tools:
[{"type": "web_search"}]`, and the compaction body sent with
`x-headroom-bypass: true`.
- Observed result: main forwards all six requests with their
`web_search_call` items; this branch drops them from the `tools: []`
compaction body on HTTP and WebSocket and leaves both controls
byte-identical. Details:
- On `main`, all six requests reach upstream byte-identical,
`web_search_call` items included.
- On the branch, the compaction body loses its two items on both
transports and the drop is logged.
- On the branch, both controls go out byte-identical on both transports,
including the bypass request.

```text
=== main @ f1bc2609
== HTTP POST /v1/responses ==
-- compaction, tools: []
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: event=outbound_request forwarder=streaming method=POST body_bytes=739 body_mutated=false mutation_reasons= source=passthrough
-- control, web_search declared
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: event=outbound_request forwarder=streaming method=POST body_bytes=761 body_mutated=false mutation_reasons= source=passthrough
-- control, tools: [] with x-headroom-bypass: true
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: event=outbound_request forwarder=streaming method=POST body_bytes=739 body_mutated=false mutation_reasons= source=passthrough
== WebSocket /v1/responses (response.create) ==
-- compaction, tools: []
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: (no matching log line)
-- control, web_search declared
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: (no matching log line)
-- control, tools: [] with x-headroom-bypass: true
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: (no matching log line)
=== branch @ 418faa61
== HTTP POST /v1/responses ==
-- compaction, tools: []
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'message', 'message']
   byte-identical: False
   log: event=web_search_history dropped=2 reason=no_web_search_tool
   log: event=outbound_request forwarder=streaming method=POST body_bytes=443 body_mutated=true mutation_reasons=responses_web_search_history source=canonical
-- control, web_search declared
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: event=outbound_request forwarder=streaming method=POST body_bytes=761 body_mutated=false mutation_reasons= source=passthrough
-- control, tools: [] with x-headroom-bypass: true
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: event=outbound_request forwarder=streaming method=POST body_bytes=739 body_mutated=false mutation_reasons= source=passthrough
== WebSocket /v1/responses (response.create) ==
-- compaction, tools: []
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'message', 'message']
   byte-identical: False
   log: event=web_search_history dropped=2 reason=no_web_search_tool
-- control, web_search declared
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: (no matching log line)
-- control, tools: [] with x-headroom-bypass: true
   client sent : ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   upstream got: ['message', 'web_search_call', 'web_search_call', 'message', 'message']
   byte-identical: True
   log: (no matching log line)
```

The backend side was measured before this PR, from a user report. The
captured compaction body was sent straight to `chatgpt.com` with no
proxy in the path. As sent, it failed with "response protection is
unavailable". With its 10 `web_search_call` items removed, or with a
web_search tool declared, it completed. Headroom Desktop has carried the
same drop as a downstream patch since 2026-10-08, on the HTTP forwarders
only. Through that patch, the forked session that had failed six
compactions in a row compacted on the first try
(`event=web_search_history dropped=10`).

- Not tested: a live ChatGPT backend run of this branch, among others:
- This branch was not run against the live ChatGPT backend, and no live
Codex session went through it. The request shape and the backend A/B
above come from the downstream patch, which makes the same edit to the
same body.
- The WebSocket path has unit and mock coverage only. The downstream
verification ran over HTTP, because Headroom Desktop configures Codex
with `supports_websockets = false`. `headroom wrap codex` sets
`supports_websockets = true`, so most upstream users take the WebSocket
path.
- No captured Codex 0.149+ compaction body with `additional_tools` items
was available.
- The `headroom wrap` push of the knob to a reused proxy was not run end
to end. The test covers `explicit_env` and the override reaching the
reader.
  - Linux and Windows were not run.

<details>
<summary>repro_web_search_history.py</summary>

```python
"""Repro: web_search_call history on a Responses request with no web_search tool.

Boots the real Headroom proxy app (create_app + ProxyConfig, optimize off so
compression cannot be the variable) in-process, points its OpenAI upstream at
a local mock, and sends a Codex local-compaction body (full history,
``tools: []``, two hosted ``web_search_call`` items) over:

  1. HTTP POST /v1/responses (stream)
  2. the Codex WebSocket /v1/responses (first response.create frame)

plus two controls on each transport that must reach upstream unchanged: the
same history with a web_search tool declared (a normal Codex turn), and the
compaction body sent with ``x-headroom-bypass: true``.

The mock records what upstream received. No network beyond 127.0.0.1, no
real provider call.

Run against a source tree:
  PYTHONPATH=<tree> LITELLM_LOCAL_MODEL_COST_MAP=True <venv>/bin/python repro_web_search_history.py
"""

from __future__ import annotations

import asyncio
import json
import logging
import os
import re
import sys
import tempfile
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

_TMP = tempfile.mkdtemp(prefix="wsh-repro-")
os.environ["HOME"] = _TMP
os.environ["HEADROOM_SAVINGS_EVENTS_PATH"] = os.path.join(_TMP, "savings_events.jsonl")
os.environ.setdefault("HEADROOM_BEACON", "off")
os.environ.setdefault("HEADROOM_TELEMETRY", "off")

import headroom  # noqa: E402
import websockets  # noqa: E402
from fastapi.testclient import TestClient  # noqa: E402

from headroom.proxy.server import ProxyConfig, create_app  # noqa: E402

HEADERS = {
    "authorization": "Bearer sk-test-not-a-real-key",
    "user-agent": "codex_cli_rs/0.161.0",
    "originator": "codex_cli_rs",
    "content-type": "application/json",
}


BYPASS_HEADERS = {**HEADERS, "x-headroom-bypass": "true"}
CASES = (
    (False, HEADERS, "compaction, tools: []"),
    (True, HEADERS, "control, web_search declared"),
    (False, BYPASS_HEADERS, "control, tools: [] with x-headroom-bypass: true"),
)


def compaction_body(*, declare_web_search: bool) -> dict:
    return {
        "model": "gpt-5.5",
        "instructions": "Codex base instructions.",
        "input": [
            {
                "type": "message",
                "role": "user",
                "content": [{"type": "input_text", "text": "what changed in the release?"}],
            },
            {
                "type": "web_search_call",
                "id": "ws_1",
                "status": "completed",
                "action": {"type": "search", "query": "release notes"},
            },
            {
                "type": "web_search_call",
                "id": "ws_2",
                "status": "completed",
                "action": {"type": "open_page", "url": "https://example.com/notes"},
            },
            {
                "type": "message",
                "role": "assistant",
                "content": [{"type": "output_text", "text": "Three fixes shipped."}],
            },
            {
                "type": "message",
                "role": "user",
                "content": [{"type": "input_text", "text": "Summarize the conversation."}],
            },
        ],
        "tools": [{"type": "web_search"}] if declare_web_search else [],
        "tool_choice": "auto",
        "stream": True,
        "store": False,
    }


def types(payload: dict) -> list[str]:
    return [item["type"] for item in payload["input"]]


SSE = (
    b'event: response.created\ndata: {"type":"response.created","response":{"id":"r_1"}}\n\n'
    b'event: response.completed\ndata: {"type":"response.completed","response":{"id":"r_1",'
    b'"usage":{"input_tokens":10,"output_tokens":2,"total_tokens":12}}}\n\n'
)


class _HttpUpstream(BaseHTTPRequestHandler):
    received: list[bytes] = []

    def do_POST(self) -> None:  # noqa: N802
        self.received.append(self.rfile.read(int(self.headers["content-length"])))
        self.send_response(200)
        self.send_header("content-type", "text/event-stream")
        self.send_header("content-length", str(len(SSE)))
        self.end_headers()
        self.wfile.write(SSE)

    def log_message(self, *args) -> None:
        pass


class _WsUpstream:
    def __init__(self) -> None:
        self.received: list[str] = []
        self.port = 0
        ready = threading.Event()

        async def handler(conn) -> None:
            async for frame in conn:
                self.received.append(frame)
                await conn.send(json.dumps({"type": "response.created", "response": {"id": "r_1"}}))
                await conn.send(
                    json.dumps({"type": "response.completed", "response": {"id": "r_1"}})
                )

        async def main() -> None:
            async with websockets.serve(handler, "127.0.0.1", 0) as server:
                self.port = server.sockets[0].getsockname()[1]
                ready.set()
                await asyncio.Future()

        threading.Thread(target=lambda: asyncio.run(main()), daemon=True).start()
        ready.wait(5)


def make_client(upstream_url: str) -> TestClient:
    config = ProxyConfig(
        optimize=False,
        cache_enabled=False,
        rate_limit_enabled=False,
        cost_tracking_enabled=False,
        log_requests=False,
        ccr_inject_tool=False,
        ccr_handle_responses=False,
        ccr_context_tracking=False,
        image_optimize=False,
        openai_api_url=upstream_url,
    )
    return TestClient(create_app(config))


class _Lines(logging.Handler):
    def __init__(self) -> None:
        super().__init__(logging.INFO)
        self.lines: list[str] = []

    def emit(self, record: logging.LogRecord) -> None:
        msg = record.getMessage()
        if "web_search_history" in msg or (
            "event=outbound_request" in msg and "/v1/responses" in msg
        ):
            self.lines.append(msg)


def report(label: str, sent_bytes: bytes | str, got: bytes | str, logs: _Lines) -> None:
    sent = json.loads(sent_bytes)
    wire = json.loads(got)
    sent_payload = sent.get("response", sent)
    wire_payload = wire.get("response", wire)
    print(f"-- {label}")
    print(f"   client sent : {types(sent_payload)}")
    print(f"   upstream got: {types(wire_payload)}")
    print(f"   byte-identical: {sent_bytes == got}")
    for line in logs.lines or ["(no matching log line)"]:
        print("   log: " + re.sub(r" (path|request_id)=\S+", "", line))
    logs.lines.clear()


def main() -> int:
    proxy_logger = logging.getLogger("headroom.proxy")
    proxy_logger.setLevel(logging.INFO)
    logs = _Lines()
    proxy_logger.addHandler(logs)
    print(f"headroom source: {os.path.dirname(headroom.__file__)}")

    http_server = ThreadingHTTPServer(("127.0.0.1", 0), _HttpUpstream)
    threading.Thread(target=http_server.serve_forever, daemon=True).start()
    print("== HTTP POST /v1/responses ==")
    with make_client(f"http://127.0.0.1:{http_server.server_port}") as client:
        for declare, headers, label in CASES:
            body = json.dumps(compaction_body(declare_web_search=declare)).encode()
            with client.stream("POST", "/v1/responses", headers=headers, content=body) as response:
                assert response.status_code == 200, response.status_code
                response.read()
            report(label, body, _HttpUpstream.received[-1], logs)

    ws_upstream = _WsUpstream()
    print("== WebSocket /v1/responses (response.create) ==")
    with make_client(f"http://127.0.0.1:{ws_upstream.port}") as client:
        for declare, headers, label in CASES:
            frame = json.dumps(
                {"type": "response.create", "response": compaction_body(declare_web_search=declare)}
            )
            before = len(ws_upstream.received)
            with client.websocket_connect("/v1/responses", headers=headers) as ws:
                ws.send_text(frame)
                while json.loads(ws.receive_text()).get("type") != "response.completed":
                    pass
            assert len(ws_upstream.received) == before + 1
            report(label, frame, ws_upstream.received[-1], logs)
    return 0


if __name__ == "__main__":
    sys.exit(main())
```

</details>

## Runtime Rollout Safety

- Rollout-managed feature(s): None.
- Minimum rollout channel: Stable.
- Stable/default behavior changed: Yes, for `/v1/responses` requests
(HTTP and Codex WebSocket) that meet all of these:
  - `input` holds `web_search_call` items;
- neither `tools` nor an `additional_tools` item declares a web_search
tool;
  - no `previous_response_id` is set;
- the request does not carry `x-headroom-bypass: true` or
`x-headroom-mode: passthrough`.

Those requests now go upstream without the `web_search_call` items,
re-serialized: canonical bytes on HTTP, `json.dumps` of the frame on the
WebSocket. Any other edit already made to the body rides along, as it
does whenever the body is mutated. One example is the forced
`store=false` on ChatGPT auth. Every other request is forwarded as
before, byte-identical when nothing else changed it. Bypass requests
stay byte-identical. Chat Completions, Anthropic, Gemini and the
`/v1/responses/{subpath}` passthrough are not touched.
- Kill switch / disable path: `HEADROOM_WEB_SEARCH_HISTORY=0` (also
`false`, `no`, `off`). It is read per request and registered as a
runtime-env knob, so there are three ways to set it:
- in the proxy's environment, which takes effect when the proxy next
starts;
- exported in the shell of a `headroom wrap` that reuses a running proxy
(wrap pushes it, no restart);
  - posted to `POST /admin/runtime-env` (no restart).

  A single request can also opt out with `x-headroom-bypass: true`.
- Unsafe override required: No.
- Qualification impact: only requests the backend was already failing
are changed, so no completed request's compression or cache result
moves. Such a request now completes, without reusing the previous turn's
cached prefix past the first dropped item.
- Over HTTP the drop runs before compression, so token counts and
savings are computed on the edited body, and the removed items are not
counted as saved.
- On the WebSocket it runs after compression, so the items appear in
both the before and after counts, and tokens saved is unchanged.
- Rollback path: set the kill switch, or revert these commits. Either
restores byte-identical forwarding of these bodies, and the failing
compactions with it.

## 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
- [x] 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 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

- Review follow-ups:
- 2099603a: bypass requests are no longer rewritten, on HTTP or on the
WebSocket.
- 418faa61: registers the kill switch as a runtime-env knob, so a reused
proxy honours it.
- Documentation: the `POST /admin/runtime-env` allowlist table in
`security-model.mdx` lists the new knob. No other page lists per-path
proxy repairs.
- Why not `body_forwarding.select_outbound_body`: it is the one place
both HTTP forwarders pick their bytes, and the downstream patch wraps it
there. But it is provider-agnostic byte policy and never sees a
WebSocket frame. A Responses-specific edit belongs in the Responses
handler, and the WebSocket needs it too.
- Why not gate on the ChatGPT backend: the failure was measured on
`chatgpt.com`, but the rule is upstream-neutral: the history references
a hosted tool the request does not declare. Dropping the item costs only
the search action. The drop also applies to API-key and custom-upstream
Responses traffic. A reviewer who prefers ChatGPT-auth only can gate the
HTTP call on `is_chatgpt_auth`; the WebSocket closure has the same flag
in scope.
- The `previous_response_id` skip is conservative. No Codex compaction
sets it, and an incremental request's earlier `additional_tools`
declarations are not in its body.
- Related: #3185 / #3186 (`additional_tools`), openai/codex#51962,
openai/codex#52016.
- Remove this workaround once a `tools: []` Responses body carrying a
`web_search_call` completes on the ChatGPT backend. The kill switch
makes that check a one-variable replay.
- Review fix fa7cea7d: the WebSocket prescreen no longer skips a frame
that spells the type with JSON escapes (`"web_search\u005fcall"`).
`test_frame_helper_decodes_escaped_type_spellings` and
`test_ws_escaped_web_search_call_frame[normal|bypass]` cover the helper
and the WS handler; both fail on 418faa61.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-24 08:39:00 -07:00
ad62166ba3 fix(copilot): preserve native inline OAuth identity (#4144)
## Description

Closes #3352.

Preserve the native inline editor OAuth identity without widening
Chat/Responses auth. Current head
`4609ac6b6162e81e4471492cb4c056065ce7f450` includes upstream main
`f1bc2609`.

## Type of Change

- [x] Bug fix
- [x] Documentation update
- [x] Code refactoring

## Changes Made

- Share one case-insensitive in-place header-removal helper across all
three auth branches; remove every unrelated provider API-key spelling
and every replaced Authorization spelling.
- Classify `ghu_` as the safe `ghu_***` kind and log that kind in the
inline branch, never the editor credential.
- Preserve the fetched same-origin/segment-boundary gateway-prefix fix
and its host/scheme/port regressions; this was already present in
`c368f1d`, not reimplemented here.
- Retain managed-seed exclusion and the existing Chat/Responses token
policy. No new live-account fallback or provider mock was introduced.
- Keep the optional path-helper extraction out; the small existing
origin guard remains explicit.

## Testing

- [x] Relevant unit/API regressions pass
- [x] Changed-file Ruff check and format pass
- [x] Manual auth operation/privacy smoke performed

### Test Output

```text
222 passed
181 passed, 5 warnings
ci-precheck PASSED — safe to push.
```

Focused command: `pytest -q tests/test_copilot_inline_client_auth.py
tests/test_copilot_auth.py tests/test_proxy_copilot_auth_hooks.py
tests/test_copilot_vscode_completions_routing.py
tests/test_copilot_integration_id_hmac.py`. Normal commit and full
pre-push hooks passed, including workspace Rust gates, genuine native
rebuild/import, critical Python and commitlint. No hooks/tests were
bypassed or filtered.

The first normal push hit the unchanged native
`expired_get_does_not_wipe_concurrent_refresh` final-live assertion: its
20 ms idle TTL can expire legitimately before the assertion under
scheduling load. This is the already-documented main stress-test issue,
not an auth-source change. A subsequent complete normal gate run used
`RUST_TEST_THREADS=1` and passed; no Rust fix or general flake
elimination is claimed.

## Real Behavior Proof

- Environment: Linux x86_64, Python 3.13.14, current published source,
real `apply_copilot_api_auth` and logging, synthetic credential
environment, isolated HOME, `DO_NOT_TRACK=1`.
- Exact command / steps: Execute `python
artifacts/review-20261013/run-native.py WORKTREE
TARGET/release/lib_core.so PROBE OUTPUT.json`. Invoke actual auth
operations for native inline on a different origin, same-origin prefixed
gateway inline, client-owned Chat gho, and Chat ghu requiring operator
replacement; include mixed-case duplicate API-key headers and capture
actual module logs.
- Observed result: Four auth cases preserve/select the correct identity,
remove all unrelated provider secrets, and log only safe kinds. Captured
kinds are `ghu_***`, `ghu_***`, `gho_***`, `ghu_***`; the full editor
credential and its suffix are absent. Existing real-proxy MockTransport
credential-gate and streaming/disconnect regressions passed in the
focused suite.
- Not tested: Live Copilot or VS Code signed-in end-to-end. The isolated
verification environment has no live Copilot credential; #3352 has no
reporter confirmation of this branch. The synthetic upstream/credential
gate is not presented as live entitlement proof. Full standalone mypy
and hosted-CI success are not asserted.

## Runtime Rollout Safety

- Rollout-managed feature(s): Existing Copilot auth routes; no feature
rollout added.
- Minimum rollout channel: Unchanged stable/default auth.
- Stable/default behavior changed: Inline token-kind diagnostics and one
shared secret-removal rule; native inline identity exception remains
host/path constrained.
- Kill switch / disable path: Existing Copilot upstream/auth
configuration; no new switch.
- Unsafe override required: No.
- Qualification impact: Auth selection, case-variant secret removal, log
privacy, gateway origin boundaries and existing proxy streaming gates
requalified; live entitlement remains external.
- Rollback path: Revert this auth helper/logging revision; no data
migration.

## Review Readiness

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

## Checklist

- [x] Documentation updated
- [x] Did not edit `CHANGELOG.md`

---------

Co-authored-by: Tejas Chopra <tejas@headroomlabs.ai>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-24 08:38:54 -07:00
1be699f68e fix(deps): patch OpenClaw Undici and narrow E2E audit exceptions (#4453)
## Description

Includes the approved #4358 as its prerequisite. This PR targets main so
the complete integration workflows qualify the combined repair; its diff
will shrink to this follow-up once #4358 lands. Replace OpenClaw's
affected Undici copy instead of excepting it, and reduce the E2E audit
exceptions from seven advisory/path pairs to three.

OpenClaw 2026.10.2 lists Undici in `bundleDependencies`. Version
2026.10.6 removes it from that bundle, allowing a targeted, same-major
override to install fixed Undici 8.12.3. npm 12.2.1 still bundles its
own affected copies; this PR retains only those existing, expiring
exceptions.

## Type of Change

- [x] Bug fix

## Changes Made

- Pin the existing E2E OpenClaw CLI to 2026.10.6 and override only its
Undici dependency to 8.12.3.
- Regenerate the E2E lockfile; keep Codex and the npm override
unchanged.
- Remove every OpenClaw exception and the now-stale advisory, preserving
the parent's exact bundled-version checks and 2026-11-15 expiry.
- Update the Dockerfile comment to the actual Node requirement: 24.22.1
in the Node 24 line. Its NodeSource installation already selects that
line.

## Dependency and install-surface assessment

This updates an existing upstream-maintained CLI for a security fix,
rather than adding a replacement package. The fixed Undici remains in
the same major line. The graph is used only by the Docker wrap E2E
harness and is not shipped in Headroom's wheel or SDK. Normal
installation runs OpenClaw's existing lifecycle scripts and fetches
packages from the registry; those scripts were inspected, then exercised
inside a fresh Linux container without host credentials. No application
compression or routing logic changes.

## Testing

- [x] Manual testing performed
- [x] Dependency installation and runtime resolution verified

### Test Output

```text
OpenClaw runtime resolves Undici 8.12.3
OpenClaw 2026.10.6 (fe06181)
Installed audit: only npm bundled copies remain
{ info: 0, low: 0, moderate: 1, high: 1, critical: 0, total: 2 }
parent: 9 audit-guard cases passed
child: 9 audit-guard cases passed
git diff --check: passed
```

The guard accepts the current scoped findings and rejects a new
advisory, wrong path, expired exception, stale exception, audit error,
changed version, non-bundled copy, and missing inherited-advisory entry.
A raw audit remains nonzero for npm's bundled dependencies; this PR does
not claim those packages are patched.

## Real Behavior Proof

- Environment: fresh Linux amd64 Docker container,
`node:24.22.1-bookworm-slim`, Node 24.22.1 / npm 11.19.1, normal `npm
ci` with lifecycle scripts enabled.
- Exact command / steps: copy the two committed package files into a
fresh container volume; run `npm ci --no-audit --no-fund`; resolve
`undici/package.json` using
`createRequire('/work/node_modules/openclaw/package.json')` and assert
version 8.12.3; run `node node_modules/openclaw/openclaw.mjs --version`
and `--help`; run `npm audit --json` and assert that every remaining
affected node is under `node_modules/npm/`.
- Observed result: installation, exact runtime-resolution assertion,
version, and help all succeeded. Both installed-tree and lockfile audits
leave only npm's bundled Undici 6.29.0 and ip-address 10.7.2. The parent
workflow's guard passes with the narrowed exceptions and rejects all
eight negative cases.
- Not tested: a billed provider request or live production deployment.
Hosted Docker agent/integration scenarios have now passed. Hosted
qualification on head 63c3abc5b3 is
complete: all reported checks are terminal with no failures or pending
checks, including the full Security, build, test, and Docker integration
workflows.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; E2E dependency data only.
- Minimum rollout channel: existing E2E test environment.
- Stable/default behavior changed: this follow-up patches only the
harness CLI. The included parent retains its explicitly documented
affected-Pillow decoder guard.
- Kill switch / disable path: revert this dependency commit.
- Unsafe override required: none; the override selects a compatible
fixed Undici 8.x patch. The parent's existing, bounded npm exceptions
remain explicit.
- Qualification impact: package installation, CLI startup, runtime
dependency resolution, and audit guarding were verified in isolation.
- Rollback path: revert the four-file change.

## Review Readiness

- [x] I performed self-review
- [x] This PR is ready for human merge review; the complete hosted check
set passed

## Checklist

- [x] I did not edit CHANGELOG.md.
- [x] The exception scope is reduced, not expanded.
- [x] No contributor correctness logic was modified.

Python lint/type checks and new production unit tests are not applicable
to these dependency/data changes. Independent human approval is
required; this is an author-side qualification record.

---------

Co-authored-by: Tejas Chopra <chopratejas@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tejas Chopra <tejas@headroomlabs.ai>
2026-10-23 23:11:35 -07:00
JD Davis e995eb9f1d docs(release): define qualification decisions (#3636)
Current maintenance status (2026-10-09): head
`0467f6e5b7ec0fbdfd4a20cf668c792c5f14b99e` includes current main
`01d9194` through a normal, conflict-free merge. The PR-specific diff
remains documentation-only (seven files). All 54 release-workflow tests
pass locally; workflow files match main. Hosted CI on this exact head is
terminal: 19 successful checks and four skips, with no failures or
running checks. The branch includes current main and is mergeable.
Independent human review and merge approval remain required. Earlier
evidence below applies to the prior head. This update does not merge the
PR or advance dependent PRs' upstream stack bases; independent human
merge approval is required.
## Description

Part of HEAOSS-6; split from #3382. Stack PR 1 defines five
release-qualification decisions: main/release semantics, artifact
identity, A1/B comparison, black-box benchmarks, and fail-closed
overrides. The split specification and implementation plan document the
remaining layers.

Current head: f4790a5359. Next PR: #3637.

## Type of Change

- [x] Documentation update
- [x] Bug fix (the restore command stages ADRs; the plan must inspect
the index)

## Changes Made

- Add the five ADRs and the specification/plan for the focused release
stack.
- Require both unstaged and cached whitespace checks after restoring
ADRs, stopping on either failure.
- Scope the placeholder scan to this slice's seven documents and
distinguish no matches from a failed scan.

## Testing

- [x] Actual disposable Git replay reproduces the staged-whitespace gap
and verifies the cached check catches it.
- [x] Both checks pass after correcting and restaging the document.
- [x] Seven actual changed documents are readable UTF-8, nonempty, and
contain no unresolved TBD/TODO markers.
- [x] Unstaged/staged whitespace checks pass on the published change.

```text
PASS reproduction: unstaged-only diff check exits 0; staged check exits 2 and reports trailing whitespace
PASS corrected staged document: both whitespace checks exit 0
PASS seven actual changed documents: readable UTF-8, nonempty, no unresolved TBD/TODO markers
PASS original source ADR untouched
```

## Real Behavior Proof

- Environment: Windows/Python 3.12.13/Git, disposable repository on G;
real ADR bytes copied from this checkout.
- Exact command / steps: `python
G:/git/headroom/.remember/tmp/pr3636-resume40-doc-replay.py`. Commit the
actual ADR as a baseline, append trailing whitespace, stage it, and
execute both Git checks. Correct/restage and rerun both checks; inspect
the seven real changed documents and verify the original ADR's digest is
unchanged.
- Observed result: The old unstaged-only check falsely succeeds while
the cached check exits 2 and identifies the staged violation. Both exit
0 after correction; the source ADR remains untouched and the changed
documentation has no unresolved placeholders.
- Not tested: Full six-PR reconstruction, release controller behavior,
candidate dispatch, production publishing, or documentation
publication/rendering. This is documentation-integrity proof.
- Evidence: pr3636-resume40-doc-replay.py/.log under
G:/git/headroom/.remember/tmp; owned replay repository
G:/tmp/headroom-review/resume40-3636-doc-replay.

## Runtime Rollout Safety

- Rollout-managed feature(s): Release qualification design;
documentation only.
- Minimum rollout channel: No runtime channel change.
- Stable/default behavior changed: The implementation plan checks staged
documents correctly; no executable release behavior is introduced here.
- Kill switch / disable path: Do not execute the plan; revert the
documentation.
- Unsafe override required: No.
- Qualification impact: Documents the intended fail-closed evidence
model; implementation/hosted qualification belongs to later stack PRs.
- Rollback path: Revert the ADR/plan slice; existing publisher remains
operational.

## Review Readiness

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

Independent review remains required. No PR merge, self-approval or
release publication performed.
2026-10-21 15:02:54 -05:00
AP 4c7acba593 docs: correct Antigravity IDE setup instructions (no third-party model providers) (#4258)
## Description

Follow-up to the merged #3817. As flagged in the post-merge thread, the
Antigravity IDE doesn’t expose third-party model-provider settings, so
the setup text was telling users to add a custom model provider in a
panel that doesn’t exist. The instructions now describe what the
integration actually covers (MCP registration and the
`/v1internal:streamGenerateContent` endpoint for `google-antigravity`
clients) and distinguish the IDE from the Antigravity CLI (`agy`), which
is the surface that accepts a custom endpoint via
`GOOGLE_GEMINI_BASE_URL`.

Follow-up fix (Devin review on this PR): the `agy` note mentioned
`GOOGLE_GEMINI_BASE_URL` but only printed the OpenAI-compatible URL. It
now prints the Gemini-compatible base URL (scheme://host, the Gemini API
convention) as an explicit `GOOGLE_GEMINI_BASE_URL=...` assignment, and
the OpenAI block is labeled for OpenAI-speaking clients.

## 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

- `headroom wrap antigravity` help text and printed setup instructions
no longer reference IDE model-provider settings; they point at MCP
registration and the native endpoint, and name the CLI separately.
- The `agy` note now shows the Gemini-compatible base URL explicitly
(`GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:<port>`), with the project
prefix (`/p/<name>`) applied like the other URLs.
- `docs/content/docs/proxy.mdx` Antigravity section corrected the same
way.
- Tests updated to assert the corrected wording.

## Testing

- [x] Unit tests pass (`pytest`)

### Test Output

```text
$ pytest tests/test_provider_antigravity.py -q
12 passed, 1 warning in 2.07s

$ pytest tests/test_mcp_registry/test_antigravity_registrar.py -q
25 passed, 1 warning in 0.82s
```

(`test_cli/test_wrap_antigravity.py` was not run locally — `typer` is
not installed in this environment; CI covers it.)

## Real Behavior Proof

- Environment: docs/string-only change; no runtime behavior affected.
- What was checked: the removed claim ("add a custom OpenAI-compatible
model provider in Antigravity’s model-provider settings") was verified
false three ways — the reporter’s own `~/.gemini/settings.json` has no
model-provider keys; Antigravity IDE 2.5.5 exposes no third-party
model-provider settings panel (upstream report plus current docs); and
the `google-antigravity` clients the new text names really do speak
Cloud Code Assist (`POST /v1internal:streamGenerateContent` is served by
the proxy — see `CLOUDCODE_HANDLER_ROUTES` in `route_specs.py`).
- Observed result: `render_setup_lines(8787)` now prints the corrected
IDE/MCP/native-traffic text,
`GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8787` for `agy`, and the OpenAI
block labeled for OpenAI-speaking clients; the 37 tests above pass.
- Not tested: a live Antigravity IDE run — no Mac with the IDE installed
in this environment, and nothing in this change touches a runtime path,
so there is no behavior to smoke-test.

## Runtime Rollout Safety

- Rollout-managed feature(s): none — documentation/strings only.
- Minimum rollout channel: n/a.
- Stable/default behavior changed: no; rendered CLI text only.
- Kill switch / disable path: n/a.
- Unsafe override required: n/a.
- Qualification impact: none.
- Rollback path: revert the 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

Docs-only PR; the remaining `wrap` CLI test module is covered by CI.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4258"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
2026-10-20 21:48:29 -05:00
gglucassandClaude Opus 5.5 62b3bedaba fix(cache): keep prefix-tracker state across a graceful proxy restart (#4299)
## Description

Every proxy restart rewrites the prompt cache of every warm
conversation. After a restart the proxy has no `PrefixCacheTracker` for
the conversation, so it compresses the whole history afresh, the early
messages come out as different bytes than the prefix it forwarded before
the restart, and the provider re-writes the cache from the first changed
message.

Measured on 2026-10-19 on one Mac running Claude Code through the proxy:
after each graceful restart (app relaunches for updates: proxy SIGTERM'd
and respawned), the next request of every active session read only ~25k
cached tokens (tools + system) and re-wrote the rest, up to 247k, 310k,
361k and 432k tokens at a time. The restart-aligned rewrites came to
about 4.6M tokens of 1h cache writes that day (2x the input price),
about a quarter of all cache writes. A client-side integrity probe
reported `kind=tracker_reset, stable_messages=861,
first_changed_message=3`.

This adds an opt-in `HEADROOM_PREFIX_STATE_FILE=<path>`. When set, the
proxy saves the `SessionTrackerStore` on graceful shutdown and restores
it at startup, before serving, so the first request after a restart
replays byte-identical frozen-prefix bytes. Unset, nothing changes. The
file holds conversation content, so it is never a default.

Related but different: #4156 (away recap replaces the lineage), #4287
(CCR proactive expansion rewrites), #4204 (deferred tool loads in the
lineage key), #4284 (mid-history divergence starts a cold lineage).

No existing issue; found while auditing one machine's token usage.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)

## Changes Made

- `SessionTrackerStore.save_state` / `load_state`
(`headroom/cache/prefix_tracker.py`). Per tracker: turn number, cached
token and message counts, last original and last forwarded messages, the
per-turn states that lineage resolution resumes, provider, last activity
and observed cache TTL; per lineage: session id, cache affinity and the
recent snapshot history. So `resolve_tracker` matches the next request
to the restored tracker, forks included. Each distinct message is stored
once per tracker (successive turns, snapshots and the original/forwarded
pairs mostly repeat), and new lineage keys and turn ids continue past
the restored ones.
- CCR entries ride along (review: retrieval integrity). Per tracker,
`save_state` collects every CCR reference in its saved messages and
read-maturation state (`hash=<hex>` markers and SmartCrusher's
`<<ccr:<hex>`) and writes the live `CompressionStore` entries behind
them (new `CompressionStore.export_entries`, which reads without
counting a retrieval). A tracker and its entries count against the size
cap together, so a tracker is never saved without them. `load_state`
re-stores them (`import_entries`) with their original expiry, before any
tracker is installed, so a replayed marker resolves from the first
request even with `HEADROOM_CCR_BACKEND=memory`. An entry a persistent
backend still holds is left as it is; a malformed one rejects the file.
- Restore keeps only trackers still inside the store's own retention
(last activity plus the observed or configured cache TTL and its cleanup
margin, at least the session TTL), the same rule the live store uses.
NaN or future timestamps are dropped.
- Versioned schema (`version: 1`). Any read, parse or validation error
logs one warning and leaves the store empty; the whole file is validated
before anything is installed. The file is written atomically
(`headroom.fsutil.write_text`: temp file, fsync, rename) at mode 0600:
an existing file is tightened to 0600 in place, never unlinked first, so
a failed write (ENOSPC) keeps the previous snapshot. Deleted after a
successful load. Stateless mode (`persistence_allowed`) neither writes
nor reads it (a stateless start used to load, and so delete, a
snapshot). Ignored with multiple workers (one file cannot hold N
per-process stores).
- Size cap: the 256 most recently active trackers and at most 64 MB,
newest first; whatever does not fit starts cold, as everything did
before.
- `HeadroomProxy.startup()` loads, `HeadroomProxy.shutdown()` saves as
its first step, before any await, so the shutdown step timeout cannot
cut it short. No periodic writes.
- Token-mode `CompressionCache` seed: a restored tracker has no
`CompressionCache` behind it in the new process, so the freeze computed
from that cache froze nothing: the pipeline recompressed messages the
provider cached, read maturation rewrote Reads inside the cached prefix,
and beyond the provider-confirmed floor the overlay declined a larger
previous form. One shared `seed_restored_compression_cache` seeds the
session's cache from the restored original/forwarded pair
(`update_from_result`) on the first request, on all three token-mode
paths: Anthropic `/v1/messages`, OpenAI `/v1/chat/completions`, and the
session-aware `/v1/compress` (sidecar). It gives the same freeze count
as before the restart.
- `ReadMaturationManager.export_state` / `validate_state` /
`restore_state`: matured markers, booked ids and replay token deltas
ride along with the tracker, so a matured Read's removal is not booked
as savings again on every request after a restart. The saved state is
validated at load with the rest of the file, so a bad entry rejects the
file instead of failing a request.
- `tests/test_anthropic_fork_lineage_cache.py`: `_drive` accepts a
shared provider-cache model and config overrides, so a second call is a
proxy restart in front of a warm provider cache.
- Documented the variable in `docs/content/docs/configuration.mdx`.
- `pyproject.toml` / `uv.lock` (review: Dependency audit): the `aiohttp`
constraint floor is now `>=3.14.4` (CVE-2026-111063, CVE-2026-111064 and
GHSA-2g87-pp6c-29x5, all fixed in 3.14.4), relocked with `uv lock
--upgrade-package aiohttp==3.14.4`. Only aiohttp (3.14.3 -> 3.14.4) and
yarl (1.22.0 -> 1.25.1, which 3.14.4 requires) move. Main still resolves
3.14.3, so the same commit is on #4299, #4286, #4285 and #4269.

Remaining gaps (unchanged by this PR, none of them changes forwarded
message bytes):
- Session-sticky `anthropic-beta` union (`HEADROOM_BETA_HEADER_STICKY`):
in memory, so after a restart a session's sticky set starts from the
client's own header again. Headers only.
- Output shaper: stateless per request (byte-stable steering text,
effort from the current request's structure), so nothing to persist.
- Gemini and Bedrock paths resume the restored tracker and its overlay
replay; they keep no token-mode `CompressionCache`, so there is nothing
to seed. A crash or SIGKILL still loses everything, by design (no
periodic writes).

## Testing

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

### Test Output

```text
# New regression tests for the review findings, run against the c141e2ec source
# (headroom/ stashed, new tests kept): all six fail, the 15 earlier tests pass.
$ uv run --frozen --extra dev pytest tests/test_prefix_tracker_restart.py -q
FAILED tests/test_prefix_tracker_restart.py::test_restored_retrieval_references_resolve_to_their_originals
FAILED tests/test_prefix_tracker_restart.py::test_a_stateless_proxy_leaves_a_saved_snapshot_alone
FAILED tests/test_prefix_tracker_restart.py::test_a_failed_save_keeps_the_previous_snapshot
FAILED tests/test_prefix_tracker_restart.py::test_saved_ccr_entries_resolve_after_a_restart
FAILED tests/test_prefix_tracker_restart.py::test_openai_token_mode_replays_its_prefix_after_a_restart
FAILED tests/test_prefix_tracker_restart.py::test_compress_sidecar_session_replays_its_prefix_after_a_restart
6 failed, 15 passed in 8.10s
# Why, in order: hash=cc146b21626392f0dee9890c no longer resolves; the stateless start
# deleted the snapshot; ENOSPC left no snapshot; retrieve() returns None; the OpenAI chat
# and /v1/compress paths re-compressed message 2 under the new query.

# Head c379245e:
$ uv run --frozen --extra dev pytest tests/test_prefix_tracker_restart.py -q
21 passed in 9.50s

$ uv run --frozen --extra dev pytest tests/test_prefix_tracker_restart.py tests/test_anthropic_fork_lineage_cache.py \
    tests/test_cache/test_prefix_tracker.py tests/test_compression_store.py tests/test_ccr_sqlite_backend.py \
    tests/test_issue_2671_block_growth_cache.py tests/test_cache_mode_cold_start.py tests/test_cache_prefix_overlay.py \
    tests/test_cross_turn_cache_safety.py tests/test_session_engine.py tests/test_read_maturation.py \
    tests/test_read_maturation_handler_nobust.py tests/test_graceful_shutdown.py tests/test_proxy_handlers_batch.py \
    tests/test_cache_control_move_bust.py tests/test_startup_log_noise.py tests/test_proxy_openai_cache_stability.py \
    tests/test_compress_session_mode.py tests/test_proxy_anthropic_cache_stability.py tests/test_ccr_row_drop_store_bridge.py \
    tests/test_bedrock_prefix_tracker_wiring.py -q
486 passed, 1 skipped in 46.92s

$ uv run --frozen --extra dev pytest tests/test_anthropic_*.py tests/test_proxy_anthropic_*.py tests/test_proxy_openai*.py \
    tests/test_openai_chat_*.py tests/test_cache_aligner_prefix_stability.py tests/test_cache_prefix_safety.py tests/test_cold_prefix.py \
    tests/test_gemini_prefix_freeze.py tests/test_prefix_tracker_client_rewrote_reply.py tests/test_tool_injection*.py tests/test_ccr_*.py -q
737 passed, 16 skipped in 51.45s

$ uvx ruff@0.17.0 check headroom tests
All checks passed!
$ uvx ruff@0.17.0 format --check headroom tests
1606 files already formatted
$ uv run --frozen --extra dev mypy headroom/cache/prefix_tracker.py headroom/cache/compression_store.py \
    headroom/proxy/handlers/anthropic.py headroom/proxy/handlers/openai.py headroom/proxy/server.py
Success: no issues found in 5 source files
```

## Real Behavior Proof

- Environment: macOS 27 (arm64), this branch at c379245e, the real proxy
process (`python -m headroom.cli proxy --port 6811 --no-http2
--no-rate-limit --mode token --read-maturation
--read-maturation-quiesce-turns 1 --read-maturation-min-size-bytes 200
--disable-kompress --no-subscription-tracking`,
`HEADROOM_ROLLOUT_CHANNEL=beta`, clean `HOME` and workspace,
`HEADROOM_PREFIX_STATE_FILE` set, `HEADROOM_CCR_BACKEND=memory`,
`HEADROOM_BACKGROUND_COMPRESSION=1`) in front of the live Anthropic API,
driven by Claude Code 2.1.303 (`claude -p --model haiku`,
`ANTHROPIC_BASE_URL=http://127.0.0.1:6811`). Each restart is a SIGTERM
(graceful shutdown) and a fresh process.
- Exact command / steps: one Claude Code session through the proxy,
three graceful restarts, the last one without the state file as the
control:
1. Turn 1: `claude -p` reads three files (4.8, 17 and 8.9 KB) one per
turn, 5 requests through the proxy. SIGTERM: `SessionTrackerStore: saved
2 of 2 prefix trackers (181266 bytes)`; file mode `-rw-------`; it holds
2 CCR entries, for the two Reads that read maturation had replaced with
`Retrieve original: hash=` markers.
2. Restart: `restored 2 of 2 prefix trackers`, file deleted. `GET
/v1/retrieve/3a739d6ec5febcd49d0cfc0e` and
`/v1/retrieve/2ee4d4d435432b4cca9b72af` on the new process: HTTP 200,
`original_content` equal to the pre-restart entries (5,129 and 18,525
chars, the Read outputs of the two files). With the in-process CCR
store, c141e2ec loses such entries at a restart (the reviewer's
reproduction;
`test_restored_retrieval_references_resolve_to_their_originals` fails on
it).
3. `claude -p --resume`, then SIGTERM + restart with the state file
again, then `claude -p --resume` again (one request each, no tools).
4. Control: SIGTERM, snapshot moved aside, restart without
`HEADROOM_PREFIX_STATE_FILE`, `claude -p --resume`.
- Observed result: after a restart with the state file the first request
read 99% of its prefix from the provider cache and both restored
retrieval hashes resolved; the control re-wrote everything after the
system prompt (proxy `PERF` lines, which match Claude Code's reported
usage):

  | First request after a restart | cache_read | cache_write | hit |
  |---|---|---|---|
  | With the state file, resume after a resume | 40,406 | 514 | 99% |
| Without the state file (control), same history | 26,053 | 11,250 | 70%
|

With the state file the proxy forwarded messages 0-10 byte-identical to
what it forwarded before the restart (compared from the saved snapshots,
`cache_control` positions excluded since Claude Code moves its
breakpoint every turn), and froze 14 of 15 messages. In the control, the
forwarded bytes changed from message 1, and the third Read, verbatim
inside the cached prefix, matured into a new marker (10,205 -> 368
chars), so everything after the system prompt was re-written.
- Not tested: Kompress itself (`--disable-kompress`; the unit suite uses
a deterministic stand-in). Windows file modes. The OpenAI chat and
`/v1/compress` seeds against a live OpenAI endpoint (covered by the
handler-level restart tests above with a query-dependent compressor).
The very first `--resume` of a `claude -p` session (step 3's first
request) read only 26,053 tokens and wrote 14,845, although the client's
messages and the proxy's forwarded messages 0-10 were byte-identical to
the pre-restart request; the read stopped at the system-prompt
breakpoint, so the change is most likely in the system/tools part of the
request, which I did not capture. The resume after it, across another
restart, read 99%.

## Runtime Rollout Safety

- Rollout-managed feature(s): None; opt-in environment variable
`HEADROOM_PREFIX_STATE_FILE`, unset by default.
- Minimum rollout channel: Stable.
- Stable/default behavior changed: No; with the variable unset nothing
is read or written and no code path changes (the new handler branches
only fire on a tracker restored from the file, and the CCR export/import
only runs inside save/load).
- Kill switch / disable path: Unset `HEADROOM_PREFIX_STATE_FILE`.
- Unsafe override required: No.
- Qualification impact: None.
- Rollback path: Unset the variable or revert this PR; a leftover state
file is inert without the variable. The file format is still `version:
1` (now with a `ccr` list); a file written by c141e2ec has no `ccr` list
and is rejected at load, which starts cold.

## 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
- [x] 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 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)

Not applicable.

## Additional Notes

- Review follow-up (c379245e): CCR entries are saved with their trackers
(P1), the seed covers the OpenAI chat and `/v1/compress` token paths, a
failed save keeps the previous snapshot, and stateless mode no longer
loads (and deletes) a snapshot. Each has a regression test that fails on
c141e2ec.
- Caller isolation: the restored store has exactly the keys, lineages
and retention the in-memory store had at shutdown, and replay still
requires the caller to send the same original messages; see the reply on
that thread for the full reasoning.
- The full `pytest tests` run was not repeated for this head (shared
machine); the focused runs above cover every module the change touches.
- Size cap choice: 256 trackers covers many concurrent Claude Code
sessions plus their subagents; 64 MB bounds shutdown time (encoding is
synchronous) and disk use.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4299"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 19:44:00 -05:00
1a40b3ce67 fix(telemetry): let HEADROOM_TELEMETRY=off stop the anonymous beacon (#4235)
## Description

Make an explicit HEADROOM_TELEMETRY=off or --no-telemetry choice stop
the anonymous upload beacon as well as local telemetry, while preserving
the separately configured HEADROOM_BEACON=on override and existing
offline/DO_NOT_TRACK policy.

Existing persistent manifests already contain explicit off values
written by the old installer defaults. Those installs stay opted out
after upgrading unless deliberately reconfigured or reinstalled. The PR
does not guess which saved off values were intentional. New installs
omit an unspecified telemetry choice so they retain the existing default
beacon policy.

## Type of Change
- [x] Bug fix (telemetry opt-out behavior)
- [x] Documentation update

## Changes Made
- Apply an explicit local-telemetry opt-out to the beacon enable
decision and report the reason in telemetry status.
- Recheck enablement before sending buffered session telemetry.
- Preserve unspecified, enabled, and disabled telemetry choices when
generating installation manifests.
- Update operator documentation and regression coverage.

## Testing
- [x] Maintainer telemetry, beacon, and snapshot suites passed after the
current-main sync.
- [x] Whitespace check passed.

### Test Output
```text
python -m pytest tests/test_telemetry_warning.py tests/test_proxy_telemetry_env.py tests/test_beacon_schema_v2.py tests/test_beacon_gzip.py tests/test_original_snapshot_in_place_hook.py -q
122 passed, 1 warning in 21.19s
```

A previous broader installer run also reproduced the persistent-service
embedder assertion on current main independently; that baseline failure
was not attributed to this PR. The other 34 planner tests passed in that
qualification. Hosted CI is qualifying head
d2f8582f97.

## Real Behavior Proof
- Environment: isolated Windows/Python 3.12.13 maintainer worktree with
actual telemetry/beacon decision logic and proxy fixtures.
- Exact command / steps: run the five pytest suites shown above,
including explicit opt-out, override, and buffered-session regressions.
- Observed result: all 122 selected tests passed after incorporating
current main. Earlier installer-choice regression coverage and the
independent main comparison are recorded in the qualification evidence.
- Not tested: independent maintainer live upload traffic to the
production collector or migration of real persistent installs. The
author's live status/proxy before/after observations are preserved below
and remain attributed to the author.

## Runtime Rollout Safety
- Rollout-managed feature(s): existing telemetry and beacon controls; no
new rollout framework toggle.
- Minimum rollout channel: existing deployment policy applies.
- Stable/default behavior changed: an explicit telemetry opt-out also
disables beacon uploads unless a permissible explicit beacon-on override
is configured. Saved legacy off values remain off; new unspecified
install choices are no longer persisted as off.
- Kill switch / disable path: HEADROOM_BEACON=off, DO_NOT_TRACK=1, or
offline mode under the existing policy.
- Unsafe override required: no.
- Qualification impact: operator intent and existing manifest behavior
must be considered during upgrade; hosted CI and human review remain
required.
- Rollback path: retain the prior qualified release; configure
HEADROOM_BEACON explicitly where appropriate rather than rewriting saved
user intent.

## Review Readiness
- [ ] I have performed a self-review
- [ ] This PR is ready for human review

Maintainer verification is documented above; author readiness
attestations have not been filled on the author's behalf.

## Additional Notes

The original author warning, description, follow-up exclusions, and
supplied evidence are preserved below.
> **Behaviour change for existing installs.** Read this before merging.
Every manifest that `headroom install` saved before this change already
contains `HEADROOM_TELEMETRY=off` and `--no-telemetry`, because the
planner wrote them by default. Those manifests are replayed as-is, so
**existing persistent installs will report the beacon OFF after
upgrading** until they are reinstalled. A loader migration can't tell
those defaults apart from a real opt-out, and turning uploads back on
for people who opted out would be worse, so this PR doesn't migrate. New
installs keep the beacon on by default.

#### The test we ran

A Daytona sandbox running Headroom Enterprise 0.4.3 (core 0.39.1), with
Codex CLI 0.162.1 and Claude Code connected to real GitHub, Context7 and
Fetch MCP servers, working through the workshop tasks.

#### What we found

`headroom telemetry --show` and the README say telemetry can be turned
off, and users reasonably set **`HEADROOM_TELEMETRY=off`** (or pass
`--no-telemetry`). But the anonymous upload beacon was gated only on
`HEADROOM_BEACON` / `DO_NOT_TRACK` / offline mode. With
`HEADROOM_TELEMETRY=off` it kept uploading, and `headroom telemetry`
still printed `Upload beacon: ON (opt-out)`.

#### The fix

- New `beacon_off_reason()` in `headroom/telemetry/beacon.py` names the
setting that turns the beacon off. `is_beacon_enabled()` delegates to
it. The order is:
  1. offline mode;
  2. `DO_NOT_TRACK`;
3. `HEADROOM_BEACON`, whose explicit `on` still wins over local stats
being off;
4. an explicit **`HEADROOM_TELEMETRY` off-value**: off / false / 0 / no
/ disable / disabled, the same `_OFF_VALUES` the module already uses.

`HEADROOM_TELEMETRY=on` still means only "local stats". It never
authorises upload.
- A session buffered before an opt-out is not sent afterwards:
`post_session_event` (heartbeat, idle close) and the exit flush re-check
`is_beacon_enabled()` at send time.
- `headroom telemetry` prints `Upload beacon: OFF
(HEADROOM_TELEMETRY=off)` (or whichever switch is in effect), and the
proxy startup log does the same.
- `headroom install`: since `off` now stops the beacon, the planner
writes `HEADROOM_TELEMETRY` / `--telemetry` / `--no-telemetry` only for
an explicit choice (`telemetry_enabled` is now tri-state, `None` = no
choice). Local stats stay off without the env var because they are
opt-in. `scripts/install.sh` and `install.ps1` already passed
`--no-telemetry` only on an explicit flag.
- Docs: README, proxy, security-model and limitations pages, the
dashboard tooltip, and the `--no-telemetry` help text.
- `test_banner_beacon_default_on_is_surfaced` asserted the old policy
(`--no-telemetry` leaves the beacon on). It now checks the default case
instead.

#### Before / after

| env | `is_beacon_enabled()` on origin/main | this PR | `headroom
telemetry` (this PR) |
|---|---|---|---|
| none | True | True | `ON (opt-out)` |
| `HEADROOM_TELEMETRY=off` | **True** | **False** | `OFF
(HEADROOM_TELEMETRY=off)` |
| `HEADROOM_TELEMETRY=off` + `HEADROOM_BEACON=on` | True | True | `ON
(opt-out)` |
| `HEADROOM_BEACON=off` | False | False | `OFF (HEADROOM_BEACON=off)` |
| `headroom install` with no flag → manifest | `HEADROOM_TELEMETRY=off`
+ `--no-telemetry` | neither written | — |

#### Tests

-
`tests/test_telemetry_warning.py::test_telemetry_off_turns_the_beacon_off_and_says_so`,
parametrized over the 7 off spellings: fails on origin/main, passes
here.
-
`tests/test_telemetry_warning.py::test_beacon_on_overrides_telemetry_off`.
-
`tests/test_telemetry_warning.py::test_buffered_session_is_not_sent_after_telemetry_off`:
fails on the first commit of this PR, passes now.
-
`tests/test_install/test_planner.py::test_install_writes_telemetry_only_when_chosen`,
through the CLI's `_build_deployment_manifest`: the no-flag case fails
on origin/main.
- Related suites pass: install, telemetry warning, beacon schema v2,
install CLI and proxy health (435 passed).
- ruff check, ruff format --check and mypy pass.

#### Follow-ups (not in this PR)

- `headroom init` passes `telemetry_enabled=True`, so its manifests turn
local stats on (`cli/init.py:718`). This doesn't affect the beacon.
- The `--telemetry` help text still says "anonymous telemetry", but the
flag only turns on local stats.

#### Real behavior proof

- **Setup:** macOS 26.7, Python 3.12.13. origin/main and this branch
were run side by side with `HEADROOM_BEACON` and `DO_NOT_TRACK` unset.
- `HEADROOM_TELEMETRY=off headroom telemetry`:
- origin/main: `Upload beacon: ON (opt-out)`, `is_beacon_enabled():
True`
- this branch: `Upload beacon: OFF (HEADROOM_TELEMETRY=off)`,
`is_beacon_enabled(): False`
- `headroom proxy --no-telemetry --no-optimize`, startup log:
- origin/main: `Anonymous upload beacon: ENABLED (default — session
summaries are sent to Headroom Labs). Opt out: HEADROOM_BEACON=off or
DO_NOT_TRACK=1`
- this branch: `Anonymous upload beacon: DISABLED
(HEADROOM_TELEMETRY=off)`
- **Not tested:** a real `headroom install apply` of a persistent
service on this branch; the manifest change is covered through
`_build_deployment_manifest`. Upgrading an existing install was not
tested either; see the warning at the top.

🤖 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>
2026-10-16 14:32:06 -07:00
dependabot[bot]andJD Davis 07c8bbf1ed deps: Bump the npm-minor-patch group across 2 directories with 16 updates (#4218)
## Description

Restore reproducible docs installs and eliminate the E2E harness bundled
npm vulnerabilities while retaining the grouped updates.

## Type of Change

- [x] Bug fix / dependency security and qualification

## Changes Made

Synced with upstream `main`
(`486afaac7426fa1d6735fe2ce6ae37630d9d11ae`). No contributor
implementation logic changed. Tested head:
`76b71e27a06c65afa74f1d278a38b4aa5b934ba4`. Includes the reviewed
dependency-floor fix from #4239 because the vulnerable version was still
permitted by shipping extras.

## Dependency assessment

Regenerates docs/bun.lock alongside the manifest/npm lockfile. The E2E
harness overrides OpenClaw's bundled npm to 12.2.1 because its bundle
patches brace-expansion, http-cache-semantics, ip-address,
postcss-selector-parser and undici advisories; ordinary npm audit fix
retained vulnerable bundled copies. npm is maintained by npm/GitHub;
this remains an E2E-only transitive CLI dependency, not a production
Python dependency. Existing CLI versions remain pinned. Also applies the
reviewed MCP CVE-2026-59951 floor and v1 cap.

## Testing

Before: frozen Bun install failed; E2E npm audit reported 5
vulnerabilities. After: bun install --frozen-lockfile --ignore-scripts
passed; bun run types:check and bun run build passed. E2E npm ci
--ignore-scripts and npm audit passed with zero vulnerabilities; Codex
0.162.1 and OpenClaw --version commands exited 0. npm bundle is 12.2.1.
Branch dependency contract: 1 passed; uv lock --check passed.

### Test Output

```text
Before: frozen Bun install failed; E2E npm audit reported 5 vulnerabilities. After: bun install --frozen-lockfile --ignore-scripts passed; bun run types:check and bun run build passed. E2E npm ci --ignore-scripts and npm audit passed with zero vulnerabilities; Codex 0.162.1 and OpenClaw --version commands exited 0. npm bundle is 12.2.1. Branch dependency contract: 1 passed; uv lock --check passed.
```

## Real Behavior Proof

- Environment: Windows, PowerShell; installed Python/uv, Node/npm/Bun
and Rust tooling as applicable. No live provider/model used.
- Exact commands / steps:

```text
bun install --frozen-lockfile --ignore-scripts; bun run types:check; bun run build (docs)
npm ci --ignore-scripts; npm audit (e2e/wrap/tools)
uv lock --check
python -m pytest -q tests/test_mcp_dependency_contract.py
git diff --check
```

- Observed result: Before: frozen Bun install failed; E2E npm audit
reported 5 vulnerabilities. After: bun install --frozen-lockfile
--ignore-scripts passed; bun run types:check and bun run build passed.
E2E npm ci --ignore-scripts and npm audit passed with zero
vulnerabilities; Codex 0.162.1 and OpenClaw --version commands exited 0.
npm bundle is 12.2.1. Branch dependency contract: 1 passed; uv lock
--check passed.
- Not tested: live model/provider traffic and full Docker E2E locally;
hosted cross-platform checks are running on the pushed head. Read hosted
results before merging. Focused checks are not a claim of complete
platform qualification.

## Runtime Rollout Safety

- Rollout-managed features: none added or enabled.
- Minimum rollout channel: unchanged.
- Stable/default behavior changed: dependency versions/ranges and
associated install metadata only; no feature rollout defaults changed.
- Kill switch / disable path: existing optional extras and plugin opt-in
paths remain available.
- Unsafe override required: no runtime qualification bypass. Security
dependency override is documented above where applicable.
- Qualification impact: hosted checks and the focused evidence above
must pass; no existing gate is removed.
- Rollback path: revert this dependency change and restore its prior
lockfiles together; retain the patched MCP minimum or another reviewed
security remediation.

## Review Readiness

- [x] Maintainer self-review and focused verification performed.
- [x] All hosted checks passed on the reviewed head. Ready for final
human merge review.

## Checklist

- [x] No contributor implementation logic rewritten.
- [x] Committed lockfiles checked against the changed manifests.
- [x] No manual CHANGELOG.md changes.
- [x] Known limitations recorded above.

## Original Dependabot update

Bumps the npm-minor-patch group with 14 updates in the /docs directory:

| Package | From | To |
| --- | --- | --- |
|
[@radix-ui/react-slot](https://github.com/radix-ui/primitives/tree/HEAD/packages/react/slot)
| `1.3.3` | `1.5.0` |
| [fumadocs-core](https://github.com/fuma-nama/fumadocs) | `16.15.15` |
`16.17.1` |
| [fumadocs-mdx](https://github.com/fuma-nama/fumadocs) | `15.4.5` |
`15.4.7` |
| [fumadocs-twoslash](https://github.com/fuma-nama/fumadocs) | `4.0.1` |
`4.0.2` |
| [fumadocs-typescript](https://github.com/fuma-nama/fumadocs) | `5.4.1`
| `5.5.1` |
| [fumadocs-ui](https://github.com/fuma-nama/fumadocs) | `16.15.15` |
`16.17.1` |
|
[lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)
| `1.48.0` | `1.55.0` |
| [next](https://github.com/vercel/next.js) | `16.3.8` | `16.4.0` |
|
[@ai-sdk/openai](https://github.com/vercel/ai/tree/HEAD/packages/openai)
| `4.0.79` | `4.0.91` |
|
[@anthropic-ai/sdk](https://github.com/anthropics/anthropic-sdk-typescript)
| `0.129.0` | `0.133.0` |
|
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
| `26.6.3` | `26.6.5` |
| [ai](https://github.com/vercel/ai/tree/HEAD/packages/ai) | `7.0.119` |
`7.0.137` |
| [openai](https://github.com/openai/openai-node) | `7.23.0` | `7.32.0`
|
| [postcss](https://github.com/postcss/postcss) | `8.5.28` | `8.5.29` |

Bumps the npm-minor-patch group with 2 updates in the /e2e/wrap/tools
directory:
[@openai/codex](https://github.com/openai/codex/tree/HEAD/codex-cli) and
[openclaw](https://github.com/openclaw/openclaw).

Updates `@radix-ui/react-slot` from 1.3.3 to 1.5.0
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/radix-ui/primitives/blob/main/packages/react/slot/CHANGELOG.md">@​radix-ui/react-slot's
changelog</a>.</em></p>
<blockquote>
<h2>1.5.0</h2>
<ul>
<li>Allow explicit <code>undefined</code> for all optional types for
compatibility with TypeScript's <code>exactOptionalPropertyTypes</code>
flag.</li>
<li>Fixed <code>Slot</code> throwing when an <code>asChild</code> child
is a lazy reference whose resolved value is itself a lazy
reference.</li>
</ul>
<h2>1.4.0</h2>
<ul>
<li>Added support for multiple <code>aria-describedby</code>
attributes.</li>
<li>Fixed compatibility issues with React Server Components.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/radix-ui/primitives/commits/HEAD/packages/react/slot">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-core` from 16.15.15 to 16.17.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-core's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.17.1</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.1</li>
<li>fumadocs-core@16.17.1</li>
<li>fumadocs-ui@16.17.1</li>
</ul>
<h3>Format generated Markdown tables</h3>
<ul>
<li>Generated tables have aligned columns: the type tables of
<code>auto-type-table</code>, the tables of
<code>renderToMarkdown()</code> and the table rows of search
records.</li>
<li><code>markdownTable()</code> from
<code>fumadocs-core/mdx-plugins/stringifier</code> creates a formatted
table for your plugins.</li>
<li><code>fumadocs-typescript</code> requires <code>fumadocs-core</code>
16.17.1.</li>
</ul>
<h2>fumadocs@16.17.0</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.0</li>
<li>fumadocs-core@16.17.0</li>
<li>fumadocs-ui@16.17.0</li>
</ul>
<h3>Highlight search results with CSS</h3>
<p>Search results no longer wrap matches in <code>&lt;mark&gt;</code>,
<code>content</code> is the indexed Markdown. The search dialog
highlights matches with the <a
href="https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API">CSS
Custom Highlight API</a>, style them with
<code>::highlight(fd-search)</code>. Custom search UIs can use
<code>useHighlightQuery()</code> from
<code>fumadocs-core/search/client</code>.</p>
<ul>
<li><code>createContentHighlighter()</code> is deprecated.</li>
<li>Removed <code>contentWithHighlights</code> from search results, and
the <code>renderHighlights</code> prop of <code>&lt;SearchDialogListItem
/&gt;</code>.</li>
<li><code>&lt;SearchDialogListItem /&gt;</code> renders the Markdown of
results with the <code>prose prose-sm</code> typography.</li>
</ul>
<h3>Search hooks for each provider</h3>
<p><code>fumadocs-core/search/client</code> exports a hook for each
search client, like <code>useFetchSearch()</code>. They return the props
of <code>&lt;SearchDialog /&gt;</code>:</p>
<pre lang="tsx"><code>const search = useFetchSearch({ locale });
<p>&lt;SearchDialog {...search} {...props}&gt;<br />
&lt;SearchDialogList /&gt;<br />
&lt;/SearchDialog&gt;;<br />
</code></pre></p>
<p><code>data</code> is the last successful search, its
<code>items</code> have their content parsed into
<code>hastContent</code>. <code>error</code> is set when the last search
failed.</p>
<ul>
<li><code>experimental_useSearch()</code> creates a search hook from a
memoized search function.</li>
<li><code>useDocsSearch()</code> is deprecated.</li>
<li><code>useFlexsearchStatic()</code> and
<code>useOramaCloudLegacySearch()</code> are exported from the paths of
their clients.</li>
<li><code>&lt;SearchDialogList /&gt;</code> shows
<code>defaultItems</code> without results.</li>
<li><code>useSearchList()</code> is removed, <code>useSearch()</code>
returns <code>getActive()</code>, <code>setActive()</code> and
<code>subscribeActive()</code> for the active item.</li>
<li><code>&lt;SearchDialogListItem /&gt;</code> renders a
<code>div</code> instead of a <code>button</code>, table rows render
their cells only.</li>
<li><code>renderMarkdown</code> of <code>&lt;SearchDialogListItem
/&gt;</code> renders <code>content</code> instead of
<code>hastContent</code>. Without it, the string content of custom items
is shown as text.</li>
<li>The templates of Fumadocs CLI and Create Fumadocs App use the new
hooks.</li>
</ul>
<h3>Index tables by row</h3>
<p>Structured data records each table row as a Markdown table of its
header row and itself, instead of a record per cell. Type tables from
<code>auto-type-table</code> record a row for each prop instead of the
<code>TypeTable</code> element. Re-sync your search indexes to pick them
up.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d6cfc48d62aa9ea413f0fc5033617c0c923681ec"><code>d6cfc48</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3683">#3683</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/54217c3df270013af0d88adefbb7817361f0a381"><code>54217c3</code></a>
feat(*): support Takumi for all templates</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/73cda6eaff4f644c0da1593674a84e4f4e9c94db"><code>73cda6e</code></a>
feat(core): format md tables</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb0b104c8681f0387781e7d0cab8b3269000bb7c"><code>cb0b104</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3682">#3682</a>
from Misyuk-T/fix/asyncapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/50c316da062579e5c0de025b7ed5f44a55860bb8"><code>50c316d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3679">#3679</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/4cb520a3f6835744d9dd24123ee332b41a8434bd"><code>4cb520a</code></a>
docs: introduce 16.17</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/53119f10154d6ae0a6253558c79739a292c66ea8"><code>53119f1</code></a>
docs: add Turbobulls to showcase (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3677">#3677</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b238fe4fa024e2ef9df0c25e786f53196a855919"><code>b238fe4</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3678">#3678</a>
from MokiMeow/fix/openapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e380a0d03a5f9e984d90230031e91c1731d10dca"><code>e380a0d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3659">#3659</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5d9353bc5879421ebcaee50f949a3681d0a7fc86"><code>5d9353b</code></a>
feat(core): better mixedbread search</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.15.15...fumadocs@16.17.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-mdx` from 15.4.5 to 15.4.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-mdx's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-mdx@15.4.7</h2>
<h3>Markdown and search records from the authored source</h3>
<p><code>remarkLLMs()</code> and <code>remarkStructure()</code> of
<code>fumadocs-core</code> slice their Markdown from the authored source
like Sätteri, instead of stringifying the syntax tree. It is much
faster, Markdown is no longer escaped or reformatted, and local images
keep their addresses. Re-sync your search indexes to pick up the new
records.</p>
<ul>
<li>Plugins record the Markdown of content they replace with
<code>replaceSource()</code> or <code>embedSource()</code> from
<code>fumadocs-core/mdx-plugins/stringifier</code>, in place of
<code>data._stringify</code>, and add search records with
<code>data.structuredData</code>. Nodes they insert otherwise are left
out. A <code>namespace</code> limits an edit to the stringifiers of that
namespace, like <code>search</code> for search records.</li>
<li>Search records are always Markdown, also in Sätteri.
<code>filterElement</code> replaces
<code>stringify.filterElement</code>, it chooses the JSX elements kept
as HTML tags (<code>File</code>, <code>TypeTable</code>,
<code>Callout</code> and <code>Card</code> by default) that search
dialogs render as components. Other elements and links are replaced by
their content, images are removed, and an element on one line is
recorded like a paragraph.</li>
<li>Removed <code>defaultStringifier()</code> (use
<code>createStringifier()</code>), <code>StringifyOptions</code>,
<code>allowedMdxAttributes</code>, <code>filterMdxAttributes</code>,
<code>placeholder()</code> (use <code>mdxAsPlaceholder</code>), and the
<code>stringify</code> and <code>mdast-util-to-markdown</code> options
of both plugins.</li>
<li>Included content goes through the plugins like the document's own,
Sätteri includes <code>.md</code> files as Markdown.</li>
<li><code>&lt;auto-files&gt;</code> shows its files in a code block,
<code>auto-type-table</code> its props in a Markdown table, created by
<code>typeTableToMarkdown()</code> from
<code>fumadocs-typescript</code>.</li>
<li><code>remarkShow()</code> and <code>fileGenerator()</code> of
<code>fumadocs-docgen</code> record their Markdown, generators receive
the <code>file</code> to do the same.</li>
<li>Records of <code>fumadocs-obsidian</code> resolve wikilinks, and
leave comments, block IDs, callout markers and embeds out. Comments are
removed before parsing, so they no longer split a paragraph.</li>
<li>Pages of <code>fumadocs-python</code> compile from their MDX, so
they have Markdown and search records.</li>
<li><code>fumadocs-mdx</code>, <code>fumadocs-docgen</code> and
<code>fumadocs-obsidian</code> require <code>fumadocs-core</code>
16.17.0.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3662">#3662</a></p>
<h2>fumadocs-mdx@15.4.6</h2>
<h3>Keep collection <code>dir</code> outside the project in file
paths</h3>
<p>When a collection's <code>dir</code> was outside the project (e.g.
<code>../content/docs</code>), the leading <code>../</code> was dropped
from <code>info.fullPath</code> and <code>absolutePath</code>, so
<code>getText('raw')</code> failed with <code>ENOENT</code>.</p>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3623">#3623</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e380a0d03a5f9e984d90230031e91c1731d10dca"><code>e380a0d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3659">#3659</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5d9353bc5879421ebcaee50f949a3681d0a7fc86"><code>5d9353b</code></a>
feat(core): better mixedbread search</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/097a544c51a3296486ee8b017a837b4855cde8dc"><code>097a544</code></a>
feat(openapi): auth provider API</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/945b87abbec82afa3549503f21a0318a05a771f3"><code>945b87a</code></a>
fix(core,satteri): optimize traverse &amp; better search records</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3bf99285a95234aa2fdbea08101ac87b7a0d1625"><code>3bf9928</code></a>
fix(ui): display fallback tree slidings correctly</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/433b586a5dba40e3dda17c4e06c5db9c99281478"><code>433b586</code></a>
fix(openapi): better code examples</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b221e1d1db1e6701b419491db9ba657e7b5f5e73"><code>b221e1d</code></a>
fix(twoslash): better truncate &amp; performance</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/48bf8c6ec9e582d84888c6dd9aba1db3502fec7e"><code>48bf8c6</code></a>
fix(openapi,typescript): render Markdown images, show the OAuth redirect
URI</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb7d92c20b1c2d60bfed6eccdc6f2882c68fe00f"><code>cb7d92c</code></a>
docs: introduce new APIs</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/8f1ffb36aaab84c35eed47bf903ce06984ae3ffe"><code>8f1ffb3</code></a>
refactor(ui): use <code>prose</code> class for search result
markdown</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-mdx@15.4.5...fumadocs-mdx@15.4.7">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-twoslash` from 4.0.1 to 4.0.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-twoslash's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-twoslash@4.0.2</h2>
<h3>Truncate long types in hovers, faster analysis</h3>
<ul>
<li>Types longer than 500 characters in hover popups are truncated by
the checker (<code>... 26 more ...</code>) instead of printed in full,
so pages with large object types compile to much smaller MDX.</li>
<li>Code blocks are briefly written to the <code>.twoslash</code>
directory while being analyzed, instead of going through filesystem
callbacks, which makes the analysis about 2x faster. Add
<code>.twoslash</code> to your <code>.gitignore</code>.</li>
<li>Identical popups of a code block are highlighted once.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3672">#3672</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e380a0d03a5f9e984d90230031e91c1731d10dca"><code>e380a0d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3659">#3659</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5d9353bc5879421ebcaee50f949a3681d0a7fc86"><code>5d9353b</code></a>
feat(core): better mixedbread search</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/097a544c51a3296486ee8b017a837b4855cde8dc"><code>097a544</code></a>
feat(openapi): auth provider API</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/945b87abbec82afa3549503f21a0318a05a771f3"><code>945b87a</code></a>
fix(core,satteri): optimize traverse &amp; better search records</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/3bf99285a95234aa2fdbea08101ac87b7a0d1625"><code>3bf9928</code></a>
fix(ui): display fallback tree slidings correctly</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/433b586a5dba40e3dda17c4e06c5db9c99281478"><code>433b586</code></a>
fix(openapi): better code examples</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b221e1d1db1e6701b419491db9ba657e7b5f5e73"><code>b221e1d</code></a>
fix(twoslash): better truncate &amp; performance</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/48bf8c6ec9e582d84888c6dd9aba1db3502fec7e"><code>48bf8c6</code></a>
fix(openapi,typescript): render Markdown images, show the OAuth redirect
URI</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb7d92c20b1c2d60bfed6eccdc6f2882c68fe00f"><code>cb7d92c</code></a>
docs: introduce new APIs</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/8f1ffb36aaab84c35eed47bf903ce06984ae3ffe"><code>8f1ffb3</code></a>
refactor(ui): use <code>prose</code> class for search result
markdown</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-twoslash@4.0.1...fumadocs-twoslash@4.0.2">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-typescript` from 5.4.1 to 5.5.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-typescript's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-typescript@5.5.1</h2>
<h3>Format generated Markdown tables</h3>
<ul>
<li>Generated tables have aligned columns: the type tables of
<code>auto-type-table</code>, the tables of
<code>renderToMarkdown()</code> and the table rows of search
records.</li>
<li><code>markdownTable()</code> from
<code>fumadocs-core/mdx-plugins/stringifier</code> creates a formatted
table for your plugins.</li>
<li><code>fumadocs-typescript</code> requires <code>fumadocs-core</code>
16.17.1.</li>
</ul>
<h2>fumadocs-typescript@5.5.0</h2>
<h3>Index tables by row</h3>
<p>Structured data records each table row as a Markdown table of its
header row and itself, instead of a record per cell. Type tables from
<code>auto-type-table</code> record a row for each prop instead of the
<code>TypeTable</code> element. Re-sync your search indexes to pick them
up.</p>
<ul>
<li><code>remarkStructure()</code> defaults <code>types</code> to
<code>table</code> instead of <code>tableCell</code>.</li>
<li><code>tableRowToStructuredData()</code> from
<code>fumadocs-core/search</code> creates the structured data of a table
row, <code>typeTableToStructuredData()</code> from
<code>fumadocs-typescript</code> of a type table.</li>
<li>Search hooks group the rows of a table into a <code>table</code>
item, <code>&lt;SearchDialogList /&gt;</code> renders it with
<code>Table</code>, <code>&lt;SearchDialogListTable /&gt;</code> by
default.</li>
<li>Algolia and Orama Cloud link to the anchor of every record, like the
props of type tables.</li>
<li>Orama Cloud searches <code>title</code>, <code>section</code> and
<code>content</code> by default, set <code>params.properties</code> to
search other fields.</li>
<li><code>remarkStructure()</code> of Sätteri records the
<code>data.structuredData</code> of nodes in place of the nodes.</li>
</ul>
<h3>Fix images in descriptions, show the OAuth redirect URI</h3>
<ul>
<li>Images in Markdown of API pages, like the description of an
operation, and in descriptions of <code>&lt;AutoTypeTable /&gt;</code>
props no longer crash the page with &quot;Element type is
invalid&quot;.</li>
<li>The OAuth panel of the playground shows the
<code>redirect_uri</code> of the authorization code and implicit flows,
with a button to copy it: the <code>oauthRedirectUrl</code> route when
set, otherwise the current page.</li>
<li>The Authorize row of OAuth schemes in the playground is one button,
filling the row.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3661">#3661</a>,
<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3663">#3663</a></p>
<h3>Markdown and search records from the authored source</h3>
<p><code>remarkLLMs()</code> and <code>remarkStructure()</code> of
<code>fumadocs-core</code> slice their Markdown from the authored source
like Sätteri, instead of stringifying the syntax tree. It is much
faster, Markdown is no longer escaped or reformatted, and local images
keep their addresses. Re-sync your search indexes to pick up the new
records.</p>
<ul>
<li>Plugins record the Markdown of content they replace with
<code>replaceSource()</code> or <code>embedSource()</code> from
<code>fumadocs-core/mdx-plugins/stringifier</code>, in place of
<code>data._stringify</code>, and add search records with
<code>data.structuredData</code>. Nodes they insert otherwise are left
out. A <code>namespace</code> limits an edit to the stringifiers of that
namespace, like <code>search</code> for search records.</li>
<li>Search records are always Markdown, also in Sätteri.
<code>filterElement</code> replaces
<code>stringify.filterElement</code>, it chooses the JSX elements kept
as HTML tags (<code>File</code>, <code>TypeTable</code>,
<code>Callout</code> and <code>Card</code> by default) that search
dialogs render as components. Other elements and links are replaced by
their content, images are removed, and an element on one line is
recorded like a paragraph.</li>
<li>Removed <code>defaultStringifier()</code> (use
<code>createStringifier()</code>), <code>StringifyOptions</code>,
<code>allowedMdxAttributes</code>, <code>filterMdxAttributes</code>,
<code>placeholder()</code> (use <code>mdxAsPlaceholder</code>), and the
<code>stringify</code> and <code>mdast-util-to-markdown</code> options
of both plugins.</li>
<li>Included content goes through the plugins like the document's own,
Sätteri includes <code>.md</code> files as Markdown.</li>
<li><code>&lt;auto-files&gt;</code> shows its files in a code block,
<code>auto-type-table</code> its props in a Markdown table, created by
<code>typeTableToMarkdown()</code> from
<code>fumadocs-typescript</code>.</li>
<li><code>remarkShow()</code> and <code>fileGenerator()</code> of
<code>fumadocs-docgen</code> record their Markdown, generators receive
the <code>file</code> to do the same.</li>
<li>Records of <code>fumadocs-obsidian</code> resolve wikilinks, and
leave comments, block IDs, callout markers and embeds out. Comments are
removed before parsing, so they no longer split a paragraph.</li>
<li>Pages of <code>fumadocs-python</code> compile from their MDX, so
they have Markdown and search records.</li>
<li><code>fumadocs-mdx</code>, <code>fumadocs-docgen</code> and
<code>fumadocs-obsidian</code> require <code>fumadocs-core</code>
16.17.0.</li>
</ul>
<p>Fix <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3662">#3662</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d6cfc48d62aa9ea413f0fc5033617c0c923681ec"><code>d6cfc48</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3683">#3683</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/54217c3df270013af0d88adefbb7817361f0a381"><code>54217c3</code></a>
feat(*): support Takumi for all templates</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/73cda6eaff4f644c0da1593674a84e4f4e9c94db"><code>73cda6e</code></a>
feat(core): format md tables</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb0b104c8681f0387781e7d0cab8b3269000bb7c"><code>cb0b104</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3682">#3682</a>
from Misyuk-T/fix/asyncapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/50c316da062579e5c0de025b7ed5f44a55860bb8"><code>50c316d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3679">#3679</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/4cb520a3f6835744d9dd24123ee332b41a8434bd"><code>4cb520a</code></a>
docs: introduce 16.17</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/53119f10154d6ae0a6253558c79739a292c66ea8"><code>53119f1</code></a>
docs: add Turbobulls to showcase (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3677">#3677</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b238fe4fa024e2ef9df0c25e786f53196a855919"><code>b238fe4</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3678">#3678</a>
from MokiMeow/fix/openapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e380a0d03a5f9e984d90230031e91c1731d10dca"><code>e380a0d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3659">#3659</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5d9353bc5879421ebcaee50f949a3681d0a7fc86"><code>5d9353b</code></a>
feat(core): better mixedbread search</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-typescript@5.4.1...fumadocs-typescript@5.5.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-ui` from 16.15.15 to 16.17.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-ui's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.17.1</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.1</li>
<li>fumadocs-core@16.17.1</li>
<li>fumadocs-ui@16.17.1</li>
</ul>
<h3>Format generated Markdown tables</h3>
<ul>
<li>Generated tables have aligned columns: the type tables of
<code>auto-type-table</code>, the tables of
<code>renderToMarkdown()</code> and the table rows of search
records.</li>
<li><code>markdownTable()</code> from
<code>fumadocs-core/mdx-plugins/stringifier</code> creates a formatted
table for your plugins.</li>
<li><code>fumadocs-typescript</code> requires <code>fumadocs-core</code>
16.17.1.</li>
</ul>
<h2>fumadocs@16.17.0</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.17.0</li>
<li>fumadocs-core@16.17.0</li>
<li>fumadocs-ui@16.17.0</li>
</ul>
<h3>Highlight search results with CSS</h3>
<p>Search results no longer wrap matches in <code>&lt;mark&gt;</code>,
<code>content</code> is the indexed Markdown. The search dialog
highlights matches with the <a
href="https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API">CSS
Custom Highlight API</a>, style them with
<code>::highlight(fd-search)</code>. Custom search UIs can use
<code>useHighlightQuery()</code> from
<code>fumadocs-core/search/client</code>.</p>
<ul>
<li><code>createContentHighlighter()</code> is deprecated.</li>
<li>Removed <code>contentWithHighlights</code> from search results, and
the <code>renderHighlights</code> prop of <code>&lt;SearchDialogListItem
/&gt;</code>.</li>
<li><code>&lt;SearchDialogListItem /&gt;</code> renders the Markdown of
results with the <code>prose prose-sm</code> typography.</li>
</ul>
<h3>Search hooks for each provider</h3>
<p><code>fumadocs-core/search/client</code> exports a hook for each
search client, like <code>useFetchSearch()</code>. They return the props
of <code>&lt;SearchDialog /&gt;</code>:</p>
<pre lang="tsx"><code>const search = useFetchSearch({ locale });
<p>&lt;SearchDialog {...search} {...props}&gt;<br />
&lt;SearchDialogList /&gt;<br />
&lt;/SearchDialog&gt;;<br />
</code></pre></p>
<p><code>data</code> is the last successful search, its
<code>items</code> have their content parsed into
<code>hastContent</code>. <code>error</code> is set when the last search
failed.</p>
<ul>
<li><code>experimental_useSearch()</code> creates a search hook from a
memoized search function.</li>
<li><code>useDocsSearch()</code> is deprecated.</li>
<li><code>useFlexsearchStatic()</code> and
<code>useOramaCloudLegacySearch()</code> are exported from the paths of
their clients.</li>
<li><code>&lt;SearchDialogList /&gt;</code> shows
<code>defaultItems</code> without results.</li>
<li><code>useSearchList()</code> is removed, <code>useSearch()</code>
returns <code>getActive()</code>, <code>setActive()</code> and
<code>subscribeActive()</code> for the active item.</li>
<li><code>&lt;SearchDialogListItem /&gt;</code> renders a
<code>div</code> instead of a <code>button</code>, table rows render
their cells only.</li>
<li><code>renderMarkdown</code> of <code>&lt;SearchDialogListItem
/&gt;</code> renders <code>content</code> instead of
<code>hastContent</code>. Without it, the string content of custom items
is shown as text.</li>
<li>The templates of Fumadocs CLI and Create Fumadocs App use the new
hooks.</li>
</ul>
<h3>Index tables by row</h3>
<p>Structured data records each table row as a Markdown table of its
header row and itself, instead of a record per cell. Type tables from
<code>auto-type-table</code> record a row for each prop instead of the
<code>TypeTable</code> element. Re-sync your search indexes to pick them
up.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d6cfc48d62aa9ea413f0fc5033617c0c923681ec"><code>d6cfc48</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3683">#3683</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/54217c3df270013af0d88adefbb7817361f0a381"><code>54217c3</code></a>
feat(*): support Takumi for all templates</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/73cda6eaff4f644c0da1593674a84e4f4e9c94db"><code>73cda6e</code></a>
feat(core): format md tables</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb0b104c8681f0387781e7d0cab8b3269000bb7c"><code>cb0b104</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3682">#3682</a>
from Misyuk-T/fix/asyncapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/50c316da062579e5c0de025b7ed5f44a55860bb8"><code>50c316d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3679">#3679</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/4cb520a3f6835744d9dd24123ee332b41a8434bd"><code>4cb520a</code></a>
docs: introduce 16.17</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/53119f10154d6ae0a6253558c79739a292c66ea8"><code>53119f1</code></a>
docs: add Turbobulls to showcase (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3677">#3677</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/b238fe4fa024e2ef9df0c25e786f53196a855919"><code>b238fe4</code></a>
Merge pull request <a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3678">#3678</a>
from MokiMeow/fix/openapi-generate-files-imports</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e380a0d03a5f9e984d90230031e91c1731d10dca"><code>e380a0d</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3659">#3659</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/5d9353bc5879421ebcaee50f949a3681d0a7fc86"><code>5d9353b</code></a>
feat(core): better mixedbread search</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.15.15...fumadocs@16.17.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `lucide-react` from 1.48.0 to 1.55.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/lucide-icons/lucide/releases">lucide-react's
releases</a>.</em></p>
<blockquote>
<h2>Version 1.55.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>mail-dot</code> icon by <a
href="https://github.com/elenakovelskikh"><code>@​elenakovelskikh</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3230">lucide-icons/lucide#3230</a></li>
<li>ci(lint): split lint jobs and annotate Prettier and JSON schema
errors in PRs by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4982">lucide-icons/lucide#4982</a></li>
<li>chore(deps-dev): bump sharp from 0.35.4 to 0.35.5 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4987">lucide-icons/lucide#4987</a></li>
<li>chore(deps): bump next from 16.3.6 to 16.3.8 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4988">lucide-icons/lucide#4988</a></li>
<li>test(lucide): add tests for empty icons error and DocumentFragment
root in createIcons by <a
href="https://github.com/grzdev"><code>@​grzdev</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4967">lucide-icons/lucide#4967</a></li>
<li>feat(icons): added <code>phone-log</code> icon by <a
href="https://github.com/Levi-Bensley"><code>@​Levi-Bensley</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3598">lucide-icons/lucide#3598</a></li>
<li>chore(copilot-instruction): Adjust instruction text to allow more
then 4 use-cases by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4989">lucide-icons/lucide#4989</a></li>
<li>feat(icons): added <code>wifi-lock</code> icon by <a
href="https://github.com/benhaube"><code>@​benhaube</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4913">lucide-icons/lucide#4913</a></li>
<li>feat(icons): Add <code>handle-bottom-right</code> icon by <a
href="https://github.com/ocavue"><code>@​ocavue</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/1793">lucide-icons/lucide#1793</a></li>
<li>test(lucide-react): add tests for DynamicIcon fallback and ref
forwarding by <a
href="https://github.com/grzdev"><code>@​grzdev</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4966">lucide-icons/lucide#4966</a></li>
<li>feat(icons): added <code>screw</code> icon by <a
href="https://github.com/edik17"><code>@​edik17</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4932">lucide-icons/lucide#4932</a></li>
<li>feat(icons): added <code>user-round-star</code> icon by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3469">lucide-icons/lucide#3469</a></li>
<li>feat(icons): added <code>shield-house</code> icon by <a
href="https://github.com/benhaube"><code>@​benhaube</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4602">lucide-icons/lucide#4602</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/grzdev"><code>@​grzdev</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4967">lucide-icons/lucide#4967</a></li>
<li><a
href="https://github.com/Levi-Bensley"><code>@​Levi-Bensley</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3598">lucide-icons/lucide#3598</a></li>
<li><a href="https://github.com/edik17"><code>@​edik17</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4932">lucide-icons/lucide#4932</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.54.0...1.55.0">https://github.com/lucide-icons/lucide/compare/1.54.0...1.55.0</a></p>
<h2>Version 1.54.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>lens</code> icon by <a
href="https://github.com/rrod497"><code>@​rrod497</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4923">lucide-icons/lucide#4923</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.53.0...1.54.0">https://github.com/lucide-icons/lucide/compare/1.53.0...1.54.0</a></p>
<h2>Version 1.53.0</h2>
<h2>What's Changed</h2>
<ul>
<li>chore(deps-dev): bump preact from 10.29.8 to 11.0.0 in the
preact-deps group by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4961">lucide-icons/lucide#4961</a></li>
<li>chore(deps): bump vue from 3.5.42 to 3.5.43 in the vue-deps group by
<a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4958">lucide-icons/lucide#4958</a></li>
<li>fix(site): Fix reset button and rename absolute stroke width to
non-scaling stroke by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4956">lucide-icons/lucide#4956</a></li>
<li>chore(deps-dev): bump simple-git from 3.36.0 to 4.0.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4968">lucide-icons/lucide#4968</a></li>
<li>chore(deps-dev): bump the angular-deps group across 1 directory with
11 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4960">lucide-icons/lucide#4960</a></li>
<li>chore(categories): Add description field to categories by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4909">lucide-icons/lucide#4909</a></li>
<li>feat(icons): added <code>groceries</code> icon by <a
href="https://github.com/rrod497"><code>@​rrod497</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4907">lucide-icons/lucide#4907</a></li>
<li>fix(icons): changed <code>pen-tool</code> icon by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4972">lucide-icons/lucide#4972</a></li>
<li>feat(icons): added new <code>hiking-stick</code> icon by <a
href="https://github.com/kamilasw"><code>@​kamilasw</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4711">lucide-icons/lucide#4711</a></li>
<li>feat(icons): added scratch-blocks icon by <a
href="https://github.com/mc20000-01"><code>@​mc20000-01</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4969">lucide-icons/lucide#4969</a></li>
<li>fix(icons): changed <code>soup</code> and <code>salad</code> icons
by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4971">lucide-icons/lucide#4971</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/mc20000-01"><code>@​mc20000-01</code></a> made
their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4969">lucide-icons/lucide#4969</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.52.0...1.53.0">https://github.com/lucide-icons/lucide/compare/1.52.0...1.53.0</a></p>
<h2>Version 1.52.0</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/lucide-icons/lucide/commit/949bc6d61f5964a98f99f4eb9b5bc291949ca18f"><code>949bc6d</code></a>
test(lucide-react): add tests for DynamicIcon fallback and ref
forwarding (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4">#4</a>...</li>
<li><a
href="https://github.com/lucide-icons/lucide/commit/98331e287029edeff0e04f269439884d060af703"><code>98331e2</code></a>
chore(deps): bump the react-deps group across 1 directory with 3 updates
(<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4951">#4951</a>)</li>
<li><a
href="https://github.com/lucide-icons/lucide/commit/09aa9c5c62c3b4b519fbb8c9ce1c396cc12f4dae"><code>09aa9c5</code></a>
chore(deps): Upgrade to vite 8 (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4950">#4950</a>)</li>
<li><a
href="https://github.com/lucide-icons/lucide/commit/e042fec3b59b2bc36a07bcd8b433c1aedde1db29"><code>e042fec</code></a>
fix(packages): declare <code>@types/react</code> as an optional peer
dependency (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4892">#4892</a>)</li>
<li>See full diff in <a
href="https://github.com/lucide-icons/lucide/commits/1.55.0/packages/lucide-react">compare
view</a></li>
</ul>
</details>
<br />

Updates `next` from 16.3.8 to 16.4.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v16.4.0</h2>
<p>Check out the <a href="https://nextjs.org/blog/next-16-4">16.4
announcement post</a> to get an overview of the changes.</p>
<h3>Core Changes</h3>
<ul>
<li>Show compiler plugin warning in more situations: <a
href="https://redirect.github.com/vercel/next.js/issues/75682">#75682</a></li>
<li>fix(scripts): correct typo in rm.mjs error message: <a
href="https://redirect.github.com/vercel/next.js/issues/87015">#87015</a></li>
<li>docs: improve clarity and punctuation in README: <a
href="https://redirect.github.com/vercel/next.js/issues/86096">#86096</a></li>
<li>Fix debug build paths Pages Router support entries: <a
href="https://redirect.github.com/vercel/next.js/issues/93529">#93529</a></li>
<li>bundle-analyzer: record historical snapshots on each analyze run: <a
href="https://redirect.github.com/vercel/next.js/issues/93520">#93520</a></li>
<li>fix: detect proxy.ts correctly with compound pageExtensions: <a
href="https://redirect.github.com/vercel/next.js/issues/93246">#93246</a></li>
<li>feat(turbopack): support <code>false</code> values for
<code>resolveAlias</code> config: <a
href="https://redirect.github.com/vercel/next.js/issues/93331">#93331</a></li>
</ul>
<h3>Misc Changes</h3>
<ul>
<li>docs: correction to dynamicParams migration: <a
href="https://redirect.github.com/vercel/next.js/issues/96624">#96624</a></li>
<li>docs: proxy event argument: <a
href="https://redirect.github.com/vercel/next.js/issues/96435">#96435</a></li>
<li>docs: remove experimental note from runtime prefetching: <a
href="https://redirect.github.com/vercel/next.js/issues/96615">#96615</a></li>
<li>Preserve per-segment prefetching after dynamic navigation: <a
href="https://redirect.github.com/vercel/next.js/issues/96583">#96583</a></li>
<li>Rename static generation stream option to waitForAllReady: <a
href="https://redirect.github.com/vercel/next.js/issues/96564">#96564</a></li>
<li>Remove obsolete static generation plumbing: <a
href="https://redirect.github.com/vercel/next.js/issues/96563">#96563</a></li>
<li>[turbopack] Drop dead writes to <code>exports</code>: <a
href="https://redirect.github.com/vercel/next.js/issues/96381">#96381</a></li>
<li>[turbopack] Ignore writes to <code>exports</code> after a
<code>module.exports = {}</code> writes: <a
href="https://redirect.github.com/vercel/next.js/issues/96380">#96380</a></li>
<li>[turbopack] Add test for sideEffects with optimizePackageImports: <a
href="https://redirect.github.com/vercel/next.js/issues/96549">#96549</a></li>
<li>[turbopack] Strip leading BOM before parsing CSS: <a
href="https://redirect.github.com/vercel/next.js/issues/96678">#96678</a></li>
<li>Upgrade React from <code>cbb046ab-20260731</code> to
<code>7dfc7ccd-20260803</code>: <a
href="https://redirect.github.com/vercel/next.js/issues/96550">#96550</a></li>
<li>docs: use relative doc links in instant-navigation error pages: <a
href="https://redirect.github.com/vercel/next.js/issues/96672">#96672</a></li>
<li>Turbopack: terminate failed plugin worker threads: <a
href="https://redirect.github.com/vercel/next.js/issues/96592">#96592</a></li>
<li>Fix HTML-limited bot matching in prerender bypass rules: <a
href="https://redirect.github.com/vercel/next.js/issues/96584">#96584</a></li>
<li>[ci] Fix create_release_branch for new repo permissions: <a
href="https://redirect.github.com/vercel/next.js/issues/96641">#96641</a></li>
<li>test: skip action module instance deploy test: <a
href="https://redirect.github.com/vercel/next.js/issues/96629">#96629</a></li>
<li>docs: quote the dynamicParams build error in a blockquote: <a
href="https://redirect.github.com/vercel/next.js/issues/96633">#96633</a></li>
<li>[react-sync] Open pull requests as the bot that authors the commits:
<a
href="https://redirect.github.com/vercel/next.js/issues/96682">#96682</a></li>
<li>[Bench] Fixes for pure Fizz bench: <a
href="https://redirect.github.com/vercel/next.js/issues/96771">#96771</a></li>
<li>Derive foreground cache revalidation from the consumer: <a
href="https://redirect.github.com/vercel/next.js/issues/96731">#96731</a></li>
<li>Fix race when navigating Back before hydration: <a
href="https://redirect.github.com/vercel/next.js/issues/96252">#96252</a></li>
<li>docs: present each Skill as steps in the AI agents guide: <a
href="https://redirect.github.com/vercel/next.js/issues/96751">#96751</a></li>
<li>Reuse completed cache entries for the rest of a request: <a
href="https://redirect.github.com/vercel/next.js/issues/96727">#96727</a></li>
<li>Upgrade React from <code>7dfc7ccd-20260803</code> to
<code>11eddecd-20260805</code>: <a
href="https://redirect.github.com/vercel/next.js/issues/96735">#96735</a></li>
<li>Remove WorkStore execution mode: <a
href="https://redirect.github.com/vercel/next.js/issues/96674">#96674</a></li>
<li>Remove cache revalidation execution mode reads: <a
href="https://redirect.github.com/vercel/next.js/issues/96670">#96670</a></li>
<li>Separate App Route render and prerender pipelines: <a
href="https://redirect.github.com/vercel/next.js/issues/96662">#96662</a></li>
<li>Remove App Page execution mode reads: <a
href="https://redirect.github.com/vercel/next.js/issues/96660">#96660</a></li>
<li>test: fix missing await in css-chunking test: <a
href="https://redirect.github.com/vercel/next.js/issues/96725">#96725</a></li>
<li>docs (Skills): stop assuming app/ at the root and port 3000: <a
href="https://redirect.github.com/vercel/next.js/issues/96696">#96696</a></li>
<li>Implement next/font BeforeResolvePlugins as
ImportMappingReplacement: <a
href="https://redirect.github.com/vercel/next.js/issues/95808">#95808</a></li>
<li>Use Tailwind Turbopack loader in create-next-app: <a
href="https://redirect.github.com/vercel/next.js/issues/96606">#96606</a></li>
<li>docs: instant navigation quick start with an adoption prompt: <a
href="https://redirect.github.com/vercel/next.js/issues/96663">#96663</a></li>
<li>Separate App Page render and prerender pipelines: <a
href="https://redirect.github.com/vercel/next.js/issues/96659">#96659</a></li>
<li>Move App Router execution intent to entrypoints: <a
href="https://redirect.github.com/vercel/next.js/issues/96640">#96640</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/e273d5b2e869d0be06c0e86f788e1594f9dd40cf"><code>e273d5b</code></a>
v16.4.0</li>
<li><a
href="https://github.com/vercel/next.js/commit/fdf41d6f6315ebff3a7056d7e7f002b8e78749d4"><code>fdf41d6</code></a>
[ai-upgrade] discover upgrade models and reasoning efforts from agent
CLIs (#...</li>
<li><a
href="https://github.com/vercel/next.js/commit/c3e76ad9e49ac21d1667e4b8b2b6b3a3348d2975"><code>c3e76ad</code></a>
v16.4.0-canary.63</li>
<li><a
href="https://github.com/vercel/next.js/commit/47c6cc8da0a35432bc964548ecfb5e1ba160b69c"><code>47c6cc8</code></a>
Document next analyze export in the package bundling guide (<a
href="https://redirect.github.com/vercel/next.js/issues/99735">#99735</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/5b10604925853d8cd0bee61eb49d4894707cf7ac"><code>5b10604</code></a>
Revert stabilization of <code>forbidden()</code> and
<code>unauthorized()</code> (<a
href="https://redirect.github.com/vercel/next.js/issues/99734">#99734</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/f3a6f976de26c40e7a6543a3175666906e84e050"><code>f3a6f97</code></a>
Preserve configured output directories during static export (<a
href="https://redirect.github.com/vercel/next.js/issues/99507">#99507</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/b22e5a299cb58577ce86f21b6a0f7bb31a6168f2"><code>b22e5a2</code></a>
Rename skill to next-bundle-optimizer and document its usage (<a
href="https://redirect.github.com/vercel/next.js/issues/99731">#99731</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/74dc549ca01d7c1adada50576b2b204a4ad32df6"><code>74dc549</code></a>
[turbo-tasks-backend] Clean up task state before publishing execution
complet...</li>
<li><a
href="https://github.com/vercel/next.js/commit/ccf8c15a42d1a7140cf569ac15bec3ccb0187e8f"><code>ccf8c15</code></a>
v16.4.0-canary.62</li>
<li><a
href="https://github.com/vercel/next.js/commit/b8c7c7f2f3222d133f2a64d9bb77cc83d68f8172"><code>b8c7c7f</code></a>
Improve static route error guidance (<a
href="https://redirect.github.com/vercel/next.js/issues/99724">#99724</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/next.js/compare/v16.3.8...v16.4.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@ai-sdk/openai` from 4.0.79 to 4.0.91
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ai/blob/main/packages/openai/CHANGELOG.md">@​ai-sdk/openai's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.91</h2>
<h3>Patch Changes</h3>
<ul>
<li>5cf13d2: feat: map the top level embedding dimensions to provider
settings</li>
<li>72e9d38: feat(openai): send image detail in decisions</li>
<li>fb933f9: Report failed and incomplete web searches as tool errors
instead of successful tool results in OpenAI Responses API calls and
batch results.</li>
<li>Updated dependencies [4dbc902]
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.26</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.58</li>
</ul>
</li>
</ul>
<h2>4.0.90</h2>
<h3>Patch Changes</h3>
<ul>
<li>6c59fb1: fix(openai): preserve sampling parameters for GPT-6 Sol and
Luna when reasoning is disabled, accounting for reasoning effort updates
in Responses requests</li>
</ul>
<h2>4.0.89</h2>
<h3>Patch Changes</h3>
<ul>
<li>
<p>9184a35: Add ordered text, file, and JSON parts to experimental
decision state. Support image input in OpenAI Decisions and language
model adapters. Gateway retains its existing string and JSON request
format and rejects files, as does TypeSafe AI.</p>
<p>Arrays passed directly as state now contain decision state parts.
Wrap JSON arrays in an object or a json part.</p>
<p>Normalize all public state forms into an array of parts before
calling decision providers. Providers receive text and JSON objects as
text and json parts.</p>
<p>Serialize decision file bytes as base64 in OpenTelemetry state
attributes. Model-call spans record normalized state parts, while outer
spans retain public state inputs.</p>
<p>Preserve native JSON state in TypeSafe AI when state contains one
JSON part. Label shared state in language-model decision prompts.</p>
</li>
<li>
<p>Updated dependencies [9184a35]</p>
<ul>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.25</li>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.57</li>
</ul>
</li>
</ul>
<h2>4.0.88</h2>
<h3>Patch Changes</h3>
<ul>
<li>32ff7ad: Preserve tool errors in OpenAI Chat Completions and
Responses by wrapping their payloads in an <code>error</code> object.
Send Google tool errors and denied executions under
<code>functionResponse.response.error</code>.</li>
</ul>
<h2>4.0.87</h2>
<h3>Patch Changes</h3>
<ul>
<li>bccc1b7: fix(openai): avoid duplicate references for stored messages
with multiple text parts</li>
</ul>
<h2>4.0.86</h2>
<h3>Patch Changes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/ai/commit/50203a81019c2117c413b959398443ec7f84f325"><code>50203a8</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22320">#22320</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/5cf13d2d60fa1afc5cebfb2aafbeb0384ca4121a"><code>5cf13d2</code></a>
feat: map the top level embedding dimensions to provider settings (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22338">#22338</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/72e9d382695ebf7535aacc68ae9b85b00254ca6d"><code>72e9d38</code></a>
feat(openai): send image detail in decisions (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22287">#22287</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/fb933f9b189bffbeb26ae831e8bf70d6f7c0bc08"><code>fb933f9</code></a>
fix(openai): report failed web searches as tool errors (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22330">#22330</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/c78c1bec0500e39bb6ab3afe2a64652e75d4d557"><code>c78c1be</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22311">#22311</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/6c59fb1d65b0d39cf96acc991733642579e7749a"><code>6c59fb1</code></a>
fix: preserve sampling parameters for GPT-6 Sol and Luna when reasoning
is di...</li>
<li><a
href="https://github.com/vercel/ai/commit/be51c7379e8b6a66218605274f379e12541cae7e"><code>be51c73</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22274">#22274</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/9184a35d40947ba6b151dca4018dca8ade457743"><code>9184a35</code></a>
feat: accept multimodal input in <code>decide</code> (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22229">#22229</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/0735a8745f2d44b68be7973013ac80ae43426a4e"><code>0735a87</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22242">#22242</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/32ff7ad300654f82d44e5519e9d42fe95b55a38f"><code>32ff7ad</code></a>
fix(openai,google): preserve tool error semantics (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/22209">#22209</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/ai/commits/@ai-sdk/openai@4.0.91/packages/openai">compare
view</a></li>
</ul>
</details>
<br />

Updates `@anthropic-ai/sdk` from 0.129.0 to 0.133.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/releases">@​anthropic-ai/sdk's
releases</a>.</em></p>
<blockquote>
<h2>sdk-v0.133.0</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add types for the Chat and Cowork unified
analytics metrics</li>
<li><strong>api:</strong> add workflows, multiagent configuration and
thread status filtering to Managed Agents</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>internal:</strong> remove the next branch rule from
CLAUDE.md</li>
</ul>
<h2>sdk-v0.132.1</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> throw before sending a request with an
empty path parameter</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> check that pull requests update the
changelog</li>
<li><strong>ci:</strong> publish every package from the publish
workflow</li>
<li><strong>docs:</strong> note that listing Claude Console spend limits
is in early access</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>split CLAUDE.md into shared, TypeScript, and repository rules</li>
</ul>
<h2>sdk: v0.132.0</h2>
<h2>0.132.0 (2026-10-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.131.0...sdk-v0.132.0">sdk-v0.131.0...sdk-v0.132.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add claude-haiku-5-5 and typed computer and
browser toolset tool calls (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/1fd826175b5742df1dc9fd69db708be1434fdc15">1fd8261</a>)</li>
<li><strong>api:</strong> add disabled to thinking types in model
capabilities (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
<li><strong>api:</strong> add display_name to RBAC roles and deprecate
name (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/7735ac3d2823c6d74377269772a5ae2b1ed939dc">7735ac3</a>)</li>
<li><strong>api:</strong> add include_default parameter to list
workspaces (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/c4019df3ad38e1ce985c1d8177c815ae36528d61">c4019df</a>)</li>
<li><strong>api:</strong> add lifecycle stage fields and filter to
/v1/models (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/fe8a762e0cdbc01aa2b4161865f44cdab70f502c">fe8a762</a>)</li>
<li><strong>api:</strong> add line to model objects (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/018aed463f7125ef7c8ee6eec2fd3610be585cc4">018aed4</a>)</li>
<li><strong>api:</strong> add url_sources to the Managed Agents
web_fetch tool config (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
<li><strong>api:</strong> add web search and code execution support to
model capabilities (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> send the beta header by default when listing
spend limits (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8f58ca41ae4097e82fe0efccfae94e0b7c5719b1">8f58ca4</a>)</li>
<li><strong>client:</strong> throw when a JSONL stream is iterated twice
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/a34266cf1ed3483eae7d44d275f761ab29d79748">a34266c</a>)</li>
<li><strong>tools:</strong> keep a local edit made after a memory upload
whose response was lost (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/893">#893</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/blob/main/CHANGELOG.md">@​anthropic-ai/sdk's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.132.1...sdk-v0.133.0">0.133.0</a>
(2026-10-09)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add types for the Chat and Cowork unified
analytics metrics</li>
<li><strong>api:</strong> add workflows, multiagent configuration and
thread status filtering to Managed Agents</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>internal:</strong> remove the next branch rule from
CLAUDE.md</li>
</ul>
<h2><a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.132.0...sdk-v0.132.1">0.132.1</a>
(2026-10-08)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> throw before sending a request with an
empty path parameter</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>ci:</strong> check that pull requests update the
changelog</li>
<li><strong>ci:</strong> publish every package from the publish
workflow</li>
<li><strong>docs:</strong> note that listing Claude Console spend limits
is in early access</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>split CLAUDE.md into shared, TypeScript, and repository rules</li>
</ul>
<h2>0.132.0 (2026-10-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.131.0...sdk-v0.132.0">sdk-v0.131.0...sdk-v0.132.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add claude-haiku-5-5 and typed computer and
browser toolset tool calls (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/1fd826175b5742df1dc9fd69db708be1434fdc15">1fd8261</a>)</li>
<li><strong>api:</strong> add disabled to thinking types in model
capabilities (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
<li><strong>api:</strong> add display_name to RBAC roles and deprecate
name (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/7735ac3d2823c6d74377269772a5ae2b1ed939dc">7735ac3</a>)</li>
<li><strong>api:</strong> add include_default parameter to list
workspaces (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/c4019df3ad38e1ce985c1d8177c815ae36528d61">c4019df</a>)</li>
<li><strong>api:</strong> add lifecycle stage fields and filter to
/v1/models (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/fe8a762e0cdbc01aa2b4161865f44cdab70f502c">fe8a762</a>)</li>
<li><strong>api:</strong> add line to model objects (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/018aed463f7125ef7c8ee6eec2fd3610be585cc4">018aed4</a>)</li>
<li><strong>api:</strong> add url_sources to the Managed Agents
web_fetch tool config (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
<li><strong>api:</strong> add web search and code execution support to
model capabilities (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2b75b497792ab23c7cac350829354a0027a93246">2b75b49</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> send the beta header by default when listing
spend limits (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8f58ca41ae4097e82fe0efccfae94e0b7c5719b1">8f58ca4</a>)</li>
<li><strong>client:</strong> throw when a JSONL stream is iterated twice
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/a34266cf1ed3483eae7d44d275f761ab29d79748">a34266c</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2979ed5cef4b2f059b95af23e08728c01e588f86"><code>2979ed5</code></a>
release: . 0.133.0</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8486d9bd224fb0c53fca05f54c5f9df5ed29b38f"><code>8486d9b</code></a>
Merge pull request <a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/908">#908</a>
from anthropics/synced/published</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/e0995e4bdea11b383c3df0882888045cc2a25636"><code>e0995e4</code></a>
feat(api): add workflows, multiagent configuration and thread status
filterin...</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/31eb3bea68ead3e8935aeef673a2b419c0e43002"><code>31eb3be</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5127b320bd571d40e78f1cec50a0f81d14e560ce"><code>5127b32</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/f702a46d872f8c27c7f641e34217447e86139dec"><code>f702a46</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/d64e976b4e36539865928bc048eaee821d60f935"><code>d64e976</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/9f754653fd2acab2b49d626552132c7711c1125f"><code>9f75465</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/6ec2ea17ac78fa99452afaea2c78783bd6e55870"><code>6ec2ea1</code></a>
chore(internal): remove the next branch rule from CLAUDE.md</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/373c33dedf525512d376bccdf16f7ab50f9ef39e"><code>373c33d</code></a>
codegen metadata</li>
<li>Additional commits viewable in <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.129.0...sdk-v0.133.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/node` from 26.6.3 to 26.6.5
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />

Updates `ai` from 7.0.119 to 7.0.137
<details>
<summary>Changelog</summary>
...

_Description has been truncated_

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-15 21:48:59 -05:00
ca6ba3486c fix(ccr): stream the buffered CCR upstream request so idle-killing networks cannot cut it (#4206)
## Description

The buffered CCR path flips a streaming Claude Code turn to `stream:
false` upstream so the proxy holds the whole reply before serving
`headroom_retrieve`. With `stream: false`, Anthropic sends no byte until
the generation is complete. A middlebox that drops HTTP connections idle
for ~60s (TLS-inspecting antivirus, VPN, corporate proxy; TCP keepalive
does not reset an HTTP-layer idle timer) closes the connection first:
each attempt fails at ~60s with `Server disconnected without sending a
response`, the client gets a 502 after ~186s, and Claude Code resends
the same body forever. The CCR continuation that serves the retrieval
(`anthropic_ccr_continuation`, its own `http_client.post`) is a second
`stream: false` call and is cut the same way. Without Headroom the
client streams and the same turns complete.

This PR keeps the buffered design and makes only its upstream leg
stream. The buffered request and every continuation built from it (CCR,
memory, turn hook) go to first-party Anthropic as `stream: true`, and
the event stream is folded back into the Message JSON the buffered path
already reads, so retrieval, memory, turn hooks, usage accounting and
SSE resynthesis see exactly what they saw before. Bytes (deltas and
pings) now flow for the whole generation, so an idle timer never fires.
The fold reuses `AnthropicSSEEnvelope`, the reconstruction #3130 and
#3266 already use on this path.

Closes #4205

## 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/proxy/handlers/anthropic.py`: new
`_send_buffered_as_stream(send, headers, body, *, url, request_id)`. It
sends `{**body, "stream": true}` with `Accept: text/event-stream` (one
Accept value, any casing replaced) and folds the reply:
- not a 200 event stream (an HTTP error, or an upstream that answered
JSON anyway): returned unchanged;
  - a whole stream: a 200 JSON response holding the folded Message;
- an in-band `error` event: the event as the body, with its own HTTP
status (529 `overloaded_error`, 429 `rate_limit_error`, other documented
types to their status, else 500);
- a stream that ended before `message_stop` or with a block open: the
existing strict 502 `upstream_protocol_error` of
`_adapt_event_stream_to_json` (#3266);
- a complete stream holding a known event the fold cannot read (an
unknown delta type): logged, and the original `stream: false` body is
sent instead. One more generation, but never a 502 the client would
resend forever.
A connection dropped mid-stream raises inside `send`, exactly as for a
`stream: false` reply. An in-band error arrives after upstream already
answered 200, so `_retry_request` does not retry it; the client gets the
status and retries as it would on a direct stream.
- It is used at the four places Headroom sends a body it made
non-streaming: the buffered CCR request (only when
`buffered_stream_ccr`; a client's own `stream: false` request still goes
through `_retry_request` with its original bytes), the CCR continuation
(the `prepare_outbound_body_bytes` + `log_outbound_request` +
`http_client.post` sequence moved into a local `_post_continuation`,
unchanged otherwise, so a fallback attempt logs its own outbound line),
the memory continuation and the turn-hook continuation.
- Gates: the body is not already streaming, the upstream is first-party
Anthropic (`is_custom_anthropic_base_url(url)` is false; the
host-equality check tool-search gating already uses), and the kill
switch `HEADROOM_BUFFERED_UPSTREAM_STREAM` is not
`0`/`false`/`no`/`off`. Copilot and other gateways keep the `stream:
false` request: the fold is checked against Anthropic's own stream, and
a gateway dialect it cannot read would cost every turn a second
generation.
- `headroom/proxy/runtime_env.py`: `HEADROOM_BUFFERED_UPSTREAM_STREAM`
is a registered knob in `RUNTIME_ENV_KNOBS`, read per request through
`runtime_env.getenv`, so a reusing `headroom wrap` pushes it to the
running proxy and `POST /admin/runtime-env` sets it with no restart.
Listed in the `security-model.mdx` allowlist.
- `headroom/proxy/anthropic_wire.py`: `fold_anthropic_stream(raw)`
parses with `AnthropicSSEEnvelope.parse` and trims each block to the
non-streaming Message shape: a null member leaves every block,
`thinking` keeps `type`/`thinking`/`signature`, `redacted_thinking`
keeps `type`/`data`. Claude Opus 5.5 streams a thinking
`content_block_start` with `estimated_tokens: null`; the CCR
continuation resends the folded turn as history, and Anthropic answers
any block carrying that member with 400 `Extra inputs are not
permitted`.
- `headroom/proxy/anthropic_wire.py` `_response_from_events`:
`message_delta.usage` is merged only where non-null, as the Anthropic
SDK's `MessageStream` does. Before, a null count there overwrote the
real `message_start` count (input and cache tokens) in the reconstructed
message.
- `headroom/proxy/buffered_ccr_response.py`: the status-to-error-type
table moves out of `_anthropic_error_type` into `ANTHROPIC_ERROR_TYPES`
so the handler can invert it; `_anthropic_error_type` returns the same
values.
- Unchanged on purpose: `body["stream"] = False` and its mutation reason
`ccr_streaming_retrieve_buffered_non_stream` stay the buffered path's
internal representation (every later step, the response-cache guard and
the #3587 log counts key on them), and the `using buffered stream:false
upstream request` log line keeps its text.
- Tests: new `tests/test_buffered_ccr_upstream_stream.py` (16 tests):
the fold equals the Anthropic Python SDK's `accumulate_event` result on
a stream with thinking, signature, redacted thinking, text, citations,
split `input_json_delta`, pings and a null usage count; stream-only
members are dropped; truncated, in-band error and unknown-delta
outcomes; the send helper's gates (kill switch, gateway URL, already
streaming), passthrough of non-stream replies, 529 for an in-band
overload, 502 for a truncated stream, the `stream: false` fallback; and
through the handler, the buffered turn and its CCR continuation both go
upstream `stream: true` with `Accept: text/event-stream` and the
continuation's resent thinking block carries only its schema, while a
client's own `stream: false` request goes out `stream: false` with
`Accept: application/json` and its original bytes.
- Existing tests that pinned `stream: false` on the wire for a buffered
turn now pin `stream: true` (`test_anthropic_streaming_ccr_retrieve.py`,
`test_ccr_buffered_stream_signed_thinking.py`,
`test_proxy_response_cache_replay.py`,
`test_no_ccr_disables_response_handling.py`).
`test_anthropic_buffered_ccr_usage.py` now answers the buffered turn
with an event stream, so usage booking is checked through the fold.
`test_buffered_ccr_accept_header.py` (#3078) pins the `stream: false`
leg it is about with the kill switch; custom upstreams such as Copilot
always take that leg.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`) - ran on the 3 changed
source files only, see below
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
$ pytest tests/test_buffered_ccr_upstream_stream.py -q
16 passed, 1 warning in 2.89s

# every test file that touches the buffered CCR path, the CCR continuation or SSE reconstruction
$ pytest tests/test_buffered_ccr_upstream_stream.py tests/test_sse_safeguards_passthrough.py \
    tests/test_buffered_ccr_salvage.py tests/test_anthropic_buffered_ccr_usage.py \
    tests/test_buffered_ccr_grace_window.py tests/test_anthropic_buffered_sse.py \
    tests/test_ccr_buffered_stream_signed_thinking.py tests/test_toin_feedback.py \
    tests/test_proxy_response_cache_replay.py tests/test_proxy/test_anthropic_buffered_timeout.py \
    tests/test_anthropic_auto_mode_passthrough.py tests/test_proxy/test_openai_responses_ccr.py \
    tests/test_sse_thinking_blocks.py tests/test_streaming_sse_malformed_events.py \
    tests/test_route_advice.py tests/test_memory_tool_stream.py \
    tests/test_proxy/test_anthropic_streaming_ccr_retrieve.py tests/test_proxy_byte_faithful_forwarding.py \
    tests/test_buffered_ccr_accept_header.py tests/test_anthropic_buffered_memory_continuation.py \
    tests/test_anthropic_ccr_workspace_unbound.py tests/test_no_ccr_disables_response_handling.py \
    tests/test_proxy_ccr.py tests/test_ccr_inline_resolve_handlers.py \
    tests/test_proxy/test_anthropic_ccr_raise.py tests/test_proxy/test_anthropic_ccr_deferred_injection.py \
    tests/test_nonstream_sse_policy.py tests/test_ccr_response_handler_extra.py \
    tests/test_compress_route_tokenizer_by_model.py -q
855 passed, 6 warnings in 57.94s

# the updated assertions fail on main's source (they pin stream:true on the wire)
$ git checkout upstream/main -- headroom/ && pytest tests/test_anthropic_buffered_ccr_usage.py \
    tests/test_proxy/test_anthropic_streaming_ccr_retrieve.py tests/test_ccr_buffered_stream_signed_thinking.py \
    tests/test_no_ccr_disables_response_handling.py tests/test_proxy_response_cache_replay.py -q --tb=no
12 failed, 33 passed, 1 warning in 13.64s

# whole suite
$ pytest tests -q
18 failed, 16435 passed, 583 skipped, 119 warnings in 1226.31s (0:20:26)
# 16 of the 18 fail the same way on unmodified main in the same environment
# (tests/test_proxy_uds.py x11, tests/test_cli/test_wrap_persistent.py x4,
#  tests/test_pricing_from_litellm.py groq/llama-guard-3-8b x1); the other 2
# (test_offline_egress_chokepoint.py::TestUpdateCheckOffline::test_explicit_update_check_never_constructs_request,
#  test_stateless_no_disk.py::test_cli_stateless_flag_exports_env_for_children) pass when run alone on this branch.

$ ruff check .
All checks passed!
$ ruff format --check .
1790 files already formatted
$ mypy headroom/proxy/anthropic_wire.py headroom/proxy/buffered_ccr_response.py headroom/proxy/handlers/anthropic.py
Success: no issues found in 3 source files
```

## Real Behavior Proof

- Environment: macOS 27.0.1 arm64, Python 3.11.13. Upstream `main`
f1bc2609 versus this branch, same venv.
- Exact command / steps: `repro_buffered_idle_cut.py` (full script in
#4205) runs the real proxy app (`create_app(ProxyConfig(...))` +
`TestClient`, real `_retry_request`, real `http_client`) against a fake
Anthropic upstream that takes 5s per reply (stream: a delta or ping
every 0.5s; non-stream: silent for 5s, then JSON), reached through a TCP
relay that closes any connection silent for 2s, a scaled-down 60s
middlebox. Scenario A: a streaming turn with a redeemable marker
(buffered path), slow reply. Scenario B: the model calls
`headroom_retrieve` in 0.3s and the continuation is slow. The script
points the first-party host check at the fake upstream and isolates
`HOME` and the savings ledger. `PYTHONPATH=<checkout> python
repro_buffered_idle_cut.py 2>/dev/null`
- Observed result: on main both scenarios fail and every upstream
request goes out `stream: false` and is cut; on the branch both complete
in about the generation time with no cut; with
`HEADROOM_BUFFERED_UPSTREAM_STREAM=0` on the branch the main behaviour
returns.

```text
# main f1bc2609
Scenario A (slow buffered turn)
  client: HTTP 200 after 10.1s -> FAIL: 20 keepalive pings, then {"type": "error", "error": {"type": "api_error", "message": "An error occurred while processing your request. Please try again."}}
  upstream requests: ['turn stream=false', 'turn stream=false', 'turn stream=false']
  connections the relay cut for idling: 3

Scenario B (slow CCR continuation)
  client: HTTP 502 after 2.3s -> FAIL: 0 keepalive pings, then {"type": "error", "error": {"type": "api_error", "message": "Unable to safely complete streamed CCR retrieval."}}
  upstream requests: ['retrieve call stream=false', 'continuation stream=false']
  connections the relay cut for idling: 1

# proxy log on main
WARNING - Request failed (attempt 1), retrying in 1322ms: Server disconnected without sending a response.
WARNING - Request failed (attempt 2), retrying in 2536ms: Server disconnected without sending a response.
ERROR - [hr_1791973393_000001] Request failed: RemoteProtocolError: Server disconnected without sending a response.
ERROR - CCR: Continuation API call failed: RemoteProtocolError: RemoteProtocolError('Server disconnected without sending a response.')
WARNING - [hr_1791973403_000002] CCR: Buffered streaming response still contains an unresolved headroom_retrieve after handling; failing closed

# this branch
Scenario A (slow buffered turn)
  client: HTTP 200 after 5.2s -> OK: the client got the final answer
  upstream requests: ['turn stream=true']
  connections the relay cut for idling: 0

Scenario B (slow CCR continuation)
  client: HTTP 200 after 5.3s -> OK: the client got the final answer
  upstream requests: ['retrieve call stream=true', 'continuation stream=true']
  connections the relay cut for idling: 0

# this branch, HEADROOM_BUFFERED_UPSTREAM_STREAM=0
Scenario A (slow buffered turn)
  client: HTTP 200 after 9.0s -> FAIL: 16 keepalive pings, then {"type": "error", "error": {"type": "api_error", "message": "An error occurred while processing your request. Please try again."}}
  upstream requests: ['turn stream=false', 'turn stream=false', 'turn stream=false']
  connections the relay cut for idling: 3

Scenario B (slow CCR continuation)
  client: HTTP 502 after 2.4s -> FAIL: 0 keepalive pings, then {"type": "error", "error": {"type": "api_error", "message": "Unable to safely complete streamed CCR retrieval."}}
  upstream requests: ['retrieve call stream=false', 'continuation stream=false']
  connections the relay cut for idling: 1
```

- Not tested: this branch has not sent traffic to api.anthropic.com. The
fold is checked against the Anthropic Python SDK's own accumulator and
against hand-built streams, not against live replies. For context, the
same transport change (a different fold implementation with the same
contract) has run as a downstream patch on the 0.39.0 wheel and was
checked live: 56 turns across Opus, Sonnet, Haiku and Fable models
(thinking, parallel `tool_use`, `web_search` with citations,
`max_tokens` cutoffs) matched the non-streaming reply's top-level, block
and usage shapes; 28 folded replies resent as history all returned 200;
behind a relay that cuts a connection after 20s of silence, a 409s
thinking turn completed (longest silence 2.1s) while the `stream: false`
path looped on 502s. The OpenAI Responses buffered path has the same
flip and is not changed here. Gateways (Copilot, custom base URLs) are
not changed.

## Runtime Rollout Safety

- Rollout-managed feature(s): None. This is a transport fix, not a
`rollout.py` feature.
- Minimum rollout channel: N/A; it applies on every channel.
- Stable/default behavior changed: Yes, for first-party Anthropic only.
A buffered CCR turn and its CCR, memory and turn-hook continuations now
go upstream `stream: true` with `Accept: text/event-stream`, and the
proxy folds the reply into the same Message JSON. Request content is
otherwise identical, so there is no compression, cache or token-count
effect. The client still gets the buffered response it got before
(keepalive pings, then the resynthesized stream), so time to first byte
(#3587) is unchanged. A client's own `stream: false` request, every
custom upstream, and the OpenAI paths are unchanged. One shared change:
`message_delta` usage nulls no longer overwrite `message_start` counts
in `AnthropicSSEEnvelope`, so a re-rendered stream on the streaming path
now carries the real count where it carried `null`.
- Kill switch / disable path: `HEADROOM_BUFFERED_UPSTREAM_STREAM=0`
(also `false`, `no`, `off`), a runtime-env knob read on every request:
set it in the proxy environment, let a reusing `headroom wrap` push it,
or `POST /admin/runtime-env` (no restart). Every buffered request then
goes out `stream: false` exactly as on main
(`test_a_propagated_kill_switch_keeps_the_request_non_streaming`).
- Unsafe override required: No.
- Qualification impact: transport only. A complete stream the fold
cannot read costs one extra generation (logged as `Could not fold the
upstream event stream ...; sending the request again as stream:false`);
that should not happen with the first-party API today and is the safe
answer to a future delta type.
- Rollback path: set `HEADROOM_BUFFERED_UPSTREAM_STREAM=0` (no restart
needed), or revert these commits.

## 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
- [x] 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, proxy transport change.

## Additional Notes

- Documentation: no user-facing doc describes the buffered request's
wire shape, so none changed. The kill switch is documented in the
helper's docstring.
- Relation to #3587: that issue is the latency side of the same flip
(time to first byte becomes the whole generation, and the flip fires on
turns where retrieval never redeems). This PR does not change when the
buffered path is taken or what the client sees first; it fixes the
availability side, where a turn longer than a middlebox's idle limit
never arrives. #3587's asks (a stricter redeemability gate, a switch
that disables buffering) are independent of this change.
- Relation to #3013: #3013 replaces the buffered path with event-level
splicing of the client stream behind `ccr_event_streaming` (default on)
and keeps the buffered `stream: false` request as the qualified fallback
when that flag is off. This PR is the small transport fix for the
buffered design as it is on main: it does not touch the
`buffered_stream_ccr` gating or the log line #3013 rewrites, and it adds
no new conflict with #3013 (a `git merge-tree` of #3013's head against
main and against this branch shows the same 3 conflict hunks in
`anthropic.py` and 2 in `test_anthropic_streaming_ccr_retrieve.py`). If
#3013 lands, its buffered fallback gets a streamed upstream leg from
this change for free.
- OpenAI Responses: that handler has the same flip (`openai.py`, `using
buffered stream:false`) and the same exposure; it is left for a
follow-up because its fold is a different event format.
- `compaction_delta` and other delta types `AnthropicSSEEnvelope` does
not reconstruct take the `stream: false` fallback rather than a guess;
teaching the envelope a new delta type removes that extra generation.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4206"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
- Review fix 61b42465: the kill switch is a registered runtime-env knob
(see Changes Made), so the rollback reaches a proxy that `headroom wrap`
reuses. Useful here because a fold failure can cost a second generation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-15 16:29:46 -05:00
Mansurshakh JaparovandJD Davis 875745889f fix(batch): preserve native Gemini continuation tools (#4211)
## Description

Closes #4182.

Google batch continuations wrapped native Tool objects in
`functionDeclarations` and could lose the retrieval declaration added
during compression. Keep the tools actually sent upstream, without
replacing the original conversation.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)

## Changes Made

- Pass native Google Tool objects directly to continuations.
- Store the effective forwarded tools, including injected retrieval and
sibling `googleSearch`/`codeExecution` tools.
- Cover batch creation through retrieval and the final answer, including
an initially empty tool list.

## Testing

- [ ] Unit tests pass (pytest) — focused suites only.
- [ ] Linting passes (ruff check .) — changed-file hooks only.
- [ ] Type checking passes (mypy headroom)
- [x] Manual testing performed

### Test Output

With this checkout's Rust extension loaded:

```text
pytest tests/test_ccr_batch_processor.py tests/test_ccr_batch_store.py tests/test_proxy_handlers_batch.py -q --no-cov
100 passed in 10.30s
```

The normal push gate also passed Rust workspace checks, rebuilt the
extension, and reported:

```text
181 passed, 5 warnings in 10.39s
ci-precheck PASSED — safe to push.
```

[Independent HTTP before/after
evidence](https://github.com/headroomlabs-ai/headroom/issues/4182#issuecomment-6149567901).

## Real Behavior Proof

- Environment: Linux x86_64, Python 3.13.14, current Rust/PyO3
extension, production batch handlers and retrieval stores; a loopback
HTTP provider, not live Google.
- Exact command / steps: run the focused command above. For the HTTP
probe, create a batch containing 200 string records and native tools,
process the injected retrieval call, and check the continuation's tools
and recovered records.
- Observed result: batch creation returns 200. The forwarded request
shrinks from 22,896 to 1,980 bytes, retains lookup, headroom_retrieve,
googleSearch and codeExecution, recovers all 200 original records, and
returns finalText="All records recovered". Rechecked at head `618811d0`.
- Not tested: live Google acceptance, billing or model quality;
Windows/macOS; successful hosted checks at this head.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; existing Google batch continuations.
- Minimum rollout channel: unchanged.
- Stable/default behavior changed: preserve the native tools and
retrieval declarations sent upstream.
- Kill switch / disable path: existing batch/CCR configuration.
- Unsafe override required: no.
- Qualification impact: real HTTP continuation verified locally; live
provider not tested.
- Rollback path: revert the fix; no persistence migration.

## 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
- [x] I did not edit CHANGELOG.md — release-please owns it

## Additional Notes

The [maintainer
re-review](https://github.com/headroomlabs-ai/headroom/pull/4211#pullrequestreview-5521733040)
says the retrieval-declaration finding is addressed. Its remaining hold
concerns shared-main rustls advisories; it did not request another code
change here.

AI-assisted; no subagents.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4211"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-15 16:28:18 -05:00
Mansurshakh JaparovandJerrettDavis f1bc260948 fix(deps): recommend headroom-ai for optional extras (#4046)
### Maintainer qualification refresh (2026-10-09)

Current head: `345d362496cd0eb3cf3919137961ef6bc7c140ec`. Merged current
main `01d9194` cleanly through GitHub branch update, preserving the
installation guidance and fixture corrections. The merged tree passed 48
focused pricing/dependency tests and 17 xAI/LiteLLM tests; Ruff and
whitespace checks passed. Current-head hosted checks are now green.
Earlier runtime and resolver evidence remains attributed to its original
tested heads. Ready for human merge review; no merge performed.

## Description

Closes #4041. Recommend this project's PyPI distribution
`headroom-ai[...]` in optional-dependency errors and installation
examples; keep the Python import and CLI name `headroom` unchanged.

Current published head: `345d362496cd0eb3cf3919137961ef6bc7c140ec`.
Maintainer updates, main's Intel-macOS ONNX documentation, shared ONNX
test-contract adaptations, and independent xAI billing checks are
preserved.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- Correct fourteen Python guidance owners and the existing installation
documentation.
- Quote extras requirements portably, e.g. `pip install
"headroom-ai[langchain]"`.
- Preserve existing exception types, optional-dependency conditions,
package imports and executable names.
- Preserve the maintainer's shared test-fixture corrections; no
production billing change.

## Testing

- [ ] Unit tests pass (`pytest`) — no new whole-project local run
claimed.
- [ ] Linting passes (`ruff check .`) — earlier bounded owner checks are
linked below.
- [ ] Type checking passes (`mypy headroom`) — no new installed-extra
whole-project claim.
- [ ] New tests added for new functionality
- [x] Manual testing performed

### Test Output

Historical pre-synchronization hosted checks:
https://github.com/headroomlabs-ai/headroom/actions/runs/37811412629

Observed on `45c5a3658`: all four Python shards, extras tests, native
Docker exercise, builds and lint succeeded. Rust-only lanes were
skipped, not counted as passed.

Independent maintainer before/after public API and pip evidence,
including complete runnable guard script and output:
https://github.com/headroomlabs-ai/headroom/pull/4046#issuecomment-6064193865

Historical owner qualification at `ef7a1c933`: 334 passed, 12 skipped, 9
local-model cases deselected; 67 dependency-contract/CLI tests passed.
The initial seven offline Ollama failures are disclosed there, not
relabeled green. Later 74-test pricing validation and the LiteLLM
1.104.2 portability check:
https://github.com/headroomlabs-ai/headroom/pull/4046#issuecomment-6064722009

## Real Behavior Proof

- Environment: original Linux x86_64 / Python 3.13.14 default-only
environment, plus the maintainer's independent Windows default-only
`headroom-ai==0.40.0` environment genuinely lacking `langchain_core`; no
provider/model calls.
- Exact command / steps: run the public `HeadroomChatModel(object())`
constructor and all seven real optional-LangChain guards using the
complete script in the linked maintainer evidence. The maintainer also
executed these non-installing resolver commands:

```powershell
G:/tmp/headroom-review/resume26-4046-venv/Scripts/python.exe -m pip install --dry-run --ignore-installed --no-deps --only-binary=:all: --report G:/git/headroom/.remember/tmp/pr4046-resume26-pip-old.json 'headroom[langchain]'
G:/tmp/headroom-review/resume26-4046-venv/Scripts/python.exe -m pip install --dry-run --ignore-installed --no-deps --only-binary=:all: --report G:/git/headroom/.remember/tmp/pr4046-resume26-pip-corrected.json 'headroom-ai[langchain]'
```

- Observed result: before, the public constructor recommends the
unrelated distribution and its check fails; after, all eight surfaces
advertise the quoted `headroom-ai[langchain]` requirement. Pip's old
requirement selects unrelated `headroom` 0.2.7 with no extras; the
corrected requirement selects `headroom-ai` 0.40.0 with the advertised
extra. No unrelated package was installed or executed.
- Not tested: live provider billing, paid endpoints, model downloads,
successful memory evaluation, or a new local whole-project typecheck.
The original default-only memory-eval attempt reached an unchanged late
NumPy import error before this guidance block; no success is claimed for
it.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; installation guidance correction
only.
- Minimum rollout channel: N/A; no rollout channel or runtime flag
added.
- Stable/default behavior changed: corrected installation advice only;
optional-import conditions and exception types are unchanged.
- Kill switch / disable path: N/A; no feature enablement or persistent
state change.
- Unsafe override required: no.
- Qualification impact: follow the correct distribution's existing
extras; no dependency constraint changes. Exact-head hosted Python
checks passed; skipped Rust-only lanes are not fresh qualification.
- Rollback path: revert the guidance change; no state migration or data
rollback.

## 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
- [x] I have made corresponding changes to the documentation
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please

## Additional Notes

Issue #4041 explicitly excludes source-string wording-only permanent
tests. A literal-message equality test would copy this edit, and live
index-resolution tests would be network-dependent; the actual public API
and non-installing resolver red/green evidence verify the requested
contract. Existing owner suites remain in place. Independent maintainer
results are attributed above, not represented as newly executed local
checks. AI-assisted follow-up, without subagents; no approval or merge
performed.

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-13 16:37:32 -07:00
Mansurshakh JaparovandJerrettDavis 9762a14a40 fix(smart-crusher): preserve wrapped retrieval results in apply (#4149)
## Current-head security-gate integration

Head `17ac399ac38930a265d8e5108c703110cd3e2ebb` incorporates upstream
main `49751ec4` (#4178). The upstream change is Cargo.lock only;
contributor logic and behavioral regressions are unchanged. This section
supersedes older current-head/check-status references below; earlier
runtime evidence is retained as historical implementation qualification.

Normal commit/pre-push hooks passed without bypass: Rust formatting,
warnings-as-errors Clippy, complete workspace tests, native editable
rebuild/import verification, **181 critical Python tests**, and
branch-range commitlint. Fresh local `cargo audit --file Cargo.lock`
also passed (546 dependencies, no findings). Hosted checks for this new
head must complete independently; local results are not a claim that all
hosted checks are green.

## Description

Closes #4147. Related: #3563, #3837 and the already merged router fix
#3915.

Close the remaining direct Python `SmartCrusher.apply()` parity gap:
resolve originating wrapper calls with the existing shared
`unwrap_tool_call_name` parser before applying the CCR retrieval
exemption. This is not a duplicate proxy/router fix, a blanket wrapper
exclusion, or a new content-based recovery heuristic.

## Type of Change

- [x] Bug fix (non-breaking correction)
- [x] Documentation update

## Changes Made

- Resolve OpenAI originating function arguments and Anthropic tool-use
input to their effective tool names in the existing call-ID index.
- Preserve null-function handling, missing-ID/name behavior and the
shared parser's conservative ambiguity/malformed-input rules.
- Add four real-native regression cases: OpenAI/Anthropic × Hermes
`tool_call`/`functions.exec`, each checking byte-exact retrieval output
and a genuinely compressed ordinary wrapper-output control.
- Remove old tautological compression assertions and retain
named-retrieval consumer coverage.
- Document direct `apply()` recovery identity, the need for originating
call history, and the context-free `crush()` limit. Native compression,
thresholds, CCR storage and the parser itself are unchanged.

## Testing

- [x] Real native regression and shared wrapper safety suites pass
- [x] Ruff passes on the two changed Python files
- [x] Scoped mypy passes on the changed source file
- [x] Actual rebuilt native API and real tokenizer exercised before and
after

### Test Output

```text
Before: 4 wrapped-recovery regressions failed at byte preservation.
After: 65 passed, 1 warning in 126.20s
Ruff: All checks passed!
mypy: Success: no issues found in 1 source file
```

The warning is the existing Anthropic tokenizer approximation in an
unchanged Hermes test. The scoped suite comprises the direct retrieval
exemption tests plus Hermes and orchestrator-wrapper safety coverage;
this is not a full-Python-suite claim.

Normal commit/push hooks completed without bypass: Rust fmt, workspace
Clippy
with `-D warnings`, workspace Rust tests, native extension
build/install/import
verification, critical Python suite (**177 passed, 4 skipped, 1 warning
in
25.48s**) and commitlint. The ordinary push succeeded with the genuine
installed
ORT library explicitly resolved. No native backend or gate threshold
changed.

### Review follow-up verification

The non-string-name caller correction is in
`40fa055854b1c4b60da84f78d534976bc3fd40fb`; the reviewed thread is
resolved. Verification against that exact published Python source: **83
passed, 1 existing Anthropic approximation warning in 16.44s**, across
direct retrieval, Hermes and orchestrator safety suites. Changed-file
Ruff and scoped mypy passed.

A separate real native API smoke reused the genuine unchanged Rust
extension and real OpenAI tokenizer: all four wire/wrapper cases
returned exactly 27,490 recovery bytes, and all ordinary controls still
compressed. An OpenAI `name=["Bash"]` returned its original `"ok"`
result. Anthropic malformed names are tested at the identity-index
boundary: the bundled tokenizer rejects such malformed tool-use names
earlier, and this PR does not change or claim that tokenizer behavior.
No mocked native backend, live provider request, or live retrieval-store
claim.

## Real Behavior Proof

- Environment: Linux x86_64, Python 3.13.14, latest-main base
`976aa714ef3e19174dc0cb586cee7b20d064e4ef`, freshly built
`headroom/_core.abi3.so`, real OpenAI `gpt-4o` tokenizer. Resolve the
installed genuine `libonnxruntime.so.1.26.0` via `ORT_DYLIB_PATH`; no
native fallback, mocked compressor or provider request.
- Exact command / steps: run `python -m pytest -q
tests/test_transforms/test_smart_crusher_ccr_retrieve_exemption.py
tests/test_hermes_tool_call_unwrap.py
tests/test_orchestrator_wrapper_ccr_retrieve.py`, Ruff on the two
changed files and mypy on `headroom/transforms/smart_crusher.py`.
Separately call the production native-backed `SmartCrusher.apply()` with
a 27,490-byte synthetic recovery result and an equally sized ordinary
result; originating wrapper arguments invoke retrieval only for the
recovery call. Exercise both wire formats and both wrappers. The
isolated reproduction uses the existing test configuration
`min_tokens_to_crush=0` unchanged before/after; production/native
thresholds are not changed.
- Observed result: before, all four recovery payloads became CCR-marked
505/509-byte outputs. After, all four returned exactly 27,490 bytes,
matching the original byte for byte, with no new recovery CCR marker.
Every ordinary wrapper result still compressed. Copied runtime results
are below.
- Not tested: a live provider session, proxy HTTP route, real client
integration, or a complete retrieval loop. This is a real direct-library
reproduction using synthetic returned recovery bytes, not a claim that a
synthetic hash was retrieved from a live store.

| Wire | Wrapper | Recovered bytes before | Recovered bytes after |
Exact after | Ordinary output compressed after |
|---|---|---:|---:|---|---|
| OpenAI | `tool_call` | 505 | 27490 | Yes | Yes |
| OpenAI | `functions.exec` | 505 | 27490 | Yes | Yes |
| Anthropic | `tool_call` | 509 | 27490 | Yes | Yes |
| Anthropic | `functions.exec` | 509 | 27490 | Yes | Yes |

## Runtime Rollout Safety

- Rollout-managed feature(s): None; existing originating-call identity
and CCR exemption only.
- Minimum rollout channel: Stable; existing rollout controls unchanged.
- Stable/default behavior changed: Direct `apply()` no longer
re-compresses recognized wrapped recovery results. Unrelated wrapper
output still compresses; malformed/ambiguous wrappers retain normal
shared-parser behavior.
- Kill switch / disable path: No new switch; revert this identity-map
correction to restore prior direct-transform behavior.
- Unsafe override required: None; runtime qualification used only
synthetic local messages.
- Qualification impact: Both wire formats, both wrapper families, real
native output/control behavior and shared parser/router safety coverage
qualified. Live-client/provider/proxy limits remain explicit above.
- Rollback path: Revert the code/tests/docs to base
`976aa714ef3e19174dc0cb586cee7b20d064e4ef`; no data/schema migration.

## Review Readiness

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

## Checklist

- [x] Shared wrapper parsing reused, no second identity convention
- [x] Documentation updated
- [x] Native and existing wrapper safety regressions pass
- [x] No new source warnings, dependencies or native policy changes
- [x] `CHANGELOG.md` untouched; Conventional Commit PR title used

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-13 16:37:18 -07:00
1dc7a183f5 fix(copilot): honour GitHub's advertised Business/Enterprise host by default (#4155)
## Description

Supersedes #3403 (parked, stacked on the conflicting #3402) as a
standalone change on `main`.

GitHub's token exchange advertises a per-plan chat host in
`endpoints.api`: `api.business.githubcopilot.com` for Business seats and
`api.enterprise.githubcopilot.com` for Enterprise seats, and GitHub's
own clients route with it. Since #2441 Headroom has folded both into the
generic `api.githubcopilot.com`, because the segmented hosts lagged on
newer Claude models at the time.

That fold breaks enterprises on GitHub's [subscription-based network
routing](https://docs.github.com/en/copilot/how-tos/administer-copilot/manage-for-enterprise/manage-access/manage-network-access):
their firewall allows only the plan host, the generic host is
unreachable, and the failure looks like a random connection error. It
also made the VS Code guide's Enterprise section wrong, which said
Headroom uses the advertised URL.

This PR honours the Business and Enterprise advertised hosts by default
and adds `GITHUB_COPILOT_USE_ADVERTISED_HOST=0` (also
`false`/`no`/`off`) to restore the generic-host fold for seats where the
segmented host still lags. An explicit `GITHUB_COPILOT_API_URL` or
enterprise domain still wins over both. The individual host keeps being
folded (#610 is unchanged).

Refs #2441, #610, #3352 (an Enterprise seat behind a corporate firewall;
the inline-completions 401 there is #4144).

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- `headroom/copilot_auth.py`:
`_subscription_api_url_from_user_info_payload` returns the advertised
host for the two plan hosts unless `GITHUB_COPILOT_USE_ADVERTISED_HOST`
opts out, and logs the chosen host with the opt-out next to it. That
line is emitted where the host is resolved: the `wrap` process for the
subscription lanes, which does not write to `proxy.log`. The dedicated
proxy's `/health` (`config.openai_api_url`) is where the chosen host
shows up. The generic and individual hosts still normalize to
`DEFAULT_API_URL`. `resolve_copilot_api_url`'s docstring no longer
claims the advertised host is ignored on purpose. Every subscription
lane (`wrap vscode`, `wrap copilot --subscription`, OpenCode
`--copilot-subscription`) already pins `resolution.api_url` into the
dedicated proxy as `--openai-api-url` and `GITHUB_COPILOT_API_URL`, so
they pick this up without changes; `is_copilot_api_url`,
`copilot_completions_base_url` and `_github_host` already treat
`*.githubcopilot.com` as a public Copilot host (verified by an
independent review of the diff).
- `headroom/cli/wrap.py`: `wrap copilot` help text describes the
per-plan routing for `--subscription`; the implicit OAuth lane still
uses the generic host (it performs no token exchange), which the text
now says.
- Docs: `docs/content/docs/vscode-copilot.mdx` Enterprise section is now
true and names the opt-out and the firewall case;
`docs/content/docs/corporate-networks.mdx` lists the plan hosts;
`TESTING-copilot-subscription.md` host section split by lane:
`--subscription` / `wrap vscode` / OpenCode honour the plan host, the
implicit OAuth `wrap copilot` lane is explicitly generic-host (it
performs no token exchange at launch, and `resolve_copilot_api_url` is
pinned network-free by an existing test), and its "open an issue for
auto-detection" paragraph removed.
- Tests: Business and Enterprise honoured; individual and generic still
folded; opt-out restores the fold; explicit pin wins; `wrap copilot
--subscription` pins the advertised host; the implicit OAuth lane stays
on the generic host even when user-info advertises the Enterprise host;
OpenCode subscription lane expectation updated. Three existing tests
that asserted the fold were updated to the new contract.

Follow-ups, not in this PR: `headroom doctor --network` still probes
only `api.githubcopilot.com` (it should probe the resolved plan host);
the implicit OAuth `wrap copilot` lane could resolve the plan host
through the token exchange too.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy`)
- [x] New tests added for new functionality
- [x] Manual testing performed (live Copilot Business seat, 2026-10-13;
see Live verification)

### Test Output

```text
$ pytest tests/test_copilot_auth.py tests/test_cli/test_wrap_copilot.py tests/test_cli/test_wrap_vscode.py \
    tests/test_copilot_vscode_completions_routing.py tests/test_provider_copilot_vscode_config.py \
    tests/test_cli/test_wrap_opencode.py tests/test_proxy_copilot_auth_hooks.py tests/test_provider_proxy_routes.py \
    tests/test_copilot_integration_id_hmac.py tests/test_proxy/test_anthropic_copilot_upstream_auth.py \
    tests/test_copilot_native_mode.py tests/test_copilot_subscription_smoke.py tests/test_cli/test_copilot_auth.py \
    tests/test_cli/test_wrap_persistent.py
449 passed, 4 deselected
# the 4 deselected tests (test_wrap_persistent.py::*recover*) fail identically on the base commit 976aa714
# with AttributeError: 'TaskManifest' object has no attribute 'runtime_kind'; unrelated to this change

$ uvx ruff@0.16.8 check . && uvx ruff@0.16.8 format --check .
All checks passed! / 1777 files already formatted
$ mypy headroom/copilot_auth.py headroom/cli/wrap.py --ignore-missing-imports
Success: no issues found in 2 source files
```

## Real Behavior Proof

- Environment: macOS, Python 3.12, repo venv, native core loaded.
- Exact command / steps: the suites above, with the new regressions
failing when `_subscription_api_url_from_user_info_payload` is reverted
to the fold.
- Observed result: the token-exchange and user-info producers, `wrap
vscode`, `wrap copilot --subscription` and the OpenCode lane all hand
the dedicated proxy `https://api.enterprise.githubcopilot.com` (or
`.business.`) as both `--openai-api-url` and `GITHUB_COPILOT_API_URL`;
completions still resolve to `copilot-proxy.githubusercontent.com`.
- Live seat: see "Live verification" below. Not tested: an
Enterprise-plan seat (`api.enterprise.`; same code branch as Business),
and the `wrap copilot --subscription` lane (the test seat has the
Copilot CLI policy off).

### Verification needed before release

No Business or Enterprise seat is available to us. Carrier (Enterprise
seats behind a subscription-routed firewall) runs, on this branch, with
`SSL_CERT_FILE` unset and no `GITHUB_COPILOT_API_URL` exported:

```bash
headroom copilot-auth login            # device flow; approve in the browser
headroom wrap vscode                   # leave running; note the port it prints
curl -s http://127.0.0.1:<port>/health | python3 -m json.tool | grep openai_api_url
#   expected: "openai_api_url": "https://api.enterprise.githubcopilot.com"
# then send one Copilot Chat turn in VS Code (any model) and one inline completion
headroom wrap copilot --subscription -- --model claude-sonnet-4.6 -s -p "Reply with exactly: OK"
#   expected: the banner shows COPILOT_PROVIDER_API_URL=https://api.enterprise.githubcopilot.com and the reply is OK
```

`curl -s http://127.0.0.1:<port>/health` on the dedicated proxy should
report `"openai_api_url": "https://api.enterprise.githubcopilot.com"`
(the "advertised plan host" log line is printed by the wrap process, not
written to `proxy.log`). If a model that the generic host serves is
rejected on the plan host (`400 ... model is not supported`), the #2455
condition still holds for that seat: set
`GITHUB_COPILOT_USE_ADVERTISED_HOST=0`, restart the wrapper, and report
the model and the response body on this PR before it is released.

### Live verification (2026-10-13, Copilot Business seat)

Branch merged with #4154 on current `main`, isolated
`HEADROOM_WORKSPACE_DIR`, `SSL_CERT_FILE` and `GITHUB_COPILOT_API_URL`
unset, `headroom copilot-auth login` device flow.

- `/copilot_internal/user` for the seat: `copilot_plan: business`,
`endpoints.api: https://api.business.githubcopilot.com`. (For about
three hours after the seat was assigned GitHub still advertised
`api.individual.`; the plan host appeared on its own.)
- Resolution: default → `https://api.business.githubcopilot.com`;
`GITHUB_COPILOT_USE_ADVERTISED_HOST=0` →
`https://api.githubcopilot.com`; explicit `GITHUB_COPILOT_API_URL` wins.
`main`'s `copilot_auth.py` resolves the same seat to
`https://api.githubcopilot.com`.
- `headroom wrap vscode`: dedicated proxy started with `--openai-api-url
https://api.business.githubcopilot.com`; `/health` reports it.
- Model sweep through the proxy, one turn per picker model on each
endpoint it lists (plus `gpt-4o-mini`): **36/36 returned 200** on the
plan host (Claude Haiku/Sonnet/Opus 4.x–5.5 on `/v1/messages` and
`/chat/completions`, Gemini 3.7/3.8/4, GPT-5.x/6.x and Grok on
`/responses`, `gpt-5-mini`, `gpt-4o-mini`). No `model_not_supported`, so
the #2441/#2455 lag does not reproduce on Business today.
- Real VS Code (Copilot Chat 0.69): Ask mode on Auto (`gpt-6-luna`),
Claude Sonnet 5.5 chat (`/v1/messages`), and Agent mode with tool calls
(wrote and ran a pytest file) all went to
`api.business.githubcopilot.com`; every Copilot upstream call in the
proxy log used the plan host, none the generic host.
- Found while testing, not caused by this PR and present on `main`:
ghost text / next edits (`copilot-nes-*` on `/chat/completions`) are
sent to CAPI and get `400 model_not_supported` on both the plan host and
the generic host. Fixed separately in #4188.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; env-gated.
- Minimum rollout channel: stable.
- Stable/default behavior changed: yes. Business and Enterprise
subscription sessions now route to their advertised plan host instead of
`api.githubcopilot.com`. Individual seats, explicit pins and GHE domains
are unchanged.
- Kill switch / disable path: `GITHUB_COPILOT_USE_ADVERTISED_HOST=0`
restores the previous fold without a rollback; `GITHUB_COPILOT_API_URL`
pins any host.
- Unsafe override required: no.
- Qualification impact: adds plan-host routing coverage to the Copilot
auth and wrap suites.
- Rollback path: revert the 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 made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-13 15:20:50 -07:00
a31d89b492 docs(security): sync runtime-env knob table with RUNTIME_ENV_KNOBS (#4051)
## Description

The "What `POST /admin/runtime-env` can change" table in
`docs/content/docs/security-model.mdx` no longer matches the allowlist
it claims to list (`RUNTIME_ENV_KNOBS` in
`headroom/proxy/runtime_env.py`).

- It lists `HEADROOM_EFFORT_ROUTER` and `HEADROOM_MECHANICAL_EFFORT`.
Those knobs were removed from the code in #3377 (2026-09-01), and today
they appear nowhere in the repo except this page. A GitHub code search
for `EFFORT_ROUTER` in this repo returns only `security-model.mdx`.
Someone who sets them through `headroom wrap` or the admin route gets a
silent no-op.
- It omits `HEADROOM_VERIFY_TRUNCATION_ON_DISK` and
`HEADROOM_VERIFY_TRUNCATION_MAX_BYTES`, which #3192 added to the
allowlist.

This page describes the admin write surface. A stale list there is a
correctness problem, not just a cosmetic one: it understates what a
caller can change and names two keys that do nothing.

The fix removes the two removed knobs and adds the two new ones, using
the descriptions from their `Knob(...)` definitions.

## Type of Change

- [x] Documentation update

## Changes Made

- Match the runtime-env table to the seven keys in `RUNTIME_ENV_KNOBS`.
- Remove the two retired effort-router keys and document the
disk-verification knobs.
- Include the existing Windows limitation: disk verification returns
`UNKNOWN` because `dir_fd` / `O_NOFOLLOW` support is unavailable.
- Maintainer synchronized current `main` without conflicts. Runtime
implementation unchanged.

## Testing

Verified the documentation against the actual registry and override
allowlist. No runtime code changed, so no new unit test was added for
this one-line platform caveat.

- [x] Manual testing completed (describe below)

### Test Output

```text
Documentation table matches all seven current registry keys; retired keys rejected; Windows UNKNOWN caveat present
git diff --check: passed
```

## Real Behavior Proof

- Environment: Windows 11, Python 3.12.13, current synchronized PR head.
- Exact command / steps: run the maintainer table/registry verifier
against this worktree; parse the seven documented keys, compare with the
actual imported `RUNTIME_ENV_KNOBS`, pass those keys and the two retired
effort knobs to the real `set_overrides`, then clear the overrides.
Inspect the Windows caveat against the registry and disk-verifier
platform restriction.
- Observed result: all seven documented keys match the current registry
and are accepted; the two retired keys are rejected. The Windows
`UNKNOWN` caveat is present. The documentation change introduces no
runtime mutation.
- Not tested: no website rendering or paid provider calls; this changes
one Markdown table and no runtime code.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; documentation only.
- Minimum rollout channel: n/a; existing behavior is described.
- Stable/default behavior changed: no.
- Kill switch / disable path: n/a; no runtime change.
- Unsafe override required: no.
- Qualification impact: documentation matches the current allowlist and
platform limits.
- Rollback path: revert the documentation commit.

## Review Readiness

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

## Additional Notes

Maintainer review and publication preserve the contributor's intended
documentation correction. The missing platform caveat is now explicit.
Hosted checks at this new head remain under maintainer qualification; no
contributor CI action is requested.

Original author: Anton Dziatkovskii / tonydzi.

---------

Signed-off-by: Anton Dziatkovskii <194927794+tonydzi@users.noreply.github.com>
Co-authored-by: Anton Dziatkovskii <194927794+tonydzi@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-08 22:40:34 -05:00
Mansurshakh Japarov 79f2c2781a fix(install): distinguish protocol targets in status (#4040)
## Description

Closes #2615.

`headroom install status` labelled the default backend as the generic
`Backend`, even when an OpenAI target was configured independently. This
made a healthy OpenAI-only deployment look like an Anthropic-only
deployment.

## Type of Change

- [x] Bug fix
- [x] Documentation update

## Changes Made

- Label the fallback/backend choice as `Default backend`.
- Show `Anthropic target` and `OpenAI target` separately as `configured`
or `default`, based on the existing live loopback health configuration.
- Do not print upstream target URLs or their embedded credentials.
- Preserve the existing non-dict health-config guard and all
lifecycle/routing behavior.
- Document the distinction in the existing persistent-installs page.
- Cover configured/default/unknown targets,
missing/non-dict/partial/malformed health configuration, manifest
fallback, credential withholding, and actual HTTP status probes.

## Testing

- Complete install/CLI owner suites: **296 passed, 5 skipped**, one
existing Starlette/httpx deprecation warning.
- Ruff lint and format checks for both changed Python files: passed.
- `mypy headroom/cli/install.py`: passed, one source file checked.
- Installed commit hooks: passed (including whole-project mirrored mypy
and commit lint).
- Required `make ci-precheck`, run by the actual pre-push hook: passed —
Rust fmt, strict Clippy, full workspace tests, native extension
build/import, **177 Python passed / 4 skipped** (one existing
provider-counting warning), and commitlint.
- First pre-push attempt hit the unchanged native
`first_dispatch_never_blocks_on_model_init` 500 ms bound at 592.8 ms.
The isolated test and then the complete unchanged gate passed. No
threshold, test, native source, or gate was modified or skipped.
- Independent installed-LangChain whole-project typing failure at
`chat_model.py:394` is tracked in #4039; this changed CLI file's scoped
check passes. No claim that the CLI change fixes that separate error.
- Hosted Codecov's automated advisory reports 0% patch coverage for the
three display lines. The real CLI before/after runs above exercise them;
no wording-only mock test was added to manufacture coverage. At the
observed SHA, there is no failing Codecov check; remaining hosted jobs
were still in progress.

## Real Behavior Proof

Linux x86_64, Python 3.13.14; base
`3c418f6f0b190ad1060413c0eadd77f20ab3cf46`.

Created a real manifest with the production planner and atomic
persistence API, then ran the actual `headroom install agent run` and
`headroom install status` CLI. HOME, canonical workspace/config roots,
profiles, logs, and ports were isolated under the project verification
directory. No system supervisor or provider configuration was installed
or modified. Compression/caching were disabled through supported raw
proxy flags because this is status-display proof, not compression proof;
the anonymous beacon was disabled.

Before, live `/health` reports `backend=anthropic`, a configured OpenAI
URL, and no configured Anthropic URL; status is running/healthy but ends
with `Backend: anthropic` only.

After, the same configuration reports:

```text
Default backend:  anthropic
Anthropic target: default
OpenAI target:    configured
```

A second actual run with both protocol URLs configured reports both
targets as configured. The intentionally unreachable Anthropic test
endpoint reports `Healthy: no` there; configured is not misrepresented
as reachable/healthy. A fake secret embedded in each verification URL
does not appear in status output. Agents were explicitly terminated
after each observation; no graceful-exit claim.

Not tested: paid upstream requests, a running compression workload,
macOS, Windows, or a real platform supervisor installation.

## Runtime Rollout Safety

No channel, feature flag, routing, auth, or persisted-data format
changes. Only operator display changes. Revert this commit to restore
the old display; deployment profiles remain valid.

## Review Readiness

- [x] Changed consumers and existing health-config contract reviewed
- [x] Actual before/after CLI surface verified

## Checklist

- [x] Existing documentation updated
- [x] No warnings introduced in the changed Python files
- [x] No CHANGELOG edit (release-please owns it)

AI-assisted: omp / GPT-6.1 Sol, without subagents. No hosted-CI claim.


## Follow-up qualification at 2969351e3d

When the health response withholds configuration or omits a target
field, status now reports `unknown` instead of asserting the default.
Malformed target values also remain unknown. Explicit null/empty URL
fields report default; configured string URLs report configured without
exposing their contents.

Reproduce the committed HTTP regressions from a configured repository
Python environment:

```sh
python -m pytest tests/test_cli/test_install_cli.py -k status -q
```

For the actual proxy/CLI replay, save the complete script in [the
maintainer evidence
comment](https://github.com/headroomlabs-ai/headroom/pull/4040#issuecomment-6062359335)
as `verify_status.py` in the repository root, then run `python
verify_status.py`. It creates temporary production manifests and an
actual uvicorn proxy, verifies direct health configuration and
configuration withheld by the real health guard through a relay, and
checks that status never prints URLs/credentials. The same script fails
on the original 39e7d46fa head and passes on this head. This is not a
real Docker networking or OS-supervisor installation claim.

Independent Windows/Python 3.12 verification: 319 install/CLI tests
pass, 2 platform skips, one existing warning; Ruff lint/format and
Linux-platform mypy over 566 files pass. The complete suite also
reproduced one unrelated Windows planner test mismatch: it expects
persistent-service defaults although unchanged Windows planning
intentionally converts that preset to persistent-task (#2552). That test
was deselected in the follow-up suite; no planner source/test changed.
Exact setup, limitations, before/after output assertions, and script are
in the linked evidence.
2026-10-08 10:18:32 -05:00
lorenzozaneandJD Davis 51ec6e8ffe fix(deps): support Intel macOS ONNX Runtime resolution (#3823)
## Description

Intel macOS cannot install `headroom-ai[proxy]` or `[all]` when the
extras select ONNX Runtime 1.24+, whose wheels no longer support x86_64
macOS. Retain the available pre-1.24 runtime on Intel Python 3.10–3.13.
On Intel Python 3.14+, omit optional ONNX backends because no compatible
wheel exists, allowing the proxy and core compression to remain usable.

Closes #3818

## Type of Change

- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [x] Documentation update

## Changes Made

- Keep ONNX Runtime below 1.24 on Intel macOS through Python 3.13, while
retaining the API-24 floor on supported modern platforms.
- Omit ONNX Runtime and its Magika, FastEmbed, and OCR dependency roots
on Intel Python 3.14+. This also fixes transitive ONNX requirements in
`[all]`.
- Refresh `uv.lock` to match the platform markers; no package names or
versions changed.
- Extend the dependency contract to Python 3.14/3.15 Intel cases and
modern Linux/Apple Silicon controls.
- Align the CLI dependency gate with those platform markers so `headroom
proxy` and `wrap` accept the omitted ONNX packages while retaining every
other required dependency check.
- Document unavailable optional ML features and the Python 3.13
alternative.

## Dependency Justification

No new package or version bump is introduced. The existing ONNX package
and dependent optional backends receive platform/interpreter markers
reflecting their published wheel availability. Installation surface
remains the existing packages on supported combinations; unsupported
Intel Python 3.14+ no longer attempts to install unavailable native
backends. Runtime model downloads and network policies are unchanged.

## Testing

At `7189f19031f77578141f98044eabadad91ea0edf`:

- 184 dependency-contract, CLI, ORT guard, relevance, and image tests
pass (four existing warnings). Marker regressions fail before their fix;
the Python 3.14/3.15 Intel CLI gate regressions also fail before the
startup correction and pass afterward. Other platforms still require the
ONNX packages.
- Ruff lint/format and whitespace pass; Linux-target mypy passes over
566 source files.
- `uv lock --check` passes; frozen `[all]` export succeeds. Lock
package-name/version sets are identical before and after refresh.
- Real wheel-aware `uv pip compile pyproject.toml --extra all
--python-version <version> --python-platform <target>
--only-binary=onnxruntime` succeeds for Intel macOS Python 3.10, 3.11,
3.13, and 3.14; Linux Python 3.10/3.14; and Apple Silicon Python 3.14
with `MACOSX_DEPLOYMENT_TARGET=14.0`.
- Intel 3.10–3.13 resolve ONNX Runtime 1.23.2. Intel 3.14 resolves
without ONNX, Magika, FastEmbed, or OCR backends. Modern Linux and macOS
14 Apple Silicon resolve ONNX Runtime 1.30.0. Individual Intel 3.14
`proxy` and `voice` extras also resolve.

## Real Behavior Proof

- Setup: Windows Python 3.12, an isolated environment installed from
dependency roots selected by Intel macOS Python 3.14 markers. Confirmed
ONNX Runtime, Magika, FastEmbed, RapidOCR, and Torch are absent. Actual
Intel/macOS execution was not available.
- Steps: run `pr3823-resume16-runtime.py` against a real uvicorn proxy
with optimization enabled and subscription polling disabled; send a real
TCP tool-result chat request to a separate loopback HTTP upstream, then
query real `/stats`.
- Observed: content detection uses `FallbackDetector`, relevance uses
BM25, proxy returns HTTP 200, and the upstream receives one request. The
inflation guard preserves the original 8,988-byte request in this case.
No local ML inference or live provider billing is claimed.
- Packaging proof: before correction the Intel Python 3.14 resolver
rejects the ONNX range because its newest Intel wheel has only
cp310–cp313/cp313t ABIs. After correction `[all]`, `proxy`, and `voice`
resolve. Evidence logs: `pr3823-resume16-red-py314.log`,
`pr3823-resume16-green-py314.log`, `pr3823-resume16-runtime.log`, and
`pr3823-resume16-focused.log`.
- Older-runtime control: a second isolated Windows Python 3.12
environment uses the Intel Python 3.13-selected dependency roots and
actual ONNX Runtime 1.23.2. Python Magika detects JSON, the API-24
native detection guard remains false, direct Rust SmartCrusher
compresses 100 JSON records to 724 bytes, and the real
optimization-enabled TCP proxy returns HTTP 200. Evidence:
`pr3823-resume16-ort123-runtime.py/log`. This verifies the older C API
path on Windows; native Intel macOS execution remains untested.
- Direct embedding audit: Python-exposed Rust SmartCrusher constructs
`HybridScorer::default`, whose `EmbeddingScorer::default` is unloaded
and uses BM25. Rust `create_scorer` also uses the unloaded default. The
native `EmbeddingScorer::try_new` call sites found are its definition
and module tests; no production Python embedding initializer is exposed.
Python FastEmbed uses the compatible installed Python ONNX backend on
older Intel interpreters.
- CLI proof: invoke the actual Click `headroom proxy` command in a
subprocess using the isolated no-ORT environment; simulate only the
Intel macOS Python 3.14 platform predicate, leaving dependency imports
and server startup real. The real dependency gate passes and live TCP
`/health` returns HTTP 200 with `ready=true`, Rust core loaded, and
optional Kompress marked degraded. Evidence:
`pr3823-resume16-cli-boot.py`, `pr3823-resume16-cli-runtime.py/log`, and
`pr3823-resume16-cli-server.log`. The owned subprocess is stopped after
verification.

## Runtime Rollout Safety

- Rollout-managed features: none; dependency selection uses package
markers.
- Default behavior: Intel Python 3.10–3.13 can use the older Python ONNX
runtime; Rust ML detection remains guarded because it requires API 24.
Intel Python 3.14+ retains core/proxy and non-ML fallbacks, with
optional ONNX features unavailable.
- Existing Linux and Apple Silicon dependency policies retain their
modern ONNX floor.
- No unsafe override or new network behavior. Rollback: revert the
marker and lockfile commits.

## Review Readiness

- [x] Self-review completed
- [x] Real behavior and packaging evidence supplied
- [x] Regression tests and local checks pass
- [x] Did not edit CHANGELOG.md

Hosted checks and review must qualify this new head before approval. No
PR merge performed.

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-08 10:07:57 -05:00
326079517b fix(codex): make unwrap codex remove headroom init routing (#3920)
## Description

`headroom init -g codex` writes a block into `~/.codex/config.toml` that
points Codex at the local proxy:

```toml
# --- Headroom init provider ---
model_provider = "headroom"
openai_base_url = "http://127.0.0.1:8787/v1"
...
# --- end Headroom init provider ---
```

There was no command to take it out again. `headroom unwrap codex` only
recognises the markers that `headroom wrap codex` writes, so on an
init-written config it prints "Nothing to undo" and then "✓ Codex is no
longer routed through the Headroom proxy." The routing is still there.

This matters most on Windows. `init` relies on Codex session hooks to
start the proxy, and those hooks are disabled upstream on Windows (init
already prints a warning about that). So after a reboot or a proxy
crash, Codex keeps calling `127.0.0.1:8787`, nothing restarts the proxy,
and the obvious undo command claims it worked. That matches the symptom
in #3749: Codex stuck on a dead local proxy until the override was
deleted by hand.

This PR makes `unwrap codex` remove the init block. It also makes the
Windows warning say what it means for the user, and documents how to
remove init routing.

Refs #3749. It doesn't close the issue, which also asks wider questions
about the Windows lifecycle; I'll answer those on the issue.

## 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

- `headroom/cli/wrap.py` (`_restore_codex_provider_config`): if the
config contains the `# --- Headroom init provider ---` marker, strip it
with the existing (already tested) `init._strip_codex_init_block` before
the usual wrap cleanup. The existing `cleaned` / `removed` / thread
re-tag flow then runs unchanged. `_codex_config_has_headroom_markers` is
deliberately not changed, because wrap's pre-wrap backup logic also uses
it.
- `headroom/cli/wrap.py` (`_restore_codex_provider_config`, backup
branch): a pre-wrap snapshot taken *after* `headroom init codex` carries
init's block, so restoring it verbatim left Codex pinned to the proxy
while unwrap printed "Restored". The snapshot is now passed through
`_strip_codex_init_block` too (and the config removed if nothing else is
left). The snapshot is read first and deleted only after the config has
been written, so a failed write leaves it in place for a retry instead
of losing it. Review findings from @JerrettDavis / Devin.
- `headroom/cli/init.py` (new `_strip_codex_root_routing_orphans`): the
orphan-key safety net (`model_provider = "headroom"`, loopback
`openai_base_url`) in both `_strip_codex_init_block` and wrap's
`_strip_codex_headroom_blocks` used to match anywhere in the file, so a
newly-reachable unwrap would delete user-owned `[profiles.*]` overrides.
It now only touches the document root, using the same first-table split
`_ensure_codex_provider` already uses. Neither writer ever puts these
keys inside a table. Review finding from @JerrettDavis / Devin.
- `headroom/cli/init.py` (`_init_codex`): on Windows, after the existing
hook warning, add one message. It says nothing starts the proxy there,
and points to `headroom install apply` for a supervised proxy and to
`headroom unwrap codex` (or deleting the project block) to remove the
routing.
- `docs/content/docs/proxy.mdx`: the "routing is persistent until you
remove it" sentence now says how to remove it, that unwrap leaves init's
Codex `SessionStart` hook in `hooks.json` (routing only), plus the
Windows caveat.
- Tests: five new `unwrap codex` cases: init block plus user content
(user content preserved), init-only file (file removed), init → `wrap
codex --prepare-only` → unwrap (snapshot restored without init routing),
the same sequence with the first unwrap's config write failing (snapshot
kept, a second unwrap restores it cleanly), and init → unwrap with a
`[profiles.work]` that sets `model_provider = "headroom"` + a loopback
`openai_base_url` (profile survives). One assertion added to the
existing Windows init warning test.
`TestSubscriptionRouting::test_strip_cleans_orphaned_openai_base_url`
used a key inside `[profiles.default]` as its "orphan"; it now puts the
orphan at the root and asserts a profile-level key survives.

## Testing

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

### Test Output

Both new tests fail on `main`; the failure reproduces the bug:

```text
tests/test_cli/test_wrap_codex.py FF
E   AssertionError: assert 'Nothing to undo' not in '...'
E         Nothing to undo: ...\.codex\config.toml has no Headroom wrap markers.
E       ✓ Codex is no longer routed through the Headroom proxy.
FAILED tests/test_cli/test_wrap_codex.py::test_unwrap_codex_removes_init_provider_routing
FAILED tests/test_cli/test_wrap_codex.py::test_unwrap_codex_removes_init_only_config_file
```

With this branch:

```text
$ pytest tests/test_cli/test_wrap_codex.py tests/test_cli/test_init_cli.py tests/test_cli/test_wrap_opencode.py -q -n 4
228 passed in 7.50s

$ ruff check .
All checks passed!
$ ruff format --check headroom/cli/wrap.py headroom/cli/init.py tests/test_cli/test_wrap_codex.py tests/test_cli/test_init_cli.py
4 files already formatted
$ mypy headroom --ignore-missing-imports --no-site-packages
headroom\fileperms.py:71: error: Module has no attribute "fchmod"  [attr-defined]
Found 1 error in 1 file (checked 554 source files)
```

The mypy error is the Windows-only `os.fchmod` false positive in an
untouched file; it passes on Linux CI.

The full `tests/test_cli` suite on Windows: 907 passed, 12 failed. Five
of those also fail on a clean `upstream/main` worktree with the same
environment (`test_recover_codex` ×2, `test_wrap_stale_marker`,
`test_unwrap_claude` ×2), so they're pre-existing Windows issues. The
other seven (`test_wrap_persistent`,
`test_install_apply_announces_windows_service_fallback`) only failed
under `-n 6` and pass when run serially on this branch (63 passed).

### Review round (rebased on `upstream/main` 1b7977ce)

The two new regression tests fail without the fix:

```text
E   AssertionError: assert {'model': 'gp... {'work': {}}} == {'model': 'gp....1:9999/v1'}}}
FAILED tests/test_cli/test_wrap_codex.py::test_unwrap_codex_after_init_then_wrap_removes_init_routing
FAILED tests/test_cli/test_wrap_codex.py::test_unwrap_codex_init_cleanup_keeps_profile_overrides
====================== 2 failed, 103 deselected in 1.21s ======================
```

With the fix (serial, Windows):

```text
$ pytest tests/test_cli tests/test_install/test_providers.py -q
FAILED tests/test_cli/test_install_cli.py::test_install_apply_restores_previous_deployment_after_failed_update
FAILED tests/test_cli/test_recover_codex.py::test_discover_dangling_homes_only_returns_codex_homes
FAILED tests/test_cli/test_recover_codex.py::test_recovery_never_writes_through_target_symlinks
FAILED tests/test_cli/test_unwrap_claude.py::test_unwrap_claude_removes_mcp_purges_retired_hook_and_stops_proxy
FAILED tests/test_cli/test_unwrap_claude.py::test_unwrap_claude_stops_claude_owned_persistent_deployment
FAILED tests/test_cli/test_wrap_stale_marker.py::test_signal_handler_unwinds_so_the_restore_can_run
====== 6 failed, 1026 passed, 6 skipped, 17 warnings in 90.47s (0:01:30) ======

$ ruff check headroom/cli/init.py headroom/cli/wrap.py tests/test_cli/test_wrap_codex.py tests/test_cli/test_init_cli.py
All checks passed!
$ ruff format --check (same files)
4 files already formatted
```

All six failures reproduce identically on a clean `upstream/main`
worktree in the same environment (`6 failed, 46 passed, 2 skipped` for
those files), so none come from this branch.

### Review round 2 (rebased on `upstream/main` 0d7d61d5)

`test_unwrap_codex_keeps_snapshot_when_init_cleanup_write_fails` fails
on the previous head (the snapshot was already deleted when the write
raised):

```text
E    +    where exists = WindowsPath('.../.codex/config.toml.headroom-backup').exists
FAILED tests/test_cli/test_wrap_codex.py::test_unwrap_codex_keeps_snapshot_when_init_cleanup_write_fails
====================== 1 failed, 105 deselected in 0.94s ======================
```

With the fix:

```text
$ pytest tests/test_cli/test_wrap_codex.py tests/test_cli/test_init_cli.py -q
188 passed in 9.21s
$ ruff check headroom/cli/wrap.py tests/test_cli/test_wrap_codex.py
All checks passed!
$ ruff format --check headroom/cli/wrap.py tests/test_cli/test_wrap_codex.py
2 files already formatted
$ mypy headroom --ignore-missing-imports --no-site-packages
headroomileperms.py:92: error: Module has no attribute "fchmod"; maybe "chmod"?  [attr-defined]
Found 1 error in 1 file (checked 561 source files)
```

Same Windows-only `os.fchmod` false positive as above.

## Real Behavior Proof

- Environment: Windows 11, Python 3.13, this branch vs. `upstream/main`
d5318ac2, isolated `HOME`/`USERPROFILE`/`CODEX_HOME` in a temp dir.
- Exact command / steps: wrote `model = "gpt-5"` to `config.toml`, added
the init block with `init._ensure_codex_provider(cfg, 8787)` (the same
writer `headroom init -g codex` uses), then ran the real `headroom
unwrap codex --no-stop-proxy` Click command and printed the file.
- Observed result: on `main`, unwrap prints "Nothing to undo ... has no
Headroom wrap markers." and "✓ Codex is no longer routed through the
Headroom proxy.", and the file still has `openai_base_url =
"http://127.0.0.1:8787/v1"`. On this branch it prints "Removed Headroom
block from ...\.codex\config.toml; other content preserved." and the
file is just `model = "gpt-5"`. Review round, same isolated setup with a
`[profiles.work]` table that sets `model_provider = "headroom"` and
`openai_base_url = "http://127.0.0.1:9999/v1"`: (a) `init` → `headroom
wrap codex --prepare-only --port 8787` → `headroom unwrap codex`: before
the fix the restored file still began with the full `# --- Headroom init
provider ---` block (`openai_base_url = "http://127.0.0.1:8787/v1"`);
after it, it prints "Restored prior ... from pre-wrap backup." and the
file is `model = "gpt-5"` plus the untouched profile. (b) `init` →
`unwrap`: before the fix `[profiles.work]` came back empty; after it
both profile keys survive.
- Not tested: running the full `headroom init -g codex` command end to
end (it also writes hooks and a deployment manifest, so I wrote the
block with the same function directly); a real Codex Desktop session;
project-scope `.codex/config.toml` init blocks, which `unwrap codex`
doesn't target (the docs now say to delete that block by hand).

## Runtime Rollout Safety

- Rollout-managed feature(s): none; CLI-only change to `headroom unwrap
codex` and an extra `headroom init codex` message on Windows
- Minimum rollout channel: stable
- Stable/default behavior changed: yes, narrowly. `unwrap codex` now
also removes the `# --- Headroom init provider ---` block from the
active Codex config; previously it left it in place and reported
success. The orphan-key safety net shared with `wrap codex` re-injection
is narrowed to the document root, so it no longer deletes matching keys
inside `[profiles.*]`
- Kill switch / disable path: not needed; the only new action runs when
the user explicitly runs `headroom unwrap codex`
- Unsafe override required: no
- Qualification impact: none; no proxy, compression or request-path code
changed
- Rollback path: revert this commit; `headroom init -g codex` re-adds
the routing if a user wants it back

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- Open PR #3355 also edits `_restore_codex_provider_config` (auth-helper
cleanup). The changes don't overlap logically, but whichever lands
second may need a small rebase.
- Open PR #749 (consolidated `headroom uninstall`) detects Codex only
through wrap markers, so it has the same blind spot for init routing; it
would get this for free by calling `unwrap codex`.
- Not in scope, and a maintainer call: whether `init codex` on Windows
should refuse to write routing, or should set up a supervisor, given
that nothing starts the proxy there.
- Deferred (Devin "existing Codex provider settings lost"): `init codex`
already deletes a user's prior root `model_provider` / `openai_base_url`
when it writes its block, and saves them nowhere. That is pre-existing
`init` behaviour on `main`, which this PR neither introduces nor
worsens, and there is no stored value for unwrap to restore. A clean fix
belongs in `init` (stash the replaced values inside its block, restore
them on unwrap), so I'd rather do it as a follow-up than widen this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3920"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-07 20:59:10 -05:00
205668d953 fix(read-maturation): keep the client's tail cache breakpoint on held Reads (#3977)
## Description

Closes #3997

With `read_maturation` on, every held Read drops Claude Code's tail
cache breakpoint, so the rest of the conversation is re-sent uncached on
every held turn. On one machine on 2026-10-05 (wheel 0.39.0), 37 of
1,353 requests were in 8 holds. One 13-request hold kept `cache_read`
stuck at 176,693 with `cache_write` 0, while the uncached tail grew from
3,879 to 14,639 tokens per request. Over its last 10 requests that hold
sent 83.8k tokens uncached. With the tail cached, the same requests cost
about 36k token-equivalents.

Cause: when `ReadMaturationManager.apply` returns `holding_msg_indices`,
the handler calls `relocate_cache_breakpoint`. That strips every
`cache_control` from the earliest held Read to the end of the
conversation and puts one marker on the message before the Read. Claude
Code marks the last two messages, so its tail marker is always dropped.
The proxy already logs this on every held turn as
`event=cache_breakpoints ... dropped=true tail_grew=true`. Nothing after
the held Read is cache-written until the Read matures, which takes at
least `quiesce_turns` (5) turns and up to `max_hold_turns` (25). The
hold saves one cache write of the Read (1.25x for a 5m TTL, 2x for 1h,
on a few thousand tokens). It pays for that with a full-price resend of
the Read and everything after it on every held turn.

This PR removes the relocation and forwards the client's breakpoints
unchanged, so the held Read is cached with its turn. On the next
request, the provider-confirmed prefix (`frozen_message_count`) covers
the Read, and the existing `i < frozen_message_count` gate in
`ReadMaturationManager.apply` leaves it verbatim. That is intended.
Maturing a Read that is already cached rewrites everything after it at
the cache-write rate, and a week of this machine's traffic, replayed,
shows that costs far more than it saves:

- Median rewrite: 19.2k tokens at the 1h write price (2x).
- What maturing saves: a Read of about 2.1k tokens, read at 0.1x over a
median of 36 remaining turns.
- Net: maturing every Read that is already cached comes to about -23.7M
base-input-token equivalents per week. Not maturing them comes to 0.

The result: maturing a Read that is already cached becomes rare, and
tokens saved from `read_maturation` drop by design. A Read still matures
when it is outside the confirmed prefix once its file goes quiet, for
example on a turn where the frozen count is reset to 0 or where the
client put no breakpoint after the Read.

Trade-offs:

- A session that ends right after the Read pays the cache-write premium
on the tail once, where the old code sent it uncached. Break-even is
about 2-3 held requests, and holds last at least 5 turns.
- The frozen count the gate uses is the handler's clamped one:
`prepare_turn` takes min(provider-confirmed, locally replayable). If no
tool output in the session has been compressed since the Read, the clamp
can hold the count at the Read even though the provider has cached it. A
Read can then still mature inside the provider-cached prefix, which is a
rewrite. Sessions with compressible tool output release the clamp on the
next request (see the probe below). Using the unclamped count for this
gate would be a one-line follow-up. I left it out to keep this PR to the
breakpoint fix.

## 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/transforms/read_maturation.py`: delete
`relocate_cache_breakpoint`. The handler was its only production caller.
Update the module docstring: the timeline, invariant 1 (now "the frozen
prefix is never mutated"), and why a cached Read stays verbatim. The
manager logic is unchanged.
- `headroom/proxy/handlers/anthropic.py`: forward `maturation.messages`
as returned, with no relocation.
- `headroom/config.py`, `headroom/proxy/models.py`,
`headroom/cli/proxy.py`, `headroom/rollout.py`,
`docs/content/docs/proxy.mdx`: these descriptions said held Reads are
kept out of the prefix cache, which is no longer true. They now say
Reads stay verbatim and compress once quiet unless the provider cache
already holds them.
- `tests/test_read_maturation_handler_nobust.py`:
`test_verbatim_read_never_cache_written_before_maturation` asserted the
old invariant: the verbatim Read is never forwarded inside the cached
prefix. That invariant is exactly the bug, so the test is now
`test_held_read_keeps_client_breakpoint_then_matures`. It asserts that
the client's breakpoint is forwarded where the client put it on every
turn. It still checks that the Read is held and then matures in order:
in this fixture nothing compresses, so the frozen count stays at the
Read. A comment in the test explains the change.
- `tests/test_read_maturation_handler_nobust.py`: new
`test_read_cached_with_its_turn_stays_verbatim`. It drives the real
handler for 7 turns with compressible Bash output around the Read, and
asserts three things: the breakpoints are kept on every turn, the frozen
count passes the held Read from the second request on, and the Read is
never rewritten.
- `tests/test_read_maturation.py`: new
`test_held_read_matures_only_outside_frozen_prefix`. A held Read matures
at quiesce when it is in the live zone and stays verbatim when the
frozen prefix covers it. The test for a client breakpoint on a fresh
Read now asserts the breakpoint stays put and survives maturation.
`TestBreakpointRelocation` is removed along with the helper.
- `tests/test_cache_ttl_preserved.py`: drop the two relocation TTL
tests. The tool-search deferral TTL tests stay.
- `tests/test_live/test_live_maturation.py`: request A asserts the held
Read is cache-written with the client's tail marker. Request B, with the
Read inside the confirmed prefix, asserts it is not matured and that A's
cached prefix is read back.

## Testing

- [x] Unit tests pass (`pytest`) - the read-maturation, breakpoint and
rollout files below, not the whole suite
- [x] Linting passes (`ruff check .`) - on the changed files, plus `ruff
format --check`
- [x] Type checking passes (`mypy headroom`) - on the six changed
modules
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

New and updated tests with `headroom/` at `main` (befdb52f):

```text
$ uv run --frozen --extra dev pytest tests/test_read_maturation.py tests/test_read_maturation_handler_nobust.py tests/test_cache_ttl_preserved.py -q
E   AssertionError: client cache breakpoint moved or dropped on turn(s) [0, 1, 2, 3, 4]
E   AssertionError: client cache breakpoint moved or dropped on turn(s) [0, 1, 2, 3, 4]
FAILED tests/test_read_maturation_handler_nobust.py::test_held_read_keeps_client_breakpoint_then_matures
FAILED tests/test_read_maturation_handler_nobust.py::test_read_cached_with_its_turn_stays_verbatim
========================= 2 failed, 33 passed in 9.68s =========================
```

With this change:

```text
$ uv run --frozen --extra dev pytest tests/gateway/test_cache_breakpoint_budget.py tests/test_cache_breakpoint_diagnostics.py \
    tests/test_cache_control_move_bust.py tests/test_issue_2671_block_growth_cache.py tests/test_rollout.py \
    tests/test_testing_harness.py tests/test_read_maturation.py tests/test_read_maturation_handler_nobust.py \
    tests/test_cache_ttl_preserved.py tests/test_live/test_live_maturation.py -q
======================== 170 passed, 2 skipped in 9.11s ========================

$ uv run --frozen ruff check <10 changed .py files>
All checks passed!
$ uv run --frozen ruff format --check <10 changed .py files>
10 files already formatted
$ uv run --frozen --extra dev mypy headroom/transforms/read_maturation.py headroom/proxy/handlers/anthropic.py \
    headroom/config.py headroom/cli/proxy.py headroom/proxy/models.py headroom/rollout.py --ignore-missing-imports
Success: no issues found in 6 source files
```

## Real Behavior Proof

- Environment: macOS 27 (arm64), Python 3.11.13, `uv run --frozen
--extra dev`, this branch and `main` (befdb52f). Live evidence comes
from a Claude Code session behind a 0.39.0 proxy with
`HEADROOM_READ_MATURATION=1` on the beta channel.
- Exact command / steps: a probe script drives
`create_app(ProxyConfig(read_maturation=True, mode="token",
cache_enabled=True))` through `TestClient` for 8 turns of one Claude
Code-shaped conversation. The conversation has two 1h system
breakpoints, client breakpoints on the last block of the last two
messages, compressible Bash JSON output, a 3 KB line-numbered Read at
message 10, and then quiet turns. The upstream mock reports cache reads
up to the last forwarded breakpoint, using the prefix tracker's own
estimator. The probe prints `count_cache_breakpoints` for each request
in and out, the frozen count maturation saw, and the Read's forwarded
form.
- Observed result: on `main`, every held turn forwards 3 of the client's
4 breakpoints, with the tail breakpoint 1, 3, 5, 7, 9 messages from the
end. The frozen count never passes the Read (10), and the Read matures
on turn 5. On this branch, all 4 breakpoints reach the tail on every
turn, the frozen count passes the Read from the second request on (11,
13, 15, ...), and the Read stays verbatim. In production, the same hold
logged `event=cache_breakpoints ... dropped=true tail_grew=true` on
every held request, with the cost figures in the Description.

```text
main (befdb52f):
INFO turn 0: in_total=4 out_total=3 in_last_tail=0 out_last_tail=1 maturation_frozen=0 read=verbatim
INFO turn 1: in_total=4 out_total=3 in_last_tail=0 out_last_tail=3 maturation_frozen=10 read=verbatim
INFO turn 2: in_total=4 out_total=3 in_last_tail=0 out_last_tail=5 maturation_frozen=10 read=verbatim
INFO turn 3: in_total=4 out_total=3 in_last_tail=0 out_last_tail=7 maturation_frozen=10 read=verbatim
INFO turn 4: in_total=4 out_total=3 in_last_tail=0 out_last_tail=9 maturation_frozen=10 read=verbatim
INFO turn 5: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=10 read=matured
INFO turn 6: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=21 read=matured
INFO turn 7: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=23 read=matured

this branch:
INFO turn 0: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=0 read=verbatim
INFO turn 1: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=11 read=verbatim
INFO turn 2: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=13 read=verbatim
INFO turn 3: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=15 read=verbatim
INFO turn 4: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=17 read=verbatim
INFO turn 5: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=19 read=verbatim
INFO turn 6: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=21 read=verbatim
INFO turn 7: in_total=4 out_total=4 in_last_tail=0 out_last_tail=0 maturation_frozen=23 read=verbatim
```

- Not tested: `tests/test_live/test_live_maturation.py` against the real
API (no `ANTHROPIC_API_KEY` here; it was updated and skips). This exact
branch has not run against live traffic. The live figures above come
from the 0.39.0 wheel. The full `pytest` suite was not run, only the
files listed under Testing.

## Runtime Rollout Safety

- Rollout-managed feature(s): read_maturation (behavior change inside
the existing feature; no new feature).
- Minimum rollout channel: Beta (unchanged - inherits the feature's
existing gate).
- Stable/default behavior changed: No. read_maturation is beta-gated and
off by default, and none of this code runs when it is off. With it on,
held Reads now keep the client's cache breakpoints and are cached with
their turn, so a Read the provider cache already covers is no longer
matured.
- Kill switch / disable path: disabling read_maturation
(`HEADROOM_READ_MATURATION=0`, or drop `--read-maturation`) disables
this with it; the old breakpoint relocation has no separate switch
because it only added cost.
- Unsafe override required: No.
- Qualification impact: None.
- Rollback path: revert the commit; no persisted format or config
surface changes, and matured-marker session state is unchanged.

## 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
- [x] 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 did **not** edit `CHANGELOG.md` - it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- `relocate_cache_breakpoint` was public in
`headroom.transforms.read_maturation` but not re-exported. A repo-wide
grep found no caller outside the handler and tests.
- `count_cache_breakpoints` and the `event=cache_breakpoints` log line
already flagged every held turn as `dropped=true`. With this change
those turns log `dropped=false`.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3977"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-07 20:57:44 -05:00
1d4b357ca7 feat(opencode): support the OpenCode 2.x plugin API (#3999)
## Description

Takeover of #3719 by @laurence-diack-pk, who has been unavailable since
Sep 23 and whose branch was left conflicted with `main`. The original
commit is preserved and @laurence-diack-pk remains its author; this
branch adds follow-up commits addressing @JerrettDavis's review and the
findings from live OpenCode 2.x testing.

It makes the OpenCode plugin and `headroom wrap opencode` work on both
OpenCode 1.x and 2.x. On 2.x the 1.x function plugin was silently
dropped (the loader requires a `{ id, setup }` default export loaded
from a directory), and Effect's `FetchHttpClient` keeps its own `fetch`
reference from before plugins load — so `wrap opencode` loaded no plugin
and routed nothing.

Closes #3669. Supersedes #3719.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)

## Changes Made

Carried from #3719:
- One plugin for both versions: default export `{ id: "headroom",
server, setup }`; 1.x calls `server`, 2.x calls `setup`.
- 2.x `setup`: registers `headroom_retrieve` via `ctx.tool.transform`
(`codemode: false`), sets `HEADROOM_*` shell env through the
`create.before` hook, and returns a cleanup that releases the refcounted
transport so hot reloads do not stack interceptors.
- 2.x model routing: `ctx.model.transform` points remote OpenAI-wire
models at the proxy with `x-headroom-base-url` /
`x-headroom-original-path` headers, since 2.x keeps its own `fetch`
reference and the transport patch alone misses model traffic.
- Wheel ships the bundle as `_dist/index.js`;
`headroom_opencode_plugin_path()` returns the directory; `wrap opencode`
adds `--standalone` on 2.x so the private server sees
`OPENCODE_CONFIG_CONTENT`.

Follow-up commits (review from #3719 + live testing):
- Rebased on current `main` (0.40.0). Fixed the routing-contract
conflict: replaced `routesThroughProxy` (TS2554 against `shouldRoute`'s
3-arg signature) with `modelBaseRoutesThroughProxy`, a deliberate
model-base eligibility check that keeps the shared protocol / loopback /
proxy-origin / excluded-host contract but drops the endpoint-suffix
requirement, since 2.x hands us model base URLs (e.g. `/v1`), not
inference endpoints.
- `setup` now resolves the effective `excludeHosts` once (option over
`HEADROOM_OPENCODE_EXCLUDE_HOSTS`) and applies it to both the transport
install and the model rewrite, with new tests for both paths.
- Fixed `test_build_launch_env_with_project` to decode
`OPENCODE_CONFIG_CONTENT` instead of substring-matching the raw path,
which JSON backslash escaping makes impossible on Windows.
- `opencode_major_version` now reads the `v2` channel marker in dev
builds (`opencode v0.0.0-v2-<stamp>`), which previously parsed as major
0, so `wrap` skips `--standalone` and the private server never loads
Headroom's config.
- Rebuilt `_dist/index.js` and `hook-shim/handler.js`; drift check
clean.

## Testing

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

### Test Output

```text
# plugins/opencode
$ npm ci && npm run typecheck && npm run build:standalone && npm test
tsc: clean (no TS2554)
vitest: Test Files 3 passed (3) | Tests 45 passed (45)
$ cmp dist-standalone/index.js ../../headroom/providers/opencode/_dist/index.js          # identical
$ cmp dist-standalone/hook-shim/handler.js ../../headroom/providers/opencode/hook-shim/handler.js  # identical

# focused Python suites (same set as #3719, plus the 2.x dev-build version case)
$ pytest tests/test_providers_opencode_plugin_path.py tests/test_providers_opencode_config.py \
    tests/test_providers_opencode_install.py tests/test_cli/test_wrap_opencode.py \
    tests/test_mcp_registry_opencode.py tests/test_learn/test_opencode_scanner.py -q
193 passed in 1.10s

$ ruff check / ruff format --check on changed paths: clean
$ mypy headroom/providers/opencode headroom/cli/wrap.py: Success: no issues found
```

## Real Behavior Proof

- Environment: macOS arm64, Node v26.10.0, Python 3.13, headroom from
this branch (0.41.0-dev). Tested against two real OpenCode 2.x clients,
each in throwaway XDG dirs with its own proxy port:
  - `opencode 2.0.19` (official 2.x binary);
- OpenCode 2.x head built from `anomalyco/opencode@v2`
(`0.0.0-v2-202610061051`, Bun 1.4.2, `bun run script/build.ts --single`
in `packages/cli`).
- Exact command / steps: throwaway XDG dirs and a dedicated proxy port;
fake key first (routing proof), then the real key (end-to-end proof):
  ```bash
  # fake key first (routing proof), then the real key (end-to-end proof)
OPENCODE_API_KEY=<key> headroom wrap opencode --port 8799 --no-serena --
\
run -m opencode-go/deepseek-v4.1-flash "reply with the single word ok"
  # exclusion check
HEADROOM_OPENCODE_EXCLUDE_HOSTS=opencode.ai OPENCODE_API_KEY=<key>
headroom wrap opencode ...
  ```
(`opencode-go` declares `OPENCODE_API_KEY` as its env credential in the
catalog, so no interactive login is needed.)
- Observed result: routed 401 with the fake key and 200 with the real
key through the proxy, `--standalone` added automatically, exclusion
honored — details:
- **Fake key** — proxy log: `proxy_inbound_request POST
/v1/chat/completions` with `user-agent: opencode/latest/2.0.19/cli` (and
`opencode/v2/0.0.0-v2-202610061051/cli` for the head), headers
`x-headroom-base-url: https://opencode.ai` and
`x-headroom-original-path: /zen/go/v1/chat/completions`; forwarded
upstream, `401` from the fake key — routed through Headroom.
- **Real key** — the model answered `ok`; proxy `status=200` with
upstream `https://opencode.ai/inference/go/openai/v1/chat/completions`.
- `wrap` added `--standalone` automatically on 2.0.19, and again on the
v2 head after the dev-build version fix (explicit `--standalone` also
works, per the kill-switch path).
- **Exclusion** — with `HEADROOM_OPENCODE_EXCLUDE_HOSTS=opencode.ai` the
model still answered while the proxy saw **zero** new chat requests: the
2.x model transform honors the exclusion list.
- Not tested: Windows; OpenAI "responses"-wire against a live 2.x
server; Anthropic-wire custom providers on 2.x; loading the plugin by
npm name (`headroom-opencode`), which needs a published release;
OpenCode 1.x older than 1.2.20.

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: on OpenCode 2.x, `wrap opencode`
launches with `--standalone` (a private server per session); on 1.x
behaviour is unchanged apart from the plugin path now being a directory.
- Kill switch / disable path: pass `--server <url>` or `--standalone`
explicitly; `HEADROOM_OPENCODE_PLUGIN_PATH` still overrides the plugin
location.
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this PR; the wheel bundle and plugin path revert
with it.

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

@laurence-diack-pk — thank you for the original implementation; the
commit is preserved verbatim at the base of this branch. @JerrettDavis —
this addresses the routing-contract conflict you described in #3719 (the
missing `excludeHosts` argument and the model-base vs endpoint
mismatch), the Windows assertion, and a dev-build version-detection gap
found while validating on macOS. Live 2.x validation is done on both
2.0.19 and today's `v2` head; details above.

---------

Co-authored-by: laurence <laurence.diack@peekrobotics.co.nz>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-07 20:52:53 -05:00
Mansurshakh JaparovandJD Davis a42fb2b9a1 fix(router): preserve human-readable Git status losslessly (#4020)
## Description

Addresses the still-reproducible Git status corruption in #3652. The
aligned `ls`/`ps`/`df` portions are already protected in current main;
this PR does not claim them as new fixes. Human-readable Git status is
still classified as prose and can lose staged/unstaged/untracked paths
through Kompress.

This is a narrow content-preservation bug fix, not the separate policy
proposal to exclude all `Bash` outputs by default.

## Type of Change

- [x] Bug fix
- [x] Documentation update

## Changes Made

- Recognize the standard English branch/detached-HEAD header plus Git
status sections/entries as structured tabular content.
- Preserve this non-rectangular `git_status` format verbatim instead of
forcing it into CSV or a prose model.
- Keep Python detection and the native Rust content/live-zone route
aligned; Rust detection uses iterator-based scans without
collection/cloning of the input.
- Leave ordinary prose, bullet lists, and other Bash output on their
existing routes.
- Guard Git status before native model classification and before
external CSV/wildcard compressor dispatch; retain the locked native
Magika production chain.
- Replace the stale `PLAIN_TEXT` status expectation with
`format=git_status` and `parse_tabular(status) is None`; keep
prose/git-log negative cases.
- Document the English-format scope and lossless/no-savings tradeoff.

## Testing

- [x] Unit tests pass (`pytest`), including the consumer-visible
lossless regression.
- [x] Native regression tests, changed-file lint, configured pre-commit
mypy and manual production runtime checks pass.

### Test Output

```text
Review correction:
Python router/external-dispatch regressions: 121 passed, 2 skipped
Existing tabular parser/detection suite: 73 passed in 7.76s
Native Git-status regressions: 3 passed
Final mixed-content correction (router, external dispatch, tabular suites):
184 passed, 2 skipped in 52.14s
```

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 used
the explicitly 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 27.72s ==================
✅ ci-precheck PASSED — safe to push.
```

```sh
python -m pytest -q tests/test_transforms_content_router.py
cargo test -p headroom-core git_status
cargo test -p headroom-core ordinary_bullet
```

Python content-router suite: **84 passed, 2 skipped**, with an existing
Hugging Face deprecation warning. Native focused regressions: **2 Git
status tests passed**, **1 ordinary-bullet negative passed**. The native
extension was rebuilt and the build/import verification passed. The
final deterministic consumer regression uses a ready lossy prose
compressor so a cold model cannot accidentally mask missing protection;
it asserts direct and tool-result output bytes, not internal call
counts.

The deterministic regression fails against the unchanged baseline with
missing status rows. After rebasing onto current main
`1ad92f0cbc3dea27676e253588100f64a2af6994`, ran the status regression
plus main's six small-MCP result tests: **7 passed**, and reran the
native Git status cases: **2 passed**.

Changed-file Ruff and formatting passed. The installed pre-commit hooks,
including `mypy headroom` and Commitlint, passed for this commit.
Full-tree Ruff is locally blocked by executable filesystem permissions
on five unchanged OAuth2 plugin files (tracked 100644); they are not
modified. A separate full dev-environment mypy run found an unchanged
optional LangChain `truthy-function` error; the configured isolated
pre-commit environment passed. No unrelated source/permissions were
changed.

## Real Behavior Proof

- Environment: Linux x86_64, CPython 3.13.14; unchanged
`dea9092e19385f286b7f67a64f4d85de2708d756` and this branch; actual Git
fixture, real content router and Anthropic token counter, rebuilt Rust
extension, **real ONNX Kompress fully preloaded before each run**, no
mocked compression backend in this smoke.
- Exact command / steps: initialize a throwaway Git repo; commit 120
files named `modified path NNN α.txt`; modify those, stage 120 new files
named `staged path NNN β.txt`, and add 120 untracked files named
`untracked path NNN γ.txt`. Capture:
  ```sh
LC_ALL=C git -c core.quotePath=false -c color.status=false status
--branch
  ```
Load the actual model with
`KompressCompressor().preload(allow_download=True)`, run
`ContentRouter(ContentRouterConfig()).compress(status)`, then run the
same router's `apply` on an Anthropic `Bash` tool-use/tool-result pair
using
`AnthropicProvider(warn=False).get_token_counter('claude-sonnet-4-5')`
and model limit 200000. Compare output bytes to the same captured
status.
- Same input in both runs: **12,469 bytes**, SHA256
`78ed6a39f2f994159099f8d4c0fe052ca09a37fa6d9f6248e8c5ebb655b19a32`.
- Before: detected as `text`; direct and Bash tool-result routes both
returned **10,748 bytes**, neither byte-exact; transform
`router:tool_result:text`.
- Observed result: after the fix, detected as `tabular`; both routes
returned **12,469 bytes**, both byte-exact; `router:noop`.
- External-compressor review proof against published head `3b035027`: a
real Git repository with 120 untracked paths produced the same
**3,415-byte** input (SHA256
`e0164d25f3f47428686d102a73018d0e00bcda53ff9674e658aa7128c038896b`).
With an operational row-trimming plugin selected for `text/csv` and
`*/*`, direct and tool-output paths both shrank to **318 bytes** before;
both preserve all **3,415 bytes** after. The same plugin still
compresses ordinary CSV. This separate plugin smoke uses the production
Tiktoken counter and disables Kompress to isolate external dispatch.
- Final mixed-content review: on published `539669c6`, appended JSON
selected `MIXED` and changed both direct and Bash tool-result bytes; the
fenced-code example was already preserved. The strategy selector now
honors `git_status` before mixed splitting. Both appended JSON and
fenced code preserve the complete payload on both routes with a ready
lossy compressor available.
- Not tested: localized Git status formats, every platform-specific Git
variant, or a paid upstream model response. The recognizer deliberately
covers standard English status output. The local real compression path
was exercised after model warmup; the initial cold-model no-op was not
treated as proof.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; content-routing data-preservation
fix.
- Minimum rollout channel: stable; no rollout-managed feature is
enabled.
- Stable/default behavior changed: recognized Git status is no longer
compressed lossily, sacrificing savings for path/state integrity.
- Kill switch / disable path: existing global Bash exclusion can bypass
compression; no new flag.
- Unsafe override required: no.
- Qualification impact: Python/Rust route parity for the recognized
status format only.
- Rollback path: revert this commit; no persistent schema migration.
Global Bash exclusions remain unchanged.

## Review Readiness

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

## Checklist

- [x] Existing tabular lossless route reused; compression docs updated.
- [x] Consumer regression and native positive/negative tests added.
- [x] `CHANGELOG.md` not edited; Conventional Commit title supplied.

This PR completes the remaining Git status defect, but intentionally
does not close #3652's separate Bash-default policy request. Remote CI
is reported by GitHub, not assumed from local tests.

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-07 17:46:57 -05:00
Mansurshakh JaparovandJD Davis 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>
2026-10-07 17:46:39 -05:00
Mansurshakh JaparovandJD Davis 9553d4292f fix(cache): retain prefix trackers for the provider cache lifetime (#4023)
## Description

Session cleanup currently drops prefix trackers after the default
600-second session lifetime even when Anthropic's request selects a
one-hour cache TTL. Losing the tracker also loses the frozen forwarded
prefix and causes the cache-preserving overlay to replay different
bytes.

Closes #4017.

## Type of Change

- [x] Bug fix
- [x] Documentation update

## Changes Made

- Resolve the request's existing Anthropic cache TTL before selecting
the prefix lineage and pass that TTL through tracker selection/creation.
- Retain each lineage for the greater of the configured session floor
and its observed/current provider TTL plus the existing 60-second safety
margin.
- Keep the lifetime per lineage rather than changing global
configuration: a five-minute session does not inherit another session's
one-hour lifetime.
- Preserve normal expiry beyond the provider lifetime and margin.
- Honor configured cache TTL before a confirmed cache write; discard
expired state before accepting a later request's longer TTL.
- Re-register the live lineage family after lookup/cleanup so recreated
sessions cannot share a tracker's frozen state across sibling
conversations or tool profiles.
- Update existing fake callbacks to the changed tracker contract,
preserve all consumer byte-stability assertions, and remove one
handler-to-store wiring-only test rather than re-pinning its internal
identity assertions.
- Document local tracker retention separately from provider cache
availability.

## Testing

- [x] Unit tests pass (`pytest`), including frozen-prefix byte stability
and independent TTL expiry.
- [x] Changed-file lint, configured pre-commit mypy and manual
production timestamp/overlay checks pass.

### Test Output

```text
Review correction: 273 passed, 2 dependency warnings in 83.79s
{"expires_beyond_provider_ttl_and_margin": true, "five_minute_session_evicted": true, "forwarded_prefix_byte_exact": true, "initial_frozen": 1, "one_hour_session_retained": true, "resolved_ttl_seconds": 3600, "resumed_frozen": 1, "same_tracker_after_660s": 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`, without skipping cached-model assertions.

```text
[build_rust_extension] headroom._core build + install + verify: OK
================== 177 passed, 4 skipped, 1 warning in 12.87s ==================
✅ ci-precheck PASSED — safe to push.
```

```sh
python -m pytest -q tests/test_cache/test_prefix_tracker.py
python -m pytest -q tests/test_proxy_anthropic_cache_stability.py tests/test_cache_prefix_overlay.py tests/test_cache_ttl_preserved.py tests/test_cold_prefix.py
```

**74 passed** in tracker tests; **54 passed** in request/cache tests
(one existing Starlette TestClient deprecation warning). Two new
regressions fail on baseline because the request TTL is not accepted; a
separate production runtime comparison demonstrates the actual pre-fix
loss, not just the missing parameter.

After rebasing onto current main
`1ad92f0cbc3dea27676e253588100f64a2af6994`, ran those suites together
with `tests/test_prefix_tracker_client_rewrote_reply.py`,
`tests/test_cache_mode_delta_marker.py`, and
`tests/test_content_router_mcp_small_result.py`: **150 passed**. The
actual production timestamp/byte-retention smoke was repeated
successfully on the rebased code, covering compatibility with main's
newly merged client-reply normalization.

Review regression and affected HTTP-consumer suite: **273 passed**,
including tracker expiry, Anthropic/OpenAI cache stability,
byte-faithful forwarding, header isolation, buffered timeouts, CCR
injection, and immutable system prompts. All affected two-argument test
callbacks now accept the TTL contract. The obsolete walker-call-order
test was removed; wire-byte assertions remain. The new
configured-TTL/expiry cases fail against the published baseline; the
post-cleanup regression also verifies that an unrelated conversation
gets a different tracker after recreation.

Changed-file Ruff, formatting, installed pre-commit `mypy headroom`, and
Commitlint hooks passed. Full-tree Ruff is locally blocked by executable
filesystem 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. No unrelated source/permissions changed.

## Real Behavior Proof

- Environment: Linux x86_64, CPython 3.13.14; unchanged
`dea9092e19385f286b7f67a64f4d85de2708d756` and this branch; real
`SessionTrackerStore`, `PrefixCacheTracker`, request TTL parser, token
estimator and `overlay_cached_prefix`, no mocked store or mocked clock.
- Exact command / steps: parse `cache_control: {type: ephemeral, ttl:
1h}` for `claude-sonnet-4-5`; establish one real cache-write-confirmed
frozen message with different original/forwarded prefix bytes; age
`_last_activity` to `time.time()-660` and make periodic cleanup due;
resume the same lineage and compare the tracker, frozen count, and
forwarded-prefix bytes. Also age beyond 3901 seconds and compare
independent 300/3600-second sessions.
- Before: resolved TTL 3600; after 660 seconds, tracker identity
changes, frozen count drops **1→0**, and forwarded-prefix bytes differ.
- Observed result: after the fix, after 660 seconds the same tracker
remains, frozen count stays **1**, and forwarded-prefix bytes are
identical. The one-hour session survives independently, the five-minute
session expires, and the one-hour lineage still expires beyond TTL plus
margin.
- Review runtime proof against published head `e1a107df`: actual stores
and prefix overlays confirm configured TTL retention before the first
cache write, no resurrection of expired state by a later one-hour
request, eventual expiry, and separate trackers after the maintainer's
3901-second cleanup/recreation sequence. On that exact baseline the
unrelated lookup reuses the wrong tracker, although the overlay guard
preserves the particular unrelated input bytes; after the fix both
identity isolation and byte preservation hold. Identical messages under
different tool profiles also receive a cold, separate tracker after the
expired bare-key transition.
- Not tested: Anthropic cloud cache availability, billed savings, or an
actual one-hour wait. The local production state and byte invariants
were exercised by aging actual timestamps, not by a paid upstream
request. Preserving a tracker cannot guarantee that the provider retains
its cache.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; repair of existing TTL-aware
cache-prefix behavior.
- Minimum rollout channel: stable; no rollout-managed feature is
enabled.
- Stable/default behavior changed: eligible local prefix trackers
survive for their provider cache lifetime. Short-TTL/default sessions
remain bounded by their own session floor.
- Kill switch / disable path: the existing prefix-freeze disable path
remains available; no new flag.
- Unsafe override required: no.
- Qualification impact: local Anthropic prefix lineage
selection/retention, not cache pricing or subscription quota policy.
- Rollback path: revert the commit to restore previous retention. No
persistent schema change.

## Review Readiness

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

## Checklist

- [x] Existing cache TTL parser and safety margin reused; cache docs
updated.
- [x] Regressions cover frozen-byte retention, expiry, mixed lifetimes,
and existing request byte-stability behavior.
- [x] `CHANGELOG.md` not edited; Conventional Commit title supplied.

Remote CI results are not inferred from local verification.

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-07 17:46:21 -05:00
Mansurshakh Japarov 278bbc8771 fix(wrap): warn when reused proxy ignores compression settings (#4019)
## Description

A healthy shared proxy is intentionally not restarted: doing so would
interrupt other clients. Explicit startup compression settings must not
be silently ignored when a wrapper reuses it. This implements the
issue's warning-on-reuse alternative.

Closes #3588.

## Type of Change

- [x] Bug fix
- [x] Documentation update

## Changes Made

- Expose the effective tool exclusions alongside the existing effective
minimum-token setting in `/health`.
- Warn when explicitly supplied `HEADROOM_MIN_TOKENS` or
`HEADROOM_EXCLUDE_TOOLS` differs from the running configuration.
- Compare tool names case-insensitively and include built-in exclusions
on both sides. Skip comparisons when older health responses lack the
setting or the requested integer is invalid.
- Preserve the existing mode warning and shared-proxy lifecycle.
Document startup-only configuration and the restart/separate-port
remedies.
- Query the running settings for explicit compression environment
variables even with `--no-proxy` and no explicit `HEADROOM_MODE`.

## Testing

- [x] Focused unit tests: `python -m pytest -q
tests/test_cli/test_wrap_bob.py` — **59 passed**. With current main's
dashboard-license tests: **67 passed**.
- [x] New consumer-visible warning regressions: **4 failed on unchanged
baseline**; the additional no-start/MODE-unset cases produced **2
failures before the final fix**, passing afterwards.
- [x] Changed-file Ruff and formatting checks; installed pre-commit
hooks, including `mypy headroom` and Commitlint, passed.
- [x] Manual testing performed.
- [ ] Full-tree `ruff check .`: blocked locally by EXE002 on five
unchanged OAuth2 plugin files checked out with executable filesystem
permissions (Git tracks them as 100644). No unrelated plugin files or
permissions changed.
- [ ] Separate full dev-environment `mypy headroom`: found one
`truthy-function` error in unchanged
`headroom/integrations/langchain/chat_model.py:394`. The file is
byte-identical to baseline (SHA256
`701a9fe8457907406a2b2810211c1534bc9dfcacf3d841ec4c27d56897209bc7`); the
project's isolated pre-commit mypy environment passed.

The mandatory pre-push `make ci-precheck` completed: workspace Rust
fmt/clippy/tests, native extension build/import verification, Python
gate **177 passed / 4 skipped**, and Commitlint all passed. The native
model gate used `ORT_DYLIB_PATH` pointing to the installed CPU
`libonnxruntime.so.1.26.0`; the cached Kompress parity suite matched
**21 fixtures byte-for-byte**. Implicit runtime selection did not finish
and was cancelled, not reported as a pass; explicit CPU runtime
qualification completed without skipping the cached-model assertions.

### Test Output

```text
[build_rust_extension] headroom._core build + install + verify: OK
================== 177 passed, 4 skipped, 1 warning in 7.29s ===================
✅ ci-precheck PASSED — safe to push.
```

## Real Behavior Proof

- Environment: Linux x86_64, CPython 3.13.14; original baseline
`dea9092e19385f286b7f67a64f4d85de2708d756` and final fix rebased onto
current main `1ad92f0cbc3dea27676e253588100f64a2af6994`; real CLI proxy
and real health endpoint.
- Exact command / steps: start the real proxy, then reuse it with
`HEADROOM_MODE` unset and conflicting compression settings without
starting/restarting it; commands below.
  ```sh
HEADROOM_BEACON=off HEADROOM_MIN_TOKENS=120 HEADROOM_EXCLUDE_TOOLS='' \
headroom proxy --host 127.0.0.1 --port 18795 --stateless --no-optimize \
--no-cache --no-rate-limit --no-subscription-tracking --disable-kompress
  ```
- With `HEADROOM_MODE` unset, reuse it without starting/restarting a
proxy:
  ```sh
  HEADROOM_MIN_TOKENS=2000 HEADROOM_EXCLUDE_TOOLS=Bash,Read,Grep,Glob \
python -c 'from headroom.cli.wrap import _ensure_proxy; print("RESULT",
_ensure_proxy(18795, True))'
  ```
- Before the final no-start-path fix: only `RESULT (None, 18795)`; both
explicit settings were silent. The original baseline was also silent.
- Observed result: both explicit-setting warnings appeared after the
fix; the same PID and running configuration remained unchanged. Output:
  ```text
Warning: this session requested HEADROOM_MIN_TOKENS=2000 (running: 120);
HEADROOM_EXCLUDE_TOOLS=['bash', 'glob', 'grep', 'read'] (running: []),
but those settings are fixed at proxy startup. Restart the proxy, or use
--port for a separate one.
  RESULT (None, 18795)
{"proxy_pid_before": 1231619, "proxy_pid_after": 1231619, "min_tokens":
120, "exclude_tools": [], "no_proxy": true, "explicit_mode": null}
  ```
- Not tested: an external interactive agent session or paid upstream
model request. The actual proxy process, health response, and wrapper
reuse path were exercised.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; diagnostic-only wrapper fix.
- Minimum rollout channel: stable; no rollout-managed feature is
enabled.
- Stable/default behavior changed: a warning only when explicit settings
conflict with the running proxy; no configuration mutation or forced
restart.
- Kill switch / disable path: remove the conflicting explicit
environment setting, or revert the commit; no new switch.
- Unsafe override required: no.
- Qualification impact: wrapper diagnostics only; no model/compression
rollout change.
- Rollback path: revert this commit; the extra health field is additive.

## Review Readiness

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

## Checklist

- [x] Existing conventions reused; documentation updated.
- [x] Regression tests cover mismatches, matching settings, built-in
exclusions, missing fields, and invalid integers.
- [x] `CHANGELOG.md` not edited; Conventional Commit title supplied for
release-please.

The intentional warning is the requested behavior, not a new unsolicited
runtime warning. Full remote CI results will be reported by GitHub, not
inferred from local checks.
2026-10-07 14:17:35 -05:00
APandJerrettDavis cd4367b040 feat(antigravity): add native Google Antigravity IDE integration (#3817)
## Description

Native Google Antigravity IDE integration for Headroom. Antigravity
reads its
model endpoints from its own model-provider settings (not env vars), so
this
follows the existing proxy-only `wrap` pattern: start the Headroom proxy
and
print the custom OpenAI-compatible provider settings to add in the IDE.
A new
MCP registrar installs Headroom into Antigravity's global
`mcp_config.json`.

Closes #727

## Type of Change

- [x] New feature (non-breaking change that adds functionality)

## Changes Made

- `headroom wrap antigravity` — starts the proxy and prints the custom
OpenAI-compatible model-provider settings for Antigravity (same
proxy-only
pattern as `wrap cursor`; per-project `/p/<name>` base-URL prefixes for
  dashboard attribution).
- `headroom mcp install --agent antigravity` — new
`AntigravityRegistrar` for
the global `mcp_config.json` under `~/.gemini/`. Prefers an
already-existing
config location, refuses to overwrite unparseable JSON, clears
Antigravity's
  per-surface MCP cache dirs on uninstall.
- Registers the `antigravity` slice in the persistent install env
registry.
- Docs: `proxy.mdx` gains an Antigravity IDE section covering `wrap`,
  `mcp install`, and the existing `/v1internal:streamGenerateContent`
Cloud Code compatibility endpoint for native google-antigravity clients.

## 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

```text
$ pytest tests/test_cli/test_wrap_antigravity.py \
         tests/test_mcp_registry/test_antigravity_registrar.py \
         tests/test_provider_antigravity.py
34 passed, 1 warning in 0.75s
(the warning is a pre-existing `asyncio_mode` config notice, unrelated)

$ ruff check <changed files>
All checks passed!

$ ruff format --check <changed files>
7 files already formatted
```

## Real Behavior Proof

- Environment: Linux, Python 3.12, branch
`fix/727-antigravity-integration`
- Exact command / steps: `wrap --help` (lists `antigravity`, exit 0);
`wrap antigravity --help` (prints the Antigravity IDE setup instructions
for the custom OpenAI-compatible model-provider flow); `wrap antigravity
--prepare-only` (exit 0).
- Observed result: the new command is wired into the CLI and its help
text
  documents the custom-provider setup flow.
- Not tested: end-to-end `mcp install` against a real Antigravity IDE
(the MCP
SDK extra is not installed in this environment; registrar behavior is
covered
by its unit tests); live proxy traffic from an actual Antigravity
client.

## Runtime Rollout Safety

- Rollout-managed feature(s): none (new additive commands only)
- Minimum rollout channel: n/a
- Stable/default behavior changed: no — existing `wrap` / `mcp install`
  flows are untouched
- Kill switch / disable path: do not run the new commands;
`headroom mcp uninstall --agent antigravity` removes the MCP
registration
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert the single 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please
      from my Conventional Commit PR title

## Additional Notes

- `mypy` was not run (not installed in this environment); `ruff check`
and
  `ruff format` are clean on all changed files.
- Antigravity reads endpoints from its model-provider settings, not env
vars,
so `wrap antigravity` prints setup instructions instead of launching the
IDE.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3817"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-07 13:33:59 -05:00
1ad92f0cbc feat: show the Headroom for Teams offer in the dashboard, docs, llms.txt and release notes (#3991)
## Description

This PR puts the Headroom for Teams offer (3 months of Enterprise free
with a 12-month plan) in the places people go after the README (#3990):
the dashboard, the docs site, `llms.txt` and the release notes. Each
link carries its own `utm_source`/`utm_medium`, so we can see which
surface converts.

No linked issue.

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] 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

- **Dashboard:** a slim, dismissible banner under the header. It shows
the user's savings when they are $1 or more. It is a plain link, so
nothing is fetched or reported.
- The banner is removed server-side on any **licensed** proxy, using the
running proxy's effective licence: `ProxyConfig.license_key`,
`HEADROOM_LICENSE`, or the deprecated `HEADROOM_LICENSE_KEY`.
`create_app` resolves the licence once and passes it to
`get_dashboard_html(licensed=...)`. This is a review fix: before, only
`HEADROOM_LICENSE` was checked.
- This only hides a promotion. OSS still needs no licence and checks
none; licences belong to the Enterprise plugins.
- **Docs site:** a dismissible top banner, a sidebar link and a new
`/docs/teams` page.
- The page's Open source vs Enterprise table now states what OSS already
ships (tool search on Anthropic requests; opt-in, rule-based model
routing) and what Enterprise adds. This is a review fix.
- **`llms.txt`:** a Headroom for Teams section, with the same accuracy
fix.
- **Release notes:** a `release.yml` step appends one footer line under
the changelog. It is keyed on its own marker, `<!--
headroom-teams-footer -->`, rather than on the perks link, so a
changelog entry that mentions the link no longer suppresses the footer.
This is a review fix.
- **Telemetry opt-out:** `llms.txt` and `docs/content/docs/proxy.mdx`
named a `--offline` flag that does not exist. The switch is
`HEADROOM_OFFLINE=1`.

## Testing

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

### Test Output

```text
$ pytest -q tests/test_dashboard_teams_perk.py tests/test_dashboard_static_assets.py
============================= 17 passed in 18.40s ==============================
# test_dashboard_teams_perk.py: renderer, with and without each licence env var and with an explicit flag;
# /dashboard route, unlicensed, with ProxyConfig.license_key, with HEADROOM_LICENSE, with HEADROOM_LICENSE_KEY

$ pytest -q tests -k "dashboard or release or license"
4 failed, 305 passed, 1 skipped
# the 4 failures are tests/test_dashboard/test_live_feed.py (Playwright browser tests). They fail identically
# on this branch without the review commit; it is this machine's browser setup.

$ ruff check headroom/dashboard/__init__.py headroom/proxy/server.py tests/test_dashboard_teams_perk.py
All checks passed!
$ mypy headroom/dashboard/__init__.py --ignore-missing-imports
Success: no issues found in 1 source file

# release footer step, simulated twice on notes that already link the perks page:
appended
skipped        # re-run is a no-op; footer present exactly once
```

## Real Behavior Proof

- Environment: macOS 26.6 (arm64), Python 3.12.13, FastAPI `TestClient`
against `create_app`.
- Exact command / steps: `pytest -q tests/test_dashboard_teams_perk.py`.
The release step's shell was run twice against a notes file that already
mentions `headroom-perks.vercel.app`.
- Observed result: the `/dashboard` route serves the banner unlicensed,
and strips it for each of the three licence sources while leaving the
rest of the page intact. The footer is appended once and is not
duplicated on a re-run.
- Not tested: the release step against a real GitHub release (it runs on
the next release), and the docs `next build` after this commit (only
Markdown/MDX text changed).

## Runtime Rollout Safety

- Rollout-managed feature(s): none.
- Minimum rollout channel: stable.
- Stable/default behavior changed: yes. Unlicensed dashboards show a
dismissible banner, and the docs site shows a dismissible banner.
- Kill switch / disable path: set any licence token to hide the
dashboard banner. It is a plain link, with no network calls.
- Unsafe override required: no.
- Qualification impact: none.
- Rollback path: revert this PR.

## 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
- [x] 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 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

- **Review fixes are in `eeb0008a`:** @JerrettDavis's two points (the
effective licence source, and the OSS routing row) and Devin's
footer-marker and `--offline` findings.
- **Not changed:** Devin's suggestion to show sub-dollar savings. The $1
floor is deliberate, because "you saved $0.40" weakens the offer, and
the cost card still shows the exact amount.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-07 10:59:41 -05:00
Tejas ChopraandClaude Opus 5.5 5a516b54af fix(deps): clear the two high npm advisories failing the Security workflow (#4004)
## Description

Since 2026-10-06 15:27 UTC, the two `npm audit` jobs in the Security
workflow fail on `main` and on every PR. They passed at 13:45. Nothing
in the repo changed in between: two advisories were published that day.

| Job | Package | Advisory |
|---|---|---|
| `npm audit (docs)` | `sharp` <0.35.5 | librsvg CVE-2026-96889
([GHSA-wq5f-xc86-pv6w](https://github.com/advisories/GHSA-wq5f-xc86-pv6w))
|
| `npm audit (e2e/wrap/tools)` | `@modelcontextprotocol/sdk`
1.12.0–1.30.1, via `openclaw` | The OAuth client could send credentials
to an authorization server chosen by the MCP server
([GHSA-6qxp-vccf-f47h](https://github.com/advisories/GHSA-6qxp-vccf-f47h))
|

No linked issue.

## 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

- `docs/package-lock.json`: `npm audit fix` moves `sharp` from 0.35.4 to
0.35.5, plus its `@img/*` platform binaries. Nothing else in the
lockfile changes.
- `e2e/wrap/tools/package.json` and its lockfile: adds `"overrides":
{"@modelcontextprotocol/sdk": "1.32.1"}`. An override is needed because
every `openclaw` release, including the latest 2026.9.8, pins the SDK to
exactly 1.30.0. npm's `--force` suggestion would *downgrade* `openclaw`
to 2026.3.12. 1.32.1 is the patched release in the same major version.

## 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

```text
$ cd docs && npm audit --audit-level=high
found 0 vulnerabilities

$ cd e2e/wrap/tools && npm audit --audit-level=high
found 0 vulnerabilities

# fresh install of the e2e tools exactly as the Dockerfile does it (npm ci from the lockfile)
$ npm ci --no-audit --no-fund && ./node_modules/.bin/openclaw --version
OpenClaw 2026.9.6 (eb377ac)
$ find node_modules -path "*@modelcontextprotocol/sdk/package.json" -not -path "*/dist/*"
node_modules/@modelcontextprotocol/sdk/package.json 1.32.1    # the only copy
```

## Real Behavior Proof

- Environment: macOS 26.6 (arm64), Node.js v26.7.0, npm from the same
install, against the public npm registry.
- Exact command / steps: `npm audit fix` in `docs/`; adding the override
and running `npm install --package-lock-only` in `e2e/wrap/tools/`; `npm
audit --audit-level=high` in both; `npm ci` plus `openclaw --version`
and `openclaw mcp --help` in a fresh copy of `e2e/wrap/tools`.
- Observed result: both audits report 0 vulnerabilities. `openclaw`
2026.9.6 installs and runs with SDK 1.32.1, which is the only copy
installed.
- Not tested: a full docs `next build`, and the Docker wrap E2E harness
end to end. CI's docs build and wrap E2E jobs cover these.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; this changes only the dependencies
of the docs site and the E2E test tools.
- Minimum rollout channel: n/a, nothing ships to users.
- Stable/default behavior changed: no.
- Kill switch / disable path: n/a.
- Unsafe override required: no.
- Qualification impact: none.
- Rollback path: revert this PR.

## 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
- [x] 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
- [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

The "added tests" checklist item is N/A here: the `npm audit` jobs in
the Security workflow are the regression test. Once this merges, the
same two red checks clear on every open PR, including #4003, #3990 and
#3991.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4004"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 17:21:09 -07:00
Sudhindra DesaiandJD Davis 01185e32d3 feat(router): add max_output_tokens condition to ModelRoute (#3898)
## Description

`ModelRoute` could bound the estimated input size (`max_input_tokens`)
but had no condition on the request's own `max_tokens`. That meant a
tiny prompt asking for a long answer (for example, `max_tokens: 4000`)
still matched a "trivial turn" downshift rule and was sent to the
cheaper model.

This PR adds `max_output_tokens`, using the shape proposed in the issue.
A rule with it set matches only when the request's `max_tokens` is `<=
N`. As with the other conditions, `None` means "ignore this condition",
set conditions AND together, and the first matching rule wins.

**Open question from the issue, decided here:** a request with no
`max_tokens`, or with a non-integer or boolean value, does **not**
match. An unbounded response is not a trivial turn, so the rule can
never widen to cover unbounded requests. This follows the same
fail-closed approach as the existing parser.

Closes #2765

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] 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

- `headroom/proxy/model_router.py`: new `ModelRoute.max_output_tokens`
field. `matches()` and `ModelRouter.select()` take an optional
`max_tokens` keyword, which defaults to `None`, so existing callers are
unchanged. `max_tokens` is added to the decision reason.
`max_output_tokens` is added to the allowed route keys and parsed with
the existing `_strict_opt_int`, so a malformed, boolean or negative
value skips the route. New `request_max_tokens(body)` helper.
- `headroom/proxy/handlers/anthropic.py`: `_maybe_route_model` passes
`request_max_tokens(body)` to the router.
- `docs/content/docs/configuration.mdx`: new field in the rule table,
plus a note on combining it with `max_input_tokens`.
- Tests for matching, absent budget, select and reason, env parsing
(valid and malformed), the helper, and handler wiring.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`): not run successfully. My
local mypy stops on an unrelated numpy stub syntax error in this env
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
$ pytest tests/test_proxy/test_model_router.py tests/test_proxy/test_model_router_wiring.py -q
54 passed, 1 warning in 5.22s

$ pytest tests/test_proxy -q -k "anthropic or router"
119 passed, 237 deselected, 1 warning in 14.41s

$ ruff check headroom/proxy/model_router.py headroom/proxy/handlers/anthropic.py tests/test_proxy/test_model_router*.py
All checks passed!
```

## Real Behavior Proof

- Environment: macOS, Python 3.12, branch head
- Exact command / steps: the rule from the issue (`from_models:
[claude-opus-4-8]`, `max_input_tokens: 4096`, `max_output_tokens: 512`,
`require_no_tools`, `to_model: claude-haiku-4-5`) built via
`ModelRouterConfig.from_env`. I then ran `select()` for the issue's
"Reply with the single word OK." prompt with three different
`max_tokens` values.
- Observed result: `max_tokens=4000` stays on `claude-opus-4-8`,
`max_tokens=256` routes to `claude-haiku-4-5`, and a request with no
`max_tokens` stays on `claude-opus-4-8`:
  ```text
  max_tokens=4000: routed_model=claude-opus-4-8 reason=no rule matched
max_tokens=256: routed_model=claude-haiku-4-5 reason=matched rule
'trivial-opus->haiku': claude-opus-4-8 -> claude-haiku-4-5
(input_tokens=7, has_tools=False, max_tokens=256)
  max_tokens=None: routed_model=claude-opus-4-8 reason=no rule matched
  ```
- Not tested: an end-to-end request through a running proxy against a
live upstream.

## Runtime Rollout Safety

- Rollout-managed feature(s): none. This only extends the opt-in model
router (`HEADROOM_MODEL_ROUTER_ENABLED`).
- Minimum rollout channel: N/A
- Stable/default behavior changed: No. The router is still off by
default, and rules without `max_output_tokens` behave exactly as before.
- Kill switch / disable path: unset `HEADROOM_MODEL_ROUTER_ENABLED`, or
remove the field from the rule.
- Unsafe override required: No
- Qualification impact: None
- Rollback path: revert this PR

## 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
- [x] 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 did **not** edit `CHANGELOG.md`

## Additional Notes

Routing still only applies on the Anthropic `/v1/messages` path, where
`max_tokens` is required. If routing is later extended to the OpenAI
paths (#2354), `request_max_tokens` is the single place to add
`max_completion_tokens` / `max_output_tokens`.


<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3898"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-06 10:30:01 -05:00
Ayush Kumar JhaandJerrett Davis 0d7d61d5cc fix(wrap): let wrap opencode target a third-party OpenAI-compatible upstream (#3125)
## Description

`headroom wrap opencode` had no way to say where OpenAI-compatible
traffic should go. `opencode()` forwarded `openai_api_url` to
`_ensure_proxy` only for `--copilot-subscription`; every other run
inherited the proxy default, `https://api.openai.com/v1`. A user
following the README's agent-wrap table with a DeepSeek key therefore
had that key presented to OpenAI, which rejected it with `401 Incorrect
API key provided` and pointed them at a `platform.openai.com` dashboard
for a key they never had. Meanwhile
`docs/content/docs/opencode-deepseek.mdx` said "Do not use `headroom
wrap`", with nothing reconciling the two.

This adds the missing plumbing (`--openai-api-url` /
`OPENAI_TARGET_API_URL`, mirroring `headroom proxy`) and the
documentation the issue asked for.

Closes #3107

## 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

- `headroom/cli/wrap.py`: `wrap opencode` gains `--openai-api-url`, with
`envvar="OPENAI_TARGET_API_URL"`, mirroring `headroom proxy
--openai-api-url`. It is passed to `_ensure_proxy`, which already knows
how to start the proxy with it and how to report a mismatch against an
already-running proxy.
- `headroom/cli/wrap.py`: combining `--openai-api-url` with
`--copilot-subscription` raises a `ClickException` before anything is
mutated — the subscription resolves its own upstream, so a manual
override would silently fight it.
- `headroom/cli/wrap.py`: the `opencode` docstring documents the default
upstream and both invocation forms.
- `headroom/cli/wrap.py`: `--no-proxy` combined with an upstream
override now fails closed (review). New
`_require_no_proxy_openai_upstream(port, url)` requires a healthy
Headroom listener whose `/health` config advertises the same
`openai_api_url` after `_normalize_proxy_api_url`; an absent listener, a
listener with no Headroom config, or a mismatched upstream each raise a
`ClickException` that names the exact `headroom proxy --port N
--openai-api-url URL` command to run. The check is opted into via a new
`require_openai_api_url` keyword on `_ensure_proxy_unlocked`, set only
by `wrap opencode`, so wrappers that pass a built-in upstream (`vibe`,
`kimi`, `grok`, `zcode`) keep their existing warn-and-reuse `--no-proxy`
behaviour. On a match wrap prints `Proxy on port N already targets URL`,
warns about a proxy-mode mismatch like the other reuse paths, and
continues. `wrap opencode` runs this check before it touches OpenCode's
config or registers a client marker, so a refused upstream leaves
nothing behind. `--prepare-only` skips it, since it never uses a proxy.
- `headroom/providers/opencode/config.py`:
`inject_opencode_provider_config(port, keep_user_entries=...)` keeps the
user's own `models` and `options` (an `apiKey`, say) under
`provider.headroom` instead of replacing the entry; Headroom still owns
`npm`, `name` and `baseURL`. `wrap opencode` passes `keep_user_entries`
only when `--openai-api-url` (or `OPENAI_TARGET_API_URL`) is set.
Without it the proxy forwards to OpenAI, so a kept third-party key would
be sent there, and wrap writes Headroom's entry as before. OpenCode only
resolves `headroom/<id>` for listed ids, so without this a DeepSeek user
had no DeepSeek model to select (`ProviderModelNotFoundError`) and no
key to send.
- `docs/content/docs/opencode.mdx`: `--openai-api-url` documented on the
canonical OpenCode page (Options block, prose, env-var table), with a
two-form example — wrap starts the proxy, or `headroom proxy
--openai-api-url …` then `wrap --no-proxy --openai-api-url …` — and a
paragraph stating that `--no-proxy` verifies and refuses rather than
re-points.
- `docs/content/docs/opencode-deepseek.mdx`: new "Common issues" entry
for the `Incorrect API key provided` 401 (it comes from OpenAI, not
DeepSeek) and a "When is `headroom wrap opencode` safe?" section — safe
as-is for the default OpenAI/Anthropic upstreams, needs
`--openai-api-url` for any third-party OpenAI-compatible provider, and
that wrap keeps the step 4 `models` and `apiKey` under
`provider.headroom` (DeepSeek needs both). The "Models appear but
requests fail" entry and the "What's NOT in this guide" bullet are
reworded to match, replacing the blanket "do not use `headroom wrap`".
- `README.md`: footnote on the OpenCode row of the agent compatibility
matrix naming the default upstream and the flag/env var.
- `tests/test_cli/test_wrap_opencode.py`: ten tests — the flag, the env
var, the unset default, the `--copilot-subscription` rejection; for
`--no-proxy`: absent, non-Headroom, matching (trailing slash, proving
normalization), and mismatched listeners; that wrappers without
`require_openai_api_url` keep lenient reuse; and that the CLI forwards
the flag. With the fix reverted, 5 of the 6 new tests fail. Review
follow-ups add: `wrap opencode --help` keeps its examples unwrapped and
`wrap.py` has no raw control bytes; a refused `--no-proxy` upstream
exits before any OpenCode config edit or client marker; the
matching-upstream path still warns about a mode mismatch.
- `tests/test_providers_opencode_config.py`: with `keep_user_entries`
the user's `headroom` models and `apiKey` survive re-injection, other
providers are untouched, and Headroom's `npm`/`baseURL` win; without it
they are dropped.
- `tests/test_cli/test_wrap_opencode.py` (second round): through the CLI
the key is kept with `--openai-api-url` and dropped without it, and
`--prepare-only --no-proxy --openai-api-url` writes config with no proxy
listening.

## Testing

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

Four failures in the wider `tests/test_cli` run are pre-existing and
Windows-only — they reproduce identically with this branch's changes
stashed: symlink/settings-path issues in `test_recover_codex.py` and
`test_unwrap_claude.py`, and `signal.SIGHUP` (absent on Windows) in
`test_wrap_stale_marker.py`. They are deselected below.
`tests/test_cli_proxy_improvements.py` and
`tests/test_memory/test_learn_flag.py` cannot run from this source
checkout because the Rust `headroom._core` extension is not built here
(same result on the clean branch); CI builds the wheel.

### Test Output

```text
$ python -m pytest tests/test_cli/test_wrap_opencode.py -q
50 passed, 1 warning in 1.96s

$ python -m pytest tests/test_cli -q     --deselect tests/test_cli/test_recover_codex.py     --deselect tests/test_cli/test_unwrap_claude.py     --deselect "tests/test_cli/test_wrap_stale_marker.py::test_signal_handler_unwinds_so_the_restore_can_run"
706 passed, 1 skipped, 46 deselected, 1 warning in 60.41s

$ git stash push -- headroom/cli/wrap.py && python -m pytest tests/test_cli/test_wrap_opencode.py -q -k no_proxy
5 failed, 2 passed   # the new tests fail without the fix; the 2 passing pin unchanged behaviour

$ python -m ruff check .
All checks passed!

$ python -m ruff format --check .
1577 files already formatted

$ python -m mypy headroom
Success: no issues found in 532 source files

$ python -m coverage run --include=headroom/cli/wrap.py -m pytest tests/test_cli/test_wrap_opencode.py -q
50 passed   # 17/17 statements added to wrap.py executed, 0 missing
# Review follow-ups (this branch, with current main merged in)
$ pytest tests/test_cli/test_wrap_opencode.py tests/test_providers_opencode_config.py
102 passed, 1 failed  # test_build_launch_env_with_project: a known Windows-only path-escaping failure, also on main
# each new test fails on the code before its fix:
test_inject_provider_config_keeps_the_users_models_and_options -> KeyError: 'apiKey'
test_no_proxy_with_openai_api_url_still_warns_about_a_mode_mismatch -> warning missing from output
test_wrap_opencode_no_proxy_rejects_a_mismatched_upstream_before_editing_config -> "MCP retrieve tool: registered", then _ensure_proxy reached
test_wrap_opencode_keeps_the_users_headroom_key_only_for_an_explicit_upstream[no flag] -> key kept (would go to OpenAI)
test_wrap_opencode_prepare_only_does_not_need_the_no_proxy_listener -> "No Headroom proxy is listening on port 9000"
# help test: dropping either no-rewrap marker, or writing a raw 0x08 byte, fails a test (3/3)
$ ruff check / ruff format --check (0.16.8): clean
$ mypy headroom/cli/wrap.py headroom/providers/opencode/config.py --ignore-missing-imports --follow-imports=silent
Success: no issues found in 2 source files
```

## Real Behavior Proof

- Environment: Windows 11, Python 3.11.9, headroom 0.35.0 (`rust_core:
loaded`), with a stub `opencode` on `PATH` that curls the proxy's
`/health` — so the wrapped agent reports the upstream the proxy actually
resolved.
- Exact command / steps: (1) baseline against released 0.35.0 without
this fix on `sys.path` — `python -m headroom.cli wrap opencode --port
8799 --no-mcp --no-serena --openai-api-url https://api.deepseek.com/v1`;
(2) same command on this branch, port 8801; (3) env-var form on this
branch — `OPENAI_TARGET_API_URL=https://api.deepseek.com/v1 python -m
headroom.cli wrap opencode --port 8802 --no-mcp --no-serena`. For the
`--no-proxy` review: `python -m headroom.cli wrap opencode --port <P>
--no-proxy --no-mcp --no-serena --openai-api-url
https://api.deepseek.com/v1` on this branch against (4) nothing on 8811;
(5) `python -m http.server 8812`; (6) a real released-0.35.0 `headroom
proxy --port 8813` (default upstream, `/health` reports
`"openai_api_url": null`); (7) a real `headroom proxy --port 8814
--openai-api-url https://api.deepseek.com/v1`.
- Observed result: step 1 reproduces the bug exactly — wrap prints
`Extra args: --openai-api-url https://api.deepseek.com/v1` (the flag is
swallowed by `ignore_unknown_options` and handed to the agent) and the
proxy it started reports `"openai_api_url": null`, i.e. it would forward
to `api.openai.com`. Step 2 prints no `Extra args` line and the proxy
reports `"openai_api_url": "https://api.deepseek.com/v1"`. Step 3
reports the same. All three runs cleaned up their proxy on exit — no
listener left on 8799/8801/8802. Steps 4–6 each exit 1 before `opencode`
is launched, with: (4) `No Headroom proxy is listening on port 8811 …
Start it separately with `headroom proxy --port 8811 --openai-api-url
https://api.deepseek.com/v1`, or drop --no-proxy …`; (5) `The listener
on port 8812 did not report a Headroom config, so wrap cannot confirm it
forwards to https://api.deepseek.com/v1 …`; (6) `The Headroom proxy on
port 8813 forwards OpenAI-compatible traffic to
https://api.openai.com/v1, not https://api.deepseek.com/v1. Restart it
with …` — and the 8813 proxy is left running, still reporting `null`.
Step 7 prints `Proxy on port 8814 already targets
https://api.deepseek.com/v1` and launches the stub (exit 0). Both
proxies were stopped afterwards; 8811–8814 verified free.
- Real OpenCode (review follow-up): OpenCode 1.18.34 installed from npm
into a scratch directory with an isolated `HOME`, and a local fake
OpenAI-compatible "DeepSeek" upstream on 8792 that records each
request's model and `Authorization` header. The global `opencode.json`
declares `provider.headroom.models.deepseek-chat` and `options.apiKey:
"{env:DEEPSEEK_API_KEY}"`. Command: `headroom wrap opencode --port 8796
--openai-api-url http://127.0.0.1:8792/v1 --no-mcp --no-serena -- run
"say hi" -m headroom/deepseek-chat`.
- before this commit: `ProviderModelNotFoundError: Model not found:
headroom/deepseek-chat.` Nothing reached the upstream, and the config
after wrap held only `gpt-4o` and `gpt-4.1` under `headroom`, with no
`apiKey`.
- after (re-run on the final head e8754b61): OpenCode printed `> build ·
deepseek-chat` and `hello from fake deepseek`. The upstream logged
`{"path": "/v1/chat/completions", "model": "deepseek-chat", "auth":
"Bearer sk-fa...", "stream": true}`. The config kept `apiKey` and
`deepseek-chat` alongside Headroom's `baseURL` and defaults.
- Not tested: a live request against `api.deepseek.com` with a real key,
since none is available here. The real-OpenCode run above uses a local
fake upstream instead, so it proves model selection, key forwarding and
routing through Headroom but not DeepSeek's own API. The
`--copilot-subscription` rejection was exercised as a unit test, not
against a real Copilot subscription.

## Runtime Rollout Safety

- Rollout-managed feature(s): none — a CLI option and its plumbing, not
gated by the rollout-channel machinery.
- Minimum rollout channel: n/a, not rollout-gated.
- Stable/default behavior changed: no — without the flag and without
`OPENAI_TARGET_API_URL`, `openai_api_url` stays `None` and the proxy
resolves its upstream exactly as before; a test pins this.
- Kill switch / disable path: omit the flag and leave
`OPENAI_TARGET_API_URL` unset — behavior is identical to the previous
default.
- Unsafe override required: no.
- Qualification impact: none — no change to compression, routing, or the
proxy request path; the option only chooses which upstream URL the proxy
is started with.
- Rollback path: revert this commit — no config, cache, or on-disk state
is written by the new option, so a revert needs no cleanup.

## 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
- [x] 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 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 — CLI and docs change.

## Additional Notes

- The `x-headroom-base-url` header workaround from the issue is
deliberately left out of the DeepSeek guide. With `--openai-api-url` the
proxy targets the right upstream directly, so the header is no longer
needed for this case. It stays documented where it belongs, in
`configuration.mdx` and `pipeline-extensions.mdx`, as a per-request
override.
- Scope is intentionally limited to `wrap opencode`, the command named
in the issue. Other `wrap` subcommands that hardcode an upstream
(`mistral`, `kimi`, `grok`) or detect one (`zcode`) are unaffected;
giving the whole wrap family a uniform upstream override is a reasonable
follow-up, not this fix.

---------

Co-authored-by: Jerrett Davis <mxjerrett@gmail.com>
2026-10-06 08:45:54 -05:00
dependabot[bot] e06631a7a7 deps: Bump source-map-js from 1.2.1 to 1.2.2 in /docs (#3986)
Bumps [source-map-js](https://github.com/7rulnik/source-map-js) from
1.2.1 to 1.2.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/7rulnik/source-map-js/releases">source-map-js's
releases</a>.</em></p>
<blockquote>
<h2>v1.2.2</h2>
<ul>
<li>
<p>Fix crash when executing in browser with CSP script-src that don't
permit unsafe-eval (<a
href="https://redirect.github.com/7rulnik/source-map-js/pull/29">#29</a>)
<a href="https://github.com/xfournet"><code>@​xfournet</code></a></p>
</li>
<li>
<p>Fix denial of service from malicious indexed source maps
(CVE-2026-93749) (<a
href="https://redirect.github.com/7rulnik/source-map-js/pull/79">#79</a>)</p>
<p>Reported by <a
href="https://github.com/waydeshi"><code>@​waydeshi</code></a> in <a
href="https://redirect.github.com/7rulnik/source-map-js/issues/76">#76</a>.
A fix was also proposed by <a
href="https://github.com/aniebiet"><code>@​aniebiet</code></a> in <a
href="https://redirect.github.com/7rulnik/source-map-js/pull/78">#78</a>.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/7rulnik/source-map-js/blob/main/CHANGELOG.md">source-map-js's
changelog</a>.</em></p>
<blockquote>
<h2>1.2.2</h2>
<ul>
<li>
<p>Fix crash when executing in browser with CSP script-src that don't
permit unsafe-eval (<a
href="https://redirect.github.com/7rulnik/source-map-js/pull/29">#29</a>)
<a href="https://github.com/xfournet"><code>@​xfournet</code></a></p>
</li>
<li>
<p>Fix denial of service from malicious indexed source maps
(CVE-2026-93749) (<a
href="https://redirect.github.com/7rulnik/source-map-js/pull/79">#79</a>)</p>
<p>Reported by <a
href="https://github.com/waydeshi"><code>@​waydeshi</code></a> in <a
href="https://redirect.github.com/7rulnik/source-map-js/issues/76">#76</a>.
A fix was also proposed by <a
href="https://github.com/aniebiet"><code>@​aniebiet</code></a> in <a
href="https://redirect.github.com/7rulnik/source-map-js/pull/78">#78</a>.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/7rulnik/source-map-js/commit/0a1d334fd1e55a47df97fcd60a7915d46df3b08a"><code>0a1d334</code></a>
1.2.2</li>
<li><a
href="https://github.com/7rulnik/source-map-js/commit/4c6fa26d77419bd8e48ec92844866cce7d9ae739"><code>4c6fa26</code></a>
Update changelog</li>
<li><a
href="https://github.com/7rulnik/source-map-js/commit/cf7658058ceeaa8619d5ae0ec90be6905209d016"><code>cf76580</code></a>
Fix denial of service from malicious indexed source maps
(CVE-2026-93749) (<a
href="https://redirect.github.com/7rulnik/source-map-js/issues/79">#79</a>)</li>
<li><a
href="https://github.com/7rulnik/source-map-js/commit/7899a86615c630f4fc220273ff9fe2e8e49a56df"><code>7899a86</code></a>
Fix crash when executing browser with CSP script-src that don't permit
unsafe...</li>
<li>See full diff in <a
href="https://github.com/7rulnik/source-map-js/compare/v1.2.1...v1.2.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=source-map-js&package-manager=npm_and_yarn&previous-version=1.2.1&new-version=1.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/headroomlabs-ai/headroom/network/alerts).

</details>
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3986"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 20:16:57 -05:00
Ayush Kumar Jha e7b3baf236 feat(proxy): serve on a Unix domain socket (--uds) (#3151)
## Description

`headroom proxy --uds PATH` binds an AF_UNIX socket instead of a TCP
port. Request handling is untouched; this is the transport only.

Reasons to prefer it over a loopback port: there's no port to collide
with, nothing listens on the network, and filesystem permissions govern
access. Containers and systemd units can share a socket through a bind
mount or a runtime directory without publishing a port.

Path handling refuses more than it deletes:
- It clears a stale socket left by a crashed proxy.
- It refuses to start when something is still listening on the path,
since two proxies would split traffic.
- It refuses a path that exists as a non-socket, which is far more
likely a mistyped argument pointing at real data than a leftover.
- It refuses a path longer than `sun_path` (108 bytes on Linux, 104 on
macOS/BSD). Otherwise that fails inside `bind()` with an error that
names nothing.
- Missing parent directories are created `0700`. An existing parent's
mode is never changed, and a world-writable, non-sticky parent is
refused.
- On Windows `--uds` is rejected with a clear error.

This PR started as a route to Claude Code Remote Control through
Headroom (#1779). That route was field-tested on Linux and does not
work. `ANTHROPIC_UNIX_SOCKET` passes Remote Control's host check, but
Claude Code then classifies the session as API-key auth, which fails
Remote Control's separate subscription-auth requirement. The
troubleshooting docs record that negative result, and this PR no longer
claims to fix #1779.

Devin's review of this head found two real defects and a few smaller
points; they're listed under "Not tested" below. @Mearman's #3959 fixes
all of them on top of this branch: it is stacked here and carries these
three commits unchanged. #3960 is their standalone alternative.
Maintainers can merge this and then #3959's nine commits, or take #3959
directly.

Refs #1779

## Type of Change

- [x] New feature (non-breaking change that adds functionality)

## Changes Made

- `headroom/proxy/uds.py` (new):
- `prepare_uds_path()`: stale-socket cleanup; refusal of a live
listener, a non-socket path or an over-long path; `0700` for directories
it creates; refusal of an unsafe existing parent
  - `remove_uds_path()`
  - the `sun_path` limits and the Windows guard
  - `socket_usage_lines()`, used by both banners
- `headroom/cli/proxy.py`: the `--uds PATH` option (env `HEADROOM_UDS`)
and the socket banner.
- `headroom/proxy/server.py`: `run_server` prepares the path, passes it
to uvicorn, and removes the socket when it exits. The legacy `python -m
headroom.proxy.server` banner uses the same usage lines.
- `headroom/proxy/models.py`: the `uds` setting on `ProxyConfig`.
- `headroom/settings_store.py`: registers `HEADROOM_UDS`.
- `docs/content/docs/proxy.mdx`: a "Serving on a Unix socket" section.
`docs/content/docs/troubleshooting.mdx` gets the Remote Control finding.
- `tests/test_proxy_uds.py`: 24 tests covering path preparation,
parent-mode handling, `sun_path` limits, the Windows guard, the banners,
and the stale-socket and live-listener cases against real AF_UNIX
sockets.

## Testing

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

### Test Output

```text
# This head (73f77da2) in a python:3.11-slim container, with the Rust core from the
# headroom-ai 0.36.0 Linux wheel (the branch's version):
== PR #3151 head 73f77da2, Python 3.11.17, Linux
$ pytest tests/test_proxy_uds.py tests/test_proxy_settings_endpoints.py -q
======================== 52 passed, 1 warning in 5.17s =========================

# Same head, the files this PR touches:
$ ruff check <files> && ruff format --check <files>   # ruff 0.16.8
All checks passed!
6 files already formatted
$ mypy headroom/proxy/uds.py headroom/cli/proxy.py headroom/proxy/server.py headroom/proxy/models.py headroom/settings_store.py --ignore-missing-imports --follow-imports=silent --platform linux   # mypy 1.19.1
Success: no issues found in 5 source files
```

## Real Behavior Proof

- Environment: Linux (Docker `python:3.11-slim` on a WSL2 kernel),
Python 3.11.17, this PR's head `73f77da2`, isolated
`HEADROOM_WORKSPACE_DIR`, no provider credentials.
- Exact command / steps: `headroom proxy --uds
/tmp/hr-uds/run/proxy.sock` with neither parent directory existing. I
queried it over the socket with httpx's UDS transport, checked the
listening TCP ports in `/proc/net/tcp*`, started a second proxy on the
same path, then stopped the first with Ctrl+C. Finally I started it
again and stopped it with SIGTERM.
- Observed result: the proxy serves over the socket, creates owner-only
parents, binds no TCP port, refuses a second proxy, and cleans up on
Ctrl+C. SIGTERM leaves the socket file behind (see "Not tested"):
  ```text
GET /health over the socket -> {'service': 'headroom-proxy', 'status':
'healthy', 'ready': True}
  socket is a unix socket: True | run/ mode: 0o700 | hr-uds/ mode: 0o700
  TCP ports in LISTEN inside the container: none
second proxy on the same path -> exit 1 | ['headroom.proxy.uds.UdsError:
Another process is already listening on /tmp/hr-uds/run/proxy.sock. Stop
it, or choose a different --uds path.']
  after Ctrl+C (SIGINT): exit 0 | socket file still present: False
after SIGTERM (systemd/docker stop): exit -15 | socket file still
present: True
  ```
- Not tested: macOS live, Windows live (`--uds` is refused there;
covered by a unit test), real provider traffic over the socket, and
`--workers` greater than 1. Known limitations at this head, all fixed in
#3959:
- SIGTERM leaves the socket file, because uvicorn re-raises the signal
before `run_server`'s cleanup runs. A restart clears the stale socket.
- A stored `HEADROOM_UDS` overrides `--port`, and `headroom wrap` passes
it to the TCP proxy it starts.
- uvicorn creates the socket `0666`. That's harmless under a `0700`
parent, but reachable by every local user if placed directly in `/tmp`.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; `--uds` is an opt-in CLI flag
- Minimum rollout channel: n/a
- Stable/default behavior changed: no. Without `--uds` (or
`HEADROOM_UDS`) the proxy binds TCP exactly as before.
- Kill switch / disable path: don't pass `--uds` and don't set
`HEADROOM_UDS`
- Unsafe override required: no
- Qualification impact: none for the default TCP path
- Rollback path: revert this PR; no stored state or format changes

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- This replaces the earlier description, which had been saved with
literal backslash-n sequences instead of newlines and was cut off
mid-sentence, so the template check could not read it.
- The "Not tested" limitations are deliberate disclosure rather than
open questions: #3959 has the fixes and tests for each.

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3151"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
2026-10-05 15:28:41 -05:00
Tejas ChopraandClaude Opus 5 119d1a1939 fix(offline): make HEADROOM_OFFLINE a real air-gap via one chokepoint (#3729)
## Description

**Revised 2026-10-05 after review: merged current `main`, routed main's
new TLS-diagnostic egress (`doctor --network` and the TLS-error chain
re-probe) through `guard_egress`, made the test socket trap let loopback
through so the async offline tests run on Windows, and closed five
model-loader findings from Devin Review.**

`HEADROOM_OFFLINE=1` is documented as an air-gap switch, but several
egress paths never consulted `headroom/offline.py`. This PR makes
`guard_egress` the single chokepoint every Headroom-initiated outbound
connection goes through, with a per-site meta-test that fails on any new
unguarded egress. Full detail of every revision is under *Changes Made*.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change) — outbound calls that previously worked with
`HEADROOM_OFFLINE=1` set now refuse; see *Behaviour change customers can
see*
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

### This revision (2026-10-05, after @JerrettDavis's review of
2026-09-24 and comment of 2026-10-03)

* **Merged current `main`.** Conflicts in `docs/content/docs/proxy.mdx`
(kept main's new rows, this PR's offline row),
`headroom/image/onnx_router.py` (both imports) and
`headroom/proxy/server.py` lifespan (main's rust-core passthrough block,
then this PR's `_configure_observability_or_refuse()`).
* **`doctor --network` / TLS diagnostics now go through the guard.**
`tls_diagnostics.probe_endpoint` calls `guard_egress` before both the
certificate-chain handshake and the `httpx.Client` GET; `headroom
doctor` turns the refusal into one `network · skipped: HEADROOM_OFFLINE
is set, no endpoint was contacted` row (status `skip`, so it does not
fail the doctor) instead of a page of "unreachable". `_probe_uncached` —
the chain handshake used both by doctor and by the request path's
TLS-error re-probe (`describe_upstream_failure`) — guards before its
socket; being diagnostic-only on the request path, it reports `skipped:
…` and the TLS explanation is still produced without the chain. No
allowlist widening: the inventory test passes because the `httpx.Client`
site is now dominated by a guard.
* **Socket trap is Windows-safe.** `no_sockets` now passes connects
whose address is a loopback **IP literal** (the Windows Proactor
self-pipe is a `127.0.0.1` listen + connect) and still fails every other
address, including hostnames such as `localhost`. `TestSocketTrap`
reproduces the Windows path on every platform by forcing
`socket._fallback_socketpair` (the implementation Windows uses for
`socket.socketpair()`) under `asyncio.run()`, and pins that outbound
IPv4/IPv6 `connect` / `connect_ex` / `create_connection` are still
caught.
* **Devin Review findings (`40e2d449`).**
* **Kompress tokenizer bypass.** Cached ONNX weights plus an uncached
ModernBERT tokenizer fell through to an unguarded
`from_pretrained(local_files_only=False)`. That call is now guarded and
becomes `KompressModelNotCached`, the same translation `_hf_artifact`
uses.
* **Kompress ONNX candidates.** An uncached first candidate no longer
ends the loop. The refusal is logged once, then the remaining candidates
are checked cache-only, so a cached fp32 fallback still loads offline.
* **fastembed.** `huggingface_hub` reads `HF_HUB_OFFLINE` once, at
import, into `constants.HF_HUB_OFFLINE`. The cache-only attempt
therefore forces that constant as well as the env var, and restores it
afterwards.
* **Image router.** It now resolves every artifact before publishing the
session, which doubles as the "loaded" flag. A refused secondary
artifact no longer leaves a half-loaded router that never retries.
* **Eval runner.** The local Ollama provider is no longer refused, for
the same operator-endpoint reason as the Ollama embedder. Anthropic and
OpenAI are still refused.
* **Sweep of main for other new egress since this PR was written:** the
scanner's only new finding was `tls_diagnostics.py`. Manually checked
the rest of the diff: the new `reqwest` client in
`crates/headroom-proxy` and the keep-alive `httpx.AsyncClient` in
`proxy/server.py` are upstream forwarding (`user-traffic`); the new HF
tokenizer allowlist in `tokenizers/huggingface.py` sits behind the
existing `is_offline()` gate (`gated`); `port_discovery.py`,
`upstream_pinning.py`, `license_env.py` and `credential_policy.py` open
no new external connections.

### A-2 (S2): the air-gap guarantee was not real

`HEADROOM_OFFLINE=1` is documented as an air-gap switch, but several
egress paths never consulted `headroom/offline.py`. A customer who set
it and believed they were air-gapped was wrong.

**This PR has been revised after an adversarial review found that the
first version's guarantee was largely unenforced.** The review is
reproduced in the fixes below; read the *What this does and does not
promise* section for the honest scope.

### The chokepoint

`headroom/offline.py` provides `guard_egress(purpose, destination)` and
a named `OfflineEgressBlocked`. It refuses loudly — a silent skip is
indistinguishable from success at the call site, which is how these
holes survived. It is always called **before the HTTP client is
constructed**, not merely before the request, so no pooled connection is
ever opened. `crates/headroom-core/src/offline.rs` is the same switch,
same env var, same rules, for the Rust core.

#### Paths routed through it

| path | previously |
| --- | --- |
| `headroom/transforms/kompress_remote.py` | built an `httpx.Client` and
`POST`ed every compressible block to the remote Kompress endpoint |
| `headroom/observability/metrics.py` | started an `OTLPMetricExporter`
plus a background `PeriodicExportingMetricReader` timer |
| `headroom/observability/tracing.py` | started an `OTLPSpanExporter` to
Langfuse Cloud — the metric exporter's twin, missed the first time |
| `headroom/onnx_runtime.py` | `hf_hub_download` on a cache miss: the
**Python** half of the HF fetch, every ONNX model in the tree resolves
through it |
| `crates/…/tokenizer/hf_impl.rs` | fetched `tokenizer.json` from
huggingface.co |
| `crates/…/transforms/kompress.rs` | fetched the **Kompress model**
from huggingface.co |
| `crates/…/relevance/embedding.rs` | fastembed fetched ONNX weights
from huggingface.co |

The three Rust sites are the same shape and the same argument:
`HF_HUB_OFFLINE` only shortcuts the *cache lookup*, and on a miss
`hf-hub` still dials out. The first version of this PR guarded one of
the three and left the other two open.

Remote Kompress is guarded twice — in `__init__`, and again at the top
of `compress()` **outside** the fail-open `try`, because the router
caches one compressor for the process lifetime and `compress()` converts
every exception into a silent passthrough.

`onnx_runtime.hf_hub_download_local_first` is guarded on the **network
fallback only**, so a pre-seeded air-gapped cache still resolves. The
three Rust fetches refuse even on a warm cache: `hf-hub` 0.5 exposes no
cache-hit/cache-miss split at that layer, so "guard before the client
exists" and "serve from the cache" cannot both hold.
`Kompress::from_files` / `HfTokenizer::from_file` are the network-free
paths for a pre-seeded Rust deployment. Splitting the Rust fetches
cache-first is the obvious follow-up and is **not** done here.

### The refusal now survives the fail-open handlers

The original docstring said "anything that catches broad `Exception`
around an egress call should re-raise this". **Nothing did** — there
were zero re-raise sites in the package — and the refusal was swallowed
on the way out of a request by `thinking_compactor._memo_compact`
(wrapped directly around the guarded `kompress.compress` call),
`ContentRouter._kompress_model_ready` (which reported a policy refusal
as "model ready"), the startup preload, and the OpenAI
reasoning-compaction path. A full `/v1/messages` request with
`HEADROOM_OFFLINE=1` + `HEADROOM_KOMPRESS_ENDPOINT` returned **200
uncompressed** with `guard_egress` having fired twice.

**`OfflineEgressBlocked` now derives from `BaseException`, not
`Exception`.** A convention that has to be re-applied at every future
`except Exception:` in a 100k-line codebase is not a guarantee; the type
hierarchy is. Same reason `KeyboardInterrupt` and `SystemExit` sit
outside `Exception`: a policy decision is control flow, not a runtime
error to degrade around. All four sites propagate with no edit to any of
them.

⚠️ **This is a behaviour change for callers.** `except Exception` no
longer catches it anywhere, including in third-party code. `except
BaseException` still does; those are swept by `TestBroadHandlerSweep`,
which requires each to re-raise or carry a written reason.
`content_router`'s native-detect degrade path now re-raises it
explicitly, alongside the cancellation `BaseException`s it already let
through.

#### Where the refusal deliberately becomes a degradation

Escaping `except Exception` is the point, but it made one class of
caller worse. Fetching **public model weights** is not data leaving the
box, and an air-gapped proxy with a cold HF cache would have started
failing user requests where it previously degraded — punishing the
request for a decision the operator made about the host. So each
optional model loader translates the refusal into its own "model
unavailable" error, **explicitly**, with the switch named in the log and
the refusal chained:

| boundary | translated to | the caller's existing degradation |
| --- | --- | --- |
| `kompress_compressor._hf_artifact` | `KompressModelNotCached` | non-ML
compression path |
| `image/onnx_router._hf_artifact` | `RuntimeError` | `ImageCompressor`
→ `Technique.PRESERVE` |
| `memory/adapters/embedders` ONNX load | `RuntimeError` | local
embedder unavailable |
| the two Kompress download daemon threads | logged, `False`/return |
keeps whatever is cached |

Behaviour for a cold air-gapped cache is exactly what it was. What
changed is that the log now names the switch, and the translation is a
reviewed decision at a named boundary rather than something inherited
from whichever `except Exception` happened to be in the stack. The
daemon threads matter separately: an unhandled `BaseException` there
reaches `threading.excepthook` as a bare traceback on every air-gapped
boot.

Paths that **send data off the box** — remote Kompress, OTLP, Langfuse,
the beacon — are untouched and still refuse loudly.

### Startup refuses a contradictory configuration

`configure_otel_metrics` was called **outside** `lifespan`'s `try`,
above the line that sets `app.state.startup_error`, so an
`OfflineEgressBlocked` escaped uvicorn as an unhandled error — killing a
proxy that had been serving traffic, with a traceback instead of an
explanation.

It now runs through `_configure_observability_or_refuse()`, which turns
a refusal into the shape `_check_rust_core` uses ten lines above: what
is wrong, how to fix it, **exit 78** (`EX_CONFIG`). A preflight covers
the remote-Kompress contradiction the same way. So the ordinary case is
settled at startup with an actionable message, and `BaseException` is
the backstop rather than the user experience.

```
FATAL: OTLP metric export (HEADROOM_OTEL_METRICS_ENABLED) needs outbound network access, but HEADROOM_OFFLINE=1 forbids it.
    refused: HEADROOM_OFFLINE is set: refusing outbound network access for OTLP metric export to …
    fix:     set HEADROOM_OTEL_METRICS_EXPORTER=console or scrape /metrics (both stay on-box), or unset HEADROOM_OTEL_METRICS_ENABLED
```

### Python/Rust normalisation parity

Python trimmed with `str.strip()`, Rust with `str::trim()`. Not the same
set: `str.isspace()` includes U+001C–U+001F, the Unicode `White_Space`
property does not, so `HEADROOM_OFFLINE=$'\x1c1'` read as **offline to
Python and online to Rust** — one variable, one half of the process
air-gapped. Both sides now trim an enumerated `TRIM_CHARS` /
`_TRIM_CHARS`, and the parity test compares the trim sets and a shared
normalisation table, not just the accepted tokens. (Case folding needed
no change: no non-ASCII character lowercases into any character of
`1`/`true`/`yes`/`on`.)

### The meta-test, rebuilt

The first version was neutered by one line:

```python
if "guard_egress" in source:
    continue
```

A whole-file exemption keyed on the string appearing *anywhere*,
including in a docstring — the exact blanket exemption the allowlist's
own comment says must never happen. It made the site-count assertion
unreachable for every guarded file, so "adding a second client trips
this test" only held for files with **no** guard at all. Two bypasses
were demonstrated against it: a second unguarded `httpx.Client` in an
already-guarded file, and a brand-new unguarded module with the word in
its docstring.

It now decides **per egress site**:

* **AST, not text.** Comments and docstrings vouch for nothing.
`self.client.post()` is no longer read as `requests.post`, and the
`httpx.post` example in `compress.py`'s docstring is not a site.
* **Dominance.** A site is guarded only when a `guard_egress` call is in
its block or an enclosing one, earlier in that block, in the same
function. A guard in a sibling `if`/`except` arm, in a nested `def`, or
after the site does not count. A guard in a helper the function calls
does not count either — conservative on purpose.
* **`TestSiteScannerRules`** tests the scanner itself, pinning both
demonstrated bypasses plus the one-line `def f(): return
httpx.Client().post(...)` that the old `startswith("def ")` skip made
invisible. A meta-test nobody tests is a comment.
* **Wider callee set:** module-level `httpx` verbs
(`headroom/cli/mcp.py` was a live unmatched site), `hf_hub_download`
(skipping `local_files_only=True`, which opens no socket), fastembed's
`TextEmbedding`, the OTLP exporters, and the OpenAI/Anthropic SDK
clients.
* **`crates/` is swept too** (`TestRustEgressChokepointCoverage`). It
was outside the scan entirely, which is how two Rust downloads stayed
open. Text-level rather than AST — no Rust parser here — so "guarded"
means a `guard_egress` earlier in the same `fn` at no deeper indent.
Weaker, and labelled as such; the runtime assertions live in each
crate's `#[test]`s.
* **Callees are resolved through the module's import table before
matching.** The scanner compared the text `ast.unparse` produced, which
is whatever local name the module bound — so `import httpx as h` hid a
client from a test whose entire job is to notice clients. That was not
hypothetical: `copilot_auth.py` does `from urllib import request as
urllib_request`, so its GitHub calls rendered as
`urllib_request.urlopen` and **five call sites, including the shared
`_urlopen` helper every Copilot request goes through, were invisible**.
`_canonical_callee` rewrites the leading name first; the alias defence
cuts both ways, so `guard_egress as ge` still counts as a guard. Imports
are collected from the whole tree, not just module level, because half
the egress here is imported inside the function that uses it.
* Allowlist counts now mean **unguarded** sites only, so a file can
legitimately guard some of its egress and still carry an entry for the
rest.
* **There is no longer a category for "known violation".**
`test_no_category_permits_a_known_violation` pins the permitted set to
`loopback` / `gated` / `user-traffic` / `operator-endpoint` /
`cache-only` and rejects "out of scope" as a reason.

### The offline policy, in plain words

`HEADROOM_OFFLINE=1` **refuses every connection Headroom itself decides
to make to a destination Headroom itself chose.** That is the rule, not
a sample list: telemetry, update check, license/usage reporter, OTLP and
Langfuse export, HuggingFace / Kompress / fastembed model and tokenizer
downloads (Python and Rust), release-binary and codebase-memory-mcp
downloads, eval dataset downloads and the provider SDK clients the eval
harness drives, GitHub Copilot device-flow auth and token exchange, the
Anthropic / Codex / Copilot subscription pollers, both OpenAI embedders,
both Headroom Cloud compression integrations, and the TLS diagnostics
(`headroom doctor --network` endpoint checks and the certificate-chain
re-probe after an upstream TLS failure).

**Four things are deliberately still allowed, and they are the complete
set of exceptions.** Every one of them is either physically incapable of
leaving the box or is not Headroom-initiated traffic:

| category | what it covers | why it survives the switch |
| --- | --- | --- |
| `user-traffic` | `proxy/server.py` (2 sites) | the caller's own
request forwarded to the upstream the operator configured. A proxy that
refuses this is not a proxy; an air-gapped install points it at an
on-prem endpoint. |
| `operator-endpoint` | `memory/adapters/embedders.py` (1 site) | the
Ollama embedder, whose address comes entirely from operator config and
defaults to `http://localhost:11434`. Exactly one thing qualifies today,
and a hard-coded internet host may never hide here. |
| `loopback` | 8 files, 12 sites | hard-coded `127.0.0.1` probes against
the operator's own local proxy (`headroom doctor`, the installers, the
MCP sidecar, the test harness). |
| `gated` | 3 files, 3 sites | the beacon, the update check and the
usage reporter are already unreachable behind an `is_offline()` check,
so no connection is ever built. |

Plus one mechanical exemption, `cache-only` (`relevance/embedding.py`, 1
site): the first of the two fastembed loads runs with `HF_HUB_OFFLINE`
forced to `1`, so `huggingface_hub` resolves from the local cache or
raises **without opening a socket**; the network retry directly below it
calls `guard_egress`. That is what lets a pre-seeded air-gapped host
keep loading the model while a cold one refuses.

#### What changed since the review

The previous revision of this PR recorded **nine egress-capable files**
under an `unguarded` allowlist category meaning "reachable under
`HEADROOM_OFFLINE`, out of scope for A-2": Copilot auth/token exchange,
three subscription pollers, the two binary/CBM downloads, the
eval-dataset fetch, and both Headroom Cloud compression integrations —
plus the eval harness's LLM clients, both OpenAI embedders and the
fastembed weights. @JerrettDavis blocked on exactly that, and he was
right: recording that a switch does not do what it says is not the same
as making it do it.

**All of them are now guarded, and the `unguarded` category is
deleted.** `test_no_category_permits_a_known_violation` pins the five
permitted categories by name and rejects "out of scope" as an allowlist
reason, so re-introducing a bless-it-and-move-on category takes a
deliberate edit with a reviewer looking at it.

#### ⚠️ Behaviour change customers can see

**Outbound calls that previously worked with `HEADROOM_OFFLINE=1` set
now refuse.** That is the point of the PR, but it is a real change for
anyone who set the flag and kept using these features:

* `headroom auth` / `headroom copilot-auth login` cannot complete a
GitHub device flow, and a cached Copilot OAuth token cannot be exchanged
for an API token. A Copilot subscription is unusable on an air-gapped
box regardless, but the failure now arrives at the moment of the
attempt.
* `headroom install` will not download release binaries or
codebase-memory-mcp. Pre-stage them, or install with the flag unset.
* The Anthropic / Codex / Copilot subscription and quota panels stay
empty, with the reason logged and (for Copilot quota) shown in the
panel's own error slot.
* Headroom Cloud compression mode in the ASGI middleware and the LiteLLM
callback refuses instead of falling through to local compression —
loudly, because silently compressing locally would hide that the
deployment is no longer doing what it was configured to do.
* The eval harness refuses to build provider clients or download BFCL.
* The OpenAI embedders (memory adapter and direct mem0 backend) refuse.
Use the ONNX or Ollama embedder on an air-gapped box.
* `EmbeddingScorer` raises "model unavailable" on a **cold** fastembed
cache. A warm one is unaffected.

#### Refusals reach a human, never a traceback

Following the pattern the earlier commits set for the Kompress download
threads, the model layer and the startup banner:

* **CLI:** `OfflineAwareGroup` (`headroom/cli/main.py`) is the one place
that translates the refusal into a Click `Error:` line, for every
subcommand at once. `OfflineEgressBlocked` stays a `BaseException`
everywhere inside, so nothing else can downgrade it; only the last frame
before the terminal is allowed to make it readable.
* **Background pollers:** each catches `OfflineEgressBlocked`
specifically, calls `offline.note_refusal` (WARNING once per purpose,
DEBUG after, so a 30-second poller does not flood the log), and returns
its ordinary "no data" value. An un-caught `BaseException` out of a bare
`create_task` surfaces as "Task exception was never retrieved" whenever
the GC gets to it — a traceback with no explanation in it.
* **Model loaders:** `EmbeddingScorer._get_model` translates into a
named "model unavailable" `RuntimeError`, the way
`kompress_compressor._hf_artifact` and `image/onnx_router._hf_artifact`
already do.

### 🚩 Two decisions that need a founder call

Both were implemented the **safe** way — refuse, loudly and legibly —
because that is the defensible default for a switch an operator sets to
mean "nothing leaves this box". Neither is obviously right, and a
permissive default should not be chosen quietly:

1. **Should OTLP / telemetry export be permitted under
`HEADROOM_OFFLINE`?** Today it refuses, and a contradictory config
(`HEADROOM_OTEL_METRICS_ENABLED=1` + offline) exits 78 at startup with
an explanation. The argument for permitting it is that a regulated
customer's OTLP collector is usually in-cluster, and losing
observability is a real operational cost. The argument against — and the
reason it is refused today — is that the guard **cannot reliably tell an
in-cluster collector from an internet host**: DNS, service meshes and
egress proxies all blur it, so any exemption is really "trust the
endpoint the config names". A customer with an in-cluster collector
currently has to scrape `localhost:8787/metrics` or use
`HEADROOM_OTEL_METRICS_EXPORTER=console`. If we want to permit it, the
honest shape is an explicit second flag (e.g.
`HEADROOM_OFFLINE_ALLOW_OTLP=1`) rather than widening the policy.
2. **Should the subscription pollers refuse, or degrade silently?**
Today all three refuse and say so once per purpose at WARNING. The
argument for silence is that these are cosmetic panels and a WARNING on
an air-gapped box is noise about a decision the operator already made.
The argument for the current behaviour is that a usage panel that
silently stops updating is exactly the "why is this empty?" confusion
the switch was supposed to end, and once-per-purpose logging bounds the
noise. Changing this is a one-line change in `offline.note_refusal`.

### Tests

`tests/test_offline_egress_chokepoint.py` — 110 tests. Per-path socket
assertions (a `no_sockets` fixture booby-traps
`socket.create_connection`, `socket.socket.connect` and `connect_ex`, so
asserting "no socket" rather than "raises" catches a guard placed after
the client is built), the scanner-rule tests, the two coverage sweeps,
the broad-handler sweep, the startup-refusal tests, the model-loader
degradation tests, the cross-language parity tests, and the doc-claim
test. Plus 8 Rust tests in `headroom-core`.

### Fail-before / pass-after

Per fix, work committed, then sources reverted while keeping the new
tests, run, restore. No `git stash`.

**Meta-test (1).** Added a probe module whose docstring mentions
`guard_egress` and a second unguarded `httpx.Client` to the
already-guarded `kompress_remote.py`. The old meta-test: `3 passed`. The
new one:

```
  headroom/_a2_probe_tmp.py
        line 7: httpx.Client().get("https://evil.example.com")
        (not guarded, not allowlisted)
  headroom/transforms/kompress_remote.py
        line 154: return httpx.Client(timeout=1.0)
        (not guarded, not allowlisted)
```

**Rust guards (2).** Guard calls commented out, tests kept:

```
panicked at crates/headroom-core/src/transforms/kompress.rs:688:
expected an offline refusal, got a network error: no loadable ONNX artifact in
`headroomlabs-ai/this-model-does-not-exist-a2` (tried [...]): request error: http status: 401
```

The model id cannot exist, so a `Hub` error can only come from a real
round-trip. That **401 is the proof a socket was opened to
huggingface.co with `HEADROOM_OFFLINE=1` set**, and `Offline` can only
come from returning before `Api::new()`.

**Refusal / startup (3, 4).**
`headroom/{offline,proxy/server,transforms/content_router}.py` reverted
to the PR tip, tests kept: `11 failed, 6 passed` — including
`test_thinking_compactor_does_not_swallow_it`,
`test_kompress_model_ready_does_not_report_a_refusal_as_ready`,
`test_no_broad_handler_swallows_the_refusal` and all five
`TestStartupRefusal` tests.

**New Python guards (5).**
`headroom/{onnx_runtime,observability/tracing}.py` reverted to
`origin/main`, tests kept: `4 failed` — the two socket tests plus both
coverage assertions.

**Normalisation (6).** Both `offline` modules reverted to the PR tip,
parity tests kept: `6 failed`, with `HEADROOM_OFFLINE="\x1c1"` reading
as offline in Python and not in Rust.

**Docs (7).** Both doc files reverted, test kept:

```
AssertionError: docs/metrics-technical-guide.md says 'disables all outbound traffic', but
_EGRESS_ALLOWLIST still records these as reachable under HEADROOM_OFFLINE: [...16 files...]
```

#### This revision (the review fixes)

Committed first, then `git checkout origin/main --
headroom/{binaries,cli/main,copilot_auth,graph/installer,integrations/asgi,integrations/litellm_callback,memory/adapters/embedders,memory/backends/direct_mem0,relevance/embedding}.py
headroom/{evals,subscription}/` with the new tests kept:

```
23 failed, 79 passed
```

The 23 are the five Copilot-auth socket tests, the four poller tests,
the two install-download tests, the BFCL test, both Headroom Cloud
tests, the two cloud-embedder tests, the four fastembed tests, both
CLI-translation tests — and
`test_every_egress_site_is_guarded_or_allowlisted`, which lists every
reverted file as "(not guarded, not allowlisted)".

The aliased-import blind spot, isolated (canonicalisation stubbed back
to the identity, i.e. the pre-fix behaviour, against the same inputs):

```
before:  INVISIBLE: import httpx as h
         INVISIBLE: from urllib import request as urllib_request
         INVISIBLE: from openai import AsyncOpenAI as AO
         INVISIBLE: import httpx as h (inside a function)
         aliased guard recognised: [False]
         copilot_auth.py sites seen: 4
after:   DETECTED (all four); aliased guard recognised: [True]
         copilot_auth.py sites seen: 6
```

**Pass-after (this revision):** `102 passed` in
`tests/test_offline_egress_chokepoint.py`; `391 passed, 86 skipped`
across the copilot-auth / copilot-quota / codex-rate-limits / binaries /
integrations / CLI subsets; `544 passed, 15 skipped` across the
relevance / embedding / mem0 / asgi / litellm / subscription / installer
subsets; `160 passed, 6 skipped` across the evals and CLI doctor/learn
subsets; `59 passed` across the proxy-startup subset; `cargo test -p
headroom-core offline` → `8 passed`.

**Pass-after (earlier revisions):** `70 passed` (pytest), `942 passed`
(`cargo test -p headroom-core --lib`), `720 passed, 4 skipped` across
the offline/otel/kompress/telemetry/onnx/tracing/relevance subsets, and
`1868 passed, 30 skipped` across the
kompress/offline/image/embedder/memory subsets after the model-loader
boundary change. The one failure in the full run,
`test_mcp_reconcile.py::test_ordinary_install_does_not_adopt_serena`,
reproduces unchanged at the PR tip and is unrelated. Cost/pricing tests
are the known `origin/main` litellm breakage (#3722) and were not run.

### Checks

- `uvx ruff@0.16.7 check .` → All checks passed
- `uvx ruff@0.16.7 format --check .` → 1622 files already formatted
- `cargo fmt --check` → clean; `cargo clippy -p headroom-core
--all-targets` → no warnings
- `CHANGELOG.md` untouched
- CodeQL: the four high alerts were all in
`tests/test_offline_egress_chokepoint.py` and are fixed honestly rather
than suppressed. Three `py/incomplete-url-substring-sanitization` host
assertions (`"host" in url`, which is also true of
`https://host.attacker.test`) now parse with `urllib.parse.urlsplit` and
compare the hostname exactly — which is what the tests meant. The
`py/redos` regex scraping Rust `char` literals had a nested `(...)+`
that can backtrack exponentially; a Rust char literal is exactly one
character, so it is now a single bounded alternation.

### Follow-ups (not in this PR)

1. ~~Guard the 16 `unguarded` files, each with its own user-facing
message.~~ Done in this PR; the `unguarded` category is deleted.
2. Split the three Rust HF fetches cache-first so a pre-seeded
air-gapped cache resolves without egress, the way
`hf_hub_download_local_first` already does on the Python side.
3. The Rust sweep is a text heuristic. An AST-level dominance check (via
`syn`, in a Rust test) would make the two halves symmetric.
4. The control-plane heartbeat lives in a different repository and is
still out of scope.
5. The scanner has no entry for transformers `from_pretrained` /
`SentenceTransformer`. The Kompress tokenizer site Devin found is
guarded now, but `models/ml_models.py` (SigLIP, technique router,
sentence-transformers) and the Kompress PyTorch backend still rely on
`HF_HUB_OFFLINE` alone, which `apply_offline_env` sets with `setdefault`
and only in the proxy process. Each needs the cache-first split the
tokenizer has, plus a scanner entry.


<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3729"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

## Testing

- [x] Unit tests pass (`pytest`) — subsets below
- [x] Linting passes (`ruff check .`) — touched files, `ruff@0.16.7`
- [ ] Type checking passes (`mypy headroom`) — not run
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
# this revision
$ LITELLM_LOCAL_MODEL_COST_MAP=True uv run --frozen --extra dev --extra proxy pytest \
    tests/test_offline_egress_chokepoint.py tests/test_cli_doctor.py tests/test_corporate_tls.py -q
245 passed
# after the Devin fixes
$ pytest tests/test_offline_egress_chokepoint.py + kompress/onnx_router/relevance/embedding/evals subsets
361 passed, 6 skipped
# fail-before for the Devin fixes (4 sources reverted, tests kept): 6 failed + the fallback test (fails once its fake
# raises OSError instead of LocalEntryNotFoundError, which conftest converts to a skip)

# fail-before, TLS guard (tls_diagnostics.py + doctor.py reverted, tests kept)
FAILED TestDoctorNetworkOffline::test_endpoint_check_refuses_before_any_connection
FAILED TestDoctorNetworkOffline::test_doctor_reports_the_network_checks_as_skipped
FAILED TestDoctorNetworkOffline::test_chain_probe_opens_no_socket
FAILED TestEgressChokepointCoverage::test_every_egress_site_is_guarded_or_allowlisted
   headroom/proxy/tls_diagnostics.py line 473: with httpx.Client(...)  (not guarded, not allowlisted)
# with only tls_diagnostics.py reverted, the doctor test fails on content, not on a missing helper:
   [('net api.anthropic.com', 'fail'), ('net api.openai.com', 'fail'), ...] != [('network', 'skip')]

# fail-before, socket trap (old fixture body, new tests kept)
FAILED TestSocketTrap::test_event_loop_wakeup_pipe_is_not_egress
   SocketOpened: outbound connection attempted while offline: (<socket ...>, ('127.0.0.1', 50151))
# — the same csock.connect inside socketpair() that Jerrett's Windows trace shows.

$ uvx ruff@0.16.7 check / format --check (touched files)
All checks passed! / 4 files already formatted
```

Earlier-revision test evidence is in *Fail-before / pass-after* under
*Changes Made*.

## Real Behavior Proof

- Environment: macOS, Python 3.14, this branch (merged with `main` at
`befdb52f`), no proxy running.
- Exact command / steps: `HEADROOM_OFFLINE=1 headroom doctor --network
--port 59999`, run for real. A second run went through
`headroom.cli.main` with a `sys.addaudithook` recording every
`socket.getaddrinfo` / `socket.connect`.
- Observed result: the doctor table shows `network · skip · skipped:
HEADROOM_OFFLINE is set, no endpoint was contacted`, with the refusal
naming `https://api.anthropic.com/v1/models` as the hint. The audit hook
recorded only `127.0.0.1` lookups and connects (the doctor's own proxy
probes on :59999 and :8787) and **zero external lookups or connects**.
Exit code 2 comes from the unrelated "proxy not reachable" failures.
- Not tested: Windows itself. The Windows mechanism is reproduced by
forcing `socket._fallback_socketpair`, which is the code Windows runs
for `socket.socketpair()`; the CI Windows job (`test-windows-newline`)
only runs `windows_newline`-marked tests and was not extended here.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; behaviour keyed on the existing
`HEADROOM_OFFLINE` switch.
- Minimum rollout channel: stable.
- Stable/default behavior changed: only when `HEADROOM_OFFLINE` is set
(refusals listed above). Unset, nothing changes.
- Kill switch / disable path: unset `HEADROOM_OFFLINE`.
- Unsafe override required: no.
- Qualification impact: none.
- Rollback path: revert this PR.

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

Two founder decisions remain flagged above (OTLP under offline; pollers
loud vs silent). Windows CI coverage for this module is not added: no
unit-test job runs the full module on Windows today, and adding one is a
workflow change better made separately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-05 15:20:39 -05:00
Ayush Kumar JhaandJD Davis 7b68fc263a fix(copilot): warn when a VS Code profile cannot see the proxy settings (#3919)
## Description

`headroom wrap vscode` writes Copilot's two endpoint overrides into the
Default profile's `settings.json` and reports success. A VS Code window
that uses a profile with its own settings reads only
`User/profiles/<id>/settings.json`, and Copilot takes these overrides
from user settings alone. In that window Copilot keeps talking to GitHub
directly: Copilot works, Headroom records nothing, and setup said it
succeeded. That is exactly what #3716 describes. The reporter hasn't
confirmed yet that they use a profile (I asked on the issue), so this
says "Refs" rather than "Closes".

After writing a VS Code user directory's `settings.json`, `wrap vscode`
now reads the profiles VS Code records in that directory's
`globalStorage/storage.json`. That file is either the Default one or one
named with `--settings-file`. For each profile that keeps its own
settings and doesn't define both overrides as live settings, it prints a
warning with the exact `--settings-file` command that routes it.

Nothing is written to profile files automatically. The docs already
scope profile-specific settings to `--settings-file`, and the block
persists and fails closed after the proxy stops. Routing every profile
silently would therefore change Copilot in profiles the user never meant
to proxy.

Refs #3716

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)

## Changes Made

- `headroom/providers/copilot/vscode.py`:
`unrouted_vscode_profiles(user_dir)` returns `(name, settings.json)` for
each stored profile that has its own settings
(`useDefaultFlags.settings` unset) and doesn't define both endpoint
overrides as live settings.
- It parses the profile's JSONC with `_parse_settings`, split out of
`_validate_settings` so both share one parser. As a result, a marker or
keys that exist only in comments don't count.
- It accepts only a local folder name as a location (VS Code uses
`hash(uuid).toString(16)`, which can be negative). That skips remote
URIs and rules out path traversal.
  - Missing or unexpected VS Code state produces no warning.
- `headroom/cli/wrap.py`: after writing the settings file, `wrap vscode`
prints one `Warning:` line per such profile of the user directory that
holds that file.
- A profile's own `settings.json` has no profile state beside it, so
running the printed remedy produces no warning.
- A `--settings-file` in another user directory (Insiders, VSCodium,
portable) gets that directory's profiles checked.
  - There's no warning with `--no-configure`.
- `headroom/providers/copilot/__init__.py`: exports the helper alongside
the other VS Code helpers.
- `docs/content/docs/vscode-copilot.mdx`: adds a troubleshooting entry
for "no requests while Copilot keeps working".
- `tests/test_cli/test_wrap_vscode.py`:
`test_wrap_vscode_names_profiles_that_ignore_default_settings` walks the
whole flow. It warns by default and when the Default file is named
explicitly, stays silent for a shared-settings profile, and goes silent
once the printed remedy has run.
`test_wrap_vscode_checks_the_profiles_of_the_user_dir_it_configures`
covers another user directory.
- `tests/test_provider_copilot_vscode_config.py` covers:
  - own versus shared settings
  - a negative-hash folder
  - traversal and remote locations
- profiles that override both endpoints, whether managed or hand-written
- a marker-only file, commented-out keys, a single key, and unparseable
settings
  - a missing or malformed `storage.json`

## Testing

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

### Test Output

```text
# The new tests against the code before each commit.
# main (c46e74d0), before the first commit:
E   assert "VS Code profile 'Work'" in "  VS Code Copilot proxy settings added: ...\Code\User\settings.json\n  Keep using Copilot's normal model picker; ..."
# c887cbab, before the review follow-up. --settings-file naming the Default file printed no warning:
E   assert "VS Code profile 'Work'" in "  VS Code Copilot proxy settings updated: ...\Code\User\settings.json\n  Keep using Copilot's normal model picker; ..."
# ...and a profile whose settings only mention the marker in a comment counted as routed:
old code, marker-only profile -> []  (expected Work to be listed)
old code, commented-out keys profile -> []  (expected Work to be listed)

# With both commits:
$ pytest tests/test_cli/test_wrap_vscode.py tests/test_provider_copilot_vscode_config.py
27 passed in 1.19s

# Each mutation of the fix fails at least one test:
M1 ignore useDefaultFlags.settings: KILLED (2 failed, 25 passed)
M2 marker text counts as configured: KILLED (7 failed, 20 passed)
M3 one live key is enough: KILLED (1 failed, 26 passed)
M4 reject leading '-' in location: KILLED (2 failed, 25 passed)
M5 accept any location string: KILLED (1 failed, 26 passed)
M6 drop the CLI warning: KILLED (2 failed, 25 passed)
M7 scan only without --settings-file: KILLED (2 failed, 25 passed)
M8 always scan the Default user dir: KILLED (1 failed, 26 passed)

$ ruff check <changed files> && ruff format --check <changed files>   # ruff 0.16.8
All checks passed!
5 files left unchanged
$ mypy headroom/providers/copilot/vscode.py headroom/providers/copilot/__init__.py headroom/cli/wrap.py --ignore-missing-imports --follow-imports=silent   # mypy 1.19.1
Success: no issues found in 3 source files
# On the first commit, `mypy headroom --ignore-missing-imports` reported only
# headroom\fileperms.py:71 (Windows-only os.fchmod), a file this PR does not touch.

# Every test in the subsystems this touches, this branch vs its base (d5318ac2):
$ pytest tests/test_cli tests/test_copilot*.py tests/test_provider*.py -n 8
branch: 7 failed, 1621 passed, 8 skipped (14 more tests than base: the new ones)
base:  25 failed, 1589 passed, 8 skipped
# All 7 branch failures also fail on base: symlink, signal, service-supervisor and
# opencode-env tests that fail on this Windows machine. The other 18 base failures
# are test_wrap_persistent.py tests that vary from one xdist run to the next; that
# file passes serially (62 passed on both the branch and main).
```

## Real Behavior Proof

- Environment: Windows 11, Python 3.11.9, VS Code 1.140.0 (official zip,
isolated `--user-data-dir`), this branch
- Exact command / steps: wrote Headroom's block into an isolated VS Code
user dir. Then opened VS Code with a small probe extension that records
`getConfiguration("github.copilot").inspect(key).globalValue` for both
keys, once in the Default profile and once with `--profile=Repro` (VS
Code created the profile and recorded it in `storage.json`). Next I ran
the `wrap vscode` command against that user dir (`APPDATA` pointed at
it). Only the Copilot subscription lookup and the proxy watcher were
stubbed, because there's no Copilot account on this machine. I ran the
command the warning printed, re-probed the profile window, and ran plain
`wrap vscode` again. For the review follow-up I repeated the CLI runs
against the same VS Code-written state with the cases from the two
findings.
- Observed result: the profile window doesn't see Headroom's settings
until the warning's command is run.
- Default profile window:
`"overrideCapiUrl":{"globalValue":"http://127.0.0.1:8788/p/a11y"}`, and
the same for `overrideProxyUrl`
- `--profile=Repro` window: `{"globalValue":null}` for both, so Copilot
falls back to the endpoints from its token, i.e. GitHub directly
- `wrap vscode` printed: `Warning: VS Code profile 'Repro' keeps its own
settings, so Copilot there still bypasses Headroom. Route it with:
headroom wrap vscode --settings-file
"V:\ud1\Code\User\profiles\6c87cdb4\settings.json"`
- after running that command, the `Repro` window sees both overrides
(`"globalValue":"http://127.0.0.1:8788/p/headroom"`), and plain `wrap
vscode` no longer warns
- review follow-up: with `Repro`'s settings holding only `// ---
Headroom Copilot proxy ---`, plain `wrap vscode` warns about `Repro`.
`--settings-file` naming the Default file warns too.
- review follow-up: the printed remedy refuses that half-written file
with the existing `Error: Incomplete Headroom marker block in
...\profiles\6c87cdb4\settings.json; refusing to edit.` Once the stray
marker is removed, the remedy succeeds and plain `wrap vscode` prints no
warning.
- Not tested: real Copilot traffic, macOS and Linux, the reporter's own
setup, and a complete local run of the full suite.
- real Copilot traffic, because there's no Copilot subscription on this
machine. I separately checked that the bundled Copilot Chat 0.66.0,
0.67.0 and 0.68.0 all read both keys as user-scope-only settings, and
that a proxy built from `main` logs both Copilot paths at INFO.
- macOS and Linux. VS Code uses the same `User/profiles` layout there,
and the unit tests cover the logic.
  - the reporter's own setup.
- the full test suite. A local run stalled at 97% and was killed after
40 minutes on this Windows machine, so I compared the touched subsystems
against the base instead; CI runs the full suite.

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: `wrap vscode` prints one extra
warning line for each VS Code profile that keeps its own settings and
doesn't define both overrides. No file it writes changes.
- Kill switch / disable path: none needed. The warning is informational,
and pointing `--settings-file` at a file outside a VS Code user
directory skips the scan.
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this PR; no persisted state or format changes

## 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
- [x] 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 did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- The second commit addresses both Devin Review findings: a commented
marker hid an unrouted profile, and an explicit Default path skipped the
scan.
- For the second finding I scan the user directory of the file being
configured rather than comparing against `vscode_settings_path()`. That
covers the explicit Default path, and it also checks profiles for
Insiders, VSCodium or portable user directories. It also avoids
resolving `APPDATA` when `--settings-file` is given.
- Question for maintainers: would you rather `wrap vscode` write the
block into every profile with its own settings, and `unwrap vscode`
remove it from all of them? It would be a small change on top of this
helper. I left it out because it changes which windows fail closed while
the proxy is down.
- `unwrap vscode` still cleans only the file it's given. A profile
configured with `--settings-file` needs the same flag to undo it, as the
docs already say.

---------

Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-05 10:03:08 -05:00
ee731d7ea8 fix(proxy): refuse token-less non-loopback binds, gate operator routes (#3852)
## Why

Four related gaps in the proxy's network gate (findings 01-F1, 01-F2,
01-F5, 01-F9):

- **Open bind.** A non-loopback bind with no `HEADROOM_PROXY_TOKEN` only
logged a warning, then served the `/v1/*` relay, with the operator's
upstream credentials, to every peer that could reach the port.
- **Missing peer address.** `is_loopback_host(None)` returned `True`. A
Unix-domain socket, an ASGI adapter that leaves `scope["client"]` unset,
or a hand-built request therefore turned off the token gate, the
`/admin` and `/debug` guards and the WebSocket gate.
- **Operator data routes.** `/stats-history` (including CSV export),
`/quota`, `/subscription-window` and `/metrics` were served to any
network caller.
- **WebSocket loopback exemption** checked only the peer IP, not the
`Host` header, so it had no DNS-rebinding defence.

## What changes

- New `headroom/proxy/bind_policy.py`. A non-loopback bind (`0.0.0.0`,
`::`, a LAN address or a hostname) with no token is refused at three
places: `create_app` (embedders and the multi-worker factory),
`run_server` (one exit with code 2 before uvicorn forks) and the
`headroom proxy` CLI (a clear error before the banner, exit code 1). An
absent host means uvicorn's default `127.0.0.1`.
- `HEADROOM_ALLOW_UNAUTHENTICATED_BIND=1` acknowledges an open bind when
the runtime already restricts reachability, such as a container
published on `127.0.0.1`. The `proxy_open_bind` warning is still logged
on that path, and the banner says the bind is open.
- `is_loopback_host(None)` now returns `False` (fail closed), matching
`identity.py`.
- `/stats-history`, `/quota` and `/subscription-window` answer only: a
non-loopback caller that passed the token gate, a loopback caller (peer
and `Host` header both loopback), a trusted dashboard client, or, under
an acknowledged token-less bind, the container's own default-gateway TCP
peer with a loopback `Host` (the host browser reaching a
`127.0.0.1`-published container). Everyone else gets 404, as with
`/admin`. Settings writes keep their stricter rule with no token
short-cut.
- `/metrics` answers a non-loopback caller that passed the token gate, a
loopback caller, a connecting peer in
`HEADROOM_PROXY_TRUSTED_GATEWAY_CIDRS` (whatever it forwards), or a
resolved client in the dashboard CIDRs. For CIDR peers a hostname `Host`
is fine, so Prometheus scrapers work; a cross-origin browser request is
still refused.
- The token short-cut applies only to non-loopback requests. The gate
exempts loopback peers without checking `Host`, so a loopback request
has not proven it holds the token and must pass the loopback `Host`
check. This blocks a DNS-rebound browser on the operator's machine.
- The `/dashboard` shell stays ungated. It is a static template, like
the already public `/dashboard/static` assets. Gating it would break the
dashboard for containers published on host loopback, where the peer is
the bridge gateway and `Host` is `localhost`. The data routes behind it
are gated.
- The WebSocket loopback exemption requires a loopback peer and a
loopback `Host` header. A loopback peer with a foreign `Host` can still
connect with the token.
- Launchers that always publish on `127.0.0.1` set the acknowledgement
themselves: `headroom install` (docker preset), `scripts/install.sh` and
`scripts/install.ps1` (through one helper that adds the acknowledgement
only together with the `127.0.0.1` publication), and
`docker/docker-compose.native.yml`.
- Docs: `proxy.mdx` documents the new variable and which routes the
token also gates; `docker-install` (docs and wiki) and the
`docker-compose.yml` comment show the acknowledgement in the
loopback-published example. `e2e/docker-bind-security.sh` sets it and
checks that the same launch without it refuses to start.

## Behaviour change (breaking)

- `headroom proxy --host 0.0.0.0`, or `HEADROOM_HOST` set to any
non-loopback address, without `HEADROOM_PROXY_TOKEN` now refuses to
start. The error names both remedies. Set a token, bind loopback, or set
`HEADROOM_ALLOW_UNAUTHENTICATED_BIND=1` when the port is already
confined. Anyone running the image by hand with `--host 0.0.0.0` and no
token must add one of these.
- Without a token, `/stats-history`, `/quota`, `/subscription-window`
and `/metrics` return 404 to non-loopback callers outside a trusted
CIDR. Prometheus scrapers on another host must be in
`HEADROOM_PROXY_TRUSTED_GATEWAY_CIDRS` or send the token.
- Code that relied on a request with no peer address being treated as
loopback now gets the non-loopback path.
- The default loopback run is unchanged.

## Tests

- `tests/test_proxy_bind_policy.py`: the refuse/allow matrix
(non-loopback, loopback, unset host, token, acknowledgement values), the
warning on the acknowledged path, `create_app`, the `run_server` exit
before uvicorn, and the CLI (refusal, `HEADROOM_HOST` from env,
acknowledged start, offline banner, start with a token).
- `tests/test_proxy_loopback_gating.py`: each data route against
non-loopback, loopback, trusted-CIDR and token callers; the dashboard
shell stays reachable; the host of an acknowledged, loopback-published
container reads the data routes while another bridge peer, a forwarded
gateway address and a foreign `Host` do not; CSV export is not served to
network callers; `/metrics` across loopback, both CIDR lists,
out-of-range peers, cross-origin browsers and token callers, including a
trusted gateway relaying a scraper outside its own range. A regression
test shows that a token on the proxy does not exempt a loopback peer
from the `Host` check; it fails without the fix.
- `tests/test_proxy_hardening.py`: the HTTP gate with no peer address,
WebSocket `Host` cases, `require_loopback` and `/debug` with no peer.
- Installer tests: `headroom install` adds the acknowledgement, and the
shell and PowerShell wrappers add it only together with the loopback
publication. Launcher-level tests start the proxy with the environment
and `--host` that `build_runtime_command()` and
`docker-compose.native.yml` produce and check that the host browser
(bridge-gateway peer) gets `/stats-history` and another container does
not.
- Tests that bound `0.0.0.0` for unrelated reasons now set a token or
the acknowledgement. Tests that read operator routes use an explicit
loopback peer.

On `main`, 14 of the gating and hardening tests fail and the bind-policy
module does not exist. Manual runs: token-less `--host 0.0.0.0` exits
with the refusal from both the CLI and `run_server`; with the
acknowledgement, the data routes are 404 to a LAN peer and to a loopback
peer with a foreign `Host`; with a token, a LAN peer gets 401 without it
and 200 with it; the default loopback bind starts as before.

Not tested: a real Unix-domain-socket deployment and a real Prometheus
scrape (both covered by tests only).

## Merge order

Part of a set. Suggested order: #3852 → #3891 → #3849 → #3860 → #3862 →
#3863. This PR goes first: it is the gate the others assume, and it is
the release-note event.

## Not in this PR

- Enforcing the token for loopback callers when one is configured.

Revised 2026-10-02 after review: `/metrics` matches gateway CIDRs
against the TCP peer, and the operator data routes serve the host of a
loopback-published container (bridge-gateway peer under the launchers'
bind acknowledgement) so the default Docker dashboard works.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3852"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-05 08:27:35 -05:00
822c886d79 fix(proxy): let an explicit compress-user-messages off beat the profile (#3936)
## Description


With the default `coding` savings profile, an operator cannot turn
user-message compression off. `HEADROOM_COMPRESS_USER_MESSAGES=0` is
ignored: `ProxyConfig.compress_user_messages` was a plain `bool =
False`, so an explicit `0` looked the same as "not set", and
`proxy_pipeline_kwargs()` could only override the profile upward (`if
config.compress_user_messages: kwargs[...] = True`). The startup banner
kept reporting `compress_user=True` and plain user text (pasted logs,
error output, paths) kept being compressed.

This makes the field tri-state, like `compress_system_messages`,
`protect_recent` and the other profile knobs: `None` follows the
profile, an explicit `True` or `False` overrides it. With the variable
unset, nothing changes for any profile. No profile default is changed.

Closes #3935

## 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/proxy/models.py`: `compress_user_messages: bool | None =
None` (was `bool = False`).
- `headroom/agent_savings.py`: `proxy_pipeline_kwargs()` applies an
explicit `True` or `False` over the profile value, the same way
`compress_system_messages` is handled a few lines below.
- `headroom/proxy/handlers/openai.py` (review follow-up): OpenAI
Responses requests (`/v1/responses` over HTTP, the Codex WebSocket path
and passthrough Responses) are split into `CompressionUnit`s instead of
going through the message pipeline. The unit builder tagged every
earlier user message `compress_user="true"` without checking
`compress_user_messages`, so this path ignored both the profile and any
override. Earlier user turns are now tagged only when the same
`proxy_pipeline_kwargs(self.config)` resolution allows it. The newest
user message stays protected and tool output routing is unchanged. All
three Responses entry points share this one builder, so they get the fix
together. Chat completions go through
`openai_pipeline.apply(**proxy_pipeline_kwargs(...))` and needed no
change there.
- `headroom/cli/proxy.py` (`headroom proxy`): parse
`HEADROOM_COMPRESS_USER_MESSAGES` with the server's
`_get_env_optional_bool`, so an empty value means unset on every entry
point (review follow-up). The CLI's own `_get_env_bool_optional` is left
as is. Its other three callers (`HEADROOM_SMART_CRUSHER_COMPACTION`,
`HEADROOM_COMPRESS_SYSTEM_MESSAGES`,
`HEADROOM_PROTECT_ANALYSIS_CONTEXT`) match the `python -m
headroom.proxy.server` parsing, which also treats empty as `False`, so
changing the helper would split those three between entry points.
- `headroom/proxy/server.py`: `python -m headroom.proxy.server` keeps
`--compress-user-messages` as force-on and otherwise reads the env var
with `_get_env_optional_bool`. The uvicorn factory
(`_proxy_config_from_env`) now reads the env var too; it ignored it
before. That entry point seeds the profile's own value into the env
first, so with nothing set explicitly it resolves to the profile
default, as before.
- `docs/content/docs/proxy.mdx`: the env table row now gives the default
as "profile" and documents `0`.
- Tests:
- `tests/test_agent_savings.py`: config layer, explicit off vs unset
under `coding`.
- `tests/test_cli_proxy_env.py`: the `headroom proxy` command with env
`0`, empty and missing, and `_proxy_config_from_env` with `0`, empty and
missing.
- `tests/test_openai_responses_compression_units.py`: Responses unit
builder, with a long earlier user message and the flag off vs unset
under `coding`.

Anthropic `tool_result` blocks and Responses tool outputs still compress
with the flag off; the proof below shows both.

## Testing

- [x] Unit tests pass (`pytest`): targeted files, listed below
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`): changed modules only, see
below
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

New tests for the config fix, on unmodified `main` (d5318ac2):

```text
$ python -m pytest tests/test_agent_savings.py::test_proxy_explicit_compress_user_messages_off_overrides_coding_profile \
    "tests/test_cli_proxy_env.py::TestCLIProxyEnvVars::test_compress_user_messages_env_off_overrides_profile" -q
tests/test_agent_savings.py:510: in test_proxy_explicit_compress_user_messages_off_overrides_coding_profile
    assert proxy_pipeline_kwargs(explicit_off)["compress_user_messages"] is False
E   assert True is False
tests/test_cli_proxy_env.py:310: in test_compress_user_messages_env_off_overrides_profile
    assert kwargs["compress_user_messages"] is expected
E   assert True is False
========================= 2 failed, 1 passed in 2.76s ==========================
```

Review follow-up tests, on the first commit of this branch (95ff25f9),
before the follow-up fixes:

```text
$ python -m pytest "tests/test_openai_responses_compression_units.py::test_openai_responses_adapter_historical_user_follows_compress_user_messages" \
    "tests/test_cli_proxy_env.py::TestCLIProxyEnvVars::test_compress_user_messages_env_off_overrides_profile" \
    tests/test_cli_proxy_env.py::test_proxy_config_from_env_compress_user_messages -q
tests/test_openai_responses_compression_units.py:1472: in test_openai_responses_adapter_historical_user_follows_compress_user_messages
E   AssertionError: assert 'compressed history' == 'history0 his...8 history1999'
tests/test_cli_proxy_env.py:317: in test_compress_user_messages_env_off_overrides_profile
E   assert False is True
FAILED tests/test_openai_responses_compression_units.py::test_openai_responses_adapter_historical_user_follows_compress_user_messages[False-None]
FAILED tests/test_cli_proxy_env.py::TestCLIProxyEnvVars::test_compress_user_messages_env_off_overrides_profile[env1-True]
========================= 2 failed, 6 passed in 0.79s ==========================
```

At branch head:

```text
$ python -m pytest <same three tests> -q
============================== 8 passed in 0.58s ===============================

$ python -m pytest tests/test_openai_responses_compression_units.py tests/test_openai_responses_read_protection.py \
    tests/test_responses_savings_denominator.py tests/test_compress_passthrough.py tests/test_openai_codex_routing.py \
    tests/test_openai_responses_context_compaction.py tests/test_openai_responses_t3_replay_regression.py \
    tests/test_codex_ws_compression_scheduler.py tests/test_openai_codex_ws_lifecycle.py \
    tests/test_openai_responses_additional_tools.py tests/test_proxy_openai.py \
    tests/test_proxy/test_openai_chat_savings_profile.py tests/test_agent_savings.py tests/test_cli_proxy_env.py \
    tests/test_proxy_healthchecks.py -q
================= 359 passed, 2 skipped, 2 warnings in 21.47s ==================

$ python -m pytest tests/test_proxy_anthropic_cache_stability.py tests/test_cli/test_wrap_persistent.py \
    tests/test_proxy_compress_endpoint.py tests/test_cli_proxy_improvements.py \
    tests/test_proxy/test_gemini_savings_profile.py -q
======================= 203 passed, 1 warning in 50.15s ========================

$ ruff check .
All checks passed!
$ ruff format --check .
1705 files already formatted

$ mypy headroom/agent_savings.py headroom/cli/proxy.py headroom/proxy/models.py headroom/proxy/server.py
Success: no issues found in 4 source files
$ mypy headroom/proxy/handlers/openai.py headroom/cli/proxy.py
Success: no issues found in 2 source files
```

## Real Behavior Proof

- Environment: macOS 27.0.1, Python 3.11.13, `main` at d5318ac2 (0.39.1)
vs this branch (29a17aa4). The real `headroom proxy` click command,
booted on a free port with `ANTHROPIC_TARGET_API_URL` or
`OPENAI_TARGET_API_URL` pointing at a local stub upstream. The stub is a
small `http.server` that returns a fixed `"ok"` reply and saves the
forwarded body. No real provider call. Default savings profile
(`coding`) unless noted.
- Exact command / steps: for each tree, mode (`HEADROOM_MODE` unset =
cache, or `token`) and `HEADROOM_COMPRESS_USER_MESSAGES` (`0` or unset):
start the stub, start `headroom proxy --port <p>`, wait for `/health`,
send the request, then compare what the stub received against what was
sent. All three request shapes carry a tool result of 18,808 chars
(collector log). They also carry an earlier user message with a
14,520-char pasted CI log, which opens with "Here is the CI output from
the failing nightly run, the parser test is the one I care about:".
- Anthropic `/v1/messages`: two Claude Code style turns, ending in "Go
ahead and patch it.".
- OpenAI `/v1/responses`: one Codex style request with `function_call`,
`function_call_output`, the earlier user `input_text`, an assistant
`output_text`, and a newest user message.
- `/v1/chat/completions`: the same conversation in chat shape, flag `0`
only.
- Other entry points, with `HEADROOM_COMPRESS_USER_MESSAGES=0`: `python
-m headroom.proxy.server --port <p>` (banner plus `/health`), and
`seed_proxy_env_defaults(); _proxy_config_from_env()` (the
`create_app_from_env` path).
- Observed result: on `main`, `=0` behaves exactly like unset (user text
compressed on Anthropic, Responses and chat completions). On the branch,
`=0` forwards the user text verbatim on all three, tool output still
compresses, and unset matches `main`.

  Anthropic `/v1/messages` (turn 2):

| tree | `HEADROOM_COMPRESS_USER_MESSAGES` | mode | banner
`compress_user` | `tool_result` forwarded | pasted user text forwarded |
  |---|---|---|---|---|---|
| main | `0` | cache | True | 18,808 -> 494 | 14,520 -> 528 (rewritten)
|
| main | unset | cache | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) |
| main | `0` | token | True | 18,808 -> 494 | 14,520 -> 528 (rewritten)
|
| main | unset | token | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) |
| branch | `0` | cache | False | 18,808 -> 494 | 14,520 -> 14,520
(verbatim) |
| branch | unset | cache | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) |
| branch | `0` | token | False | 18,808 -> 494 | 14,520 -> 14,520
(verbatim) |
| branch | unset | token | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) |

  OpenAI `/v1/responses`:

| tree | `HEADROOM_COMPRESS_USER_MESSAGES` | profile | mode | banner
`compress_user` | `function_call_output` forwarded | earlier user text
forwarded | newest user text |
  |---|---|---|---|---|---|---|---|
| main | `0` | coding | cache | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| main | unset | coding | cache | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| main | `0` | coding | token | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| main | unset | coding | token | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| main | unset | general | cache | False | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| branch | `0` | coding | cache | False | 18,808 -> 494 | 14,520 ->
14,520 (verbatim) | verbatim |
| branch | unset | coding | cache | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| branch | `0` | coding | token | False | 18,808 -> 494 | 14,520 ->
14,520 (verbatim) | verbatim |
| branch | unset | coding | token | True | 18,808 -> 494 | 14,520 -> 528
(rewritten) | verbatim |
| branch | unset | general | cache | False | 18,808 -> 494 | 14,520 ->
14,520 (verbatim) | verbatim |

Proxy log for the Responses request with `=0` under `coding`: on `main`
the request was compressed 34,325 -> 1,708 bytes (11,240 tokens saved,
transforms `router:openai:responses:function_call_output:log`, `log`,
`router:openai:responses:message:log`); on the branch 34,325 -> 15,856
bytes (5,769 tokens saved, transforms
`router:openai:responses:function_call_output:log`, `log`). The
`general` rows show that on `main` the Responses path ignored the
profile as well as the override: the banner said `compress_user=False`
while earlier user text was still compressed.

`/v1/chat/completions`, `=0`: in token mode, `main` forwards the pasted
user text as 14,520 -> 528 chars and the branch forwards it verbatim.
The tool message compresses 18,808 -> 494 on both. In cache mode neither
tree compresses anything on this single request.

Other entry points with `=0`: `python -m headroom.proxy.server` reports
`compress_user=True` and `/health` `compress_user_messages: true` on
`main`, and `False`/`false` on the branch. The factory config resolves
`compress_user_messages` to `True` on `main` and `False` on the branch.
- Not tested: a real provider upstream, Codex over WebSocket,
Gemini/Bedrock, Linux/Windows, the full suite, and Kompress ML (details
below).
  - A real Anthropic or OpenAI upstream (stub only, no credentials).
- Codex over WebSocket: not booted. It calls the same
`_compress_openai_responses_payload` -> unit builder as HTTP
`/v1/responses`, and the WebSocket test files above pass.
  - Gemini and Bedrock handlers were not booted.
  - Linux and Windows.
- The full `pytest` suite and a full `mypy headroom` (targeted files and
changed modules only).
- Kompress ML: the local venv lacks the `mcp`, `magika` and
`onnxruntime` extras. The proxy logged "Kompress model not ready", so
the compression shown is the structural log compressor; ML text
compression was not exercised. The same venv was used for both trees.
- Launcher shortcuts: the proof launcher stubbed
`ensure_proxy_dependencies` and set `HEADROOM_MALLOC_TUNING=0`, because
the `python -c` launcher used here exited at startup without it. That is
unrelated to this change.

## Runtime Rollout Safety

- Rollout-managed feature(s): None. This changes how an existing env var
and config field are parsed and applied; it is not a `FEATURES` registry
entry.
- Minimum rollout channel: N/A (not rollout-gated; applies on every
channel).
- Stable/default behavior changed: No for the default `coding` profile
with the variable unset: Anthropic, chat completions and Responses
traffic all resolve as before (verified above). There are three changes,
each scoped:
- An explicit false `HEADROOM_COMPRESS_USER_MESSAGES` is now honored on
every path. It was silently ignored before, so those deployments
compress less user text, as they asked to.
- On OpenAI Responses traffic (`/v1/responses`, Codex WebSocket,
passthrough Responses), earlier user turns now follow the profile, as
they already did on the message pipeline. Under `balanced` and
`general`, whose profiles set `compress_user_messages=False`, those
turns now stay verbatim; before, this path compressed them under every
profile. `coding` and `agent-90` are unchanged.
- The uvicorn factory starts honoring an explicit `=1` under `balanced`
or `general`, which it ignored before.

`headroom wrap` seeds the env var from the same profile it seeds
everything else from, so wrapped launches follow the same rules. An
empty value now means unset on all entry points.
- Kill switch / disable path: Set `HEADROOM_COMPRESS_USER_MESSAGES=1` to
compress user turns everywhere, including Responses user turns under
`balanced` or `general`. Unset it to follow the profile.
- Unsafe override required: No.
- Qualification impact: None on default `coding` traffic. An operator
who sets `=0` loses the savings from user text they opted out of; on the
Responses repro above that is 11,240 -> 5,769 tokens saved. Responses
traffic under `balanced` or `general` loses the same share. Tool output
compression is unaffected.
- Rollback path: revert the commits; no persisted state or schema is
involved.

## 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
- [x] 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 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


- Related, not overlapping: #3923 passes `prefix_replay_guaranteed=True`
on the cache-mode delta call, which protects the newest user message's
text only. This PR lets an operator keep all user-message text verbatim.
The proof's pasted message is not the newest user message, so #3923
alone would not change that row.
- #1494 asks for "never compress user instructions" in a coding profile.
With this change that is `HEADROOM_COMPRESS_USER_MESSAGES=0` on top of
`coding`, with no new profile.
- Downstream: Headroom Desktop has patched
`_PROFILES["coding"].compress_user_messages` back to `False` at import
time since the headroom-ai 0.34.0 wheel, because the env var could not
do it. This PR lets it use the documented override instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3936"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-04 13:57:08 -07:00
5eaf24ec97 docs: add Hermes Agent integration page (#3041)
## Description

Adds `docs/content/docs/hermes.mdx` and registers it in the Integrations
nav (before `mcp`). The repo ships `plugins/hermes` (CCR retrieval
plugin for Hermes Agent) with a thorough README, but the docs site's
Integrations section has no page for it — Hermes users browsing
headroom.sh won't discover the plugin exists. Content is sourced
verbatim-accurate from `plugins/hermes/README.md`.

## Type of Change

- [x] Documentation update

## Changes Made

- Added `docs/content/docs/hermes.mdx`: install, enable, config, usage,
and troubleshooting for the Hermes plugin.
- Registered the page in `docs/content/docs/meta.json` Integrations nav,
inserted before the `mcp` entry.

## 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

```text
# Docs-only change: no Python surface touched, so pytest/ruff/mypy are unaffected.
# Manual checks performed:
#   - frontmatter/title/meta of hermes.mdx match sibling Integrations pages
#   - docs/content/docs/meta.json remains valid JSON with the new nav entry
#   - markdown links resolve to existing docs pages
```

## Real Behavior Proof

- Environment: local checkout of `main` + branch
- Exact command / steps: inspected `docs/content/docs/meta.json` after
edit (valid JSON, nav ordering correct); diffed `hermes.mdx` frontmatter
against `mcp.mdx` and sibling integration pages
- Observed result: page follows the same MDX structure and nav placement
renders in the expected section
- Not tested: full `fumadocs` site build (requires Node install);
content is plain MDX consistent with existing pages

## Runtime Rollout Safety

- Rollout-managed feature(s): none — documentation only
- Minimum rollout channel: N/A
- Stable/default behavior changed: none
- Kill switch / disable path: N/A
- Unsafe override required: none
- Qualification impact: none
- Rollback path: revert the two-file 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
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title

## Additional Notes

Docs-only PR: pytest/ruff/mypy items intentionally unchecked (no Python
code changed).

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/3041"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

---------

Signed-off-by: LeonSGP43 <LeonSGP43@users.noreply.github.com>
Co-authored-by: LeonSGP43 <LeonSGP43@users.noreply.github.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-03 15:53:23 -05:00
dependabot[bot]andJD Davis afe4f4eca5 deps: bump the npm-minor-patch group across 2 directories with 11 updates (#3903)
Bumps the npm-minor-patch group with 9 updates in the /docs directory:

| Package | From | To |
| --- | --- | --- |
| [fumadocs-core](https://github.com/fuma-nama/fumadocs) | `16.15.12` |
`16.15.15` |
| [fumadocs-mdx](https://github.com/fuma-nama/fumadocs) | `15.4.3` |
`15.4.5` |
| [fumadocs-ui](https://github.com/fuma-nama/fumadocs) | `16.15.12` |
`16.15.15` |
|
[lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)
| `1.47.0` | `1.48.0` |
|
[@ai-sdk/openai](https://github.com/vercel/ai/tree/HEAD/packages/openai)
| `4.0.71` | `4.0.79` |
|
[@anthropic-ai/sdk](https://github.com/anthropics/anthropic-sdk-typescript)
| `0.127.0` | `0.129.0` |
|
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
| `26.6.2` | `26.6.3` |
| [ai](https://github.com/vercel/ai/tree/HEAD/packages/ai) | `7.0.107` |
`7.0.119` |
| [openai](https://github.com/openai/openai-node) | `7.20.0` | `7.23.0`
|

Bumps the npm-minor-patch group with 2 updates in the /e2e/wrap/tools
directory:
[@openai/codex](https://github.com/openai/codex/tree/HEAD/codex-cli) and
[openclaw](https://github.com/openclaw/openclaw).

Updates `fumadocs-core` from 16.15.12 to 16.15.15
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-core's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.15.15</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.15</li>
<li>fumadocs-core@16.15.15</li>
<li>fumadocs-ui@16.15.15</li>
</ul>
<h3>Fix infinite recursion in the MDX stringifier with
<code>mdast-util-to-markdown@2.1.3</code></h3>
<p>The stringifier wraps every <code>toMarkdown</code> handler but
dropped their <code>attention</code> and <code>peek</code> properties,
which <code>mdast-util-to-markdown@2.1.3</code> relies on to serialize
bold and italic text. Pages containing them overflowed the stack during
build.</p>
<h2>fumadocs@16.15.14</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.14</li>
<li>fumadocs-core@16.15.14</li>
<li>fumadocs-ui@16.15.14</li>
</ul>
<h3>Announce copy confirmation to screen readers</h3>
<p>Copy buttons are polite live regions whose label switches to
&quot;Copied&quot; after a successful copy, so screen readers announce
it. The code block's copy button no longer reports success when the
clipboard write fails.</p>
<h3>Expose the search dialog as a combobox</h3>
<p>The search input is now a <code>combobox</code> that controls a
<code>listbox</code> of <code>option</code> results and reports the
highlighted result through <code>aria-activedescendant</code>, so screen
readers announce results as you move through them. Hidden result buttons
are removed from the tab order, and the empty state is announced as a
status message.</p>
<h3>Remove hidden sidebar controls from the tab order</h3>
<p>The collapsed sidebar and its floating pill are now
<code>inert</code> while hidden, and toggling the sidebar moves focus to
the trigger that becomes visible.</p>
<h3>Add <code>block</code> TOC style</h3>
<p>A TOC style without the track line: headings are indented by depth,
and a block slides behind the active headings.</p>
<pre lang="tsx"><code>&lt;DocsPage tableOfContent={{ style: 'block' }}
/&gt;
</code></pre>
<h3>Wrap page footer descriptions instead of truncating</h3>
<p>The previous/next page footer cards now wrap long descriptions
instead of cutting them off with an ellipsis.</p>
<h2>fumadocs@16.15.13</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.13</li>
<li>fumadocs-core@16.15.13</li>
<li>fumadocs-ui@16.15.13</li>
</ul>
<h3>Keep the collapsed sidebar's controls off the page title</h3>
<p>With the sidebar collapsed, the docs layout floats the reopen and
search buttons in a fixed pill at the top-left of the page and starts
the article at the same row.
Wherever the article is not centered with room to spare, every viewport
below about 1280px, the pill covered the page title.
The article now leaves room for the pill while the sidebar is
collapsed.</p>
<h3>AI page actions name the page by the URL the reader is on</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/1bc5374faf4b477f63f54861fa7bf12c5aa18214"><code>1bc5374</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3603">#3603</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7b83e88b1f6b952ba19b397f135b3268ae844324"><code>7b83e88</code></a>
fix(core): fix infinite recursion in the MDX stringifier with
`mdast-util-to-...</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/c481705c52b47c356de8dd7b14fe9a28a2a917c9"><code>c481705</code></a>
fix(api-docs): label schema property copy button (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3602">#3602</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d48fa917ce1257fcb595794c351befd3d626810d"><code>d48fa91</code></a>
docs: preview toc variants</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb6f3d6d56fbc816ff86b09d3be6bba32dcf39e4"><code>cb6f3d6</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3600">#3600</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/6676327fcc0faa7f49851d43b9fa6144a21077d4"><code>6676327</code></a>
perf(mdx): reduce duplicated file reads</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/f1186d9947089dc57abcf10f6ed5179d946b9846"><code>f1186d9</code></a>
fix(openapi): normalize fetch methods</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/a8438dc5e451fb195ab07bc5b3a4e6f82555787b"><code>a8438dc</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3595">#3595</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/539badaf639670203eb39453c06976d89dbae61f"><code>539bada</code></a>
feat(ui): support <code>block</code> toc variant</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/23bef0bb90450080466528e385c8c586037196a5"><code>23bef0b</code></a>
docs: correct stale info</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.15.12...fumadocs@16.15.15">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-mdx` from 15.4.3 to 15.4.5
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-mdx's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs-mdx@15.4.5</h2>
<h3>Stop recrawling <code>node_modules</code> on every Vite config
resolution</h3>
<p>The config hook of <code>fumadocs-mdx/vite</code> walked the
dependency tree below Fumadocs packages once per chain reaching a
package, so a docs app with a few Fumadocs packages read ~10k
<code>package.json</code> files (~0.9s) each time Vite resolved its
config, which it does once per build environment.</p>
<p>The crawl now visits each package once, breadth-first, and still
records the shortest chain to every CommonJS dependency
(<code>fumadocs-ui &gt; @base-ui/react &gt;
use-sync-external-store/shim</code> and friends). The result is memoized
for the process until the package manager's install state changes, so a
build with several environments crawls once.</p>
<h2>fumadocs-mdx@15.4.4</h2>
<h3>Sort glob results for deterministic codegen</h3>
<p><code>fumadocs-mdx</code>'s Node codegen now sorts glob-matched files
before generating collections, so the output (and anything derived from
<code>getPages()</code>) is stable across builds of unchanged content.
The Vite codegen path was checked separately: Vite's own
<code>import.meta.glob</code> already sorts matched files internally, so
it did not need the same fix.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb6f3d6d56fbc816ff86b09d3be6bba32dcf39e4"><code>cb6f3d6</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3600">#3600</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/6676327fcc0faa7f49851d43b9fa6144a21077d4"><code>6676327</code></a>
perf(mdx): reduce duplicated file reads</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/f1186d9947089dc57abcf10f6ed5179d946b9846"><code>f1186d9</code></a>
fix(openapi): normalize fetch methods</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/a8438dc5e451fb195ab07bc5b3a4e6f82555787b"><code>a8438dc</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3595">#3595</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/539badaf639670203eb39453c06976d89dbae61f"><code>539bada</code></a>
feat(ui): support <code>block</code> toc variant</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/23bef0bb90450080466528e385c8c586037196a5"><code>23bef0b</code></a>
docs: correct stale info</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/e988e547b00c386facfbc5801951457017d61c23"><code>e988e54</code></a>
fix(ui): announce copy confirmation to screen readers</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/583e2cacda64bb7c78216ca8f684cf02977462c5"><code>583e2ca</code></a>
fix(ui): keep search dialog active state inside the list</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/11bc9dc765dc2725eb4b5565e5733e1f6dde1576"><code>11bc9dc</code></a>
fix(ui): expose the search dialog as a combobox</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d7fa38c138ae4b12418421d5548842eba16c4ccf"><code>d7fa38c</code></a>
fix(ui): remove hidden sidebar controls from the tab order</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs-mdx@15.4.3...fumadocs-mdx@15.4.5">compare
view</a></li>
</ul>
</details>
<br />

Updates `fumadocs-ui` from 16.15.12 to 16.15.15
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/fuma-nama/fumadocs/releases">fumadocs-ui's
releases</a>.</em></p>
<blockquote>
<h2>fumadocs@16.15.15</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.15</li>
<li>fumadocs-core@16.15.15</li>
<li>fumadocs-ui@16.15.15</li>
</ul>
<h3>Fix infinite recursion in the MDX stringifier with
<code>mdast-util-to-markdown@2.1.3</code></h3>
<p>The stringifier wraps every <code>toMarkdown</code> handler but
dropped their <code>attention</code> and <code>peek</code> properties,
which <code>mdast-util-to-markdown@2.1.3</code> relies on to serialize
bold and italic text. Pages containing them overflowed the stack during
build.</p>
<h2>fumadocs@16.15.14</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.14</li>
<li>fumadocs-core@16.15.14</li>
<li>fumadocs-ui@16.15.14</li>
</ul>
<h3>Announce copy confirmation to screen readers</h3>
<p>Copy buttons are polite live regions whose label switches to
&quot;Copied&quot; after a successful copy, so screen readers announce
it. The code block's copy button no longer reports success when the
clipboard write fails.</p>
<h3>Expose the search dialog as a combobox</h3>
<p>The search input is now a <code>combobox</code> that controls a
<code>listbox</code> of <code>option</code> results and reports the
highlighted result through <code>aria-activedescendant</code>, so screen
readers announce results as you move through them. Hidden result buttons
are removed from the tab order, and the empty state is announced as a
status message.</p>
<h3>Remove hidden sidebar controls from the tab order</h3>
<p>The collapsed sidebar and its floating pill are now
<code>inert</code> while hidden, and toggling the sidebar moves focus to
the trigger that becomes visible.</p>
<h3>Add <code>block</code> TOC style</h3>
<p>A TOC style without the track line: headings are indented by depth,
and a block slides behind the active headings.</p>
<pre lang="tsx"><code>&lt;DocsPage tableOfContent={{ style: 'block' }}
/&gt;
</code></pre>
<h3>Wrap page footer descriptions instead of truncating</h3>
<p>The previous/next page footer cards now wrap long descriptions
instead of cutting them off with an ellipsis.</p>
<h2>fumadocs@16.15.13</h2>
<ul>
<li><code>@​fumadocs/base-ui</code><a
href="https://github.com/16"><code>@​16</code></a>.15.13</li>
<li>fumadocs-core@16.15.13</li>
<li>fumadocs-ui@16.15.13</li>
</ul>
<h3>Keep the collapsed sidebar's controls off the page title</h3>
<p>With the sidebar collapsed, the docs layout floats the reopen and
search buttons in a fixed pill at the top-left of the page and starts
the article at the same row.
Wherever the article is not centered with room to spare, every viewport
below about 1280px, the pill covered the page title.
The article now leaves room for the pill while the sidebar is
collapsed.</p>
<h3>AI page actions name the page by the URL the reader is on</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/1bc5374faf4b477f63f54861fa7bf12c5aa18214"><code>1bc5374</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3603">#3603</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/7b83e88b1f6b952ba19b397f135b3268ae844324"><code>7b83e88</code></a>
fix(core): fix infinite recursion in the MDX stringifier with
`mdast-util-to-...</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/c481705c52b47c356de8dd7b14fe9a28a2a917c9"><code>c481705</code></a>
fix(api-docs): label schema property copy button (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3602">#3602</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/d48fa917ce1257fcb595794c351befd3d626810d"><code>d48fa91</code></a>
docs: preview toc variants</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/cb6f3d6d56fbc816ff86b09d3be6bba32dcf39e4"><code>cb6f3d6</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3600">#3600</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/6676327fcc0faa7f49851d43b9fa6144a21077d4"><code>6676327</code></a>
perf(mdx): reduce duplicated file reads</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/f1186d9947089dc57abcf10f6ed5179d946b9846"><code>f1186d9</code></a>
fix(openapi): normalize fetch methods</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/a8438dc5e451fb195ab07bc5b3a4e6f82555787b"><code>a8438dc</code></a>
Version Packages (<a
href="https://redirect.github.com/fuma-nama/fumadocs/issues/3595">#3595</a>)</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/539badaf639670203eb39453c06976d89dbae61f"><code>539bada</code></a>
feat(ui): support <code>block</code> toc variant</li>
<li><a
href="https://github.com/fuma-nama/fumadocs/commit/23bef0bb90450080466528e385c8c586037196a5"><code>23bef0b</code></a>
docs: correct stale info</li>
<li>Additional commits viewable in <a
href="https://github.com/fuma-nama/fumadocs/compare/fumadocs@16.15.12...fumadocs@16.15.15">compare
view</a></li>
</ul>
</details>
<br />

Updates `lucide-react` from 1.47.0 to 1.48.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/lucide-icons/lucide/releases">lucide-react's
releases</a>.</em></p>
<blockquote>
<h2>Version 1.48.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat(icons): added <code>briefcase-plus</code> icon by <a
href="https://github.com/tylerkade"><code>@​tylerkade</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4757">lucide-icons/lucide#4757</a></li>
<li>feat(icons): added <code>square-sparkles</code> icon by <a
href="https://github.com/nananecy"><code>@​nananecy</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3610">lucide-icons/lucide#3610</a></li>
<li>feat(icons): added <code>line-dot-left-horizontal</code> icon by <a
href="https://github.com/nathan-de-pachtere"><code>@​nathan-de-pachtere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3855">lucide-icons/lucide#3855</a></li>
<li>fix(packages/svelte,solid): fix shared type imports in Solid and
Svelte by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4846">lucide-icons/lucide#4846</a></li>
<li>chore(deps-dev): bump react-native from 0.76.9 to 0.87.1 in the
react-native-deps group across 1 directory by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4673">lucide-icons/lucide#4673</a></li>
<li>feat(packages): export __iconNode data across framework packages by
<a href="https://github.com/lx3133584"><code>@​lx3133584</code></a> in
<a
href="https://redirect.github.com/lucide-icons/lucide/pull/4761">lucide-icons/lucide#4761</a></li>
<li>fix(icons): Tweak <code>card-sim</code> chip by <a
href="https://github.com/danielbayley"><code>@​danielbayley</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3649">lucide-icons/lucide#3649</a></li>
<li>feat(icons): added <code>line-dot-top-vertical</code> icon by <a
href="https://github.com/nathan-de-pachtere"><code>@​nathan-de-pachtere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3856">lucide-icons/lucide#3856</a></li>
<li>feat(icons): added <code>line-dot-bottom-vertical</code> icon by <a
href="https://github.com/nathan-de-pachtere"><code>@​nathan-de-pachtere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3857">lucide-icons/lucide#3857</a></li>
<li>fix(packages/react-native): pass testID to the rendered Svg element
by <a href="https://github.com/OlegBezr"><code>@​OlegBezr</code></a> in
<a
href="https://redirect.github.com/lucide-icons/lucide/pull/4881">lucide-icons/lucide#4881</a></li>
<li>chore(<code>@​lucide/vue</code>): Fix types <code>@lucide/vue</code>
package and added workflow for it. by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4883">lucide-icons/lucide#4883</a></li>
<li>test(packages/shared): cover buildLucideIconForReact by <a
href="https://github.com/vugarbbakhishov-hub"><code>@​vugarbbakhishov-hub</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4872">lucide-icons/lucide#4872</a></li>
<li>feat(site): Better icon detail page and add unreleased flag by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4877">lucide-icons/lucide#4877</a></li>
<li>fix(icons): changed <code>map-pinned</code> icon by <a
href="https://github.com/jguddas"><code>@​jguddas</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4880">lucide-icons/lucide#4880</a></li>
<li>fix(icons): changed <code>mail-pen</code> by <a
href="https://github.com/karsa-mistmere"><code>@​karsa-mistmere</code></a>
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4899">lucide-icons/lucide#4899</a></li>
<li>chore(deps-dev): bump the angular-deps group across 1 directory with
14 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4895">lucide-icons/lucide#4895</a></li>
<li>chore(deps): bump the vue-deps group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4893">lucide-icons/lucide#4893</a></li>
<li>chore(typchecking): More typecheck jobs for all packages by <a
href="https://github.com/ericfennis"><code>@​ericfennis</code></a> in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4885">lucide-icons/lucide#4885</a></li>
<li>feat(icons): add house-cog icon by <a
href="https://github.com/ajaxjiang96"><code>@​ajaxjiang96</code></a> in
<a
href="https://redirect.github.com/lucide-icons/lucide/pull/4904">lucide-icons/lucide#4904</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/nananecy"><code>@​nananecy</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/3610">lucide-icons/lucide#3610</a></li>
<li><a href="https://github.com/OlegBezr"><code>@​OlegBezr</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4881">lucide-icons/lucide#4881</a></li>
<li><a
href="https://github.com/vugarbbakhishov-hub"><code>@​vugarbbakhishov-hub</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4872">lucide-icons/lucide#4872</a></li>
<li><a
href="https://github.com/ajaxjiang96"><code>@​ajaxjiang96</code></a>
made their first contribution in <a
href="https://redirect.github.com/lucide-icons/lucide/pull/4904">lucide-icons/lucide#4904</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/lucide-icons/lucide/compare/1.47.0...1.48.0">https://github.com/lucide-icons/lucide/compare/1.47.0...1.48.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/lucide-icons/lucide/commit/f06ac67e33d645c40b8ce19a0419c85c5d7dd751"><code>f06ac67</code></a>
chore(typchecking): More typecheck jobs for all packages (<a
href="https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react/issues/4885">#4885</a>)</li>
<li>See full diff in <a
href="https://github.com/lucide-icons/lucide/commits/1.48.0/packages/lucide-react">compare
view</a></li>
</ul>
</details>
<br />

Updates `@ai-sdk/openai` from 4.0.71 to 4.0.79
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ai/blob/main/packages/openai/CHANGELOG.md">@​ai-sdk/openai's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.79</h2>
<h3>Patch Changes</h3>
<ul>
<li>
<p>e3605f6: Fix streamed tool calls with missing, blank, or repeated
IDs.</p>
</li>
<li>
<p>525efc5: feat(provider): advertise image model file and mask input
support</p>
<p>Use confirmed model IDs for capability declarations so unrecognized
model names
remain unknown. Include Together AI FLUX.2 Pro and Flex single-image
editing, and
allow asynchronous capability lookups and middleware overrides to
resolve to
unknown.</p>
<p>Advertise QuiverAI Arrow 2 and Arrow 2 Telos file-input support, and
mark Together
AI Gemini image inputs unsupported by the current single-image request
mapping.</p>
</li>
<li>
<p>Updated dependencies [e3605f6]</p>
</li>
<li>
<p>Updated dependencies [525efc5]</p>
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.50</li>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.19</li>
</ul>
</li>
</ul>
<h2>4.0.78</h2>
<h3>Patch Changes</h3>
<ul>
<li>94d5d6d: Support <code>reasoningEffortUpdate: 'none'</code> for
GPT-6 Sol and Luna in request-level options and positioned system
messages. Validate update efforts against the model's supported efforts,
warning and omitting unsupported request-level updates and rejecting
unsupported historical updates.</li>
</ul>
<h2>4.0.77</h2>
<h3>Patch Changes</h3>
<ul>
<li>2abd503: Default OpenAI Responses function tools to <code>strict:
false</code> when tool strict mode is omitted.</li>
<li>Updated dependencies [af9597b]</li>
<li>Updated dependencies [bc49f78]
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.49</li>
</ul>
</li>
</ul>
<h2>4.0.76</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies [be877ff]
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.48</li>
</ul>
</li>
</ul>
<h2>4.0.75</h2>
<h3>Patch Changes</h3>
<ul>
<li>ca31b89: The OpenAI Responses provider now accepts
<code>providerOptions.openai.reasoningEffortUpdate</code> on empty
system messages and sends each update at its position in the
conversation. This lets applications change reasoning effort during a
conversation while preserving the prompt prefix for caching.</li>
</ul>
<h2>4.0.74</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/ai/commit/20ad146f3c1177375639f8ba96b4bc5be4a729b1"><code>20ad146</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21569">#21569</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/525efc552bc56380fa511357e552d54f927b44ad"><code>525efc5</code></a>
feat: advertise image model file and mask input capabilities (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/19230">#19230</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/8ff139b73483292518ba3ca17da1028005830f28"><code>8ff139b</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21520">#21520</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/94d5d6d3e607f5cdaf112ca8674a86f1da03f8b7"><code>94d5d6d</code></a>
fix(openai): allow none in reasoning effort updates (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21518">#21518</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/ee3169b3c4880e2abe4d0d7c781243bb81822ec4"><code>ee3169b</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21508">#21508</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/2abd503e955cc44b2147fe6621894f535ef67418"><code>2abd503</code></a>
fix(openai): default Responses tool strict mode to false (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/15889">#15889</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/00f50d942708d8d906fc6db5cafd1eb9076a5f50"><code>00f50d9</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21466">#21466</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/3f3a717e2237c56aed9fab22269f07ccfeb0a142"><code>3f3a717</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21417">#21417</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/ca31b890a6a55f1f084bc807266bcdd2663a06e1"><code>ca31b89</code></a>
feat(openai): support message-level reasoning effort updates (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21418">#21418</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/a8961ebc4920ae8a0850c8d50af3fca2eb2d375b"><code>a8961eb</code></a>
docs: refresh model defaults across docs and examples (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/openai/issues/21416">#21416</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/ai/commits/@ai-sdk/openai@4.0.79/packages/openai">compare
view</a></li>
</ul>
</details>
<br />

Updates `@anthropic-ai/sdk` from 0.127.0 to 0.129.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/releases">@​anthropic-ai/sdk's
releases</a>.</em></p>
<blockquote>
<h2>sdk: v0.129.0</h2>
<h2>0.129.0 (2026-09-28)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.128.0...sdk-v0.129.0">sdk-v0.128.0...sdk-v0.129.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add between_tools thinking type (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/ab51075609a2d583dffdca24856f4214779d9e7f">ab51075</a>)</li>
<li><strong>api:</strong> add claude-sonnet-5-5 (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/4e7736625fd23a5607800e8de4aa3c37daa74a07">4e77366</a>)</li>
<li><strong>api:</strong> add ClientToolUnion type for client-executed
tools (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2c1d2d712071a5f10d2e70ea02dc33425b087799">2c1d2d7</a>)</li>
<li><strong>api:</strong> add include_inherited and source to workspace
rate limits (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/66e925e54ff3435a56f51f687641728b94aff306">66e925e</a>)</li>
<li><strong>api:</strong> add typed event type values to the Managed
Agents events list filter (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8ac4a26809418453b64fee79f8ec790d32d1f92c">8ac4a26</a>)</li>
<li><strong>api:</strong> cache diagnostics GA — diagnostics on Message
/ MessageCreateParams (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5ba5f29696d520f68a794936eff7337dce83ac05">5ba5f29</a>)</li>
<li><strong>tools:</strong> optionally start tool calls while the reply
streams (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/083969beadb360b9c4b329ee2541f67bd78d9caf">083969b</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> also send X-Stainless-Timeout for
client-level timeouts (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b84783b6ee03eed519d622ea1e477cf8eb3863bf">b84783b</a>)</li>
<li><strong>client:</strong> send upload filenames as given, with no
placeholder (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/f9d3e980b1b498c1c452300a205811f6a56de69b">f9d3e98</a>)</li>
<li><strong>helpers:</strong> degrade between_tools thinking to disabled
on fallback hops (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/841">#841</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/edbbf05a62ffe2c95c13810f6d7a0a2796786e5f">edbbf05</a>)</li>
<li><strong>internal:</strong> let bundlers drop unused classes with
more than ten private-member assignments (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/67c7adbe5ebae805631e104b341d932a1554bda8">67c7adb</a>)</li>
<li><strong>streaming:</strong> show every complete array item and hold
back unfinished numbers in partial tool input (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/781">#781</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/58065889d6b112db6da5127484e0a24025e3fa37">5806588</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>streaming:</strong> drop the redundant iterSSEChunks layer
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/0357f812dab273c0780c558606663a03e93e34df">0357f81</a>)</li>
<li><strong>streaming:</strong> take each string token as one slice in
the partial JSON tokenizer (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/255">#255</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/cdfb1e55afebe1c3be50401ca56bebf0ff009a4e">cdfb1e5</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> deprecate the betas param on GA models and
completions methods (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5c74e4532bb69f22afa3e08013645ac059440aef">5c74e45</a>)</li>
<li><strong>api:</strong> list the known model ids first in the Model
types (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/94528226386311c3ade468cbdea0326c06a1e53d">9452822</a>)</li>
<li><strong>ci:</strong> choose the CI runner by repository (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/33db1ec2e99a415ff98619cf88ddddbf2b7ca7b1">33db1ec</a>)</li>
<li><strong>docs:</strong> clarify that stream: true returns the raw
event stream (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/4286c227c3a605bf04d4f59ffb496f44c102a6ec">4286c22</a>)</li>
<li><strong>docs:</strong> make Managed Agents actor descriptions
resource-neutral (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/15733f98deaae4aee2fba26c1bfe4ee1514c7080">15733f9</a>)</li>
<li><strong>docs:</strong> restore the research-preview notice on the
Dream type (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b32f8baa27c40ad5901531024bae86e0ca046bb5">b32f8ba</a>)</li>
<li><strong>internal:</strong> move old constants around (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/0cd8edfdc6dd91af4ffee4ed3cc7fc8cc22d65e3">0cd8edf</a>)</li>
<li><strong>tests:</strong> add diagnostics to the parser test's Message
fixtures (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/eb5ca58d51ed3309b1f317b20f7d248b036ba76a">eb5ca58</a>)</li>
<li><strong>tools:</strong> remove client-side compaction control (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/802">#802</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/9c3e8a5ffa38c35dec32f0258becd360babd5fb1">9c3e8a5</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><strong>api:</strong> prefer each field's own description over its
shared type's (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/51934782720725acca570edeb0a3a7501ca7dbd8">5193478</a>)</li>
<li>expand CLAUDE.md into a full contributor guide (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/98d2ddbce7c1eabbabe5a130d18d307c237fb75c">98d2ddb</a>)</li>
</ul>
<h2>sdk: v0.128.0</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-typescript/blob/main/CHANGELOG.md">@​anthropic-ai/sdk's
changelog</a>.</em></p>
<blockquote>
<h2>0.129.0 (2026-09-28)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.128.0...sdk-v0.129.0">sdk-v0.128.0...sdk-v0.129.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add between_tools thinking type (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/ab51075609a2d583dffdca24856f4214779d9e7f">ab51075</a>)</li>
<li><strong>api:</strong> add claude-sonnet-5-5 (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/4e7736625fd23a5607800e8de4aa3c37daa74a07">4e77366</a>)</li>
<li><strong>api:</strong> add ClientToolUnion type for client-executed
tools (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2c1d2d712071a5f10d2e70ea02dc33425b087799">2c1d2d7</a>)</li>
<li><strong>api:</strong> add include_inherited and source to workspace
rate limits (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/66e925e54ff3435a56f51f687641728b94aff306">66e925e</a>)</li>
<li><strong>api:</strong> add typed event type values to the Managed
Agents events list filter (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8ac4a26809418453b64fee79f8ec790d32d1f92c">8ac4a26</a>)</li>
<li><strong>api:</strong> cache diagnostics GA — diagnostics on Message
/ MessageCreateParams (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5ba5f29696d520f68a794936eff7337dce83ac05">5ba5f29</a>)</li>
<li><strong>tools:</strong> optionally start tool calls while the reply
streams (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/083969beadb360b9c4b329ee2541f67bd78d9caf">083969b</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> also send X-Stainless-Timeout for
client-level timeouts (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b84783b6ee03eed519d622ea1e477cf8eb3863bf">b84783b</a>)</li>
<li><strong>client:</strong> send upload filenames as given, with no
placeholder (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/f9d3e980b1b498c1c452300a205811f6a56de69b">f9d3e98</a>)</li>
<li><strong>helpers:</strong> degrade between_tools thinking to disabled
on fallback hops (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/841">#841</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/edbbf05a62ffe2c95c13810f6d7a0a2796786e5f">edbbf05</a>)</li>
<li><strong>internal:</strong> let bundlers drop unused classes with
more than ten private-member assignments (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/67c7adbe5ebae805631e104b341d932a1554bda8">67c7adb</a>)</li>
<li><strong>streaming:</strong> show every complete array item and hold
back unfinished numbers in partial tool input (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/781">#781</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/58065889d6b112db6da5127484e0a24025e3fa37">5806588</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>streaming:</strong> drop the redundant iterSSEChunks layer
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/0357f812dab273c0780c558606663a03e93e34df">0357f81</a>)</li>
<li><strong>streaming:</strong> take each string token as one slice in
the partial JSON tokenizer (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/255">#255</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/cdfb1e55afebe1c3be50401ca56bebf0ff009a4e">cdfb1e5</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> deprecate the betas param on GA models and
completions methods (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/5c74e4532bb69f22afa3e08013645ac059440aef">5c74e45</a>)</li>
<li><strong>api:</strong> list the known model ids first in the Model
types (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/94528226386311c3ade468cbdea0326c06a1e53d">9452822</a>)</li>
<li><strong>ci:</strong> choose the CI runner by repository (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/33db1ec2e99a415ff98619cf88ddddbf2b7ca7b1">33db1ec</a>)</li>
<li><strong>docs:</strong> clarify that stream: true returns the raw
event stream (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/4286c227c3a605bf04d4f59ffb496f44c102a6ec">4286c22</a>)</li>
<li><strong>docs:</strong> make Managed Agents actor descriptions
resource-neutral (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/15733f98deaae4aee2fba26c1bfe4ee1514c7080">15733f9</a>)</li>
<li><strong>docs:</strong> restore the research-preview notice on the
Dream type (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b32f8baa27c40ad5901531024bae86e0ca046bb5">b32f8ba</a>)</li>
<li><strong>internal:</strong> move old constants around (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/0cd8edfdc6dd91af4ffee4ed3cc7fc8cc22d65e3">0cd8edf</a>)</li>
<li><strong>tests:</strong> add diagnostics to the parser test's Message
fixtures (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/eb5ca58d51ed3309b1f317b20f7d248b036ba76a">eb5ca58</a>)</li>
<li><strong>tools:</strong> remove client-side compaction control (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/802">#802</a>)
(<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/9c3e8a5ffa38c35dec32f0258becd360babd5fb1">9c3e8a5</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><strong>api:</strong> prefer each field's own description over its
shared type's (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/51934782720725acca570edeb0a3a7501ca7dbd8">5193478</a>)</li>
<li>expand CLAUDE.md into a full contributor guide (<a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/98d2ddbce7c1eabbabe5a130d18d307c237fb75c">98d2ddb</a>)</li>
</ul>
<h2>0.128.0 (2026-09-22)</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/bf2058689f845dfb10e59bd9ebeb5cb4e9318a9d"><code>bf20586</code></a>
Merge pull request <a
href="https://redirect.github.com/anthropics/anthropic-sdk-typescript/issues/1218">#1218</a>
from anthropics/release-please--branches--main--chan...</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/da41a5a0e5d6f498f1bb8b71beb5b1e0a2bd1e48"><code>da41a5a</code></a>
chore: release main</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/3a79b93f0210a83f8bf9fda91a42b577c9e6b93c"><code>3a79b93</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/4e7736625fd23a5607800e8de4aa3c37daa74a07"><code>4e77366</code></a>
feat(api): add claude-sonnet-5-5</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/2c1d2d712071a5f10d2e70ea02dc33425b087799"><code>2c1d2d7</code></a>
feat(api): add ClientToolUnion type for client-executed tools</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/f9d3e980b1b498c1c452300a205811f6a56de69b"><code>f9d3e98</code></a>
fix(client): send upload filenames as given, with no placeholder</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/8ac4a26809418453b64fee79f8ec790d32d1f92c"><code>8ac4a26</code></a>
feat(api): add typed event type values to the Managed Agents events list
filter</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/083969beadb360b9c4b329ee2541f67bd78d9caf"><code>083969b</code></a>
feat(tools): optionally start tool calls while the reply streams</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/9505bf37def4a4ada41c95e4e4fa7fb6b3b3f679"><code>9505bf3</code></a>
codegen metadata</li>
<li><a
href="https://github.com/anthropics/anthropic-sdk-typescript/commit/b84783b6ee03eed519d622ea1e477cf8eb3863bf"><code>b84783b</code></a>
fix(client): also send X-Stainless-Timeout for client-level
timeouts</li>
<li>Additional commits viewable in <a
href="https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.127.0...sdk-v0.129.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/node` from 26.6.2 to 26.6.3
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />

Updates `ai` from 7.0.107 to 7.0.119
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ai/blob/main/packages/ai/CHANGELOG.md">ai's
changelog</a>.</em></p>
<blockquote>
<h2>7.0.119</h2>
<h3>Patch Changes</h3>
<ul>
<li>
<p>33e94ba: fix(ai): cancel response streams when clients disconnect</p>
</li>
<li>
<p>34d869e: fix(ai): prevent unhandled stream completion rejections in
non-Node runtimes</p>
</li>
<li>
<p>def4df8: fix(ai): store static tool input errors in the current input
field</p>
</li>
<li>
<p>525efc5: feat(provider): advertise image model file and mask input
support</p>
<p>Use confirmed model IDs for capability declarations so unrecognized
model names
remain unknown. Include Together AI FLUX.2 Pro and Flex single-image
editing, and
allow asynchronous capability lookups and middleware overrides to
resolve to
unknown.</p>
<p>Advertise QuiverAI Arrow 2 and Arrow 2 Telos file-input support, and
mark Together
AI Gemini image inputs unsupported by the current single-image request
mapping.</p>
</li>
<li>
<p>Updated dependencies [e3605f6]</p>
</li>
<li>
<p>Updated dependencies [525efc5]</p>
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.50</li>
<li><code>@​ai-sdk/provider</code><a
href="https://github.com/4"><code>@​4</code></a>.0.19</li>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.97</li>
</ul>
</li>
</ul>
<h2>7.0.118</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies [e6a7996]</li>
<li>Updated dependencies [e19f0fc]
<ul>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.96</li>
</ul>
</li>
</ul>
<h2>7.0.117</h2>
<h3>Patch Changes</h3>
<ul>
<li>Updated dependencies [b67b1b7]
<ul>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.95</li>
</ul>
</li>
</ul>
<h2>7.0.116</h2>
<h3>Patch Changes</h3>
<ul>
<li>af9597b: Compile packages for ES2022 runtime target</li>
<li>bc49f78: Preserve original opaque URI strings in tagged file URLs
during prompt conversion. Match explicit supported URL MIME types
exactly so unsupported subtypes are not forwarded to providers.</li>
<li>Updated dependencies [af9597b]</li>
<li>Updated dependencies [bc49f78]
<ul>
<li><code>@​ai-sdk/provider-utils</code><a
href="https://github.com/5"><code>@​5</code></a>.0.49</li>
<li><code>@​ai-sdk/gateway</code><a
href="https://github.com/4"><code>@​4</code></a>.0.94</li>
</ul>
</li>
</ul>
<h2>7.0.115</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/ai/commit/20ad146f3c1177375639f8ba96b4bc5be4a729b1"><code>20ad146</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21569">#21569</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/33e94baaf446f8b75dec4cd0d7eed44fd8c057a0"><code>33e94ba</code></a>
fix: settle response stream pipes and cancel their sources after client
disco...</li>
<li><a
href="https://github.com/vercel/ai/commit/525efc552bc56380fa511357e552d54f927b44ad"><code>525efc5</code></a>
feat: advertise image model file and mask input capabilities (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/19230">#19230</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/34d869e95400e9ae420e7a5a4755f03935fa1410"><code>34d869e</code></a>
fix: streamText emits unhandled completion rejections in non-Node
runtimes (#...</li>
<li><a
href="https://github.com/vercel/ai/commit/def4df89d527a70f226a44c455e3981efc8b73be"><code>def4df8</code></a>
fix: SDK-generated static tool input errors use deprecated fields and
validat...</li>
<li><a
href="https://github.com/vercel/ai/commit/5d12eaa6caa193d3901cbab98a734403eb6bf622"><code>5d12eaa</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21559">#21559</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/5382b8562630932af02954bdd00f4727320fd2fd"><code>5382b85</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21535">#21535</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/b67b1b746341ca591bd1551fde809278ae7f9f44"><code>b67b1b7</code></a>
feat(provider/gateway): type conditional evaluation fallbacks (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21215">#21215</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/ee3169b3c4880e2abe4d0d7c781243bb81822ec4"><code>ee3169b</code></a>
Version Packages (<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21508">#21508</a>)</li>
<li><a
href="https://github.com/vercel/ai/commit/af9597bda905ccd5f432c7f06e8238637d5349e4"><code>af9597b</code></a>
chore: standardize tsconfig <code>target</code> to <code>ES2022</code>
(<a
href="https://github.com/vercel/ai/tree/HEAD/packages/ai/issues/21498">#21498</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/ai/commits/ai@7.0.119/packages/ai">compare
view</a></li>
</ul>
</details>
<br />

Updates `openai` from 7.20.0 to 7.23.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/openai/openai-node/releases">openai's
releases</a>.</em></p>
<blockquote>
<h2>v7.23.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.22.0...v7.23.0">7.23.0</a>
(2026-09-23)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add GCP external storage support (<a
href="https://redirect.github.com/openai/openai-node/issues/2794">#2794</a>)
(<a
href="https://github.com/openai/openai-node/commit/7cd0629a8897b34df07d12fe1ec76050cce5a5a0">7cd0629</a>)</li>
<li><strong>api:</strong> add GPT-Rosalind research model (<a
href="https://redirect.github.com/openai/openai-node/issues/2792">#2792</a>)
(<a
href="https://github.com/openai/openai-node/commit/d0e6fcd686dfe5415df110a83e4923abadb8419c">d0e6fcd</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> document exact Chat Completions seed bounds
(<a
href="https://redirect.github.com/openai/openai-node/issues/2796">#2796</a>)
(<a
href="https://github.com/openai/openai-node/commit/13b844fad0b6a7206fb81fe8b7285593119488ac">13b844f</a>)</li>
</ul>
<h2>v7.22.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.21.0...v7.22.0">7.22.0</a>
(2026-09-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add GPT-6 Sol and Luna model identifiers (<a
href="https://redirect.github.com/openai/openai-node/issues/2790">#2790</a>)
(<a
href="https://github.com/openai/openai-node/commit/cff2135ff75c54d04be256d19d99fad8ca4a9d3b">cff2135</a>)</li>
</ul>
<h2>v7.21.0</h2>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.20.0...v7.21.0">7.21.0</a>
(2026-09-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add session environment reset events (<a
href="https://redirect.github.com/openai/openai-node/issues/2777">#2777</a>)
(<a
href="https://github.com/openai/openai-node/commit/5de2360474aba30a3176ba2dde9ac5e55783efb5">5de2360</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> preserve model choices and improve request
handling (<a
href="https://redirect.github.com/openai/openai-node/issues/2787">#2787</a>)
(<a
href="https://github.com/openai/openai-node/commit/a4a439633e41880108624460c62bf13fd94c171b">a4a4396</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> document response management resources (<a
href="https://redirect.github.com/openai/openai-node/issues/2775">#2775</a>)
(<a
href="https://github.com/openai/openai-node/commit/0472fb3d9979c238c552da4a7403fe4631e3707b">0472fb3</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/openai/openai-node/blob/main/CHANGELOG.md">openai's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.22.0...v7.23.0">7.23.0</a>
(2026-09-23)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add GCP external storage support (<a
href="https://redirect.github.com/openai/openai-node/issues/2794">#2794</a>)
(<a
href="https://github.com/openai/openai-node/commit/7cd0629a8897b34df07d12fe1ec76050cce5a5a0">7cd0629</a>)</li>
<li><strong>api:</strong> add GPT-Rosalind research model (<a
href="https://redirect.github.com/openai/openai-node/issues/2792">#2792</a>)
(<a
href="https://github.com/openai/openai-node/commit/d0e6fcd686dfe5415df110a83e4923abadb8419c">d0e6fcd</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> document exact Chat Completions seed bounds
(<a
href="https://redirect.github.com/openai/openai-node/issues/2796">#2796</a>)
(<a
href="https://github.com/openai/openai-node/commit/13b844fad0b6a7206fb81fe8b7285593119488ac">13b844f</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.21.0...v7.22.0">7.22.0</a>
(2026-09-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add GPT-6 Sol and Luna model identifiers (<a
href="https://redirect.github.com/openai/openai-node/issues/2790">#2790</a>)
(<a
href="https://github.com/openai/openai-node/commit/cff2135ff75c54d04be256d19d99fad8ca4a9d3b">cff2135</a>)</li>
</ul>
<h2><a
href="https://github.com/openai/openai-node/compare/v7.20.0...v7.21.0">7.21.0</a>
(2026-09-22)</h2>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add session environment reset events (<a
href="https://redirect.github.com/openai/openai-node/issues/2777">#2777</a>)
(<a
href="https://github.com/openai/openai-node/commit/5de2360474aba30a3176ba2dde9ac5e55783efb5">5de2360</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> preserve model choices and improve request
handling (<a
href="https://redirect.github.com/openai/openai-node/issues/2787">#2787</a>)
(<a
href="https://github.com/openai/openai-node/commit/a4a439633e41880108624460c62bf13fd94c171b">a4a4396</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> document response management resources (<a
href="https://redirect.github.com/openai/openai-node/issues/2775">#2775</a>)
(<a
href="https://github.com/openai/openai-node/commit/0472fb3d9979c238c552da4a7403fe4631e3707b">0472fb3</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/openai/openai-node/commit/b073a4ddadb121d2bd17ce23e235ff969192f0e0"><code>b073a4d</code></a>
release: 7.23.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2793">#2793</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/13b844fad0b6a7206fb81fe8b7285593119488ac"><code>13b844f</code></a>
chore(api): document exact Chat Completions seed bounds (<a
href="https://redirect.github.com/openai/openai-node/issues/2796">#2796</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/7cd0629a8897b34df07d12fe1ec76050cce5a5a0"><code>7cd0629</code></a>
feat(api): add GCP external storage support (<a
href="https://redirect.github.com/openai/openai-node/issues/2794">#2794</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/d0e6fcd686dfe5415df110a83e4923abadb8419c"><code>d0e6fcd</code></a>
feat(api): add GPT-Rosalind research model (<a
href="https://redirect.github.com/openai/openai-node/issues/2792">#2792</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/1dd5587abd96ea986109ab0d0effec1772b98f0b"><code>1dd5587</code></a>
release: 7.22.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2791">#2791</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/cff2135ff75c54d04be256d19d99fad8ca4a9d3b"><code>cff2135</code></a>
feat(api): add GPT-6 Sol and Luna model identifiers (<a
href="https://redirect.github.com/openai/openai-node/issues/2790">#2790</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/cf1b7e1cf7981ef79695c496caf14b6bb492f18e"><code>cf1b7e1</code></a>
release: 7.21.0 (<a
href="https://redirect.github.com/openai/openai-node/issues/2776">#2776</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/a4a439633e41880108624460c62bf13fd94c171b"><code>a4a4396</code></a>
fix(api): preserve model choices and improve request handling (<a
href="https://redirect.github.com/openai/openai-node/issues/2787">#2787</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/5de2360474aba30a3176ba2dde9ac5e55783efb5"><code>5de2360</code></a>
feat(api): add session environment reset events (<a
href="https://redirect.github.com/openai/openai-node/issues/2777">#2777</a>)</li>
<li><a
href="https://github.com/openai/openai-node/commit/0472fb3d9979c238c552da4a7403fe4631e3707b"><code>0472fb3</code></a>
chore(api): document response management resources (<a
href="https://redirect.github.com/openai/openai-node/issues/2775">#2775</a>)</li>
<li>See full diff in <a
href="https://github.com/openai/openai-node/compare/v7.20.0...v7.23.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `@openai/codex` from 0.155.1 to 0.158.0
Updates `openclaw` from 2026.9.5 to 2026.9.6
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/openclaw/openclaw/releases">openclaw's
releases</a>.</em></p>
<blockquote>
<h2>openclaw 2026.9.6</h2>
<blockquote>
<p><strong>macOS app rebuilt 2026-09-24:</strong> the original 2026.9.6
macOS build crashed at launch (<a
href="https://redirect.github.com/openclaw/openclaw/issues/156861">#156861</a>)
and was replaced at 09:52 UTC by a rebuilt, notarized 2026.9.6 build
with the fix (<a
href="https://redirect.github.com/openclaw/openclaw/issues/156881">#156881</a>).
Download the DMG below or update from 2026.9.5 in the app. If you
installed the earlier 2026.9.6 build and it does not launch, install the
DMG once. The npm package is unchanged.</p>
</blockquote>
<!-- raw HTML omitted -->
<h2>OpenClaw v2026.9.6</h2>
<p>178 direct commits · 2,614 pull requests · 351 contributors</p>
<h3>Changes included in this release</h3>
<p>The release notes and changelog contain the same content, presented
in two formats:</p>
<ul>
<li><a href="https://docs.openclaw.ai/releases/2026.9.6">Release
notes</a> — formatted for people, with expandable sections.</li>
<li><a
href="https://raw.githubusercontent.com/openclaw/openclaw/main/CHANGELOG/2026.9.6.md">Changelog</a>
— plain Markdown for AI agents and tools.</li>
</ul>
<h3>Thanks</h3>
<p><a
href="https://github.com/0-danielviktorovich-0"><code>@​0-danielviktorovich-0</code></a>
<a
href="https://github.com/1Vision365-PeterTijsma"><code>@​1Vision365-PeterTijsma</code></a>
<a href="https://github.com/609NFT"><code>@​609NFT</code></a> <a
href="https://github.com/aatreya"><code>@​aatreya</code></a> <a
href="https://github.com/abacha"><code>@​abacha</code></a> <a
href="https://github.com/AbuSido82"><code>@​AbuSido82</code></a> <a
href="https://github.com/agebreak0083"><code>@​agebreak0083</code></a>
<a href="https://github.com/agent-axos"><code>@​agent-axos</code></a> <a
href="https://github.com/AgentSolomon"><code>@​AgentSolomon</code></a>
<a href="https://github.com/ago1776"><code>@​ago1776</code></a> <a
href="https://github.com/Albertyn87"><code>@​Albertyn87</code></a> <a
href="https://github.com/alex-brave"><code>@​alex-brave</code></a> <a
href="https://github.com/alexey-pelykh"><code>@​alexey-pelykh</code></a>
<a href="https://github.com/Alix-007"><code>@​Alix-007</code></a> <a
href="https://github.com/allen0373"><code>@​allen0373</code></a> <a
href="https://github.com/altaywtf"><code>@​altaywtf</code></a> <a
href="https://github.com/alvelda"><code>@​alvelda</code></a> <a
href="https://github.com/amittell"><code>@​amittell</code></a> <a
href="https://github.com/Andapeng"><code>@​Andapeng</code></a> <a
href="https://github.com/aniketkrs"><code>@​aniketkrs</code></a> <a
href="https://github.com/aniruddhaadak80"><code>@​aniruddhaadak80</code></a>
<a href="https://github.com/anyech"><code>@​anyech</code></a> <a
href="https://github.com/ayoakouh"><code>@​ayoakouh</code></a> <a
href="https://github.com/azuretek"><code>@​azuretek</code></a> <a
href="https://github.com/baiwei0427"><code>@​baiwei0427</code></a> <a
href="https://github.com/baovo15"><code>@​baovo15</code></a> <a
href="https://github.com/Bartok9"><code>@​Bartok9</code></a> <a
href="https://github.com/Baumus"><code>@​Baumus</code></a> <a
href="https://github.com/bdjben"><code>@​bdjben</code></a> <a
href="https://github.com/beeven"><code>@​beeven</code></a> <a
href="https://github.com/beings1988-lab"><code>@​beings1988-lab</code></a>
<a href="https://github.com/bek91"><code>@​bek91</code></a> <a
href="https://github.com/benediktweber"><code>@​benediktweber</code></a>
<a
href="https://github.com/berklingtools"><code>@​berklingtools</code></a>
<a href="https://github.com/bharatvasan"><code>@​bharatvasan</code></a>
<a
href="https://github.com/BinChenUtrecht"><code>@​BinChenUtrecht</code></a>
<a href="https://github.com/bipolar84"><code>@​bipolar84</code></a> <a
href="https://github.com/bitbalancer"><code>@​bitbalancer</code></a> <a
href="https://github.com/blackeyes-boy"><code>@​blackeyes-boy</code></a>
<a href="https://github.com/bobbygaerd"><code>@​bobbygaerd</code></a> <a
href="https://github.com/BodegaClaw"><code>@​BodegaClaw</code></a> <a
href="https://github.com/BorClaw"><code>@​BorClaw</code></a> <a
href="https://github.com/BottaniCals"><code>@​BottaniCals</code></a> <a
href="https://github.com/britrik"><code>@​britrik</code></a> <a
href="https://github.com/brokemac79"><code>@​brokemac79</code></a> <a
href="https://github.com/Bruce-Yii"><code>@​Bruce-Yii</code></a> <a
href="https://github.com/brunorapido"><code>@​brunorapido</code></a> <a
href="https://github.com/BsnizND"><code>@​BsnizND</code></a> <a
href="https://github.com/camerono"><code>@​camerono</code></a> <a
href="https://github.com/Carme99"><code>@​Carme99</code></a> <a
href="https://github.com/ceckert"><code>@​ceckert</code></a> <a
href="https://github.com/CHE10X"><code>@​CHE10X</code></a> <a
href="https://github.com/chelsealong"><code>@​chelsealong</code></a> <a
href="https://github.com/cipp-ashe"><code>@​cipp-ashe</code></a> <a
href="https://github.com/cjn119-ui"><code>@​cjn119-ui</code></a> <a
href="https://github.com/ckupferschmid"><code>@​ckupferschmid</code></a>
<a
href="https://github.com/cloudgg82-blip"><code>@​cloudgg82-blip</code></a>
<a href="https://github.com/cnflwzh"><code>@​cnflwzh</code></a> <a
href="https://github.com/cognos2013"><code>@​cognos2013</code></a> <a
href="https://github.com/colehammond65"><code>@​colehammond65</code></a>
<a
href="https://github.com/Colton-Harris"><code>@​Colton-Harris</code></a>
<a href="https://github.com/ComfyChloe"><code>@​ComfyChloe</code></a> <a
href="https://github.com/Conan-Scott"><code>@​Conan-Scott</code></a> <a
href="https://github.com/cookywook"><code>@​cookywook</code></a> <a
href="https://github.com/cortanapham"><code>@​cortanapham</code></a> <a
href="https://github.com/cpsleepy"><code>@​cpsleepy</code></a> <a
href="https://github.com/ctbritt"><code>@​ctbritt</code></a> <a
href="https://github.com/Cyb3rb1ade"><code>@​Cyb3rb1ade</code></a> <a
href="https://github.com/dale-goes-fast"><code>@​dale-goes-fast</code></a>
<a
href="https://github.com/damiansmazurek"><code>@​damiansmazurek</code></a>
<a
href="https://github.com/dankarization"><code>@​dankarization</code></a>
<a href="https://github.com/DasX"><code>@​DasX</code></a> <a
href="https://github.com/davidchyi-beep"><code>@​davidchyi-beep</code></a>
<a
href="https://github.com/davidcittadini"><code>@​davidcittadini</code></a>
<a
href="https://github.com/Davidofflol12"><code>@​Davidofflol12</code></a>
<a href="https://github.com/Dazlarus"><code>@​Dazlarus</code></a> <a
href="https://github.com/ddupg"><code>@​ddupg</code></a> <a
href="https://github.com/Deregtx"><code>@​Deregtx</code></a> <a
href="https://github.com/desksk"><code>@​desksk</code></a> <a
href="https://github.com/destinedenergy"><code>@​destinedenergy</code></a>
<a href="https://github.com/dh-js"><code>@​dh-js</code></a> <a
href="https://github.com/dimonnld"><code>@​dimonnld</code></a> <a
href="https://github.com/dltlaos11"><code>@​dltlaos11</code></a> <a
href="https://github.com/dmlau76"><code>@​dmlau76</code></a> <a
href="https://github.com/dmnksss"><code>@​dmnksss</code></a> <a
href="https://github.com/dom521"><code>@​dom521</code></a> <a
href="https://github.com/DonnieFi"><code>@​DonnieFi</code></a> <a
href="https://github.com/droidyouwerelookingfor"><code>@​droidyouwerelookingfor</code></a>
<a href="https://github.com/DrToNy1"><code>@​DrToNy1</code></a> <a
href="https://github.com/dustytext-bot"><code>@​dustytext-bot</code></a>
<a href="https://github.com/duybaovin"><code>@​duybaovin</code></a> <a
href="https://github.com/easyteacher"><code>@​easyteacher</code></a> <a
href="https://github.com/edenfunf"><code>@​edenfunf</code></a> <a
href="https://github.com/edgarstool"><code>@​edgarstool</code></a> <a
href="https://github.com/edrwalker"><code>@​edrwalker</code></a> <a
href="https://github.com/eefreenyc"><code>@​eefreenyc</code></a> <a
href="https://github.com/Eragim"><code>@​Eragim</code></a> <a
href="https://github.com/ericcaiwx-star"><code>@​ericcaiwx-star</code></a>
<a href="https://github.com/ericcurtin"><code>@​ericcurtin</code></a> <a
href="https://github.com/ericpearson"><code>@​ericpearson</code></a> <a
href="https://github.com/ERMALTA"><code>@​ERMALTA</code></a> <a
href="https://github.com/etzelm"><code>@​etzelm</code></a> <a
href="https://github.com/ezimerman"><code>@​ezimerman</code></a> <a
href="https://github.com/Fatal0607"><code>@​Fatal0607</code></a> <a
href="https://github.com/fduch-stranger"><code>@​fduch-stranger</code></a>
<a href="https://github.com/fede-kamel"><code>@​fede-kamel</code></a> <a
href="https://github.com/flynnmcpoc"><code>@​flynnmcpoc</code></a> <a
href="https://github.com/flyto168"><code>@​flyto168</code></a> <a
href="https://github.com/fozzels-assistant"><code>@​fozzels-assistant</code></a>
<a href="https://github.com/fray-ai"><code>@​fray-ai</code></a> <a
href="https://github.com/freshxiaoyao"><code>@​freshxiaoyao</code></a>
<a
href="https://github.com/fulgerulnegru"><code>@​fulgerulnegru</code></a>
<a
href="https://github.com/fuller-stack-dev"><code>@​fuller-stack-dev</code></a>
<a href="https://github.com/Gabrielnkl"><code>@​Gabrielnkl</code></a> <a
href="https://github.com/galiniliev"><code>@​galiniliev</code></a> <a
href="https://github.com/ge0el"><code>@​ge0el</code></a> <a
href="https://github.com/gennadyclaw"><code>@​gennadyclaw</code></a> <a
href="https://github.com/giodl73-repo"><code>@​giodl73-repo</code></a>
<a
href="https://github.com/GoldenrodScript"><code>@​GoldenrodScript</code></a>
<a href="https://github.com/gorkem2020"><code>@​gorkem2020</code></a> <a
href="https://github.com/goutamadwant"><code>@​goutamadwant</code></a>
<a href="https://github.com/Grynn"><code>@​Grynn</code></a> <a
href="https://github.com/guarismo"><code>@​...

_Description has been truncated_

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-10-03 15:52:31 -05:00