Repository navigation
Commit 0229ff2
fix(server): stop OpenCode model parsing from dropping models with a slash in the body
`parseModelsCliOutput` reads the `opencode models` output as alternating lines:
a `provider/model` slug line, then the model's single-line `JSON.stringify`
body. It told the two apart with `SLUG_LINE_RE = /^(\S+\/\S+)\s*$/`, which
matches any line that has no interior whitespace and contains a `/`. A JSON
body line can satisfy both: an OpenRouter-style model whose `id` is
`vendor/model` and whose string values contain no spaces (e.g.
`{"id":"qwen/qwen3-coder","providerID":"openrouter","name":"qwen3-coder","status":"active"}`)
is classified as a new slug, so `flushModel` runs against an empty body and the
model is silently dropped from the provider list.
A model body is always a single `JSON.stringify` line starting with `{`, and a
slug line never is, so only treat non-`{` lines as slug candidates. Added a
regression test (fails before, passes after).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>1 parent e259dd2 commit 0229ff2
2 files changed
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
128 | 153 | | |
129 | 154 | | |
130 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
| |||
0 commit comments