openclaw - 💡(How to fix) Fix [Feature]: openclaw auth migrate — atomic auth profile switch across all agent stores [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61709Fetched 2026-04-08 02:55:34
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Root Cause

Auth profile management is currently a per-agent manual operation that requires knowing the internal file structure. As constellations grow (multiple agents per host), the risk of partial/inconsistent migrations increases. A single atomic command would eliminate the class of "works for one agent, broken for another" failures entirely.

Code Example

openclaw auth migrate --provider anthropic --from <profile-id> --to <profile-id>

---

openclaw auth set-active --provider anthropic --profile <profile-id>
RAW_BUFFERClick to expand / collapse

Problem

When switching a provider's auth mode (e.g., Anthropic OAuth token → API key), each agent has its own auth-profiles.json under ~/.openclaw/agents/<id>/agent/auth-profiles.json. There is no CLI command to update all agent stores atomically. The result: partial migrations where some agents are updated and others are not, leading to silent failures where one agent is running on a broken/expired profile while others are fine.

Concrete case

We migrated the proving-ground agent from an Anthropic CC OAuth token to an API key successfully. The main agent on the same host still had both OAuth token profiles in its auth-profiles.json with lastGood.anthropic pointing to one of them. This was only discovered during a separate diagnostic pass — the gateway gave no warning that two agents on the same host were using different (and one broken) auth profiles for the same provider.

Proposed CLI command

openclaw auth migrate --provider anthropic --from <profile-id> --to <profile-id>

Or more simply, for the common "switch all agents to this profile" case:

openclaw auth set-active --provider anthropic --profile <profile-id>

This would:

  1. Find all agent-scoped auth-profiles.json files on the host
  2. Update lastGood.<provider> in each to point to the specified profile
  3. Optionally remove deprecated profiles (with --remove-stale flag)
  4. Report which agent stores were updated

Why this matters

Auth profile management is currently a per-agent manual operation that requires knowing the internal file structure. As constellations grow (multiple agents per host), the risk of partial/inconsistent migrations increases. A single atomic command would eliminate the class of "works for one agent, broken for another" failures entirely.

extent analysis

TL;DR

Implementing a CLI command like openclaw auth migrate or openclaw auth set-active can help update all agent stores atomically, preventing partial migrations and silent failures.

Guidance

  • To mitigate the issue, consider creating a script that manually updates each agent's auth-profiles.json file to ensure consistency across all agents on a host.
  • Before implementing any changes, verify the current state of auth-profiles.json files for all agents to identify any existing inconsistencies.
  • When designing the proposed CLI command, ensure it handles cases where agents may have different or missing auth-profiles.json files to prevent errors.
  • Consider adding a --dry-run flag to the proposed CLI command to test its effects without making actual changes to the agent stores.

Example

# Example of how the proposed CLI command could be used
openclaw auth set-active --provider anthropic --profile new-api-key-profile

Notes

The implementation of the proposed CLI command should be carefully considered to ensure it handles all possible edge cases and scenarios, such as agents with missing or corrupted auth-profiles.json files.

Recommendation

Apply a workaround by creating a script to manually update each agent's auth-profiles.json file, as implementing the proposed CLI command may require significant development and testing efforts. This workaround can help prevent partial migrations and silent failures until a more permanent solution is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature]: openclaw auth migrate — atomic auth profile switch across all agent stores [1 participants]