Skip to content

feat(diagnostics): Anthropic OAuth migration warning banner (#556)#911

Draft
vivekchand wants to merge 1 commit intomainfrom
bot-fix/issue-556-anthropic-oauth-migration-banner
Draft

feat(diagnostics): Anthropic OAuth migration warning banner (#556)#911
vivekchand wants to merge 1 commit intomainfrom
bot-fix/issue-556-anthropic-oauth-migration-banner

Conversation

@vivekchand
Copy link
Copy Markdown
Owner

Summary

After Anthropic's April 4 2026 billing change, users who configured OpenClaw with an OAuth/legacy token (instead of an API key) will silently fail. ClawMetry already reads the OpenClaw config to detect billing mode; this PR wires that signal into a dismissible top-of-page warning banner so affected users see a clear, actionable message the next time they open the dashboard.

Changes

  • routes/health.py: extend /api/diagnostics with anthropic_oauth_warning: boolTrue when an Anthropic auth profile exists in ~/.openclaw/openclaw.json but no API key is configured (uses existing _provider_has_api_key + _load_openclaw_config_cached helpers, no new logic)
  • clawmetry/templates/partials/banners.html: new #oauth-migration-banner div — amber warning palette, matching the heartbeat/budget banner style; includes a one-click copy button for openclaw onboard --anthropic-api-key
  • clawmetry/static/js/app.js: loadDiagnostics() shows the banner when the flag is set and the user hasn't dismissed it; dismissOauthMigrationBanner() hides and persists dismissal via localStorage; copyOauthMigrationCmd() handles clipboard copy with fallback

Test plan

  • Set ANTHROPIC_API_KEY="" and add an Anthropic auth profile (with mode != "token") to ~/.openclaw/openclaw.json → banner appears on dashboard load
  • Set ANTHROPIC_API_KEY=sk-ant-... → no banner shown
  • Click Dismiss → banner hides; survives page refresh (localStorage key persists)
  • Click the command button → openclaw onboard --anthropic-api-key is copied to clipboard
  • GET /api/diagnostics returns anthropic_oauth_warning: true/false correctly
  • python3 -c 'import ast; ast.parse(open("routes/health.py").read())' passes

Bot meta

Draft PR opened autonomously based on the plan in #556. Marked draft for human review — mark Ready for Review once happy.

Closes #556


Generated by Claude Code

…556)

After Anthropic's April 4 2026 billing change, users still configured
with an OAuth profile (no API key) will silently fail. ClawMetry already
reads the OpenClaw config to detect billing mode; this wires that
signal into a dismissible top-of-page banner so affected users see an
actionable message the next time they open the dashboard.

- routes/health.py: add `anthropic_oauth_warning` bool to /api/diagnostics
  (True when an Anthropic auth profile exists but no API key is configured)
- clawmetry/templates/partials/banners.html: new #oauth-migration-banner
  (amber palette, matches existing heartbeat/budget banners)
- clawmetry/static/js/app.js: loadDiagnostics() shows the banner on flag;
  dismissOauthMigrationBanner() + copyOauthMigrationCmd() handle UX

Closes #556

Co-Authored-By: ClawMetry Autofix Bot <bot-autofix@clawmetry.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: In-dashboard migration guide — detect Anthropic OAuth token and prompt switch to API key

1 participant