detached 25a4caf

fix kimi oauth token refresh

commit
25a4cafb4e74c982c600206c5992b2a4ade9b0da
author
patriceckhart · · 2026-05-06 16:19 UTC
parent
168941f
signature
unsigned
refs
tag: v0.1.58
2 files · +7 -3
M internal/agent/build.go +5 -1
@@ -357,7 +357,11 @@ func (r Resolved) NewClient() provider.Client {
357357 case "ollama":
358358 return provider.NewOpenAI(r.Credential, r.BaseURL)
359359 case "kimi":
360- return provider.NewKimiWithHeaders(r.Credential, r.BaseURL, kimiCodeHeaders())
360+ inner := provider.NewKimiWithHeaders(r.Credential, r.BaseURL, kimiCodeHeaders())
361+ if r.AuthMethod == "oauth" {
362+ return r.wrapWithRefresh(inner)
363+ }
364+ return inner
361365 case "openai":
362366 if r.AuthMethod == "oauth" {
363367 inner := provider.NewOpenAICodex(r.Credential, r.AccountID, r.BaseURL)
@@ -357,7 +357,11 @@ func (r Resolved) NewClient() provider.Client {
357 case "ollama":357 case "ollama":
358 return provider.NewOpenAI(r.Credential, r.BaseURL)358 return provider.NewOpenAI(r.Credential, r.BaseURL)
359 case "kimi":359 case "kimi":
360- return provider.NewKimiWithHeaders(r.Credential, r.BaseURL, kimiCodeHeaders())360+ inner := provider.NewKimiWithHeaders(r.Credential, r.BaseURL, kimiCodeHeaders())
361+ if r.AuthMethod == "oauth" {
362+ return r.wrapWithRefresh(inner)
363+ }
364+ return inner
361 case "openai":365 case "openai":
362 if r.AuthMethod == "oauth" {366 if r.AuthMethod == "oauth" {
363 inner := provider.NewOpenAICodex(r.Credential, r.AccountID, r.BaseURL)367 inner := provider.NewOpenAICodex(r.Credential, r.AccountID, r.BaseURL)
M internal/provider/openai.go +2 -2
@@ -356,12 +356,12 @@ func (c *openaiClient) Stream(ctx context.Context, req Request) (<-chan Event, e
356356
357357 resp, err := c.http.Do(httpReq)
358358 if err != nil {
359- return nil, fmt.Errorf("openai: %w", err)
359+ return nil, fmt.Errorf("%s: %w", c.Name(), err)
360360 }
361361 if resp.StatusCode != http.StatusOK {
362362 b, _ := io.ReadAll(resp.Body)
363363 resp.Body.Close()
364- return nil, fmt.Errorf("openai: http %d: %s", resp.StatusCode, strings.TrimSpace(string(b)))
364+ return nil, fmt.Errorf("%s: http %d: %s", c.Name(), resp.StatusCode, strings.TrimSpace(string(b)))
365365 }
366366
367367 out := make(chan Event, 16)
@@ -356,12 +356,12 @@ func (c *openaiClient) Stream(ctx context.Context, req Request) (<-chan Event, e
356 356
357 resp, err := c.http.Do(httpReq)357 resp, err := c.http.Do(httpReq)
358 if err != nil {358 if err != nil {
359- return nil, fmt.Errorf("openai: %w", err)359+ return nil, fmt.Errorf("%s: %w", c.Name(), err)
360 }360 }
361 if resp.StatusCode != http.StatusOK {361 if resp.StatusCode != http.StatusOK {
362 b, _ := io.ReadAll(resp.Body)362 b, _ := io.ReadAll(resp.Body)
363 resp.Body.Close()363 resp.Body.Close()
364- return nil, fmt.Errorf("openai: http %d: %s", resp.StatusCode, strings.TrimSpace(string(b)))364+ return nil, fmt.Errorf("%s: http %d: %s", c.Name(), resp.StatusCode, strings.TrimSpace(string(b)))
365 }365 }
366 366
367 out := make(chan Event, 16)367 out := make(chan Event, 16)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close