Skip to content

Conversation

@victoraranda
Copy link

@victoraranda victoraranda commented Sep 10, 2025

This PR introduces support for the Claude Sonnet 4 model on Vertex AI with a 1M token context window.

Key updates:

  • Adds a toggle and schema extension for 1M context via vertex1MContext in provider settings.
  • Updates backend handler to apply tiered context window and correct input/output pricing.
  • Updates UI to allow users to select and display the 1M context option where relevant.
  • Adds and updates localization for new UI elements in all relevant languages.
  • Expands test coverage with new and edge-case scenarios for large-prompt acceptance and explicit handling of the 1M context tier.
  • Ensures all migrations, config export/import, and downstream consumers are compatible with the new setting.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Sep 10, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

The key 'vertex1MContextLabel' uses an inconsistent language: the string "1M context window (Preview) aktivieren" mixes English with German. Consider changing it to fully German, for example "1M Kontextfenster (Vorschau) aktivieren", to maintain consistency with the rest of the file.

Suggested change
"vertex1MContextLabel": "1M context window (Preview) aktivieren",
"vertex1MContextLabel": "1M Kontextfenster (Vorschau) aktivieren",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in updated PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical suggestion: The key value uses “內容視窗” but for consistency with other keys, it might be intended to be "上下文視窗".

Suggested change
"vertex1MContextLabel": "啟用 1M 內容視窗(預覽)",
"vertex1MContextLabel": "啟用 1M 上下文視窗(預覽)",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in updated PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical suggestion: Consider changing “內容視窗” to "上下文視窗" in the description for consistency with similar keys.

Suggested change
"vertex1MContextDescription": "為 Claude Sonnet 4 將內容視窗擴展至 100 萬個 token。此為預覽功能,可能不適用於所有使用者。",
"vertex1MContextDescription": "為 Claude Sonnet 4 將上下文視窗擴展至 100 萬個 token。此為預覽功能,可能不適用於所有使用者。",

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in updated PR

Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the changes for adding Vertex Claude Sonnet 4 1M context support and found several issues that need attention.

.gitignore Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

These changes appear unrelated to the 1M context feature. Could you remove these local development entries from this PR? They should be in a separate PR or kept in your local .git/info/exclude file.

Copy link
Author

Choose a reason for hiding this comment

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

Unrelated local development ignore entries have been reverted. Only project-relevant ignore patterns remain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional? Adding test execution to the pre-commit hook is unrelated to the 1M context feature and will affect all developers. This change should be discussed separately and not included in this feature PR.

Copy link
Author

Choose a reason for hiding this comment

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

The pre-commit test execution has been reverted and is no longer included, this was intended for a local change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we improve the error handling here? Currently, errors are silently ignored which could mask configuration issues. Consider:

Copy link
Author

Choose a reason for hiding this comment

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

Error handling for the credential file load is now clear and visible, logging configuration issues with a standard message consistent with project conventions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is setting vertex1MContext: false here intentional? This seems inconsistent with how other provider-specific fields are handled. Consider removing this default initialization since it's provider-specific.

Copy link
Author

Choose a reason for hiding this comment

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

The default config no longer sets vertex1MContext: false. This provider-specific key is now initialized only via migration logic where relevant, restoring consistency with project patterns.

Copy link
Contributor

Choose a reason for hiding this comment

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

The Catalan translations are still in English. Should these be translated to Catalan for consistency?

Copy link
Author

Choose a reason for hiding this comment

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

All new Catalan translation keys are now fully and accurately translated; no English remains in user-facing content.

Copy link
Contributor

Choose a reason for hiding this comment

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

The diff shows '...[2558 characters omitted]...' which suggests test content may be truncated or missing. Could you verify that all test implementations are complete?

Copy link
Author

Choose a reason for hiding this comment

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

The test file is byte-for-byte identical to upstream/main except for a minimal, appended set of new tests for 1M context support. There is no structural truncation, no "rest of file unchanged" lines, and no block reordering. The original "characters omitted" was due to Roo repeatedly failling flle-edits and trying to restore the entire file.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 10, 2025
@victoraranda victoraranda force-pushed the vertex-claude-sonnet-1m-context branch from 3f5c1b0 to 9ae1a0e Compare September 10, 2025 17:27
@victoraranda victoraranda changed the title Add Vertex Claude Sonnet 4 1M context support feat: add Vertex Claude Sonnet 4 1M context support Sep 10, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 10, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 10, 2025
@daniel-lxs
Copy link
Member

Hey @victoraranda Thank you for your contribution, I still see some unrelated changes around the pre-commit hook and .gitignore files, can you revert those to review this properly?

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Sep 10, 2025
@victoraranda victoraranda force-pushed the vertex-claude-sonnet-1m-context branch from 9ae1a0e to 0263ca0 Compare September 11, 2025 00:28
@victoraranda victoraranda force-pushed the vertex-claude-sonnet-1m-context branch from 0263ca0 to 29781ca Compare September 11, 2025 00:34
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 11, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@hannesrudolph
Copy link
Collaborator

Stale. Please open new PR if still interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants