Repository navigation
feat(anthropic): migrate to Anthropic SDK 1.x - #189697
roboclaw-bot wants to merge 2 commits into
Conversation
Move @anthropic-ai/sdk 0.137.0 -> 1.3.0 and @anthropic-ai/vertex-sdk 0.22.0 -> 1.1.0 (newest releases at or before the 2026-10-24 cutoff). SDK 1.x defaults to API version 2026-10-21, sends API keys as bearer tokens, and its Vertex client copies the header version into the body. Keep the wire contract OpenClaw already sends from its fetch transport: anthropic-version 2023-06-01 (vertex-2023-10-16 on Vertex), API keys in X-Api-Key with Authorization nulled, and OAuth/Copilot/Foundry/Mantle on bearer auth. 2026-10-21 rejects temperature for Claude models that still accept it and is unavailable for pre-4.7 models on Bedrock, so adopting it stays a separate product change. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: ed351993-c71c-4bc1-9971-746b48ecf441
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesUpgrade the Anthropic and Vertex SDKs to 1.x while preserving authentication, API versions, and supported sampling. Example: Claude Sonnet 4.6 receives temperature 0.2 through the Anthropic provider.
Review scores
ProductKind: Maintenance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored migration open. It preserves existing provider contracts, remains absent from main, and introduces no actionable defect found in this review; the current-head CI gate passes. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe AI package converts conversation and generation options into Anthropic requests; provider plugins supply Mantle or Google credentials, and streamed responses become assistant events. flowchart LR
A[Conversation and options] --> B[Shared Anthropic request builder]
B --> C[Anthropic SDK provider]
B --> D[Fetch transport]
E[Vertex and Mantle adapters] --> C
C --> F[Provider endpoint]
D --> F
F --> G[Assistant stream events]
Technical reviewBest possible solution: Retain the focused SDK migration with explicit wire compatibility in the existing provider owners. Do we have a high-confidence way to reproduce the issue? This is a dependency migration; source inspection confirms the upstream default changes, and the PR reports red/green wire regressions without claiming a current-main incident. Is this the best way to solve the issue? The patch uses existing request and header owners to preserve compatibility, and the simplification review found no unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7fa562d7281b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +31, Tests +200, Config 0, Other +2. Total +233 across 16 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 31, 2026, 3:38 PM ET / 19:38 UTC. |
What Problem This Solves
Upgrade the Anthropic and Vertex SDKs to their eligible 1.x releases without silently changing authentication, request versions, or supported sampling behavior.
User Impact
No intended user-visible change. API keys remain in
X-Api-Key; OAuth/setup-token, Copilot, Foundry bearer and Mantle credentials remain bearer-authenticated; Vertex retains Google authentication. Custom temperature on older Claude models, streaming, tool calls, caching, thinking, refusals and error handling retain their existing contracts. Missing credentials still fail before network access.Why This Change Was Made
@anthropic-ai/sdk0.137.0 → 1.3.0 across root, AI package, Mantle and the existing shared pin;@anthropic-ai/vertex-sdk0.22.0 → 1.1.0. The existing Vertex-specific Google auth 11.3.1 override follows the upgraded parent. No new override policy or release-age exception.2026-10-21and bearer API keys. Use its documented custom-header support to preserve the existing2023-06-01API andX-Api-Keycontract, matching OpenClaw's fetch transport. Credential layers now merge case-insensitively so caller overrides replace rather than duplicate credentials.anthropic_versionand strips the header. Explicitly retainvertex-2023-10-16; Mantle retains2023-06-01.Upstream research and holds
Audit instant: 2026-10-31T16:54:00Z; inclusive cutoff: 2026-10-24T16:54:00Z. These are the newest qualifying releases: SDK 1.3.0 published October 23 at 23:31:47.897Z; Vertex 1.1.0 at 13:13:08.611Z. Registry integrity matches the generated lock. Application lock audit: 1,749 package identities before/after, only these two replacements, no other dependency-edge changes or downgrades after normalizing the intended upgrade.
Authoritative sources: SDK changelog, Vertex changelog, API migration guide.
Upstream highlights: 1.0 changes API version/authentication and role-specific message types; 1.1–1.3 add administrative endpoints and message threads, repair tool-runner behavior, and adjust endpoint query handling. Published tarball comparison confirms the SSE parser and error classes are unchanged; OpenClaw's
messages.create(...).asResponse()/Stream.rawEvents()path remains supported.Hold: adopting API version
2026-10-21. It rejects sampling parameters even on models that previously supported them, with no equivalent replacement, and Bedrock supports it only for Claude 4.7+. Adopting it would remove supported behavior and needs a separate product decision. This PR upgrades the SDKs using their supported explicit-version/header APIs instead.Unchanged: desktop runtime pruning still names SDK 0.132.1, already stale before this migration; its owner's re-audit is outside this change.
Evidence
Candidate:
c21aae8f1971b0ef916237d204153995e9b36bef(base1df551011c87ddab2b6e6edb316682cd8a9de1f2).pnpm install --lockfile-onlyandpnpm install --frozen-lockfile: passed. No hand-edited lockfile.git diff --check, and test-line ratchet passed. No lint/test suppressions or new unsafe casts.Timing: final AI batch 52s wrapper wall / 36s Vitest; extension batch 678s / 626s (91% transform); sibling/prefix batches 764s wrapper. Individual new wire tests are subsecond; CI timing remains pending. Earlier overloaded-host attempts timed out during declaration preparation and test transformation, before assertions; completed recovery checks above replace those incomplete attempts without weakening gates.
Remaining evidence limits: no authenticated live Anthropic, Vertex or Mantle call and no real-model Gateway E2E was run—task environment exposes none of their credentials. Wire/consumer proofs use synthetic external I/O. Hosted CI and required repository/security review remain pending; no merge or auto-merge requested.
Requested and guided by @steipete.
Work sessions
Worked on by