Skip to content

fix(openclaw): read the retrieve hash from params, not the tool-call id - #4641

Merged
JerrettDavis merged 2 commits into
headroomlabs-ai:mainfrom
Vivek1898:fix/4638-openclaw-retrieve-execute-args
Nov 5, 2026
Merged

JerrettDavis merged 2 commits into
headroomlabs-ai:mainfrom
Vivek1898:fix/4638-openclaw-retrieve-execute-args

Conversation

@Vivek1898

@Vivek1898 Vivek1898 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4638

Description

Problem

headroom_retrieve is registered through api.registerTool as a concrete OpenClaw tool. OpenClaw calls such a tool as execute(toolCallId, params, signal?, onUpdate?) (ErasedAgentToolExecute in src/agents/tools/common.ts), but the tool read its first argument as { hash }. At runtime hash was therefore the tool-call id string, the 24-hex check failed, and every real call returned Invalid hash format without sending a request. The same input passed as the only argument reached the proxy, which is why the reproducer in the issue isolates it cleanly.

Change

execute now takes the OpenClaw shape: when the first argument is a string (the tool-call id) the input comes from the second argument; when it is an object, as in a direct execute({ hash }) call, it is used as before. A missing or non-string hash takes the existing format-error path, so a bad call still fails closed without a request.

The hash format check and the return shape are unchanged. #4640 widens the accepted hash lengths in the same function; the two changes touch different lines of it.

Tests

plugins/openclaw/test/headroom-retrieve-execute-args.test.ts, with fetch stubbed:

  • execute("call_fixture", { hash }) sends GET /v1/retrieve/<hash> and does not return the format error;
  • execute({ hash }) still sends the request;
  • execute("call_fixture", { hash: "not-a-hash" }) and execute("call_fixture") return the format error without a request.

I could not run vitest here; the tests follow proxy-manager.test.ts in the same folder (vi.stubGlobal("fetch", ...)).


Devin Review

Type of Change

  • Bug fix

Changes Made

  • Select tool input from OpenClaw's second execute argument while preserving direct object calls and the existing hash policy.
  • Maintainer follow-up: assert the exact retrieved content in both successful argument-shape tests. Contributor runtime logic is unchanged.

Testing

  • Unit tests pass (full OpenClaw Vitest suite; Python tests are N/A for this TypeScript change)

Maintainer qualification on Windows, Node 22.22.0, Python 3.12.13: npm ci --no-audit --no-fund, npm test, npm run typecheck, and npm run build in plugins/openclaw. Full plugin suite: 145 passed, 2 Windows skips. Typecheck and package/declaration build passed. Test result assertions were strengthened after the initial run; the complete suite and typecheck were rerun successfully.

Test Output

$ npm test
Test Files 10 passed (10)
Tests 145 passed | 2 skipped (147)
$ npm run typecheck
(exit 0)
$ npm run build
ESM Build success
DTS Build success

Real Behavior Proof

  • Environment: Windows; built plugin; actual loopback TCP Uvicorn Headroom proxy from this PR, actual in-memory CompressionStore; offline and beacon opt-out enabled. Existing development native extension used for startup; no fresh native build claimed.
  • Exact command / steps: build the package; start create_app(ProxyConfig(stateless=True, optimize=False, cache_enabled=False, rate_limit_enabled=False, log_requests=False)) on a free localhost port; get_compression_store().store(original, "short", original_tokens=15, compressed_tokens=1); import createHeadroomRetrieveTool from dist/index.js; call await tool.execute("call_fixture", {hash}) and await tool.execute({hash}); JSON-parse and compare original_content to the stored Unicode original. Compare the same two-argument call with the unchanged execute implementation on fix(openclaw): accept 12-character hashes in headroom_retrieve #4640.
  • Observed result: both supported calls on this PR recovered the exact original, including Unicode, through real GET /v1/retrieve/{hash}. The prior implementation returned Invalid hash format for the OpenClaw call shape. Invalid hash input remained rejected before retrieval. The current upstream OpenClaw ErasedAgentToolExecute declaration independently confirms (toolCallId, params, signal?, onUpdate?).
  • Not tested: an installed OpenClaw agent session, model/provider calls, abort/update behavior, cross-platform runtime, fresh native build. The separate 12-character validator issue is scoped to fix(openclaw): accept 12-character hashes in headroom_retrieve #4640 and not fixed by this PR.

Runtime Rollout Safety

  • Rollout-managed feature(s): none; existing retrieval tool.
  • Minimum rollout channel: unchanged.
  • Stable/default behavior changed: valid OpenClaw tool calls can reach retrieval; direct calls remain supported.
  • Kill switch / disable path: existing plugin disable path.
  • Unsafe override required: no.
  • Qualification impact: focused argument-shape coverage, full plugin validation, real local proxy retrieval.
  • Rollback path: revert the change; no schema migration.

Review Readiness

Maintainer qualification and review of the test-only follow-up (not an inferred author attestation):

  • I have performed a self-review
  • This PR is ready for human review
    Hosted CI on the published final head must finish independently. No merge has been performed.

OpenClaw calls a registered tool as execute(toolCallId, params, signal?, onUpdate?). headroom_retrieve read its first argument as { hash }, so the tool-call id was validated as a hash and every real call returned the format error before any request. Read params when the first argument is the id; a direct execute({ hash }) call keeps working.

Fixes headroomlabs-ai#4638
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR governance

This PR follows the template and is marked ready for human review.

@github-actions github-actions Bot added the status: needs author action Pull request body or readiness checklist still needs author updates label Nov 5, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

@JerrettDavis JerrettDavis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the argument adapter and its registration against OpenClaw's execute(toolCallId, params, signal?, onUpdate?) declaration. The hash comes from params for OpenClaw calls, and direct object calls remain supported. Missing/invalid hash inputs fail before retrieval.

The published head includes only a maintainer test follow-up asserting the exact returned content for both successful call shapes. Full plugin validation passes: 145 tests, 2 Windows skips; typecheck and package/declaration build pass. A real TCP Uvicorn Headroom proxy and actual CompressionStore returned the exact Unicode original through the built tool for both call shapes, while the previous signature failed the OpenClaw call. Both Devin findings are addressed and resolved; the PR body records commands/output and qualification limits. Required exact-head CI and hosted rollup are green, and current main 31dcaf4 is included. No installed OpenClaw agent session or fresh native build is claimed. Approved for final human merge review; nothing merged.

@github-actions github-actions Bot added status: ready for review Pull request body is complete and the author marked it ready for human review and removed status: needs author action Pull request body or readiness checklist still needs author updates labels Nov 5, 2026
@JerrettDavis
JerrettDavis merged commit 362e1fc into headroomlabs-ai:main Nov 5, 2026
44 checks passed
JerrettDavis added a commit that referenced this pull request Nov 5, 2026
<!-- maintainer-current-main -->
## Maintainer latest-main checkpoint
Published `930d7f115250cb8d0344f0be8e4fa3fc9f40faa3` incorporates
current upstream main `e4a60ed72f6ef5b28569f8bfbe2163cfda32c948` after a
clean merge. 153 plugin tests pass, 2 Windows skips; typecheck/build
pass. Eight actual TCP/store retrieval cases again recover exact
originals through direct/OpenClaw calls and lowercase/uppercase
12/24-character keys. Contributor correctness logic was not rewritten.
Earlier qualification captures below retain their original
commit/platform scope. Hosted CI must finish on this exact head before
approval; nothing merged.
<!-- /maintainer-current-main -->

## Description

The OpenClaw `headroom_retrieve` tool rejected 12-character hashes with
"Invalid hash format. Expected 24 hex characters." before the request
could reach `GET /v1/retrieve/{hash}`. The SmartCrusher row-drop path
keys its CCR markers with a 12-char SHA-256 hex prefix, mirrored into
the compression store through `explicit_hash`, so 12-char keys are valid
retrieval keys. Every other marker consumer in the repo already accepts
both lengths; this validator was the odd one out.

Closes #4639

## Type of Change

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

## Changes Made

- `plugins/openclaw/src/tools/headroom-retrieve.ts`: validator now
accepts 12- or 24-character hex hashes
(`/^(?:[a-f0-9]{12}|[a-f0-9]{24})$/i`); error message and both the tool
and parameter descriptions updated to say 12 or 24.
- `plugins/openclaw/test/headroom-retrieve.test.ts`: new regression
tests — 12-char accepted (reaches fetch), uppercase 12-char accepted,
24-char still accepted, non-hex / 13-char / empty rejected without a
fetch call, and both descriptions mention both lengths.

## Testing

- [x] New tests added for new functionality
- [x] Manual testing performed

The template's pytest/ruff/mypy items are N/A here: this change is
TypeScript-only, in the OpenClaw plugin. What actually ran (fresh clone
at upstream main 31dcaf4, Node v22.23.1, plugin dir `plugins/openclaw`,
`npm ci`):

### Test Output

```text
$ npx vitest run
 Test Files  10 passed (10)
      Tests  150 passed (150)

$ npm run typecheck
(no output — clean)
```

Before the fix, the issue's repro form showed a 12-char hash refused
locally (`{"error":"Invalid hash format. Expected 24 hex characters."}`,
fetch not called) while a 24-char hash reached the stub backend. After
the fix, both lengths reach the stub backend. The new test file fails
6/7 on the unpatched validator and passes 7/7 after; the one test that
passes on both sides is the "24-char still accepted" guard, which exists
to prove the fix did not regress the length that already worked. Full
suite went from 9 files / 143 tests to 10 files / 150 tests.

## Real Behavior Proof

- Environment: fresh clone of headroomlabs-ai/headroom at main 31dcaf4,
Node v22.23.1, npm 11.20.0, vitest, plugin dir `plugins/openclaw`.
- Exact command / steps: `npm ci`, then `npx vitest run` (full plugin
suite) and `npm run typecheck`; plus the issue's repro form (stubbed
fetch, call `headroom_retrieve` with a 12-char hash, observe whether a
request goes out) run before and after the patch.
- Observed result: 12-char hash now produces `GET
/v1/retrieve/{12-char-hash}` against the stub and returns the stored
content; suite 150/150 green, typecheck clean.
- Not tested: no live Headroom proxy (fetch stubbed throughout, so no
real round trip against a running Headroom); no Python or Rust suites
(change is TypeScript-only); no `npm run build`; no in-OpenClaw agent
session; other plugins were not checked for a copy of the same
validator.

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: N/A
- Stable/default behavior changed: yes, intentionally — 12-character
hashes are now accepted instead of rejected; 24-character behavior is
unchanged, and all other lengths and non-hex input are still rejected.
- Kill switch / disable path: none needed; revert the commit to restore
the old behavior.
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this commit.

## Review Readiness

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

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [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 — no UI change.

## Additional Notes

One honest caveat on the tests: the "24-char still accepted" test passes
before and after by design (it guards against regression, so it cannot
fail on the unpatched code). The file as a whole fails before the fix
and passes after, which is what the repo's bug-fix rule asks for. The
three rejection tests fail pre-fix only on the changed error string;
their accept/reject verdicts are unchanged.
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4640"
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 -->

## Maintainer follow-up qualification
Published `9bcb14fc447abdc844b77c399691e6bbc9e208f2` includes latest
main `ddbbb07746a274da5c9bd7380a42ba2a46e7515d`, including #4641's
OpenClaw execute adapter and the tsup update. The merge is clean;
contributor normalization logic is unchanged. The previous uppercase
finding is fixed by lowercasing accepted keys before the GET request,
with URL assertions for both lengths.

Windows, Node 22.22.0, Python 3.12.13: `npm ci --no-audit --no-fund`,
`npm test`, `npm run typecheck`, `npm run build` all pass. Full plugin
suite: **153 passed, 2 skipped**, 11 test files; package and
declarations build successfully.

Actual runtime proof: start an offline/beacon-opt-out localhost TCP
Uvicorn `create_app(ProxyConfig(stateless=True, optimize=False,
cache_enabled=False, rate_limit_enabled=False, log_requests=False))`;
store a Unicode original with `get_compression_store().store(original,
"short")` and again with `explicit_hash="a1b2c3d4e5f6"`; import
`createHeadroomRetrieveTool` from the built `dist/index.js`. For each
12/24-character lowercase and uppercase key, call both
`tool.execute({hash})` and `tool.execute("call_fixture", {hash})`,
JSON-parse the response, and assert `original_content` equals the exact
original and returned `hash` equals lowercase input. **All eight real
GET round-trips succeed**. The prior uppercase 404 no longer reproduces.
Both Devin findings are addressed by the code/test follow-up and this
live proof.

Not tested: an installed OpenClaw agent session, model/provider calls,
native rebuild, non-Windows runtime. Existing development native
extension was used only for proxy startup. Hosted checks must complete
on the final published head; nothing merged.

---------

Co-authored-by: JerrettDavis <[email protected]>
mosatch added a commit to mosatch/headroom that referenced this pull request Nov 7, 2026
- fix(deps): patch OpenClaw Undici and narrow E2E audit exceptions (headroomlabs-ai#4453)
- feat(ccr): Redis backend, one CCR store for every replica (headroomlabs-ai#4368)
- fix(cache): bound the router's compression cache, keep the rest in SQLite (headroomlabs-ai#4357)
- feat(compress): share /v1/compress sessions across replicas via Redis (headroomlabs-ai#4369)
- fix(proxy): keep in-period costs in the budget ledger when the entry cap is reached (headroomlabs-ai#4448)
- fix(proxy): import Response at runtime in the Bedrock handler (headroomlabs-ai#4397)
- fix(tabular): pass tables with repeated header names through verbatim (headroomlabs-ai#4278)
- fix(smart-crusher): match audit-safe protected_patterns against unescaped text (headroomlabs-ai#4294)
- fix(copilot): detect COPILOT_API_URL in cli-main.js for Copilot CLI >= 1.0.93 (headroomlabs-ai#4450)
- fix(proxy): do not rebuild a failed turn-hook re-drive as HTTP 200 (headroomlabs-ai#4398)
- fix(transforms): keep the fences of a code block passed through for a protected tag (headroomlabs-ai#4292)
- fix(cache): keep indented lines intact in OpenAI whitespace normalization (headroomlabs-ai#4343)
- fix(gemini): keep snake_case inline_data and function parts when compressing (headroomlabs-ai#4290)
- fix(proxy): record outcome when a passthrough stream ends mid-character (headroomlabs-ai#4429)
- fix(image): flatten transparent images onto white before re-encoding as JPEG (headroomlabs-ai#4296)
- fix(proxy): honor bypass header and license gate in Anthropic batch create (headroomlabs-ai#4411)
- fix(install): keep the HuggingFace cache on a writable mount in Docker presets (headroomlabs-ai#4207) (headroomlabs-ai#4209)
- fix(opencode): do not rewrite an OpenCode config that fails to parse (headroomlabs-ai#4424)
- fix(openai): recompress cached Responses units whose CCR entries expired (headroomlabs-ai#4146)
- fix(kompress): never drop words the model did not see (headroomlabs-ai#4175)
- fix(proxy): bound per-model state keyed by the client model string (headroomlabs-ai#4407)
- fix(copilot): preserve native inline OAuth identity (headroomlabs-ai#4144)
- fix(proxy): drop web_search_call history from a Responses request with no web_search tool (headroomlabs-ai#4202)
- fix(security): restrict the Windows runtime log via NTFS ACL, not just warn (headroomlabs-ai#4135)
- fix(sdk): preserve Vercel AI SDK file and image parts through compression (headroomlabs-ai#4048)
- fix(ci): pin checkout in release notification smoke workflow (headroomlabs-ai#4399)
- docs(troubleshooting): explain the frozen ghcr.io/chopratejas/headroom image (headroomlabs-ai#4069)
- fix(proxy): count output tokens from CRLF-framed SSE streams too (headroomlabs-ai#4298)
- fix(telemetry): give empty-item compressions a stable tool signature (headroomlabs-ai#4396)
- fix(proxy): keep tool deferral for GitHub Copilot upstream (headroomlabs-ai#4356)
- fix(savings): key a Responses conversation on its thread, not the shared session (headroomlabs-ai#4440)
- fix(storage): normalize timezone-aware JSONL time filters (headroomlabs-ai#4063)
- fix(gateway): keep input_includes_cache when re-drive usage is merged (headroomlabs-ai#4423)
- fix(proxy): copy cached tool compaction results (hardening) (headroomlabs-ai#4410)
- fix(image): clear last_result before each compress() call (headroomlabs-ai#4341)
- fix(memory): resolve partial IDs beyond the first 1000 records (headroomlabs-ai#4389)
- fix(memory): ignore incidental cwd prose (headroomlabs-ai#4166)
- fix(mcp): accept the JSONC opencode config that wrap and install already accept (headroomlabs-ai#4297)
- fix(proxy): accept HEADROOM_MEMORY_INJECTION_MODE=tool (headroomlabs-ai#4395)
- fix(memory): treat a cwd with no UTF-8 form as unresolved instead of raising (headroomlabs-ai#4167)
- fix(opencode): restore process env keys on transport dispose (headroomlabs-ai#4430)
- docs: drop effort-routing text that headroomlabs-ai#3377 removed (headroomlabs-ai#4449)
- fix(transforms): pass HeadroomConfig.smart_crusher to the default pipeline's router (headroomlabs-ai#4243)
- fix(proxy): skip memory tool injection on streamed OpenAI requests (headroomlabs-ai#4451)
- fix(learn): anchor the managed block on its last start marker, append when no end marker (headroomlabs-ai#4342)
- fix(proxy): keep negative compression savings across restart (headroomlabs-ai#4406)
- fix(ccr): recognize client-owned MCP retrieval aliases (headroomlabs-ai#4165)
- fix(logs): count omitted levels from dropped lines (headroomlabs-ai#4141)
- fix(zcode): skip providers that point at the Headroom proxy itself (headroomlabs-ai#4413)
- fix(memory): bound retrieval queries before embedding (headroomlabs-ai#4244)
- fix(offline): keep litellm's pricing table local under HEADROOM_OFFLINE (headroomlabs-ai#4242)
- feat(proxy): report the same tool savings on gateway /v1/compress as the proxy path (headroomlabs-ai#4467)
- chore: release 0.42.0 (headroomlabs-ai#4228)
- deps: Bump the npm-minor-patch group across 3 directories with 9 updates (headroomlabs-ai#4495)
- deps: Bump the npm-minor-patch group across 2 directories with 14 updates (headroomlabs-ai#4455)
- deps: require Python 3.11; clear Dependabot alerts in the 3.10 lock fork (headroomlabs-ai#4517)
- docs(teams): replace the 3-months-free perk with a talk-to-us pitch (headroomlabs-ai#4524)
- fix(docker): install the redis extra in every image (headroomlabs-ai#4514)
- fix(packaging): rename the sandbox extra to lean and correct SECURITY.md claims (headroomlabs-ai#3727)
- fix(openclaw/release): ship responsive npm integrations (headroomlabs-ai#1458)
- fix(memory): fail close unresolved project operations (headroomlabs-ai#2637)
- fix(proxy): install SOCKS support for websocket proxies (headroomlabs-ai#3357)
- fix(pricing): add Claude Haiku 5.5 rates, 1M context and its 100K long-prompt card (headroomlabs-ai#4037)
- fix(proxy): keep deferred tool loads out of the prefix-tracker lineage key (headroomlabs-ai#4204)
- fix(transforms): stop an embedded markdown table from dropping the rest of a tool result (headroomlabs-ai#4216)
- fix(client): store metrics at HeadroomConfig.store_url (headroomlabs-ai#4270)
- fix(install): write persistent shell env values verbatim (headroomlabs-ai#4289)
- fix: do not report a seeded stored setting as an env override (headroomlabs-ai#4326)
- fix(cache): invalidate configured registry instances on replacement (headroomlabs-ai#4363)
- fix(cache): validate malformed learned TTL values (headroomlabs-ai#4364)
- fix(memory): bound history traversal on cyclic supersession links (headroomlabs-ai#4366)
- fix(memory): skip the edit-distance retry check on long commands (headroomlabs-ai#4371)
- fix(memory): match compound and null SQLite metadata filters (headroomlabs-ai#4373)
- fix(proxy): log unknown model ids as one bounded token; skip unparseable PERF lines (headroomlabs-ai#4374)
- fix(memory): preserve relationships when updating graph entities (headroomlabs-ai#4379)
- chore(sdk-typescript): npm metadata and the proxy requirement up front (headroomlabs-ai#4536)
- fix(proxy): recognise every local spelling of the proxy in the cc-switch loop guard (headroomlabs-ai#4405)
- fix(proxy): do not book Gemini countTokens as a request outcome (headroomlabs-ai#4412)
- fix(router): keep small shell results verbatim (headroomlabs-ai#3590) (headroomlabs-ai#4426)
- fix(codex): accept multi-line inline tables in Codex config.toml (headroomlabs-ai#4436)
- fix(proxy): preserve response cache keys across in-place hooks (headroomlabs-ai#4457)
- fix(transforms): tolerate malformed assistant tool calls in ContentRouter.apply (headroomlabs-ai#4459)
- fix(read-lifecycle): keep Reads fresh after a failed Edit or Write (headroomlabs-ai#4461)
- fix(mixed-content): do not carve ISO-timestamped log rows as search results (headroomlabs-ai#4463)
- fix(install): tolerate absent Windows tasks in stop_supervisor (headroomlabs-ai#4465) (headroomlabs-ai#4468)
- fix(tokenizers): don't cache token-count inputs larger than max_chars (headroomlabs-ai#4469)
- fix(compaction): reject negative dictionary indices and non-array legends in expand_compacted (headroomlabs-ai#4470)
- fix(tokenizers): coerce structured text values in message token counters (headroomlabs-ai#4472)
- docs: clarify Target savings metric is % of new input tokens (headroomlabs-ai#4485)
- fix(toin): skip a malformed pattern instead of aborting the store load (headroomlabs-ai#4484)
- fix(client): close upstream responses when wrapped streams are closed (headroomlabs-ai#4482)
- fix(cache): namespace SemanticCacheLayer by provider, model and metadata (headroomlabs-ai#4473)
- fix(router): validate lossless provider output on the excluded-tool path (headroomlabs-ai#4486)
- fix(dedup): bound line-number digit run and never fold into a longer pointer (headroomlabs-ai#4488)
- fix(sdk): send Anthropic messages to /v1/compress natively so thinking blocks survive (headroomlabs-ai#4489)
- fix(doctor): detect root openai_base_url Codex routing and agent-configured proxy ports (headroomlabs-ai#4490)
- fix(proxy): cap cache_control breakpoints on OpenAI chat path (headroomlabs-ai#4471) (headroomlabs-ai#4491)
- fix(cache): count a tool_result with no text as replayable in the frozen prefix (headroomlabs-ai#4523)
- fix(proxy): keep read maturation out of the provider-confirmed prefix (headroomlabs-ai#4522)
- fix(relevance): cap embedding batch size so ORT's arena stays small (headroomlabs-ai#4507)
- fix(transforms): honour Subscription toin_read_only when the router calls SmartCrusher (headroomlabs-ai#4493)
- fix(transforms): enforce role, mutable, and cache zone guards in batch compression (headroomlabs-ai#4480) (headroomlabs-ai#4494)
- fix(transforms): preserve YAML block scalar data during comment elision (headroomlabs-ai#4498)
- fix(memory): compare SQLite timestamps as UTC instants (headroomlabs-ai#4499)
- fix(client): preserve Anthropic create stream flags (headroomlabs-ai#4500)
- fix(client): honor configured cache optimizer enablement (headroomlabs-ai#4501)
- fix(proxy): don't fail startup when libc_ver() can't read the interpreter (headroomlabs-ai#4519)
- fix(security): lstat before narrowing sqlite files (headroomlabs-ai#4527)
- docs(site): Python-first quickstart and a FastAPI page built on compress() (headroomlabs-ai#4529)
- fix(cache): preserve OpenAI tool block metadata on cached replay (headroomlabs-ai#4334)
- fix(evals): reject changed numeric probe values (headroomlabs-ai#4502)
- fix(tokenizers): price Anthropic document blocks by page count, not as base64 text (headroomlabs-ai#4441)
- fix(deps): clear the glob and minimatch npm audit findings (headroomlabs-ai#4599)
- test(proxy): make compression timeout regression deterministic (headroomlabs-ai#4587)
- deps: bump ruff from 0.17.0 to 0.17.2 in the pip-minor-patch group across 1 directory (headroomlabs-ai#4380)
- ci: Bump actions/setup-python from 6 to 7 (headroomlabs-ai#4558)
- fix(mcp): confine headroom_read to the workspace (GHSA-8g49-pg6g-xgrf) (headroomlabs-ai#4525)
- ci: Bump the actions-minor-patch group with 2 updates (headroomlabs-ai#4557)
- deps: Bump the npm-minor-patch group across 1 directory with 6 updates (headroomlabs-ai#4621)
- chore(deps): bump the uv group across 1 directory with 2 updates (headroomlabs-ai#4537)
- deps: Bump @anthropic-ai/sdk from 0.133.0 to 1.3.0 in /sdk/typescript (headroomlabs-ai#4554)
- fix(proxy): keep tool deferral on Copilot Business/Enterprise/Individual hosts (headroomlabs-ai#4608)
- fix(deps): bump mem0ai, langgraph and langgraph-sdk past open advisories (headroomlabs-ai#4614)
- deps: Bump the cargo-minor-patch group across 1 directory with 12 updates (headroomlabs-ai#4553)
- deps: Bump tsup from 8.5.1 to 9.0.0 in /sdk/typescript (headroomlabs-ai#4386)
- deps: Bump tsup from 8.5.1 to 9.0.0 in /plugins/opencode (headroomlabs-ai#4385)
- deps: Bump lru from 0.18.5 to 0.19.0 (headroomlabs-ai#4382)
- fix(cli): document that code-aware compression is enabled by default (headroomlabs-ai#4616)
- fix(proxy): keep health probes and the Codex attestation out of the proxy log (headroomlabs-ai#4611)
- fix(privacy): turn off ONNX Runtime's Microsoft telemetry by default (headroomlabs-ai#4602)
- test(deps): fail when a composite extra's uv.lock list drops a nested extra's package (headroomlabs-ai#4598)
- deps: qualify latest Anthropic SDK 1.4.0 in docs (headroomlabs-ai#4556)
- fix(router): preserve read protection for quiet sed options (headroomlabs-ai#4521)
- fix(wrap): overwrite drifted selfheal hook command instead of skipping it (headroomlabs-ai#2723)
- fix(langgraph): replace the compressed ToolMessage in graph state (headroomlabs-ai#4620)
- test(wrap): isolate two auth-precedence tests from the caller's ANTHROPIC_* env (headroomlabs-ai#4601)
- fix(privacy): turn off Mem0's PostHog telemetry by default (headroomlabs-ai#4619)
- fix(relevance): hand the embedding arena back after each run on macOS (headroomlabs-ai#4567)
- fix(codec): reject densified blocks with mismatched row counts (headroomlabs-ai#4271)
- fix(proxy): skip the memory-context search in cache mode (headroomlabs-ai#4606)
- fix(pipeline): store the pipeline input in CCR behind offload markers (headroomlabs-ai#4576)
- fix(backends/litellm): keep cache_control on text blocks for Bedrock prompt caching (headroomlabs-ai#4565)
- fix(relevance): load the Rust default embedder from Python's pinned snapshot (headroomlabs-ai#4190)
- fix(smart-crusher): preserve unchanged JSON bytes (headroomlabs-ai#4044)
- fix(scripts): resolve hooks dir via git so install-git-hooks works in linked worktrees (headroomlabs-ai#4176)
- fix(proxy/memory): harden _extract_tool_calls against malformed choices and blocks (headroomlabs-ai#2483)
- fix: Add info about apply to README.md (headroomlabs-ai#1592)
- Fix(proxy) vertex model override propagation (headroomlabs-ai#2367)
- fix(backends): forward the standard service_tier param (litellm + anyllm) (headroomlabs-ai#2468)
- fix(wrap): route OMP OpenAI providers through Headroom (headroomlabs-ai#2755)
- fix(proxy): warm deferred kompress model so /health stops reporting backend=null (headroomlabs-ai#2799)
- ci: run eval smoke test on Rust compressor changes (headroomlabs-ai#2948)
- fix(proxy): handle ClientDisconnect in anthropic_messages (headroomlabs-ai#3532)
- fix(output-savings): rewrite a pre-rule ledger once instead of warning on every /stats poll (headroomlabs-ai#4196)
- fix(openclaw): record turn advancements as one marker file per key (headroomlabs-ai#4212)
- fix(ccr): keep proactive expansion out of the cached prefix (headroomlabs-ai#4300)
- fix(proxy): route /v1/models to the x-headroom-base-url upstream (headroomlabs-ai#4308)
- fix(docker): pass RUNTIME_HOME=/root for root bake targets (headroomlabs-ai#4445)
- docs: fix generate_report example arguments (headroomlabs-ai#4435)
- fix(proxy): forward Copilot accounting headers on streaming path (headroomlabs-ai#4431)
- fix(memory): bound verb-pattern word runs to stop quadratic backtracking in bridge import (headroomlabs-ai#4370) (headroomlabs-ai#4376)
- fix(cache): fail closed on SQLite corruption instead of deleting the store online (headroomlabs-ai#4361)
- fix(proxy): reconcile Chat content-block cache markers after prefix replay (headroomlabs-ai#4333)
- fix(diff): keep combined-diff changes made against a later parent (headroomlabs-ai#4318)
- fix(opencode): only route POST requests to LLM endpoint paths (headroomlabs-ai#4464)
- fix: [BUG] A timeout in one image compression call resets the shared worker pool and affects concurrent requests (headroomlabs-ai#4528)
- docs(readme): lead with two front doors and one measured savings claim (headroomlabs-ai#4530)
- docs(llms): add a by-task section and state the measured savings claim once (headroomlabs-ai#4531)
- docs: add AGENTS.md for agents using Headroom and agents changing the repo (headroomlabs-ai#4532)
- docs(pypi): job-word summary and keywords, and a PyPI-specific README (headroomlabs-ai#4534)
- deps: qualify latest compatible docs and E2E tools (headroomlabs-ai#4580)
- fix(proxy): preserve retrieval outputs across Codex WS deltas (headroomlabs-ai#4574)
- fix(sdk): carry Vercel AI SDK reasoning parts and provider options through compression (headroomlabs-ai#4564)
- feat(savings): show the proxy's model-routing savings in headroom savings (headroomlabs-ai#4304)
- feat(plugins): headroom skill for Claude Code, Codex, Copilot and skills.sh (headroomlabs-ai#4533)
- fix(providers): isolate resolved Anthropic context limits (headroomlabs-ai#4593)
- fix(proxy): honor x-headroom-base-url on provider passthrough routes (headroomlabs-ai#4596)
- fix(packaging): use direct CLI module entry point (headroomlabs-ai#2665)
- test(onnx): fix magika idle-thread test on macOS with ORT 1.31 (headroomlabs-ai#4194)
- fix(memory): dispatch core text search to the async FTS5 adapter (headroomlabs-ai#4365)
- fix: [BUG] DirectMem0Adapter.search_memories calls removed mem0 search API (headroomlabs-ai#4518)
- fix(toin): retain pending changes after filesystem save failures (headroomlabs-ai#4568)
- fix(thinking): isolate compaction memo by compressor instance (headroomlabs-ai#4569)
- fix(cache): build semantic entry before evicting so a failed embedding keeps live entries (headroomlabs-ai#4581)
- fix(tabular): keep empty records and separator-like Markdown body rows (headroomlabs-ai#4582)
- fix(code): preserve syntax in CCR retrieval comments (headroomlabs-ai#4583)
- fix: [BUG] Saved request metrics lose their cache optimization fields (headroomlabs-ai#4584)
- fix(proxy): preserve Cline headroom__headroom_retrieve results from recompression (headroomlabs-ai#4586)
- fix(cache): scope router results to request compression policy (headroomlabs-ai#4590)
- fix(proxy): keep mid-conversation system sections for third-party models (headroomlabs-ai#4591)
- feat(mcp)!: port MCP servers to SDK 2.x (headroomlabs-ai#4603)
- fix(proxy): strip upstream transport framing headers from Gemini response replays (headroomlabs-ai#4605)
- fix(code): keep multi-line class headers' opening brace (headroomlabs-ai#4623)
- fix(code): keep Rust attributes attached to their items (headroomlabs-ai#4624)
- docs: add Kong AI Gateway integration page (headroomlabs-ai#4625)
- fix: use all user text blocks for relevance scoring (headroomlabs-ai#4628)
- fix: [BUG] Volatile SQLite metrics stores lose their schema before the first save (headroomlabs-ai#4633)
- fix(kompress): read the pinned snapshot from Python's one HF cache in the native proxy (headroomlabs-ai#4438)
- test(tokenizer): hold the env lock in the invalid-repo Hub error test (headroomlabs-ai#4151)
- fix(proxy): skip memory-context search in cache mode on OpenAI routes (headroomlabs-ai#4632)
- fix(proxy): skip memory-context search on OpenAI paths in cache mode (headroomlabs-ai#4634)
- feat(ccr): answer headroom_retrieve on streaming chat completions (headroomlabs-ai#4631)
- fix(openclaw): read the retrieve hash from params, not the tool-call id (headroomlabs-ai#4641)
- fix(proxy): bypass compression for large admitted histories (headroomlabs-ai#4142)
- fix(tokenizers): resolve tiktoken encoding for gateway-prefixed model ids (headroomlabs-ai#4637)
- fix(proxy): answer /api/hello probes behind the token gate, log rejection context (headroomlabs-ai#4150)
- fix(memory): keep learned evidence until persistence succeeds (headroomlabs-ai#4229)
- fix(proxy): allow loopback-published container hosts to access /debug/memory (headroomlabs-ai#4259)
- fix(code): keep semicolon-separated statements valid (headroomlabs-ai#4630)
- fix(config): use the longest matching model_context_limits prefix (headroomlabs-ai#4288)
- fix(transforms): recognise code fences whose info string is not a bare word (headroomlabs-ai#4291)
- fix(transforms): stop the dense-line elider cutting Chinese, Japanese and Thai prose (headroomlabs-ai#4295)
- fix(cache): reject nonpositive semantic cache capacities (headroomlabs-ai#4301)
- fix(proxy): strip only one leading space from SSE field values (headroomlabs-ai#4306)
- fix(tokenizers): honor registered model factories (headroomlabs-ai#4437)
- fix(memory): preserve parent scopes when clearing memories (headroomlabs-ai#4305)
- deps: Bump tsup from 8.5.1 to 9.0.0 in /plugins/openclaw (headroomlabs-ai#4384)
- fix(diff): renumber hunk headers after trimming context (headroomlabs-ai#4319)
- fix(kompress): keep words past the tokenizer's truncation point (headroomlabs-ai#4328)
- fix(tabular): keep tables whose columns share a name (headroomlabs-ai#4329)
- fix(proxy): let model discovery honor the custom base URL (headroomlabs-ai#4330)
- fix(offline): guard the learn and memory-eval LLM calls under HEADROOM_OFFLINE (headroomlabs-ai#4344)
- fix(proxy): keep Gemini memory context on entries with non-text parts (headroomlabs-ai#4506)
- docs(security): sync security model with egress pollers, counts and beacon payload (headroomlabs-ai#4539)
- fix(proxy): say a forwarded streaming error came from the provider (headroomlabs-ai#4629)
- fix(install): stabilize Windows task lifecycle and eliminate console window popup (headroomlabs-ai#4627)
- fix(ccr): buffer a stream only for a marker new this turn (headroomlabs-ai#4607)
- fix(toin): preserve stores that exceed the byte limit (headroomlabs-ai#4589)
- fix(opencode): route Copilot Claude models through the proxy (headroomlabs-ai#4594)
- fix(thinking): leave a thinking block with a null or non-string value unchanged (headroomlabs-ai#4562)
- fix(tabular): keep interior blank CSV rows instead of dropping them (headroomlabs-ai#4563)
- fix(update-check): skip releases with no files and do not fall back to an uninstallable version (headroomlabs-ai#4560)
- fix(core): case-insensitive Bearer scheme, clamp SQLite CCR TTLs, redact the Redis URL in logs (headroomlabs-ai#4561)
- fix(kompress): run the CPU and ONNX Runtime loader guards before building a session (headroomlabs-ai#4559)
- fix(router): gate block-form tool output against cached lossy results (headroomlabs-ai#4504)
- ci: bump astral-sh/setup-uv from 10.3.2 to 10.3.3 in the actions-minor-patch group (headroomlabs-ai#4659)
- deps: update tomlkit requirement from <1.0,>=0.15.0 to >=0.15.2,<1.0 (headroomlabs-ai#4653)
- deps: bump ruff from 0.17.2 to 0.17.3 in the pip-minor-patch group (headroomlabs-ai#4652)
- docs(security): describe the per-route outcome of an unsafe base-URL override (headroomlabs-ai#4660)
- chore: release 0.43.0 (headroomlabs-ai#4643)
- fix(router): log the ONNX fallbacks at info instead of warning (headroomlabs-ai#4535)
- fix: keep parent predicates when clearing a narrower memory scope (headroomlabs-ai#4327)
- fix(proxy): preserve Unicode separators in SSE JSON (headroomlabs-ai#4337)
- fix(proxy): bound the model-keyed tokenizer, beacon and litellm caches (headroomlabs-ai#4497)
- fix(router): keep tagged blocks out of the lossy size-gate fallback (headroomlabs-ai#4543)
- fix(ccr): keep the in-memory order queue from evicting re-stored entries (headroomlabs-ai#4545)
- fix(ort): avoid implicit runtime discovery from the workspace (headroomlabs-ai#4570)
- fix(ccr): only refuse a bare marker, not originals that start and end with markers (headroomlabs-ai#4626)
- fix(proxy): use HTTP/1.1 client for ChatGPT streaming and model metadata (headroomlabs-ai#4006)
- test(gemini): serve the memory-tail tests' body through request.stream() (headroomlabs-ai#4645)
- fix(kompress): load ONNX Runtime through the dynamic loader guard before building a session (headroomlabs-ai#4644)
- fix(openclaw): accept 12-character hashes in headroom_retrieve (headroomlabs-ai#4640)
- deps: bump the npm-minor-patch group across 3 directories with 6 updates (headroomlabs-ai#4662)
- fix(release): normalize damaged release PR envelopes before detection (headroomlabs-ai#4664)
- fix(memory): replace the HNSW vector when a memory is re-indexed (headroomlabs-ai#4649)
- fix(memory): read the relation key the memory_save schema advertises (headroomlabs-ai#4647)
- chore: release 0.43.1 (headroomlabs-ai#4661)
- fix(proxy): keep cold-turn reasoning drops sticky so the next warm turn reuses the cached prefix (headroomlabs-ai#4592)
- fix(tabular): split fixed-width rows on column boundaries, not on double spaces (headroomlabs-ai#4541)
- fix(learn): support opencode v2 session schema in learn scanner (headroomlabs-ai#4199)
- fix(proxy): rename leaked_threads metric to timed_out_workers_total (headroomlabs-ai#3908)
- fix(content-router): trust confident HTML detection over mixed-content heuristics (headroomlabs-ai#3627)
- deps: bump the npm-minor-patch group across 1 directory with 2 updates (headroomlabs-ai#4650)
- deps: update tree-sitter requirement from <0.27,>=0.25.2 to >=0.26.0,<0.27 (headroomlabs-ai#4656)
- fix(proxy): add --no-ccr-response-handling flag to bypass response buffering (headroomlabs-ai#3082) (headroomlabs-ai#3100)
- fix(install): make install status agree with doctor when the proxy is reachable (headroomlabs-ai#3072) (headroomlabs-ai#3141)
- fix(cli): resolve active proxy port for read commands (headroomlabs-ai#3522)
- feat(providers): add Hermes agent wrap support (headroomlabs-ai#934)
- deps: update click requirement from >=8.3.3 to >=8.5.0 (headroomlabs-ai#4655)
- deps: update sqlite-vec requirement from >=0.1.6 to >=0.1.9 (headroomlabs-ai#4654)
- deps: bump rusqlite from 0.40.2 to 0.41.1 (headroomlabs-ai#4658)
- deps: bump the cargo-minor-patch group with 3 updates (headroomlabs-ai#4657)
- fix(kompress): prevent loading model when enable_kompress is False (headroomlabs-ai#4667)
- fix(kompress): let the next window decide the words past the token cut (headroomlabs-ai#4669)
- fix(sdk): keep Vercel AI SDK tool-result output kinds through compression (headroomlabs-ai#4670)
- ci: pin every GitHub Action to a commit SHA (headroomlabs-ai#4671)
- fix(memory): keep multimodal user content intact when injecting memories (headroomlabs-ai#4648)
- fix(router): ignore shell operators inside quoted arguments in read detection (headroomlabs-ai#4646)
- fix(packaging)!: keep PyTorch extras out of all (headroomlabs-ai#4067)
- fix(langchain): check optional integration availability (headroomlabs-ai#4042)
- fix(memory): gracefully degrade on context lookup and initialization errors (headroomlabs-ai#3251) (headroomlabs-ai#4049)
- fix(install): decode Windows Task Scheduler XML output before parsing (headroomlabs-ai#3969) (headroomlabs-ai#4064)
- fix(search_compressor): keep kept rows byte-for-byte and in input order (headroomlabs-ai#3982)
- fix(telemetry): keep install ID stateless (headroomlabs-ai#3542)
- fix(providers): count Anthropic tool_result/tool_use content blocks in OpenAI token counter (headroomlabs-ai#2681)
- fix(binaries): fail closed on HEADROOM_BINARIES_ALLOW_UNVERIFIED=0/false (headroomlabs-ai#3218)
- fix(doctor): recognize IPv6 loopback and case-insensitive proxy routing URLs (headroomlabs-ai#3255)
- fix(vertex): explain Vertex failures in-band, correct the model/region matrix (headroomlabs-ai#2640)
JerrettDavis added a commit that referenced this pull request Nov 8, 2026
…re shape (#4617)

## Description

Two gaps stop a gateway from using `/v1/compress` well. Both showed up
while fixing LiteLLM's `headroom` guardrail, which is the follow-up PR
that needs this one.

1. **No mode compresses messages losslessly without markers.** A gateway
with no retrieval loop can't resolve a marker or call
`headroom_retrieve`, so it needs a mode with nothing to retrieve. The
existing marker-free modes still run lossy compressors.
2. **Hooks guess the provider from the model name.** A gateway can send
any client's shape to any model. Claude Code's Anthropic body routed to
Gemini looked like OpenAI, so skill condensing found nothing to change.

## Type of Change

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

## Changes Made

**`config.mode="lossless"`**
- Runs format-native folds only, with no markers and no CCR store
writes. A registered lossless provider still applies.
- Turns off stale-Read pointers, which drop the file body and need the
retrieval tool.
- Turns off cross-turn dedup pointers, which a client that never numbers
its messages can't resolve.
- Scope: the guarantee covers message compression (lossless codecs, no
CCR). On a gateway turn, tool schema compaction and registered turn
hooks still run as configured, as in every other mode; description
truncation only happens when an operator sets
`HEADROOM_TOOL_DESC_MAX_CHARS`.

**`provider_for_body`**
- Hooks and the session tracker now use the body's wire shape, and fall
back to the model name when the shape proves nothing, such as plain text
with no system prompt or tools.
- Anthropic's own tool types (server tools such as
`web_search_20250305`, client tools such as `bash_20250124`) end in an
eight-digit date and count as the Anthropic shape, so a first-turn body
whose only tool is a server tool is read correctly.
- `route.provider` still follows the model.
- The cache breakpoint budget runs when either the shape or the model is
Anthropic, and never on a Responses body.
- `gateway_response_fields` loses its unused `provider` parameter, and
`RESPONSE_RECEIVED` keeps reporting the model's provider.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`, `ruff format --check .`, on the
pinned 0.17.0)
- [ ] Type checking passes (`mypy headroom`): one error, in
`headroom/integrations/langchain/chat_model.py`, which this PR doesn't
touch (local mypy 1.19.1)
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
pytest tests/test_proxy_compress_endpoint.py tests/gateway tests/test_gateway_turn_unit.py tests/test_compress_route_tokenizer_by_model.py
425 passed, 4 skipped

Regression tests with the fixes removed: 8 failed, 7 passed
```

## Real Behavior Proof

- **Environment:** LiteLLM main with the follow-up guardrail change,
this branch as the sidecar, and a fake upstream that simulates prompt
caching. No real provider API was called.
- **Exact command / steps:** replayed a scripted 17-call agent session
with exact-duplicate outputs removed, once direct to the fake upstream
and once through LiteLLM and `/v1/compress`.
- **Observed result:** 0 errors, 0 rewrites of already-sent results,
`Read` and `Edit` results unchanged, about 1.3s added in total.

| Client | Prompt cost vs direct |
|---|---|
| Anthropic Messages, Claude Code cache markers | −3.9% |
| Chat Completions | −3.8% |
| Responses | −4.1% |

The script's outputs are synthetic, so treat these as a comparison
between setups, not a forecast for real traffic.

## Known limits

- The default mode and `lossy_inline` can still return a stale-Read
`Retrieve original: hash=` marker, although the docs call them
marker-free. This predates the PR and needs a separate fix. Proxy
`--lossless` has no read-lifecycle guard either, from reading the code.
- With no `ContentRouter`, `_derived_compress_pipeline` falls back to
the default pipeline, so `lossless` wouldn't hold. Production always has
a router, so only test stubs reach this.

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

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

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4617"
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 -->

## Maintainer post-merge revisit: main e9331b6
Published head `e50b001bd05c9bc85405accca49cbef0e7786e51` incorporates
upstream main `e9331b6b963b5b6554f45943abed2366aaa25ea6` after #4142,
#4637 and #4641 merged. 164 endpoint/gateway/tokenizer/admission tests
pass; one json_minifier strategy assertion fails identically on actual
main e9331b6. Ruff/format/diff pass. Import-only conflict resolved by
retaining both provider_for_body and RequestBodyTooLarge. Both existing
holds reconfirmed: lossless HTTP output removes unique description
suffix via tool_desc_compaction; Anthropic server tool with Gemini model
is classified OpenAI.

Contributor correctness logic was not rewritten. The existing Changes
Requested decision remains applicable; unchanged findings are not
reposted as duplicate reviews. Scoped Windows qualification uses the
existing development native extension, not a fresh build. Hosted checks
must finish independently; no contributor CI action requested and
nothing merged by this review.


## Maintainer post-merge revisit: main cc1eb54
Published `38b871120e318f6eaa1cb2ce16f96d4f6cc2b1e8` includes upstream
main `cc1eb5402aade58204b96b6b4b4d280cdd5456d2`. 90 gateway/tokenizer
tests pass; both existing HTTP/provider counterexamples reconfirmed.
Clean merge; Ruff/format/diff pass. Contributor correctness logic was
not rewritten. The existing Changes Requested decision remains
applicable; unchanged findings are not reposted. Scoped Windows
qualification uses the existing development native extension, not a
fresh build. Hosted checks must finish independently; nothing merged by
this review.


### Maintainer current-main requalification

Exact head `33395b5cdd7ee9facce9f97f2a3250f5e6e49cb2`, upstream main
`ecbaf86d78cf52d185fbffa306157b9a4cc1b906`.

Mechanically merged upstream/main
ecbaf86 without changing contributor
policy logic. Re-reviewed the combined gateway/provider delta and
existing comments. All 90 focused gateway/tokenizer tests and ten
inherited Gemini fixture cases pass; Ruff0.17.3 lint/format and
whitespace checks pass. The shared Gemini repair was already present, so
no duplicate fixture commit was added.

Both existing correctness findings independently remain on this combined
tree. An HTTP200 /v1/compress request with config.mode=lossless still
drops UNIQUE_REQUIREMENT_AT_END from a long tool description, reporting
tool_desc_compaction. An Anthropic web_search_20250305 tool body with a
Gemini-named model still returns provider openai. Existing requested
semantic fixes/regressions remain necessary; maintainers are handling CI
and no contributor CI execution is requested. No contributor logic was
rewritten and nothing merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `4c40adb53a68f382e32f00620adcfaf1cff477f5`, upstream main
`8d3e9e5ca7cd645eb73084b848edbea5fc796e1a`.

Clean mechanical sync with upstream
main8d3e9e5ca7cd645eb73084b848edbea5fc796e1a including intervening
release/runtime/cache/CCR/SSE/HTTP1.1 merges. No contributor
gateway/provider policy rewritten. Fresh author/Devin discussion
considered.100focused gateway-contract/tokenizer/Gemini tests
pass;7changed Python files pass Ruff0.17.3check/format and whitespace
checks pass. Last main delta after test start changes only
Rust/OpenClaw, leaving tested Python inputs unchanged.

Both existing blockers remain freshly reproduced from this worktree
(source import path verified): real app POST/v1/compress lossless
returns200 but drops UNIQUE_REQUIREMENT_AT_END from tool description via
tool_desc_compaction; Anthropic server-tool wire shape with Gemini model
returns provider openai. Preserve promised lossless content and classify
server-tool wire forms correctly, with regressions. No external provider
session/nativebuild claimed. Copied extension supports Python startup;
maintainers handle hosted checks. Nothing merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `8b7b2b0d02daf1a031828ecb13095ab315431f7e`, upstream main
`917edc62230c3c4a8a415e2053da68dab1f003dd`.

Current-main integration against917edc62230c3c4a8a415e2053da68dab1f003dd
is clean. Compared entire headroom/crates/Python manifests+lock/tests
inputs to prior qualified4c40adb53: byte-identical. Intervening changes
are reviewed npm maintenance and release-envelope recovery workflow; no
contributor gateway policy changed.75new-base
release-workflow/normalizer tests pass,whitespace passes.
Prior100gateway/tokenizer/Gemini results remain scoped to those
identical inputs rather than relabeled fresh.

Both gateway blockers freshly rechecked from worktree: Anthropic
server-tool+Gemini body classifiesopenai; actual lossless/v1/compress
returns200 but drops unique description suffix via tool_desc_compaction.
Retain existing losslessness/classification corrections. No fresh
nativebuild/provider claim. Maintainers handle exactheadCI;nothing
merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `490ff6defdebddda9106e9e143d42d1e463b6324`, upstream main
`7592e681459f14a2041eb5f524a658cb6ad1dd92`.

Clean integration with upstream/main
7592e68. Reviewed both intervening
memory fixes and fresh PR discussion. Gateway/runtime/Rust inputs are
unchanged from the previously reviewed head; only the two main memory
fixes and their regressions enter this merge. Nine memory/Gemini
regression tests pass; main-relative whitespace passes.

Fresh actual-app probes retain both existing blockers: Anthropic
server-tool content with a Gemini model classifies as OpenAI; lossless
/v1/compress removes the unique tool-description suffix through
tool_desc_compaction. No contributor policy was rewritten. Existing
native extension used for Python startup, not a fresh native-build
claim. Maintainers handle hosted checks; nothing merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `d3cb3a02af03991a696461160ee0db322dd8bf48`, upstream main
`2d3ee51846435ef5b320eea4806af14e602b0d8c`.

Clean integration with upstream/main
2d3ee51 after the external 0.43.1
release merge. Exact headroom/crates/tests comparison against prior
reviewed 490ff6d shows no changes. Re-reviewed generated release
metadata; 78 release/version/MCP tests pass on this composed tree, and
whitespace passes. Previous nine memory/Gemini regressions and fresh
gateway probes remain scoped to identical runtime inputs.

Both established blockers remain: lossless /v1/compress drops the unique
tool-description suffix, and Anthropic server-tool content with a Gemini
model classifies as OpenAI. Runtime probes were not relabeled as rerun
after this metadata-only merge. No contributor policy rewritten; no
fresh native-build claim. Maintainers handle exact-head checks; nothing
merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `e0c873630e9ffc7bc0d0d2fdd22c483b731e49a3`, upstream main
`910588e6b15ab54c4099d03703e5fa20c8abb757`.

Clean mechanical synchronization with upstream
main910588e6b15ab54c4099d03703e5fa20c8abb757, including the externally
merged runtime fixes, docs dependency update and tree-sitter lock
repair. No contributor gateway/provider policy rewritten. Current
author/Devin discussion considered. All90 gateway
contract/tokenizer-by-model tests pass on the preceding composed runtime
tree; the final dependency-only merge changes only pyproject/uv.lock,
leaving those gateway/tokenizer sources unchanged. No redundant rerun on
the final merge is claimed. Changed Python Ruff lint/format and
main-relative whitespace pass.

Both existing blockers freshly reproduce on the composed runtime paths:
lossless /v1/compress returns200 but drops UNIQUE_REQUIREMENT_AT_END
from the tool description and reports tool_desc_compaction; Anthropic
server-tool content with a Gemini model is classified as OpenAI.
Preserve the lossless original payload and classify the full request
protocol consistently, with endpoint regressions for these inputs. The
main fixes do not close either defect.

Tests use the existing native core for startup, not a fresh native
build; no live provider traffic was made. Maintainers handle hosted
checks; no inherited-main pipeline failure attributed and nothing
merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `507433606f698249e546e1418928caee99d0c901`, upstream main
`7877241d84c93b3ec487e07324245838ddae85cc`.

Clean mechanical integration with
upstream/main7877241d84c93b3ec487e07324245838ddae85cc. Gateway
production/contracts remain byte-identical to the preceding reviewed
head; re-reviewed the new CLI/Hermes integration.127 gateway
request/response contract and model-tokenizer tests pass; whitespace
passes. Both existing holds freshly reproduce on this exact tree:
lossless /v1/compress returns200 while dropping
UNIQUE_REQUIREMENT_AT_END and reporting tool_desc_compaction; Anthropic
server-tool content with a Gemini model is classified as OpenAI.
Preserve the lossless original payload and classify the full request
protocol consistently, with endpoint regressions. No contributor
gateway/provider policy rewritten. Existing native core used for
startup; no fresh native build or live provider claim. Maintainers
handle hosted checks; nothing merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `b0daece6b10f623a6e7b0dc3eb01c73e05fa3209`, upstream main
`c01cf07d943d816cfd9d97e6838ed4e38f1ff9a4`.

Final post-Dependabot requalification against upstream/main
c01cf07. All six Dependabot updates are
now merged. Relative to this branch's freshly tested prepared tree, the
final main sync changes only the three intended Cargo.lock records;
Python/source/test inputs are unchanged. Re-reviewed the integration and
confirmed complete native source/lock/toolchain objects match the tested
combined build and exact fresh native DLL used for this branch's local
tests.

Focused fresh-native qualification: 127 passed, 3 warnings in 104.78s
(0:01:44). Selected real dependency overlays and native DLL paths are
recorded in final4617-fresh-native-tests.log; the DLL provenance/input
hashes are in final-native-artifact-proof.json. No redundant rerun is
implied after this Cargo-only merge. Whitespace passes. Prior source
review and scoped real-behavior evidence remain applicable to unchanged
contributor inputs.

Both existing blockers freshly reproduce using the combined native DLL:
lossless /v1/compress returns200 but removes UNIQUE_REQUIREMENT_AT_END
and reports tool_desc_compaction; Anthropic server-tool content with a
Gemini model is classified as OpenAI. Preserve the original lossless
payload and classify the complete wire protocol, with endpoint
regressions.

Maintainers handle hosted checks; no external-provider claim,
contributor semantic rewrite or non-Dependabot merge.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `ec6abc0228a93c5eab1881938041dfee344b1e3a`, upstream main
`2973ca593d2fe65c3259941fdff8009175eff456`.

Requalified after human merges #4667/#4669/#4670 against upstream main
ce42754. All 11 integration patches
exactly match the prior-main-to-current-main delta after ignoring diff
locations; no contributor gateway/provider policy changed. Fresh gateway
request/response contracts, model-tokenizer, gateway unit,
Kompress-disable and must-keep suites: 207 passed, 3 warnings. Six
changed Python files pass Ruff lint/format; offline lock validation and
whitespace pass. Existing matching-core DLL used; native
source/lock/toolchain unchanged by these main merges, with no fresh
native build or live-provider claim. Both existing blockers freshly
reproduce: lossless /v1/compress returns 200 while removing
UNIQUE_REQUIREMENT_AT_END and reporting tool_desc_compaction; Anthropic
server-tool content with a Gemini model is classified as OpenAI.
Preserve original lossless payload and recognize complete wire protocol
with endpoint regressions. Author and Devin discussions checked;
existing findings remain actionable. Maintainers handle hosted checks;
nothing merged.
Subsequent human merge #4671 advanced main to
2973ca5 before publication; guard
stopped the old candidate. Cleanly integrated the new workflow-only
delta and re-reviewed action pinning with 62 workflow/release tests
passing. Runtime/native sources are byte-identical to the immediately
preceding 207-test and real-behavior qualification; those results apply
to unchanged inputs. All prior-main hosted results are historical for
readiness.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `9f857218486fa451ecacc675863a64bc95f45bb0`, upstream main
`2b0315b2d4b0d54947050bbdad2de9e89df06378`.

Current-main requalification
against2b0315b2d4b0d54947050bbdad2de9e89df06378 after later human
merges. All37 integration patches exactly match2973ca59-to-current-main
delta after diff-location normalization; contributor gateway/provider
policy unchanged.393gateway request/response
contracts,model-tokenizer,gateway
unit,Kompress-disable,must-keep,doctor,search tests
pass;3warnings.27changedPythonfiles pass Ruff lint/format;offline
lock/whitespacepass. Existing pr3982 native DLL verified every tracked
native-input hash/artifactchecksum;no fresh build claimed. Author/Devin
discussion checked. Both correctness blockers freshly reproduce:lossless
/v1/compress returns200while droppingUNIQUE_REQUIREMENT_AT_END and
reportingtool_desc_compaction;Anthropicserver-toolcontent
withGeminimodel classifiedOpenAI. Preserve original lossless payload and
classify full request wire protocol consistently,with endpoint
regressions. No live provider qualification,contributor logic rewrite,or
inherited-main CI fault attributed. Maintainers handle hosted
checks;nothing merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.


### Maintainer current-main requalification

Exact head `41b2145418db7f5980cd52e6235ab330fcd31ac0`, upstream main
`0ddaa56c21cdc01c4774391fdcc69e987ecc4e5c`.

Clean integration with upstream/main
0ddaa56. All 17 integration patches
exactly match the prior-reviewed-main to current-main delta after
diff-location normalization; contributor gateway/provider policy is
unchanged. Fresh gateway/tokenizer/search/doctor and incoming
Vertex/backend/CLI qualification: 455 passed, 11 skipped, 3 warnings.
Additional gateway request/response contracts and compress-endpoint
suite: 158 passed, 1 warning. Twelve changed Python files pass Ruff
lint/format; offline lock and whitespace checks pass.

Author discussion and outstanding Devin findings read. Both existing
correctness findings freshly reproduce on this exact tree: lossless
/v1/compress returns 200 but drops UNIQUE_REQUIREMENT_AT_END through
tool_desc_compaction; Anthropic server-tool content with a Gemini model
classifies as OpenAI. Existing requested corrections remain; no new
duplicate finding. Local app probes are not live provider proof. Native
DLL reused only after verifying the complete tracked input set, every
recorded input SHA256 and artifact checksum against
pr3982-c01-native-proof.json; no fresh build claimed. Maintainers handle
exact-head hosted checks. No PR merged.


Exact-head hosted checks are being handled by maintainers. Existing
correctness/qualification holds remain; nothing merged.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: JD Davis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready for review Pull request body is complete and the author marked it ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenClaw headroom_retrieve reads toolCallId as args and rejects valid hashes

2 participants