Skip to content

fix: inject anthropic service_tier for OAuth auth#55922

Merged
vincentkoc merged 4 commits intoopenclaw:mainfrom
Cypherm:fix/oauth-service-tier
Mar 29, 2026
Merged

fix: inject anthropic service_tier for OAuth auth#55922
vincentkoc merged 4 commits intoopenclaw:mainfrom
Cypherm:fix/oauth-service-tier

Conversation

@Cypherm
Copy link
Copy Markdown
Contributor

@Cypherm Cypherm commented Mar 27, 2026

No description provided.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Mar 27, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 27, 2026

Greptile Summary

This PR removes the OAuth token (sk-ant-oat-*) exclusion from createAnthropicFastModeWrapper, allowing OAuth-authenticated requests to receive service_tier injection (auto or standard_only) just like regular API key requests. This fixes unnecessary 529 overloaded errors for OAuth users during high API load. The isAnthropicOAuthApiKey helper remains in use in createAnthropicBetaHeadersWrapper for beta-header filtering, so it is not dead code.\n\nKey changes:\n- anthropic-stream-wrappers.ts: Removes || isAnthropicOAuthApiKey(options?.apiKey) from the early-return guard in createAnthropicFastModeWrapper\n- pi-embedded-runner-extraparams.test.ts: Flips the existing OAuth test assertion from "does not inject" to "injects auto"; adds a second regression test covering fastMode: falsestandard_only\n\nThe fix is correct, well-scoped, and well-tested. The existing guard at line 370 (if (payloadObj.service_tier === undefined)) ensures pre-set values are never overwritten.

Confidence Score: 5/5

This PR is safe to merge — the change is minimal, correct, and well-covered by updated tests.

One line removed from an early-return guard; the fix aligns OAuth token behavior with regular API key behavior and is backed by two targeted regression tests. No P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
src/agents/pi-embedded-runner/anthropic-stream-wrappers.ts Removes the OAuth token exclusion from the service_tier injection guard — one-line fix, correct and minimal.
src/agents/pi-embedded-runner-extraparams.test.ts Flips existing OAuth test assertion and adds a regression test for fastMode: false → standard_only.

Reviews (1): Last reviewed commit: "fix: inject anthropic service_tier for O..." | Re-trigger Greptile

@Cypherm
Copy link
Copy Markdown
Contributor Author

Cypherm commented Mar 27, 2026

@vincentkoc — OAuth tokens now receive service_tier injection, matching Claude Code CLI behavior. Reduces avoidable 529 cascades during high API load. 2 files, +22/-4. Fixes #55758.

@Mdx2025

This comment was marked as spam.

@vincentkoc vincentkoc self-assigned this Mar 29, 2026
Cypherm and others added 2 commits March 30, 2026 07:40
Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758
@vincentkoc vincentkoc merged commit 924c264 into openclaw:main Mar 29, 2026
8 checks passed
@Mdx2025

This comment was marked as spam.

Alix-007 pushed a commit to Alix-007/openclaw that referenced this pull request Mar 30, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
alexjiang1 pushed a commit to alexjiang1/openclaw that referenced this pull request Mar 31, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
pgondhi987 pushed a commit to pgondhi987/openclaw that referenced this pull request Mar 31, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Tardisyuan pushed a commit to Tardisyuan/openclaw that referenced this pull request Apr 30, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix: inject anthropic service_tier for OAuth auth

Remove the OAuth-token exclusion from createAnthropicFastModeWrapper
so that sk-ant-oat-* requests receive service_tier injection, matching
Claude Code CLI behavior and reducing avoidable 529 overload cascades.

isAnthropicOAuthApiKey remains in use in createAnthropicBetaHeadersWrapper
for beta header selection — it is not dead code after this change.

Fixes openclaw#55758

* docs(changelog): note anthropic oauth service tier fix

* Update CHANGELOG.md

---------

Co-authored-by: Cypherm <28184436+Cypherm@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants