Skip to content

Providers: skip context1m beta for Anthropic OAuth tokens#24620

Merged
vincentkoc merged 10 commits intomainfrom
vincentkoc-code/pr-10647-context1m-auth
Feb 23, 2026
Merged

Providers: skip context1m beta for Anthropic OAuth tokens#24620
vincentkoc merged 10 commits intomainfrom
vincentkoc-code/pr-10647-context1m-auth

Conversation

@vincentkoc
Copy link
Member

@vincentkoc vincentkoc commented Feb 23, 2026

Summary

  • skip context-1m-* beta injection when Anthropic auth uses OAuth/subscription tokens (sk-ant-oat-*)
  • preserve required OAuth betas (oauth-2025-04-20, claude-code-20250219) so auth still works
  • update docs to call out this compatibility behavior
  • update tests to assert context1m beta is excluded for OAuth tokens

Why

Anthropic currently rejects context-1m-* beta + OAuth token combinations with HTTP 401. This keeps context1m working for API-key flows while avoiding OAuth failures.

Fixes: #10647
Fixes: #20354

Validation

  • pnpm format
  • pnpm tsgo
  • pnpm test src/agents/pi-embedded-runner-extraparams.test.ts

Greptile Summary

Implements OAuth token compatibility fix for Anthropic's context-1m-* beta header limitation. When OAuth/subscription tokens (sk-ant-oat-*) are detected, the PR skips injecting the context-1m-2025-08-07 beta header while preserving required OAuth betas (oauth-2025-04-20, claude-code-20250219). This prevents HTTP 401 errors from Anthropic when using context1m with OAuth authentication.

Key changes:

  • Updated createAnthropicBetaHeadersWrapper in src/agents/pi-embedded-runner/extra-params.ts to filter out context-1m-* beta for OAuth tokens while preserving OAuth-required betas
  • Replaced lookupContextTokens with new resolveContextTokensForModel function that integrates context1m awareness into context window resolution
  • Applied context token resolution updates across status display (status.ts), session storage (session-store.ts), and status summary (status.summary.ts)
  • Added comprehensive test coverage for OAuth token handling and context window display
  • Updated documentation to inform users about the OAuth + context1m incompatibility

Confidence Score: 5/5

  • This PR is safe to merge - implements a targeted compatibility fix with comprehensive test coverage and no breaking changes.
  • The implementation is clean, focused, and well-tested. The logic correctly filters the context1m beta header only for OAuth tokens while preserving all required OAuth betas. Test coverage validates both the OAuth token filtering behavior and the context window resolution. Documentation updates appropriately inform users about the limitation. The change is backwards compatible and follows the repository's coding standards.
  • No files require special attention

Last reviewed commit: 1f752b0

@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Feb 23, 2026
@vincentkoc vincentkoc marked this pull request as ready for review February 23, 2026 17:23
@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: M and removed size: XS labels Feb 23, 2026
@vincentkoc vincentkoc merged commit f03ff39 into main Feb 23, 2026
18 checks passed
@vincentkoc vincentkoc deleted the vincentkoc-code/pr-10647-context1m-auth branch February 23, 2026 17:29
jaydiamond42 pushed a commit to jaydiamond42/bloomtbot that referenced this pull request Feb 23, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
carlosrivera pushed a commit to myascendai/meshiclaw that referenced this pull request Feb 23, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
PR openclaw#24620 skipped context-1m-* models for OAuth tokens because Anthropic
returned HTTP 401. However, Anthropic now accepts these models for accounts
with Extra Usage enabled. The fix changes from pre-emptive blocking to
attempt-first behavior, only skipping on actual 401 responses.

Fixes openclaw#30049
planfit-alan pushed a commit to planfit/openclaw that referenced this pull request Mar 3, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display

(cherry picked from commit f03ff39)
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…4620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR size: M

Projects

None yet

1 participant