Skip to content

fix(providers): forward default_headers to Anthropic/Bedrock clients - #38

Merged
zhanghanduo merged 4 commits into
mainfrom
fix/anthropic-default-headers
Sep 24, 2026
Merged

zhanghanduo merged 4 commits into
mainfrom
fix/anthropic-default-headers

Conversation

@zhanghanduo

Copy link
Copy Markdown
Collaborator

Summary

  • _build_anthropic dropped cfg["default_headers"], although AnthropicClient already passes them to both AsyncAnthropic and the Bedrock transport. Gateway routing/auth headers therefore never reached protocol: anthropic / bedrock requests.
  • Forward a copy (dict(cfg.get("default_headers") or {})); missing key → {}, same as before on the wire.
  • CHANGELOG entry under Unreleased.

Why

ApodexHarness PR #611 (Toolathlon) worked around this by turning miroharness.infra.protocol_client from a pure alias into a product adapter that re-implements the Anthropic builder and calls the private _enabled_thinking_budget. Once this ships and the pin is bumped, that shim can go back to an 8-line alias.

Test plan

  • New parametrized regression test_anthropic_builders_forward_default_headers (anthropic + bedrock, with and without headers)
  • uv run pytest -q: 1572 passed, 2 skipped
  • uv run ruff check . clean

🤖 Generated with Claude Code

zhanghanduo and others added 4 commits September 24, 2026 09:53
_build_anthropic dropped cfg['default_headers'] even though AnthropicClient
accepts and forwards them for both the direct and Bedrock transports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@zhanghanduo
zhanghanduo merged commit c7c952f into main Sep 24, 2026
5 checks passed
@zhanghanduo
zhanghanduo deleted the fix/anthropic-default-headers branch September 24, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant