Skip to content

Commit f56c865

Browse files
committed
fix(#170): remove 1m-context fork feature — causes startup errors
1 parent a2f91e8 commit f56c865

6 files changed

Lines changed: 25 additions & 49 deletions

File tree

‎.fork-features/manifest.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
}
5959
},
6060
"1m-context": {
61-
"status": "active",
61+
"status": "dropped",
62+
"droppedReason": "Caused startup errors; feature removed in issue #170",
6263
"description": "1M token context window for Anthropic Opus models. Requires Tier 4 account ($400 credits).",
6364
"issue": "https://github.com/randomm/opencode/issues/150",
6465
"newFiles": [],

‎packages/opencode/src/cli/cmd/tui/routes/session/index.tsx‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import path from "path"
1616
import { useRoute, useRouteData } from "@tui/context/route"
1717
import { useSync } from "@tui/context/sync"
1818
import { SplitBorder } from "@tui/component/border"
19+
import { Spinner } from "@tui/component/spinner"
1920
import { useTheme } from "@tui/context/theme"
2021
import {
2122
BoxRenderable,
@@ -1577,7 +1578,13 @@ function InlineTool(props: {
15771578
)
15781579
}
15791580

1580-
function BlockTool(props: { title: string; children: JSX.Element; onClick?: () => void; part?: ToolPart }) {
1581+
function BlockTool(props: {
1582+
title: string
1583+
children: JSX.Element
1584+
onClick?: () => void
1585+
part?: ToolPart
1586+
spinner?: boolean
1587+
}) {
15811588
const { theme } = useTheme()
15821589
const renderer = useRenderer()
15831590
const [hover, setHover] = createSignal(false)
@@ -1600,9 +1607,16 @@ function BlockTool(props: { title: string; children: JSX.Element; onClick?: () =
16001607
props.onClick?.()
16011608
}}
16021609
>
1603-
<text paddingLeft={3} fg={theme.textMuted}>
1604-
{props.title}
1605-
</text>
1610+
<Show
1611+
when={props.spinner}
1612+
fallback={
1613+
<text paddingLeft={3} fg={theme.textMuted}>
1614+
{props.title}
1615+
</text>
1616+
}
1617+
>
1618+
<Spinner color={theme.textMuted}>{props.title.replace(/^# /, "")}</Spinner>
1619+
</Show>
16061620
{props.children}
16071621
<Show when={error()}>
16081622
<text fg={theme.error}>{error()}</text>
@@ -1655,6 +1669,7 @@ function Bash(props: ToolProps<typeof BashTool>) {
16551669
<BlockTool
16561670
title={title()}
16571671
part={props.part}
1672+
spinner={isRunning()}
16581673
onClick={overflow() ? () => setExpanded((prev) => !prev) : undefined}
16591674
>
16601675
<box gap={1}>

‎packages/opencode/src/plugin/copilot.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
305305
if (!incoming.model.providerID.includes("github-copilot")) return
306306

307307
if (incoming.model.api.npm === "@ai-sdk/anthropic") {
308-
output.headers["anthropic-beta"] =
309-
"claude-code-20250219,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-1m-2025-08-07"
308+
output.headers["anthropic-beta"] = "interleaved-thinking-2025-05-14"
310309
}
311310

312311
const session = await sdk.session

‎packages/opencode/src/provider/provider.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export namespace Provider {
7373
options: {
7474
headers: {
7575
"anthropic-beta":
76-
"claude-code-20250219,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-1m-2025-08-07",
76+
"claude-code-20250219,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
7777
},
7878
},
7979
}
@@ -647,12 +647,6 @@ export namespace Provider {
647647
variants: {},
648648
}
649649

650-
// Override context limit for Anthropic models with context-1m header support
651-
// The models.dev API returns 200k for these models, but with our context-1m header they support 1M
652-
if (provider.id === "anthropic" && (m.id.startsWith("claude-sonnet-") || m.id.startsWith("claude-opus-4"))) {
653-
m.limit.context = 1_000_000
654-
}
655-
656650
m.variants = mapValues(ProviderTransform.variants(m), (v) => v)
657651

658652
return m

‎packages/opencode/src/provider/transform.ts‎

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -451,40 +451,8 @@ export namespace ProviderTransform {
451451

452452
case "@ai-sdk/anthropic":
453453
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/anthropic
454-
case "@ai-sdk/google-vertex/anthropic": {
454+
case "@ai-sdk/google-vertex/anthropic":
455455
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-vertex#anthropic-provider
456-
const modelId = model.id || ""
457-
const isOpus46 =
458-
modelId.includes("claude-opus-4.6") ||
459-
modelId.includes("claude-opus-4-6") ||
460-
modelId.includes("claude-opus-4.6")
461-
462-
if (isOpus46) {
463-
// Opus 4.6 uses GA 'effort' parameter (no beta header required, officially recommended by Anthropic)
464-
// Note: thinking type: 'adaptive' is separate and requires adaptive-thinking beta header
465-
return {
466-
low: {
467-
thinking: {
468-
type: "enabled",
469-
effort: "low",
470-
},
471-
},
472-
high: {
473-
thinking: {
474-
type: "enabled",
475-
effort: "high",
476-
},
477-
},
478-
max: {
479-
thinking: {
480-
type: "enabled",
481-
effort: "max",
482-
},
483-
},
484-
}
485-
}
486-
487-
// Older models use manual thinking with budgetTokens
488456
return {
489457
high: {
490458
thinking: {
@@ -499,7 +467,6 @@ export namespace ProviderTransform {
499467
},
500468
},
501469
}
502-
}
503470

504471
case "@ai-sdk/amazon-bedrock":
505472
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock

‎packages/opencode/src/session/compaction.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export namespace SessionCompaction {
3232
if (config.compaction?.auto === false) return false
3333
const context = input.model.limit.context
3434
if (context === 0) return false
35-
const count = input.tokens.input + input.tokens.cache.read
35+
const count = input.tokens.input + input.tokens.cache.read + input.tokens.output
3636
const output = Math.min(input.model.limit.output, SessionPrompt.OUTPUT_TOKEN_MAX) || SessionPrompt.OUTPUT_TOKEN_MAX
3737
const usable = input.model.limit.input || context - output
3838
return count > usable

0 commit comments

Comments
 (0)