fix(sdd): parse model string on first separator to fix OpenRouter /free bug#242
fix(sdd): parse model string on first separator to fix OpenRouter /free bug#242ACDPDEV wants to merge 1 commit into
Conversation
…ee bug Both extractModelFromAgent and ReadCurrentModelAssignments incorrectly preferred colon over slash when splitting model strings. For OpenRouter free models like openrouter/qwen/qwen3.6-plus:free, this produced openrouter/qwen/qwen3.6-plus/free instead of the correct :free suffix. Fix: find the FIRST occurrence of either / or : (whichever comes first), matching the correct implementation already present in parseModelSpec.
|
fsda |
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
Review: APPROVE
Clean, correct, well-scoped fix. The first-separator approach matches the existing parseModelSpec in sync.go and correctly handles OpenRouter model IDs that contain both / and :.
Suggestions (non-blocking)
-
Extract a shared helper — after this PR there are three identical copies of the "split on first
/or:" logic (sync.go,profiles.go,read_assignments.go). A singlesplitProviderModel(s string) (string, string, bool)function would prevent this class of bug from recurring. Consider a follow-up. -
Add a regression test for the OpenRouter format. The existing tests in
read_assignments_test.goonly coverprovider:modelandprovider/model— none cover the combined caseopenrouter/qwen/qwen3.6-plus:freethat motivated this fix. Same forextractModelFromAgent, which has no dedicated test coverage at all.
Both are follow-ups, not blockers. The fix itself is correct.
|
Actual issue: #260 |
|
Hola @ACDPDEV — me crucé con tu PR después de entrar al issue #260. El fix es elegante: buscar el primer separador ( Lo que veo en CI:
Ese fallo es de hace 2.5 semanas. También dejé un comment en #260 dirigido al reporter que quedó desalineado (no vi tu PR cuando lo escribí — mea culpa por búsqueda floja). Lo voy a editar para redirigir a acá. Si preferís que no me meta, todo tranqui, me aparto. Tu PR, tu merge. Solo quería ofrecer desatascar el E2E si está frenado por drift. |
|
Te dejo mano libre, me sería de mucha ayuda, ya no pude seguir con esto porque acabo de entrar a la universidad y ando muy atareado, más bien @Basparin te agradecería la ayuda. |
|
Sí logras solucionar lo del E2E sería de mucha ayuda |
|
This proposal is currently working on #374 |
Summary
/freesuffix instead of:freeinopencode.jsonextractModelFromAgentandReadCurrentModelAssignments) incorrectly preferred:over/when splitting model strings, causingopenrouter/qwen/qwen3.6-plus:freeto be parsed asProviderID=openrouter/qwen/qwen3.6-plus, ModelID=free/or:(whichever comes first), matching the correct implementation already present inparseModelSpec(sync.go)Why the first-separator rule works
The
provider/model-idformat inopencode.jsonis inherently ambiguous when the model ID contains slashes (OpenRouter IDs likeqwen/qwen3.6-plus:free). All provider IDs are simple (never contain/or:), so finding the first separator correctly splits:openrouter/qwen/qwen3.6-plus:freeopenrouterqwen/qwen3.6-plus:freeanthropic/claude-opus-4-6"anthropicclaude-opus-4.6opencode/qwen3.6-plus-freeopencodeqwen3.6-plus-freeFiles Changed
internal/components/sdd/profiles.go—extractModelFromAgent: first-separator parsinginternal/components/sdd/read_assignments.go—ReadCurrentModelAssignments: same fix + removed unusedstringsimportTesting
Closes #244