Commit 0306f2b
fix(opencode-go): fetch models unconditionally — the /models endpoint is public (#437)
* fix(opencode-go): fetch models unconditionally — the /models endpoint is public
The Opencode Go model fetch in `requestRouterModels` was gated behind
`if (opencodeGoApiKey)` on the assumption that its `/models` endpoint requires
auth. It does not: the endpoint returns the full model list (HTTP 200) with no
Authorization header. Gating meant `routerModels["opencode-go"]` stayed `{}`
whenever the key wasn't present in `apiConfiguration` at fetch time, so the
model picker showed an empty list, fell back to the hardcoded default
(`glm-5.1`), and offered no model to select.
Fetch Opencode Go unconditionally like the other public routers
(`openrouter`, `vercel-ai-gateway`), forwarding the API key when present and
still flushing the cache when a new key is supplied. Updates the affected
`requestRouterModels` tests and adds a regression test for the keyless path.
* test: update ClineProvider.spec.ts assertions for unconditional opencode-go fetch
Mirror changes already made in webviewMessageHandler.spec.ts:
- successful responses: expect opencode-go call, assert mockModels
- individual provider failures: add mockResolvedValueOnce for opencode-go
- skips LiteLLM: assert mockModels instead of empty object
* add refresh button and update coverage
---------
Co-authored-by: Armando Vaquera <263793884+proyectoauraorg@users.noreply.github.com>
Co-authored-by: Naved Merchant <naved.merchant@gmail.com>1 parent f792c1b commit 0306f2b
5 files changed
Lines changed: 269 additions & 18 deletions
File tree
- src/core/webview
- __tests__
- webview-ui/src/components/settings/providers
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2580 | 2580 | | |
2581 | 2581 | | |
2582 | 2582 | | |
| 2583 | + | |
| 2584 | + | |
2583 | 2585 | | |
2584 | 2586 | | |
2585 | 2587 | | |
| |||
2595 | 2597 | | |
2596 | 2598 | | |
2597 | 2599 | | |
2598 | | - | |
| 2600 | + | |
2599 | 2601 | | |
2600 | 2602 | | |
2601 | 2603 | | |
| |||
2627 | 2629 | | |
2628 | 2630 | | |
2629 | 2631 | | |
| 2632 | + | |
2630 | 2633 | | |
2631 | 2634 | | |
2632 | 2635 | | |
| |||
2644 | 2647 | | |
2645 | 2648 | | |
2646 | 2649 | | |
2647 | | - | |
| 2650 | + | |
2648 | 2651 | | |
2649 | 2652 | | |
2650 | 2653 | | |
| |||
2741 | 2744 | | |
2742 | 2745 | | |
2743 | 2746 | | |
2744 | | - | |
| 2747 | + | |
2745 | 2748 | | |
2746 | 2749 | | |
2747 | 2750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
| |||
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
384 | | - | |
| 386 | + | |
385 | 387 | | |
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
390 | 421 | | |
391 | 422 | | |
392 | 423 | | |
| |||
469 | 500 | | |
470 | 501 | | |
471 | 502 | | |
472 | | - | |
| 503 | + | |
473 | 504 | | |
474 | 505 | | |
475 | 506 | | |
| |||
493 | 524 | | |
494 | 525 | | |
495 | 526 | | |
| 527 | + | |
496 | 528 | | |
497 | 529 | | |
498 | 530 | | |
| |||
527 | 559 | | |
528 | 560 | | |
529 | 561 | | |
530 | | - | |
| 562 | + | |
531 | 563 | | |
532 | 564 | | |
533 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | | - | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1038 | 1042 | | |
1039 | 1043 | | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1049 | 1047 | | |
1050 | 1048 | | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
1051 | 1054 | | |
1052 | 1055 | | |
1053 | 1056 | | |
| |||
Lines changed: 71 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
| |||
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
35 | 68 | | |
36 | 69 | | |
37 | 70 | | |
| |||
44 | 77 | | |
45 | 78 | | |
46 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
47 | 90 | | |
48 | 91 | | |
49 | 92 | | |
| |||
62 | 105 | | |
63 | 106 | | |
64 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
65 | 135 | | |
66 | 136 | | |
67 | 137 | | |
| |||
0 commit comments