History

feat(devin): prefix all Devin model IDs with devin/ namespace

sususu committed 2 months ago

Commit eed24901 parent cbe800a6 files · +63 −23Browse files

Unified · Split

6 files
  1. internal/registry/model_definitions.go +6 −6
  2. internal/registry/model_definitions_test.go +7 −7
  3. internal/runtime/executor/helps/devin_models.go +11 −5
  4. internal/runtime/executor/helps/devin_models_test.go +30 −0
  5. internal/runtime/executor/helps/devin_wire.go +4 −5
  6. internal/util/provider.go +5 −0
internal/registry/model_definitions.go+6−6
@@ -88,7 +88,7 @@ func GetAntigravityModels() []*ModelInfo { · 87 unmodified lines
8888
8989 var staticDevinModels = []*ModelInfo{
9090 {
91− ID: "swe-2",
91+ ID: "devin/swe-2",
9292 Type: "devin",
9393 OwnedBy: "cognition",
9494 DisplayName: "SWE-2",
@@ -99,7 +99,7 @@ var staticDevinModels = []*ModelInfo{ · 4 unmodified lines
9999 },
100100 },
101101 {
102− ID: "claude-fable-5-1",
102+ ID: "devin/claude-fable-5-1",
103103 Type: "devin",
104104 OwnedBy: "anthropic",
105105 DisplayName: "Claude Fable 5.1",
@@ -110,7 +110,7 @@ var staticDevinModels = []*ModelInfo{ · 4 unmodified lines
110110 },
111111 },
112112 {
113− ID: "gpt-6-astra",
113+ ID: "devin/gpt-6-astra",
114114 Type: "devin",
115115 OwnedBy: "openai",
116116 DisplayName: "GPT-6 Astra",
@@ -121,7 +121,7 @@ var staticDevinModels = []*ModelInfo{ · 4 unmodified lines
121121 },
122122 },
123123 {
124− ID: "swe-1-7-lightning",
124+ ID: "devin/swe-1-7-lightning",
125125 Type: "devin",
126126 OwnedBy: "cognition",
127127 DisplayName: "SWE-1.7 Lightning",
@@ -132,7 +132,7 @@ var staticDevinModels = []*ModelInfo{ · 4 unmodified lines
132132 },
133133 },
134134 {
135− ID: "glm-5-2",
135+ ID: "devin/glm-5-2",
136136 Type: "devin",
137137 OwnedBy: "zhipu",
138138 DisplayName: "GLM-5.2",
@@ -143,7 +143,7 @@ var staticDevinModels = []*ModelInfo{ · 4 unmodified lines
143143 },
144144 },
145145 {
146− ID: "glm-5-3",
146+ ID: "devin/glm-5-3",
147147 Type: "devin",
148148 OwnedBy: "zhipu",
149149 DisplayName: "GLM-5.3",
internal/registry/model_definitions_test.go+7−7
@@ -164,21 +164,21 @@ func TestGetDevinModelsFallback(t *testing.T) { · 163 unmodified lines
164164 foundSWE2 := false
165165 foundFable := false
166166 for _, m := range devinModels {
167− if m != nil && m.ID == "swe-2" {
167+ if m != nil && m.ID == "devin/swe-2" {
168168 foundSWE2 = true
169169 if m.Type != "devin" {
170− t.Errorf("swe-2 Type = %q, want devin", m.Type)
170+ t.Errorf("devin/swe-2 Type = %q, want devin", m.Type)
171171 }
172172 }
173− if m != nil && m.ID == "claude-fable-5-1" {
173+ if m != nil && m.ID == "devin/claude-fable-5-1" {
174174 foundFable = true
175175 }
176176 }
177177 if !foundSWE2 {
178− t.Error("expected swe-2 in GetDevinModels()")
178+ t.Error("expected devin/swe-2 in GetDevinModels()")
179179 }
180180 if !foundFable {
181− t.Error("expected claude-fable-5-1 in GetDevinModels()")
181+ t.Error("expected devin/claude-fable-5-1 in GetDevinModels()")
182182 }
183183
184184 byChannel := GetStaticModelDefinitionsByChannel("devin")
@@ -186,9 +186,9 @@ func TestGetDevinModelsFallback(t *testing.T) { · 1 unmodified line
186186 t.Fatal("GetStaticModelDefinitionsByChannel(\"devin\") returned empty list")
187187 }
188188
189− info := LookupStaticModelInfo("swe-2")
189+ info := LookupStaticModelInfo("devin/swe-2")
190190 if info == nil {
191− t.Fatal("LookupStaticModelInfo(\"swe-2\") = nil, want valid model")
191+ t.Fatal("LookupStaticModelInfo(\"devin/swe-2\") = nil, want valid model")
192192 }
193193 if info.DisplayName != "SWE-2" {
194194 t.Errorf("info.DisplayName = %q, want SWE-2", info.DisplayName)
internal/runtime/executor/helps/devin_models.go+11−5
@@ -79,13 +79,19 @@ func ResolveDevinChatModelUID(rawModel string, thinkingLevel string, budgetToken · 78 unmodified lines
7979 return "swe-2-high"
8080 }
8181
82− // 1. If already ends with an exact Devin effort suffix, use directly
83− if HasDevinEffortSuffix(model) {
84− return model
82+ // 1. Strip devin/ prefix if present (case-insensitive)
83+ cleanModel := model
84+ if strings.HasPrefix(strings.ToLower(cleanModel), "devin/") {
85+ cleanModel = cleanModel[6:]
8586 }
8687
87− // 2. Strip CPA colon or parenthesis suffix (suffix overrides body per CPA convention)
88− parsedSuffix := thinking.ParseSuffix(model)
88+ // 2. If already ends with an exact Devin effort suffix, use directly
89+ if HasDevinEffortSuffix(cleanModel) {
90+ return cleanModel
91+ }
92+
93+ // 3. Strip CPA colon or parenthesis suffix (suffix overrides body per CPA convention)
94+ parsedSuffix := thinking.ParseSuffix(cleanModel)
8995 baseModel := strings.TrimSpace(parsedSuffix.ModelName)
9096 if parsedSuffix.HasSuffix {
9197 thinkingLevel = parsedSuffix.RawSuffix
internal/runtime/executor/helps/devin_models_test.go+30−0
@@ -88,6 +88,36 @@ func TestResolveDevinChatModelUID(t *testing.T) { · 87 unmodified lines
8888 thinkingLevel: "medium",
8989 want: "glm-5-3-high",
9090 },
91+ {
92+ name: "devin prefix lowercase swe-2",
93+ rawModel: "devin/swe-2",
94+ thinkingLevel: "",
95+ want: "swe-2-high",
96+ },
97+ {
98+ name: "Devin prefix capitalized swe-2 with suffix",
99+ rawModel: "Devin/swe-2(max)",
100+ thinkingLevel: "",
101+ want: "swe-2-max",
102+ },
103+ {
104+ name: "devin prefix claude-fable-5-1",
105+ rawModel: "devin/claude-fable-5-1",
106+ thinkingLevel: "",
107+ want: "claude-fable-5-1-medium",
108+ },
109+ {
110+ name: "Devin prefix gpt-6-astra with suffix",
111+ rawModel: "Devin/gpt-6-astra(high)",
112+ thinkingLevel: "",
113+ want: "gpt-6-astra-high",
114+ },
115+ {
116+ name: "devin prefix direct effort UID",
117+ rawModel: "devin/swe-2-high",
118+ thinkingLevel: "",
119+ want: "swe-2-high",
120+ },
91121 }
92122
93123 for _, tt := range tests {
internal/runtime/executor/helps/devin_wire.go+4−5
@@ -139,11 +139,10 @@ func WrapConnectEnvelope(protoBytes []byte) []byte { · 138 unmodified lines
139139
140140 // WrapConnectEnvelopeWithFlag wraps payload bytes with an explicit Connect flag.
141141 func WrapConnectEnvelopeWithFlag(flag byte, protoBytes []byte) []byte {
142− out := make([]byte, 5+len(protoBytes))
143− out[0] = flag
144− binary.BigEndian.PutUint32(out[1:5], uint32(len(protoBytes)))
145− copy(out[5:], protoBytes)
146− return out
142+ header := make([]byte, 5, 5+len(protoBytes))
143+ header[0] = flag
144+ binary.BigEndian.PutUint32(header[1:5], uint32(len(protoBytes)))
145+ return append(header, protoBytes...)
147146 }
148147
149148 // ReadConnectFrame reads a single framed message from a Connect-proto stream.
internal/util/provider.go+5−0
@@ -65,6 +65,11 @@ func GetProviderName(modelName string) []string { · 64 unmodified lines
6565 for _, provider := range registry.GetGlobalRegistry().GetModelProviders(modelName) {
6666 appendProvider(provider)
6767 }
68+ if len(providers) == 0 && strings.ToLower(modelName) != modelName {
69+ for _, provider := range registry.GetGlobalRegistry().GetModelProviders(strings.ToLower(modelName)) {
70+ appendProvider(provider)
71+ }
72+ }
6873
6974 if len(providers) > 0 {
7075 return providers

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t