Skip to content

Add Claude Sonnet 5 default#134

Merged
aaditagrawal merged 43 commits into
mainfrom
sync/upstream-20260701-claude-sonnet-5
Jul 3, 2026
Merged

Add Claude Sonnet 5 default#134
aaditagrawal merged 43 commits into
mainfrom
sync/upstream-20260701-claude-sonnet-5

Conversation

@aaditagrawal

@aaditagrawal aaditagrawal commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What Changed

Adds Claude Sonnet 5 support and default behavior translated into the fork's provider-instance model system.

Why

This ports the upstream Claude Sonnet 5 default while preserving the fork's custom provider and model configuration architecture.

UI Changes

None beyond provider/model option behavior already covered by the model default update.

Checklist

  • Part 5 of the upstream sync stack
  • Validation on stack tip: vp check
  • Validation on stack tip: vp run typecheck
  • Validation on stack tip: vp run lint:mobile
  • Full vp test had one ACP timeout flake; rerunning that file passed

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0b0da57-fb0e-430d-9aa2-85d7001533a7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/upstream-20260701-claude-sonnet-5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

aaditagrawal commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 effective changed lines (test files excluded in mixed PRs). labels Jul 1, 2026
@aaditagrawal
aaditagrawal marked this pull request as ready for review July 2, 2026 12:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47de4ca871

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts
id: "contextWindow",
label: "Context Window",
options: [
{ value: "200k", label: "200k", isDefault: true },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat Sonnet 5 as native 1M context

For Claude Code versions that support Sonnet 5, the changelog describes it as having a native 1M-token context window (https://code.claude.com/docs/en/changelog), but this descriptor defaults the model to a synthetic 200k/1m selector. In the default path resolveClaudeApiModelId sends the plain slug while selectedClaudeContextWindow reports 200k from this option, so token/context usage and the traits UI understate the actual window; selecting 1M also emits claude-sonnet-5[1m] instead of using the native model, unlike the existing Opus 4.7/4.8 native-1M handling.

Useful? React with 👍 / 👎.

Comment thread packages/contracts/src/model.ts
@aaditagrawal

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-chat-mobile branch from 730be69 to 4798ab9 Compare July 2, 2026 13:23
@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-claude-sonnet-5 branch from 47de4ca to fcef224 Compare July 2, 2026 13:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcef224c3b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Effect.provide(
mockSpawnerLayer((args) => {
const joined = args.join(" ");
if (joined === "--version") return { stdout: "1.0.0\n", stderr: "", code: 0 };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use a Sonnet 5-capable version in this test

In this test, the mocked claude --version returns 1.0.0, but the provider code added in this commit filters claude-sonnet-5 unless the parsed version is at least 2.1.197. When ProviderRegistry.test.ts runs, checkClaudeProviderStatus therefore returns no Sonnet 5 entry and the assertion above this stub fails before any descriptor checks run; bump the stubbed version or change the expectation to match the gating behavior.

Useful? React with 👍 / 👎.

Comment on lines +1590 to +1593
getClaudeModelCapabilities("claude-sonnet-5").optionDescriptors?.some(
(descriptor) => descriptor.id === "contextWindow",
),
true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the Sonnet 5 context assertion

After using a supported Claude Code version, this assertion still fails because the Sonnet 5 model definition in this commit only exposes the effort descriptor and intentionally has no contextWindow selector. Update this test to assert the native/no-selector behavior, or use a different model if the test is meant to cover selectable context windows.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0acab3dda

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts
Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts
@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-claude-sonnet-5 branch from a0acab3 to d7b1bb2 Compare July 2, 2026 14:15
@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-chat-mobile branch from 4798ab9 to 6258f37 Compare July 2, 2026 14:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7b1bb2a77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/contracts/src/model.ts Outdated
"claude-opus-4.6": "claude-opus-4-6",
"claude-opus-4-6-20251117": "claude-opus-4-6",
sonnet: "claude-sonnet-4-6",
sonnet: "claude-sonnet-5",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep custom aliases from bypassing Sonnet 5 gating

When Claude Code is older than v2.1.197 and a user already has sonnet in customModels, providerModelsFromSettings normalizes that custom entry through this new alias after getBuiltInClaudeModelsForVersion has removed the built-in claude-sonnet-5; because the filtered built-in list no longer has that slug in seen, it gets appended back as a custom model and the new default/fallback path can select a model the installed CLI cannot run. Fresh evidence beyond the prior built-in gating finding is this custom-model normalization path reintroducing the gated slug.

Useful? React with 👍 / 👎.

Comment on lines 343 to 344
case "claude-sonnet-5":
return 1_000_000;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect 200K Sonnet 5 configurations

This unconditional 1M seed is wrong when Claude Code is running with CLAUDE_CODE_DISABLE_1M_CONTEXT=1 or behind an ANTHROPIC_BASE_URL gateway: the Claude Code docs for Sonnet 5 context say those configurations budget the window at 200K unless the 1M variant is selected (https://code.claude.com/docs/en/model-config#sonnet-5-context-window). In those environments T3 will report maxTokens: 1_000_000 and clamp usage against 1M even though the session auto-compacts around 200K, so derive the seeded window from the Claude environment/model variant instead of hard-coding the slug.

Useful? React with 👍 / 👎.

@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-chat-mobile branch from 6258f37 to eeacb89 Compare July 2, 2026 17:47
@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-claude-sonnet-5 branch from d7b1bb2 to 61dfc95 Compare July 2, 2026 17:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61dfc954b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/contracts/src/model.ts
Comment thread apps/web/src/modelSelection.ts
Comment thread packages/contracts/src/model.ts Outdated
"claude-opus-4.6": "claude-opus-4-6",
"claude-opus-4-6-20251117": "claude-opus-4-6",
sonnet: "claude-sonnet-4-6",
sonnet: "claude-sonnet-5",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Claude's backend-specific sonnet alias

When a Claude instance is configured with a non-Anthropic backend via per-instance environment variables such as ANTHROPIC_BASE_URL, Claude Code resolves sonnet differently by backend; the official model-config docs say Anthropic API maps it to Sonnet 5, while AWS maps it to Sonnet 4.6 and Bedrock/Vertex/Foundry map it to Sonnet 4.5 (https://code.claude.com/docs/en/model-config). This global normalization rewrites any saved/custom sonnet to claude-sonnet-5 before the CLI can apply that backend-specific alias, so those instances can dispatch an unavailable full model instead of their supported Sonnet default.

Useful? React with 👍 / 👎.

@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-claude-sonnet-5 branch from 61dfc95 to 29b3f3c Compare July 2, 2026 18:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f09beb8605

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +237 to +238
{ value: "200k", label: "200k", isDefault: true },
{ value: "1m", label: "1M" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don’t default Anthropic Sonnet 5 to 200K

Fresh evidence in this revision is that the Sonnet 5 descriptor now marks 200k as the default context selection; the composer materializes descriptor defaults into modelSelection, so normal direct-Anthropic claude-sonnet-5 sends carry contextWindow=200k and selectedClaudeContextWindow returns 200,000 before reaching its Sonnet 5 native-1M branch. Claude Code's model config docs say Anthropic API Sonnet 5 has no 200K variant and always runs with the 1M window (https://code.claude.com/docs/en/model-config#sonnet-5-context-window), so the default path under-reports/clamps usage and exposes a non-existent 200K choice.

Useful? React with 👍 / 👎.

@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-chat-mobile branch from 8e8ba2e to 9ee152a Compare July 3, 2026 08:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ced218f852

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


export const makePendingClaudeProvider = (
claudeSettings: ClaudeSettings,
environment: NodeJS.ProcessEnv = process.env,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass instance env into pending Claude snapshots

With a custom Claude instance whose provider-instance environment sets ANTHROPIC_BASE_URL or CLAUDE_CODE_DISABLE_1M_CONTEXT, this default reads only the server's global env: I checked ClaudeDriver.create, where the initial snapshot calls makePendingClaudeProvider(settings.provider) while checked snapshots pass the merged processEnv. That makes the pending model list omit Sonnet 5's contextWindow selector until the probe finishes, so a user who opens or sends immediately on a gateway instance cannot choose/report the 1M sonnet[1m] variant even though the later snapshot exposes it; pass the merged instance env into the pending snapshot.

Useful? React with 👍 / 👎.

Comment on lines +281 to +283
return (
environment.CLAUDE_CODE_DISABLE_1M_CONTEXT === "1" ||
(environment.ANTHROPIC_BASE_URL?.trim().length ?? 0) > 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not offer 1M when context is disabled

When a Claude instance sets CLAUDE_CODE_DISABLE_1M_CONTEXT=1, this treats it the same as an LLM gateway, and withClaudeSonnet5ContextWindowSelector then appends the shared selector that includes 1m; selecting that option later dispatches sonnet[1m]. I checked the Claude Code model-config docs, which say this env var removes 1M variants from the picker (https://code.claude.com/docs/en/model-config#extended-context), so T3 can bypass an operator's context cap or send a variant they explicitly disabled; only expose the 1M choice for ANTHROPIC_BASE_URL, not for the disable flag.

Useful? React with 👍 / 👎.

@aaditagrawal
aaditagrawal force-pushed the sync/upstream-20260701-chat-mobile branch 3 times, most recently from 53ee88c to feb7380 Compare July 3, 2026 08:20
@aaditagrawal
aaditagrawal changed the base branch from sync/upstream-20260701-chat-mobile to graphite-base/134 July 3, 2026 08:20
@graphite-app

graphite-app Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merge activity

  • Jul 3, 8:23 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Jul 3, 8:23 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@aaditagrawal
aaditagrawal changed the base branch from graphite-base/134 to main July 3, 2026 08:27
@aaditagrawal
aaditagrawal merged commit 5e64b9b into main Jul 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant