Compare commits

...

4 Commits

Author SHA1 Message Date
Saoud Rizwan 8726473424 v3.40.2 Release Notes (hotfix)
Hotfix release including:
- 279e371cf: fix: prevent logout on network errors during token refresh (#8021)
2025-12-11 03:39:26 +09:00
Saoud Rizwan 849aa41601 fix: prevent logout on network errors during token refresh (#8021)
* fix: prevent logout on network errors during token refresh

When network errors occur at startup (e.g., opening laptop while offline),
users were being logged out because the token refresh failed and returned
null to AuthService.

Now on network errors or max retries exceeded, we return the stored auth
data instead of clearing the session. This keeps users logged in with
their existing credentials. If the token is truly invalid, the actual API
request will fail later when the user tries to use Cline, rather than
logging them out preemptively at startup.

* chore: add changeset
2025-12-11 03:39:00 +09:00
Saoud Rizwan 0edcc02e9f v3.40.1 Release Notes
Hotfix release including:
- 4df486fa5: fix cost calculation for Anthropic API requests (#7943)
2025-12-05 15:52:02 -08:00
Saoud Rizwan 5479fe53a6 fix: restore cost calculation for Anthropic API requests (#7943)
The taskMetrics.totalCost was incorrectly initialized to 0 instead of
undefined in commit 09692d7d3. This broke cost display for providers
like Anthropic that don't return totalCost in their usage chunks.

When totalCost is 0, the fallback to calculateApiCostAnthropic() in
updateApiReqMsg doesn't trigger because the nullish coalescing operator
(??) only falls back for null/undefined, not 0.

By initializing totalCost to undefined:
- Providers that return totalCost (like OpenRouter) use that value
- Providers that don't (like Anthropic) fall back to calculating cost
  from token counts and model pricing info
2025-12-05 15:51:44 -08:00
4 changed files with 22 additions and 9 deletions
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## [3.40.2]
- Fix logout on network errors during token refresh (e.g., opening laptop while offline)
## [3.40.1]
- Fix cost calculation display for Anthropic API requests
## [3.40.0]
- Fix highlighted text flashing when task header is collapsed
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "claude-dev",
"displayName": "Cline",
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, running commands, using the browser, and more with your permission every step of the way.",
"version": "3.40.0",
"version": "3.40.2",
"icon": "assets/icons/icon.png",
"engines": {
"vscode": "^1.84.0"
+7 -1
View File
@@ -2716,7 +2716,13 @@ export class Task {
await this.postStateToWebview()
try {
const taskMetrics = { cacheWriteTokens: 0, cacheReadTokens: 0, inputTokens: 0, outputTokens: 0, totalCost: 0 }
const taskMetrics: {
cacheWriteTokens: number
cacheReadTokens: number
inputTokens: number
outputTokens: number
totalCost: number | undefined
} = { cacheWriteTokens: 0, cacheReadTokens: 0, inputTokens: 0, outputTokens: 0, totalCost: undefined }
const abortStream = async (cancelReason: ClineApiReqCancelReason, streamingFailedMessage?: string) => {
if (this.diffViewProvider.isEditing) {
@@ -136,11 +136,9 @@ export class ClineAuthProvider implements IAuthProvider {
// Check if we've exceeded max retries
if (this.refreshRetryCount >= this.MAX_REFRESH_RETRIES) {
Logger.error(`Max refresh retries (${this.MAX_REFRESH_RETRIES}) exceeded. Clearing auth state.`)
controller.stateManager.setSecret("cline:clineAccountId", undefined)
this.refreshRetryCount = 0
this.lastRefreshAttempt = 0
return null
Logger.error(`Max refresh retries (${this.MAX_REFRESH_RETRIES}) exceeded.`)
// Don't clear session - return stored data and let API request fail later
return storedAuthData
}
// Try to refresh the token using the refresh token
@@ -177,8 +175,9 @@ export class ClineAuthProvider implements IAuthProvider {
throw refreshError
}
// For network errors, return null and let retry logic handle it
return null
// For network errors, return stored data - let the API request fail later
// when the user actually tries to use Cline, not at startup
return storedAuthData
}
}