Repository navigation
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
Adds a connection-scoped “CC Compatible 1M Context” toggle for Claude Code-compatible providers, persists it in providerSpecificData.requestDefaults.context1m, and uses it to append the anthropic-beta: context-1m-2025-08-07 header when enabled.
Changes:
- Add UI controls to create/edit provider connections with a CC-compatible 1M context toggle.
- Validate/normalize
providerSpecificData.requestDefaults.context1mand expose helper accessors. - Append the 1M beta header in the executor path and add unit tests covering schema/defaults/executor behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/app/(dashboard)/dashboard/providers/[id]/page.tsx |
Adds create/edit UI toggle and wiring to persist requestDefaults.context1m. |
src/lib/providers/requestDefaults.ts |
Adds normalization + getter for CC-compatible context1m request default. |
src/shared/validation/schemas.ts |
Extends providerSpecificData validation to enforce boolean requestDefaults.context1m. |
open-sse/executors/base.ts |
Appends anthropic-beta context-1m header based on extendedContext or CC connection defaults. |
open-sse/services/claudeCodeCompatible.ts |
Introduces CONTEXT_1M_BETA_HEADER, model support check, and a safe header append helper. |
tests/unit/executor-default-base.test.ts |
Verifies executor appends context-1m beta header based on CC connection defaults / extendedContext. |
tests/unit/provider-specific-data-schema.test.ts |
Ensures schemas accept boolean requestDefaults.context1m and reject non-boolean values. |
tests/unit/request-defaults-store-session.test.ts |
Ensures normalization preserves only valid CC-compatible context1m (and strips invalid types). |
| @@ -20,6 +21,12 @@ function hasNonEmptyString(value: unknown): boolean { | |||
| return typeof value === "string" && value.trim().length > 0; | |||
| } | |||
|
|
|||
| function isClaudeCodeCompatibleProvider(provider: string | null | undefined): boolean { | |||
| return ( | |||
| typeof provider === "string" && provider.startsWith(CLAUDE_CODE_COMPATIBLE_PROVIDER_PREFIX) | |||
| ); | |||
| } | |||
There was a problem hiding this comment.
isClaudeCodeCompatibleProvider() and the anthropic-compatible-cc- prefix are redefined here, but similar helpers/constants already exist elsewhere (e.g. src/shared/constants/providers.ts and open-sse/services/claudeCodeCompatible.ts). Duplicating the prefix logic risks drift if the identifier format changes; prefer importing a single shared helper/constant rather than maintaining a third copy.
| delete currentRequestDefaults.context1m; | ||
| } | ||
| updates.providerSpecificData.requestDefaults = | ||
| Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : undefined; |
There was a problem hiding this comment.
In EditConnectionModal, when toggling CC Compatible 1M Context off and there are no other requestDefaults keys, updates.providerSpecificData.requestDefaults is set to undefined. Because the update payload is JSON-stringified, undefined fields are omitted, so the server merge will keep the existing requestDefaults (and context1m may never be cleared). Send an explicit value to overwrite/clear it (e.g. null or {} so normalization can remove it) when the object becomes empty.
| Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : undefined; | |
| Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : {}; |
| modelSupportsContext1mBeta(model) && | ||
| !isClaudeCodeCompatible(this.provider); | ||
| const shouldForwardCcCompatibleContext1m = | ||
| isClaudeCodeCompatible(this.provider) && ccRequestDefaults.context1m === true; |
There was a problem hiding this comment.
shouldForwardCcCompatibleContext1m appends the 1M beta header for CC-compatible providers without checking whether the selected model supports the context-1m beta. Since modelSupportsContext1mBeta() and the supported model list already exist (and are used for extendedContext), consider applying the same model gating here to avoid sending anthropic-beta: context-1m-2025-08-07 on unsupported models.
| isClaudeCodeCompatible(this.provider) && ccRequestDefaults.context1m === true; | |
| isClaudeCodeCompatible(this.provider) && | |
| ccRequestDefaults.context1m === true && | |
| modelSupportsContext1mBeta(model); |
|
Thanks for this contribution! 🎉 The CC Compatible 1M context toggle has been integrated into the |
Summary
CC Compatible 1M Contexttoggle to the provider connection UIproviderSpecificData.requestDefaults.context1mwith normalization and schema validationanthropic-beta: context-1m-2025-08-07for CC Compatible requests when the connection toggle is enabled, without altering model idsWhy
CC Compatible connections need a connection-scoped configuration similar to the Codex OAuth fast service tier controls. The 1M behavior should be explicitly enabled per connection and should not rely on model-name suffixes.
Validation
npx prettier --write open-sse/executors/base.ts open-sse/services/claudeCodeCompatible.ts 'src/app/(dashboard)/dashboard/providers/[id]/page.tsx' src/lib/providers/requestDefaults.ts src/shared/validation/schemas.ts tests/unit/executor-default-base.test.ts tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.tsnode --import tsx/esm --test tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.ts tests/unit/executor-default-base.test.tsnpx eslint open-sse/executors/base.ts open-sse/services/claudeCodeCompatible.ts 'src/app/(dashboard)/dashboard/providers/[id]/page.tsx' src/lib/providers/requestDefaults.ts src/shared/validation/schemas.ts tests/unit/executor-default-base.test.ts tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.tsnpm run typecheck:core