Skip to content

Commit 1ad87dc

Browse files
committed
Fix token expiration for copilot and anthropic.
1 parent 75e1c52 commit 1ad87dc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Drop `agentFileRelativePath` in favor of behaviors customizations in the future.
66
- Unwrap `chat` config to be at root level.
7+
- Fix token expiration for copilot and anthropic.
78

89
## 0.39.0
910

src/eca/llm_providers/anthropic.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
(if (= 200 status)
238238
{:refresh-token (:refresh_token body)
239239
:access-token (:access_token body)
240-
:expires-at (+ (System/currentTimeMillis) (* 1000 (:expires_in body)))}
240+
:expires-at (+ (quot (System/currentTimeMillis) 1000) (:expires_in body))}
241241
(throw (ex-info (format "Anthropic token exchange failed: %s" (pr-str body))
242242
{:status status
243243
:body body})))))
@@ -256,7 +256,7 @@
256256
(if (= 200 status)
257257
{:refresh-token (:refresh_token body)
258258
:access-token (:access_token body)
259-
:expires-at (+ (System/currentTimeMillis) (* 1000 (:expires_in body)))}
259+
:expires-at (+ (quot (System/currentTimeMillis) 1000) (:expires_in body))}
260260
(throw (ex-info (format "Anthropic refresh token failed: %s" (pr-str body))
261261
{:status status
262262
:body body})))))

0 commit comments

Comments
 (0)