Skip to content

fix: don't warn about expired OAuth tokens with valid refresh tokens - #4593

Merged
shakkernerd merged 1 commit into
openclaw:mainfrom
ayushozha:fix/doctor-oauth-refresh-token-warning
Jan 30, 2026
Merged

shakkernerd merged 1 commit into
openclaw:mainfrom
ayushozha:fix/doctor-oauth-refresh-token-warning

Conversation

@ayushozha

@ayushozha ayushozha commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • OAuth credentials with a valid refresh token auto-renew on first API call
  • buildProfileHealth() in auth-health.ts now checks for a refresh token before marking status as "expired" or "expiring"
  • When a refresh token is present, the status is reported as "ok" instead, suppressing the unnecessary doctor warning
  • Added test coverage for OAuth credentials without a refresh token (empty string)

Test plan

  • Existing auth-health tests updated and passing
  • New test for OAuth without refresh token verifies it still reports "expired"
  • Build passes

Fixes #3032

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jan 30, 2026
OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-Authored-By: Ayush Ojha <[email protected]>
@shakkernerd
shakkernerd force-pushed the fix/doctor-oauth-refresh-token-warning branch from f20a6c9 to a2c0d05 Compare January 30, 2026 15:37
@shakkernerd
shakkernerd merged commit 37e295f into openclaw:main Jan 30, 2026
19 of 23 checks passed
GodsBoy added a commit to GodsBoy/openclaw that referenced this pull request Jan 31, 2026
Add Claude Code CLI credential sync to external-cli-sync, matching the existing Qwen CLI pattern. When ~/.claude/.credentials.json contains full OAuth credentials (access + refresh token), they are imported as type: oauth profiles enabling automatic token refresh.

Changes:
- external-cli-sync.ts: add Claude CLI sync (OAuth + setup-token fallback)
- doctor-auth.ts: un-deprecate anthropic:claude-cli profile
- external-cli-sync.test.ts: integration tests
- isExternalProfileFresh: accept optional provider param

Supersedes openclaw#4615. Complements openclaw#4593.
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Jan 31, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ayushozha added a commit to ayushozha/openclaw that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
GodsBoy added a commit to GodsBoy/openclaw that referenced this pull request Feb 1, 2026
Add Claude Code CLI credential sync to external-cli-sync, matching the
existing Qwen CLI pattern. When ~/.claude/.credentials.json contains
full OAuth credentials (access + refresh token), they are imported as
type: "oauth" profiles enabling automatic token refresh.

This solves three problems:
1. Token expiry requires manual re-auth (auto-refresh via refresh token)
2. Re-onboarding with setup-token loses user:profile scope (full OAuth
   preserves all scopes including usage tracking)
3. No easy path to import Claude Code credentials (automatic sync)

Changes:
- external-cli-sync.ts: add Claude CLI sync (OAuth + setup-token fallback)
- doctor-auth.ts: un-deprecate anthropic:claude-cli profile, update hint
  to recommend `claude login` for refresh
- external-cli-sync.test.ts: integration tests using temp credential files
- isExternalProfileFresh: accept optional provider param for multi-CLI use
- Refactored Qwen sync to use shared syncExternalCliCredentialsForProvider

Supersedes openclaw#4615 (scope hint) by addressing the root cause.
Complements openclaw#4593 (don't warn about expired tokens with refresh tokens).
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
YuriNachos pushed a commit to YuriNachos/clawdbot-fork that referenced this pull request Feb 1, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
mf-yang added a commit to mf-yang/openclaw-cn that referenced this pull request Feb 2, 2026
…upstream openclaw#4593)

Suppress misleading warnings when OAuth tokens have valid refresh tokens.
HashWarlock pushed a commit to HashWarlock/openclaw that referenced this pull request Feb 4, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
uxcu pushed a commit to uxcu/kook-openclaw that referenced this pull request Feb 5, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
bestNiu pushed a commit to bestNiu/clawdbot that referenced this pull request Feb 5, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
Geravant pushed a commit to anthillnet/openclaw that referenced this pull request Feb 27, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…penclaw#4593)

OAuth credentials with a refresh token auto-renew on first API call,
so the doctor should not warn about access token expiration when a
refresh token is present. This avoids unnecessary "expired" warnings
that prompt users to re-auth when no action is needed.

Fixes openclaw#3032

Co-authored-by: Ayush Ojha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor: don't warn about expiring OAuth tokens with valid refresh tokens

2 participants