feat: adding Opus 4.6 to model list for computer use#1665
feat: adding Opus 4.6 to model list for computer use#1665Kylejeong2 wants to merge 1 commit intomainfrom
Conversation
|
There was a problem hiding this comment.
3 issues found across 3 files
Confidence score: 3/5
- There is a concrete policy violation: hardcoded allow-lists of LLM model names were extended, which can block valid provider/model combinations and cause user-facing failures.
- Severity is medium-high (7/10) across multiple files, so there is some risk until the model-acceptance logic is made more flexible per the rule.
- Pay close attention to
packages/core/lib/v3/agent/AgentProvider.ts,packages/core/lib/v3/types/public/agent.ts,packages/core/tests/public-api/llm-and-agents.test.ts- hardcoded model allow-list expansion.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/core/tests/public-api/llm-and-agents.test.ts">
<violation number="1" location="packages/core/tests/public-api/llm-and-agents.test.ts:29">
P1: Rule violated: **Ensure we never check against hardcoded lists of allowed LLM model names**
This change extends a hardcoded allow-list of LLM model names. The rule (“Ensure we never check against hardcoded lists of allowed LLM model names”) forbids adding or updating such lists, even in tests. Please refactor the test to avoid asserting against a fixed model-name list (e.g., validate provider/model-name format or defer to provider validation) instead of enumerating specific models.</violation>
</file>
<file name="packages/core/lib/v3/types/public/agent.ts">
<violation number="1" location="packages/core/lib/v3/types/public/agent.ts:374">
P1: Rule violated: **Ensure we never check against hardcoded lists of allowed LLM model names**
Avoid extending hardcoded allowlists of LLM model names. The rule requires accepting any provider/model-name instead of adding more entries to lists like AVAILABLE_CUA_MODELS; please replace this allowlist-based check with validation that does not hardcode model names (unless explicitly blocking known-bad models).</violation>
</file>
<file name="packages/core/lib/v3/agent/AgentProvider.ts">
<violation number="1" location="packages/core/lib/v3/agent/AgentProvider.ts:23">
P1: Rule violated: **Ensure we never check against hardcoded lists of allowed LLM model names**
This change adds a hardcoded allowed model name to the model-to-provider map, violating the rule to avoid hardcoded lists of allowed LLM models. Update the logic to accept any model name (preferably provider/model-name) and let the provider validate availability instead.</violation>
</file>
Architecture diagram
sequenceDiagram
participant User as Client/Test
participant API as Public API (AVAILABLE_CUA_MODELS)
participant Map as AgentProvider (modelToAgentProviderMap)
participant Anthropic as Anthropic Provider
participant LLM as Claude Opus 4.6 (External)
Note over User,LLM: Runtime Model Resolution Flow
User->>API: Initialize Agent with model: "anthropic/claude-opus-4-6"
API->>API: Validate against AVAILABLE_CUA_MODELS
alt NEW: Model exists in list
API-->>User: Validation Success
else Model not in list
API-->>User: Throw Error
end
User->>Map: Get Provider for "claude-opus-4-6"
Note right of Map: NEW: Map "claude-opus-4-6" -> "anthropic"
Map-->>User: Return AgentProviderType.anthropic
User->>Anthropic: Request Computer Use action
Anthropic->>LLM: POST /v1/messages (model: "claude-opus-4-6")
Note over Anthropic,LLM: Includes computer-use tool definitions
LLM-->>Anthropic: Action (mouse/keyboard/click)
Anthropic-->>User: Execute Action in Browser
Note over User,Map: Tests verify model presence in both list and map class definitions.
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| "openai/computer-use-preview-2025-03-11", | ||
| "anthropic/claude-3-7-sonnet-latest", | ||
| "anthropic/claude-opus-4-5-20251101", | ||
| "anthropic/claude-opus-4-6", |
There was a problem hiding this comment.
P1: Rule violated: Ensure we never check against hardcoded lists of allowed LLM model names
This change extends a hardcoded allow-list of LLM model names. The rule (“Ensure we never check against hardcoded lists of allowed LLM model names”) forbids adding or updating such lists, even in tests. Please refactor the test to avoid asserting against a fixed model-name list (e.g., validate provider/model-name format or defer to provider validation) instead of enumerating specific models.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/tests/public-api/llm-and-agents.test.ts, line 29:
<comment>This change extends a hardcoded allow-list of LLM model names. The rule (“Ensure we never check against hardcoded lists of allowed LLM model names”) forbids adding or updating such lists, even in tests. Please refactor the test to avoid asserting against a fixed model-name list (e.g., validate provider/model-name format or defer to provider validation) instead of enumerating specific models.</comment>
<file context>
@@ -26,6 +26,7 @@ describe("LLM and Agents public API types", () => {
"openai/computer-use-preview-2025-03-11",
"anthropic/claude-3-7-sonnet-latest",
"anthropic/claude-opus-4-5-20251101",
+ "anthropic/claude-opus-4-6",
"anthropic/claude-haiku-4-5-20251001",
"anthropic/claude-sonnet-4-20250514",
</file context>
| "openai/computer-use-preview-2025-03-11", | ||
| "anthropic/claude-3-7-sonnet-latest", | ||
| "anthropic/claude-opus-4-5-20251101", | ||
| "anthropic/claude-opus-4-6", |
There was a problem hiding this comment.
P1: Rule violated: Ensure we never check against hardcoded lists of allowed LLM model names
Avoid extending hardcoded allowlists of LLM model names. The rule requires accepting any provider/model-name instead of adding more entries to lists like AVAILABLE_CUA_MODELS; please replace this allowlist-based check with validation that does not hardcode model names (unless explicitly blocking known-bad models).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/types/public/agent.ts, line 374:
<comment>Avoid extending hardcoded allowlists of LLM model names. The rule requires accepting any provider/model-name instead of adding more entries to lists like AVAILABLE_CUA_MODELS; please replace this allowlist-based check with validation that does not hardcode model names (unless explicitly blocking known-bad models).</comment>
<file context>
@@ -371,6 +371,7 @@ export const AVAILABLE_CUA_MODELS = [
"openai/computer-use-preview-2025-03-11",
"anthropic/claude-3-7-sonnet-latest",
"anthropic/claude-opus-4-5-20251101",
+ "anthropic/claude-opus-4-6",
"anthropic/claude-haiku-4-5-20251001",
"anthropic/claude-sonnet-4-20250514",
</file context>
| "claude-sonnet-4-20250514": "anthropic", | ||
| "claude-sonnet-4-5-20250929": "anthropic", | ||
| "claude-opus-4-5-20251101": "anthropic", | ||
| "claude-opus-4-6": "anthropic", |
There was a problem hiding this comment.
P1: Rule violated: Ensure we never check against hardcoded lists of allowed LLM model names
This change adds a hardcoded allowed model name to the model-to-provider map, violating the rule to avoid hardcoded lists of allowed LLM models. Update the logic to accept any model name (preferably provider/model-name) and let the provider validate availability instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/agent/AgentProvider.ts, line 23:
<comment>This change adds a hardcoded allowed model name to the model-to-provider map, violating the rule to avoid hardcoded lists of allowed LLM models. Update the logic to accept any model name (preferably provider/model-name) and let the provider validate availability instead.</comment>
<file context>
@@ -20,6 +20,7 @@ export const modelToAgentProviderMap: Record<string, AgentProviderType> = {
"claude-sonnet-4-20250514": "anthropic",
"claude-sonnet-4-5-20250929": "anthropic",
"claude-opus-4-5-20251101": "anthropic",
+ "claude-opus-4-6": "anthropic",
"claude-haiku-4-5-20251001": "anthropic",
"gemini-2.5-computer-use-preview-10-2025": "google",
</file context>
Greptile OverviewGreptile SummaryThis PR adds support for Anthropic's Claude Opus 4.6 model to the computer use agent functionality. Changes:
Notes:
Confidence Score: 4/5
Sequence DiagramsequenceDiagram
participant User
participant Stagehand
participant AgentProvider
participant AnthropicCUAClient
participant Anthropic API
User->>Stagehand: agent({mode: "cua", model: "anthropic/claude-opus-4-6"})
Stagehand->>AgentProvider: getClient("claude-opus-4-6")
AgentProvider->>AgentProvider: getAgentProvider("claude-opus-4-6")
Note over AgentProvider: Looks up "claude-opus-4-6" in<br/>modelToAgentProviderMap
AgentProvider->>AgentProvider: Returns "anthropic"
AgentProvider->>AnthropicCUAClient: new AnthropicCUAClient(...)
AnthropicCUAClient-->>AgentProvider: client instance
AgentProvider-->>Stagehand: agent client
Stagehand-->>User: agent instance
User->>Stagehand: agent.execute({instruction: "..."})
Stagehand->>AnthropicCUAClient: execute(...)
AnthropicCUAClient->>Anthropic API: API call with claude-opus-4-6
Anthropic API-->>AnthropicCUAClient: response
AnthropicCUAClient-->>Stagehand: AgentResult
Stagehand-->>User: result
|
| "claude-sonnet-4-20250514": "anthropic", | ||
| "claude-sonnet-4-5-20250929": "anthropic", | ||
| "claude-opus-4-5-20251101": "anthropic", | ||
| "claude-opus-4-6": "anthropic", |
There was a problem hiding this comment.
Check that claude-opus-4-6 is the official model identifier from Anthropic's API. All other Claude models include date suffixes (e.g., claude-opus-4-5-20251101), but this one doesn't follow the pattern.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/lib/v3/agent/AgentProvider.ts
Line: 23:23
Comment:
Check that `claude-opus-4-6` is the official model identifier from Anthropic's API. All other Claude models include date suffixes (e.g., `claude-opus-4-5-20251101`), but this one doesn't follow the pattern.
How can I resolve this? If you propose a fix, please make it concise.
why
opus 4.6 is sota on os world for computer use
what changed
enabled it on list of models
test plan
Summary by cubic
Added Claude Opus 4.6 to the computer use model list to make it available for agents. Mapped it to the Anthropic provider and updated public API types and tests.
Written for commit cf0ff38. Summary will update on new commits. Review in cubic