Repository navigation
Conversation
Implements hourly ping for all Anthropic OAuth accounts to prevent token expiration after periods of inactivity. - New module: auth/keepalive.ts - Uses /api/oauth/usage endpoint (zero token cost) - Pings all logged-in accounts (multi-account support) - First ping after 5 minutes, then every hour - Integrated into InstanceBootstrap Fixes #9111
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Author
|
This PR implements a fix for the token expiration issues reported in #6559 and #4992. The approach uses the existing
Happy to address any feedback! |
This was referenced Jan 17, 2026
|
Why was this PR closed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements an automatic keep-alive mechanism for Anthropic OAuth tokens to prevent the "Token refresh failed: 400" error that occurs after periods of inactivity.
Problem
Users report that after several hours of inactivity (especially after sleep/overnight), the Anthropic OAuth token expires and refresh fails:
This forces users to re-login every morning. See related issues:
Solution
New module
auth/keepalive.tsthat periodically pings all logged-in Anthropic OAuth accounts using the/api/oauth/usageendpoint:InstanceBootstrap(), no user action requiredauth.keepalivefor debuggingChanges
packages/opencode/src/auth/keepalive.ts- New module with keep-alive logicpackages/opencode/src/project/bootstrap.ts- Initialize keep-alive on startupTesting
auth.keepalivemessages: