Skip to content

Commit 933715d

Browse files
committed
Fix renew token regression.
1 parent d2df06e commit 933715d

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- Fix renew token regression.
6+
- Improve error feedback when failed to renew token.
7+
58
## 0.44.0
69

710
- Support `deny` tool calls via `toolCall approval deny` setting.

src/eca/features/chat.clj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@
129129
(send-content! chat-ctx :system {:type :progress
130130
:state :running
131131
:text "Renewing auth token"})
132-
(f.login/renew-auth! provider db*)))
132+
(f.login/renew-auth! provider chat-ctx
133+
{:on-error (fn [error-msg]
134+
(send-content! chat-ctx :system {:type :text
135+
:text error-msg})
136+
(finish-chat-prompt! :idle chat-ctx)
137+
(throw (ex-info "Auth token renew failed" {})))})))
133138

134139
(send-content! chat-ctx :system {:type :progress
135140
:state :running

src/eca/features/login.clj

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,26 @@
4949
:content {:type :text
5050
:text (str input "\n")}})
5151
(login-step ctx)
52-
(db/update-global-cache! @db*)
5352
{:chat-id chat-id
5453
:status step}))
5554

56-
(defn renew-auth! [provider db*]
57-
(login-step
58-
{:provider provider
59-
:step :login/renew-token
60-
:db* db*})
61-
(db/update-global-cache! @db*))
55+
(defn renew-auth!
56+
[provider
57+
{:keys [db* messenger config]}
58+
{:keys [on-error]}]
59+
(try
60+
(login-step
61+
{:provider provider
62+
:messenger messenger
63+
:config config
64+
:step :login/renew-token
65+
:db* db*})
66+
(db/update-global-cache! @db*)
67+
(catch Exception e
68+
(on-error (.getMessage e)))))
6269

6370
(defn login-done! [{:keys [db* config messenger]}]
71+
(db/update-global-cache! @db*)
6472
(models/sync-models! db*
6573
config
6674
(fn [new-models]

0 commit comments

Comments
 (0)