fix(model): parse model specs with multiple slashes and colons correctly#930
fix(model): parse model specs with multiple slashes and colons correctly#930decode2 wants to merge 4 commits into
Conversation
The test was hardcoding Unix-style paths (~/.config/gga/config) but gga.ConfigPath() uses %APPDATA%\gga\config on Windows. Use the gga package functions to get platform-correct paths instead of hardcoding. This ensures the test works correctly on all platforms.
The read-path parser in ReadCurrentModelAssignments was splitting on the first colon before checking for slashes. This broke model specs like 'openrouter/qwen/qwen3.6-plus:free' where the provider is before the first slash, not before the colon. Changed the parsing logic to find the first separator (either '/' or ':') instead of preferring colon-first. This aligns with the write-path parser in parseModelSpec (sync.go) which already handles this correctly. Added test coverage for OpenRouter free-model specs with the format 'provider/org/model:variant'. Fixes Gentleman-Programming#802
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFixes the colon-first separator bug in ChangesSDD model spec first-separator fix
GGA backup test path correction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
The ReadCurrentModelAssignments fix looks right, but #802 also calls out the same parsing bug in internal/components/sdd/profiles.go. That path still parses colon-first, so openrouter/qwen/qwen3.6-plus:free gets split incorrectly for named SDD profiles. Please update the profile parsing path to use the same first-separator logic and add a regression test through DetectProfiles or extractModelFromAgent.
Apply same fix as read_assignments.go to profiles.go: find the first separator (either '/' or ':') instead of preferring colon-first. This fixes parsing of specs like 'openrouter/qwen/qwen3.6-plus:free' where the provider is before the first slash, not before the colon. Added test TestExtractModelFromAgent_OpenRouterFreeModel to verify the fix works correctly for named SDD profiles. Addresses review feedback from Alan-TheGentleman on PR Gentleman-Programming#930
|
@Alan-TheGentleman Applied the same fix to profiles.go as requested. The extractModelFromAgent function now finds the first separator (either '/' or ':') instead of preferring colon-first, matching the fix in read_assignments.go. Added test TestExtractModelFromAgent_OpenRouterFreeModel to verify that 'openrouter/qwen/qwen3.6-plus:free' is parsed correctly for named SDD profiles. Both parsing paths now handle multi-slash/colon specs consistently. |
|
Hi @Alan-TheGentleman, the changes are complete:
Ready for re-review! |
Summary
Fixes model spec parsing in \ReadCurrentModelAssignments\ to correctly handle specs with multiple slashes and colons like \openrouter/qwen/qwen3.6-plus:free.
Problem
The read-path parser was splitting on the first colon before checking for slashes. This broke model specs where the provider is before the first slash, not before the colon.
For example, \openrouter/qwen/qwen3.6-plus:free\ was incorrectly parsed as:
When it should be:
Solution
Changed the parsing logic to find the first separator (either /\ or :) instead of preferring colon-first. This aligns with the write-path parser in \parseModelSpec\ (sync.go) which already handles this correctly.
Changes
Testing
All existing tests pass, including:
Fixes #802
Summary by CodeRabbit
Bug Fixes
/or:) and correctly deriving provider/model IDs, including cases with multiple separator characters. Malformed specs (including leading/empty separators) are now skipped instead of misparsed.Tests