Skip to content

Conversation

@chromiebot
Copy link
Contributor

@chromiebot chromiebot commented Jan 27, 2026

why

what changed

test plan


Summary by cubic

Add a deprecation warning for legacy model names (no slash) while keeping them working, and update errors to guide users to the provider/model format. Also improves provider error handling and adds tests.

  • New Features
    • Log level-0 deprecation warning when using legacy names (e.g., "gpt-4o"); suggest "provider/model" (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4").
    • Update UnsupportedModelError to list supported models and include provider/model guidance with examples.
    • Throw UnsupportedModelProviderError in LLMProvider’s default switch case for unknown providers.
    • Add Vitest tests covering deprecation logs, error messages, legacy model support, provider/model format, and invalid providers.

Written for commit 71ca391. Summary will update on new commits. Review in cubic

Chromie Bot and others added 3 commits January 27, 2026 23:51
Add unit tests to verify:
- UnsupportedModelError includes guidance about provider/model format
- LLMProvider logs deprecation warning for legacy model names
- Legacy model names still work (non-breaking)
- Provider/model format works without deprecation warning
- UnsupportedAISDKModelProviderError for invalid providers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to inform users about the new provider/model format:

1. UnsupportedModelError now includes a note encouraging users to use
   the provider/model format (e.g., "openai/gpt-4o") instead of the
   legacy format (e.g., "gpt-4o")

2. Fixed the default case in LLMProvider switch to throw
   UnsupportedModelProviderError (for internal consistency issues)
   instead of UnsupportedModelError (which is for user-facing errors)

This is a non-breaking change - legacy model names still work but
users are now informed about the preferred format.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…provider-map

Chromie/fix deprecate model to provider map
@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

⚠️ No Changeset found

Latest commit: 71ca391

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR


this.logger({
category: "llm",
message: `Deprecation warning: Model format "${modelName}" is deprecated. Please use the provider/model format (e.g., "openai/gpt-4o" or "anthropic/claude-3-5-sonnet-latest").`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
message: `Deprecation warning: Model format "${modelName}" is deprecated. Please use the provider/model format (e.g., "openai/gpt-4o" or "anthropic/claude-3-5-sonnet-latest").`,
message: `Deprecation warning: Model format "${modelName}" is deprecated. Please use the provider/model format (e.g., "openai/gpt-5" or "anthropic/claude-sonnet-4-5").`,

const modelList = supportedModels.join(", ");
const deprecationNote =
`\n\nNote: The legacy model format (e.g., "gpt-4o") is deprecated. ` +
`Please use the provider/model format instead (e.g., "openai/gpt-4o", "anthropic/claude-3-5-sonnet-latest").`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`Please use the provider/model format instead (e.g., "openai/gpt-4o", "anthropic/claude-3-5-sonnet-latest").`;
`Please use the provider/model format instead (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4-5").`;

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

Added deprecation warnings for legacy model format (e.g., gpt-4o) to guide users toward the new provider/model format (e.g., openai/gpt-4o).

Key changes:

  • LLMProvider.getClient() now logs a level 0 deprecation warning when legacy model format is used
  • UnsupportedModelError includes a deprecation note with examples of the new format
  • Comprehensive test coverage validates backward compatibility and warning behavior
  • Legacy format continues to work while users are informed of the preferred approach

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Well-implemented deprecation pattern that maintains full backward compatibility while guiding users to the new format. Comprehensive test coverage validates all scenarios including warnings, errors, and continued functionality.
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/lib/v3/llm/LLMProvider.ts Added deprecation warning for legacy model format (without slash), maintains backward compatibility while guiding users to new provider/model format
packages/core/lib/v3/types/public/sdkErrors.ts Enhanced UnsupportedModelError with deprecation note explaining the new provider/model format with examples
packages/core/tests/model-deprecation.test.ts Comprehensive test suite validating deprecation warnings, error messages, and backward compatibility for legacy model names

Sequence Diagram

sequenceDiagram
    participant User
    participant LLMProvider
    participant Logger
    participant ModelMap
    participant ClientFactory
    
    User->>LLMProvider: getClient("gpt-4o")
    LLMProvider->>LLMProvider: Check if modelName includes "/"
    
    alt New format (contains "/")
        LLMProvider->>ClientFactory: Create AISdkClient
        ClientFactory-->>LLMProvider: Return client
    else Legacy format (no "/")
        LLMProvider->>ModelMap: Lookup provider for "gpt-4o"
        ModelMap-->>LLMProvider: Return "openai"
        
        alt Model not found
            LLMProvider->>User: Throw UnsupportedModelError<br/>(with deprecation note)
        else Model found
            LLMProvider->>Logger: Log deprecation warning (level 0)
            Logger-->>User: Display warning message
            LLMProvider->>ClientFactory: Create legacy client (OpenAIClient)
            ClientFactory-->>LLMProvider: Return client
        end
    end
    
    LLMProvider-->>User: Return LLMClient
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Updated model examples in deprecation messaging from:
- openai/gpt-4o -> openai/gpt-5
- anthropic/claude-3-5-sonnet-latest -> anthropic/claude-sonnet-4

This addresses the PR review feedback requesting more current model names.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Confidence score: 4/5

  • Safe to merge overall; the only noted issue is a low-severity test weakness rather than a runtime bug.
  • packages/core/tests/model-deprecation.test.ts may silently pass if getClient stops throwing because assertions live only inside a try/catch, reducing confidence in the test’s signal.
  • Pay close attention to packages/core/tests/model-deprecation.test.ts - assertions can be skipped if no exception is thrown.
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/model-deprecation.test.ts">

<violation number="1" location="packages/core/tests/model-deprecation.test.ts:132">
P2: Test does not fail if getClient stops throwing; assertions are only inside try/catch, so the error path can be skipped silently.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant Client as User Code
    participant Provider as LLMProvider
    participant Log as Logger

    Note over Client, Provider: Flow: resolving model names to clients

    Client->>Provider: getClient(modelName, options)

    alt modelName contains "/" (e.g. "openai/gpt-4o")
        Note over Provider: Standard V3 flow (unchanged)
        Provider->>Provider: Instantiate provider from prefix
    else CHANGED: Legacy format (e.g. "gpt-4o")
        Provider->>Provider: Lookup legacy model map

        alt Legacy Mapping Not Found
            Note right of Provider: CHANGED: Error message now<br/>explicitly suggests "provider/model" format
            Provider--XClient: Throw UnsupportedModelError
        else Legacy Mapping Found
            Note right of Log: NEW: Level 0 Deprecation Warning<br/>(Suggests new format)
            Provider->>Log: log("Deprecation warning: ...")
            
            alt Switch Case: Known Provider (OpenAI/Anthropic)
                Provider->>Provider: Instantiate legacy client
            else NEW: Switch Default (Provider in map but not in switch)
                Provider--XClient: Throw UnsupportedModelProviderError
            end
        end
    end

    Provider-->>Client: Return LLMClient Instance
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const logger = (line: LogLine) => logs.push(line);
const provider = new LLMProvider(logger);

try {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 28, 2026

Choose a reason for hiding this comment

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

P2: Test does not fail if getClient stops throwing; assertions are only inside try/catch, so the error path can be skipped silently.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/tests/model-deprecation.test.ts, line 132:

<comment>Test does not fail if getClient stops throwing; assertions are only inside try/catch, so the error path can be skipped silently.</comment>

<file context>
@@ -0,0 +1,196 @@
+      const logger = (line: LogLine) => logs.push(line);
+      const provider = new LLMProvider(logger);
+
+      try {
+        provider.getClient("some-unknown-model" as any, mockClientOptions);
+      } catch (error) {
</file context>
Fix with Cubic

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants