Skip to content

fix(import): consolidate per-agent auth profiles into global store during OpenClaw import #439

@alexey-pelykh

Description

@alexey-pelykh

Context

#427 (done ✅) adapted the OpenClaw import for the Phase 1 auth changes but predated the global auth store relocation (#438). OpenClaw stores auth profiles per-agent at ~/.openclaw/agents/{id}/agent/auth-profiles.json. After #438, RemoteClaw uses a single global store at ~/.remoteclaw/auth-profiles.json. The import now copies auth files into the old per-agent structure where they won't be found.

Problem

After #438 lands, imported OpenClaw installations will have:

  • Auth profile files at ~/.remoteclaw/agents/{id}/agent/auth-profiles.json (old per-agent paths)
  • Global store at ~/.remoteclaw/auth-profiles.json either empty or missing
  • Credentials silently unused

Required changes

1. Consolidate per-agent auth files into global store

During import:

  • Discover all auth-profiles.json files under source (existing discoverSourceAuthProfileIds logic)
  • Merge all discovered profiles into a single store
  • Conflict resolution: warn if same profile ID appears in multiple agent dirs with different keys
  • Write consolidated store to ~/.remoteclaw/auth-profiles.json (global path)
  • Do NOT copy auth files into per-agent directories

2. Update copyDirectory auth handling

The current copyDirectory copies auth-profiles.json as regular files preserving directory structure. After this change:

  • Skip auth-profiles.json files during regular directory copy
  • Collect them separately for consolidation into the global store

Tests

  • Import with per-agent auth profiles → consolidated into single global file
  • Import with auth profiles in multiple agent dirs → merged correctly
  • Profile ID conflict across agents → warning logged
  • Auth profiles NOT copied to per-agent directories
  • Existing import tests continue to pass

Depends on

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions