GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(provider): graceful context-1m fallback for sub-Tier-4 accounts by sjawhar · Pull Request #15641 · anomalyco/opencode

Conversation

@sjawhar

@sjawhar sjawhar commented Mar 2, 2026

Copy link
Copy Markdown

Summary

  • Adds graceful error handling when the context-1m-2025-08-07 Anthropic beta header is rejected by accounts below Tier 4
  • On the first request, if Anthropic returns HTTP 400 with "long context beta not available", the fetch wrapper strips the header, retries immediately, and remembers to skip it for the rest of the process
  • Zero configuration required — Tier 4+ accounts get 1M context automatically, sub-Tier-4 accounts fall back to 200K seamlessly

Changes

  • packages/opencode/src/provider/provider.ts — Added _context1mDisabled flag and stripContext1m() helper in the fetch wrapper for error-based retry
  • packages/opencode/test/provider/context1m.test.ts — 9 tests covering header stripping and error detection

Context

The feat/opus-4-6-adaptive-thinking branch adds context-1m-2025-08-07 to the static Anthropic beta header, enabling 1M context for supported models. However, this breaks accounts below Tier 4 ($400 cumulative deposits) which receive a hard error. This PR makes the feature degrade gracefully.

Note: The context-1m header alone does NOT change pricing — premium rates (2× input, 1.5× output) only apply when actual input tokens exceed 200K.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DusKing1 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
sjawhar and others added 6 commits February 27, 2026 19:43
@sjawhar
feat(session): allow setting custom session ID when creating a session
c2b4476
Add optional `id` field to Session.create() with strict format validation
(ses_ + 12 lowercase hex + 14 Base62). Duplicate IDs return 409 Conflict.

- Add `id` field with regex validation to Session.create schema
- Add duplicate session ID check before creation
- Add DuplicateIDError (NamedError) with 409 status mapping
- Update OpenAPI spec and regenerate SDK with id field + 409 response
- Add 6 tests: custom ID, default behavior, duplicate, invalid prefix/format

Closes anomalyco#12916

resolve: custom session id conflicts
@okhsunrog @sjawhar
feat(provider): add 1M context beta header, fix SDK v6 token double-c…
af6f0a1
…ounting, use plugin fork for OAuth context cap
@sjawhar
feat(session): add messageCount endpoint for efficient message counting
852eafa
resolve: merge conflicts in generated SDK files
@sjawhar
docs: design doc for session-aware 1M context auto-escalation
354eeb7
@sjawhar
feat(provider): auto-retry without context-1m header when account lac…
1220a78
…ks access
@sjawhar
feat(provider): auto-retry without context-1m header when account lac…
9b392ca
…ks access
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 2, 2026
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found some related PRs, but none appear to be duplicates of PR #15641. Here's what I found:

Related (but distinct) PRs:

  1. feat(provider): add 1M context window support for Anthropic models (PR feat(provider): add 1M context window support for Anthropic models #14375)

    • Likely implements the initial 1M context feature that PR feat(provider): graceful context-1m fallback for sub-Tier-4 accounts #15641 builds upon
  2. feat(provider): add adaptive thinking and 1M context support for Claude Opus 4.6 (PR feat(provider): add adaptive thinking and 1M context support for Claude Opus 4.6 #12342)

    • Earlier work on context support, likely a foundation for this feature
  3. fix(provider): enable 1M context for Vertex AI Anthropic models (PR fix(provider): enable 1M context for Vertex AI Anthropic models #14055)

    • Related to context features but for Vertex AI specifically

PR #15641 is distinct from these because it specifically addresses the graceful degradation for sub-Tier-4 accounts (adding error handling and fallback logic) rather than implementing the core 1M context feature itself.

No duplicate PRs found

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 2, 2026
📊 AI CLI 工具社区动态日报 2026-03-02 duanyytop/agents-radar#40
Closed
@sjawhar

sjawhar commented Mar 2, 2026

Copy link
Copy Markdown
Author

Closing — this PR includes unrelated merge parents. The context-1m fallback change will be included when the parent feature branch (feat/opus-4-6-adaptive-thinking) is ready.

DusKing1 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sjawhar sjawhar closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@sjawhar @okhsunrog
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.