feat(provider): graceful context-1m fallback for sub-Tier-4 accounts#15641
feat(provider): graceful context-1m fallback for sub-Tier-4 accounts#15641sjawhar wants to merge 6 commits intoanomalyco:devfrom
Conversation
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
…ounting, use plugin fork for OAuth context cap
resolve: merge conflicts in generated SDK files
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
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. |
|
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:
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 |
|
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. |
Summary
context-1m-2025-08-07Anthropic beta header is rejected by accounts below Tier 4Changes
packages/opencode/src/provider/provider.ts— Added_context1mDisabledflag andstripContext1m()helper in the fetch wrapper for error-based retrypackages/opencode/test/provider/context1m.test.ts— 9 tests covering header stripping and error detectionContext
The
feat/opus-4-6-adaptive-thinkingbranch addscontext-1m-2025-08-07to 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-1mheader alone does NOT change pricing — premium rates (2× input, 1.5× output) only apply when actual input tokens exceed 200K.