GeezerVison is showing github.com — [backend] Port 1M context / adaptive thinking for Opus 4.6 (upstream #12338) · Issue #150 · randomm/opencode
[backend] Port 1M context / adaptive thinking for Opus 4.6 (upstream #12338) #150
Description
Description
Port upstream PR anomalyco#12342 to enable 1M context window and adaptive thinking for Claude Opus 4.6.
Scope
This is a major AI SDK upgrade (v5→v6) with breaking changes. Not a simple cherry-pick.
Changes Required
Phase 1 - Minimal (just headers + adaptive thinking):
- Add
context-1m-2025-08-07 beta header to Anthropic provider
- Add
adaptive-thinking-2026-01-28 beta header
- Add adaptive thinking detection for Opus 4.6 in transform.ts
- Convert budgetTokens → effort for Opus 4.6 models
Phase 2 - SDK Upgrade (breaking changes):
- Upgrade
ai 5.0.124 → 6.0.72
- Upgrade all @ai-sdk/* packages (18+ packages)
- Migrate LanguageModelV2 → LanguageModelV3
- Make toModelMessages async
- Rename tool factory functions
- Update test suites for new usage types
- Fix compaction token counting bug
Key Files
packages/opencode/src/provider/provider.ts - Beta headers
packages/opencode/src/provider/transform.ts - Adaptive thinking logic
packages/opencode/src/session/compaction.ts - Token counting
packages/opencode/src/session/llm.ts - Async migration
packages/opencode/src/session/prompt.ts - Type migration
packages/opencode/src/provider/sdk/copilot/responses/tool/* - Factory renames
Upstream Reference
Quality Gates
- Tests pass
- Type checking passes
- Manual test: Opus 4.6 with >200k tokens
Activity
randomm commented on Feb 6, 2026
Merged in PR #152 - 1M context headers and adaptive thinking for Opus 4.6
okhsunrog commented on Feb 6, 2026
@randomm could you explain to me what's happening here? I didn't get any review on my PR and I see a PR with a similar name getting merged, but obviously incomplete, as it doesn't actually enable adaptive thinking.
type: "enabled" is for manual thinking with budgetTokens. Adaptive thinking requires type: "adaptive".
okhsunrog commented on Feb 6, 2026
ah, sorry, I see that it's your fork, not opencode official repo
Metadata
Metadata
Development
No branches or pull requestsIssue actions