fix(opencode): parse model IDs containing spaces - #7834
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Simple bug fix adjusting a regex to allow spaces in model IDs during CLI output parsing. The change is minimal, well-scoped, and includes a test case to verify the fix. You can add or adjust custom eligibility rules. Learn more. |
What Changed
Update regex to detect opencode models with whitespaces in id.
Before:

my-provider/Kimi K3model and preceding modelmy-provider/grok-4.6missingAfter:

my-provider/Kimi K3model and preceding modelmy-provider/grok-4.6correctly discovered and includedWhy
custom-provider/Kimi K3Checklist
I included a video for animation/interaction changesNote
Low Risk
Parser-only regex tweak with a targeted unit test; no auth, data, or runtime-control changes.
Overview
Fixes OpenCode CLI model inventory so slugs like
custom/Kimi K3are recognized instead of being skipped (which also dropped the following model).SLUG_LINE_REnow allows spaces in the model-id portion afterprovider/, and a unit test covers a spaced ID without losing the previous model.Reviewed by Cursor Bugbot for commit d2f5b9a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
SLUG_LINE_REto parse model IDs containing spaces in opencode runtimeBroadens the
SLUG_LINE_REregex in opencodeRuntime.ts so the model segment of a provider/model line may include internal spaces, as long as it does not start or end with whitespace. Adds a test case in opencodeRuntime.cliParsers.test.ts verifying that models with spaces in their IDs are parsed correctly and existing models under the same provider are preserved.Macroscope summarized d2f5b9a.