feat(claude): map Claude Code model strings to OpenCode format when importing agents#2333
Open
devxoul wants to merge 4 commits intocode-yeongyu:devfrom
Open
feat(claude): map Claude Code model strings to OpenCode format when importing agents#2333devxoul wants to merge 4 commits intocode-yeongyu:devfrom
devxoul wants to merge 4 commits intocode-yeongyu:devfrom
Conversation
…xes, passthrough provider-prefixed models
There was a problem hiding this comment.
2 issues found across 4 files
Confidence score: 2/5
- There are two high-severity, high-confidence compatibility problems that are likely user-impacting, so merge risk is elevated rather than routine.
- In
src/features/claude-code-agent-loader/claude-model-mapper.test.ts, normalizinggpt-5.2to a dashed form breaks OpenCode’s expected model ID, which can cause model resolution failures for non-Claude models. - In
src/features/claude-code-plugin-loader/agent-loader.ts, missing the requiredanthropic/provider prefix on bare Claude model IDs can prevent the OpenCode SDK from resolving models correctly. - Pay close attention to
src/features/claude-code-agent-loader/claude-model-mapper.test.ts,src/features/claude-code-plugin-loader/agent-loader.ts- model ID normalization/prefix handling is likely to break OpenCode compatibility.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/features/claude-code-agent-loader/claude-model-mapper.test.ts">
<violation number="1" location="src/features/claude-code-agent-loader/claude-model-mapper.test.ts:62">
P1: Custom agent: **Opencode Compatibility**
The model mapper incorrectly normalizes dots to dashes in non-Claude models like `gpt-5.2`, breaking compatibility with OpenCode where the ID is explicitly `gpt-5.2`.</violation>
</file>
<file name="src/features/claude-code-plugin-loader/agent-loader.ts">
<violation number="1" location="src/features/claude-code-plugin-loader/agent-loader.ts:56">
P1: Custom agent: **Opencode Compatibility**
OpenCode SDK requires model IDs to include the provider prefix (e.g., `anthropic/claude-sonnet-4-5`). Prepend `anthropic/` to bare Claude models so the SDK can correctly resolve the provider.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
src/features/claude-code-agent-loader/claude-model-mapper.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/features/claude-code-agent-loader/claude-model-mapper.ts">
<violation number="1" location="src/features/claude-code-agent-loader/claude-model-mapper.ts:19">
P2: Unsafe object property access - built-in object properties like 'constructor', 'toString', or 'valueOf' will be returned from prototype chain instead of `undefined`, violating the `string | undefined` return type.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…ined for non-Claude bare models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.claude/agents/or plugins), themodelfrontmatter field was parsed but silently droppedmapClaudeModelToOpenCode()that converts Claude Code model strings to OpenCode'sprovider/modelformatsonnet→anthropic/claude-sonnet-4-6,opus→anthropic/claude-opus-4-6,haiku→anthropic/claude-haiku-4-5(case-insensitive)inherit: returnsundefined(no model override, lets OpenCode decide)claude-sonnet-4-5-20250514→anthropic/claude-sonnet-4-5-20250514(adds provider prefix)claude-3.5-sonnet→anthropic/claude-3-5-sonnetanthropic/claude-sonnet-4-6passes through unchangedclaude-code-agent-loaderandclaude-code-plugin-loaderagent loaders