openclaw - 💡(How to fix) Fix [Feature]: Add opt-out for external CLI credential sync into auth profiles [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#61694Fetched 2026-04-08 02:55:47
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Add a supported global opt-out for external CLI credential sync into OpenClaw auth profiles.

Root Cause

Existing behavior like OPENCLAW_AUTH_STORE_READONLY=1 is not sufficient because it only prevents persistence to disk. It does not disable the in-memory sync behavior.

Code Example

{
  "auth": {
    "externalCliSync": {
      "enabled": false
    }
  }
}

---

OPENCLAW_AUTH_EXTERNAL_CLI_SYNC=0
RAW_BUFFERClick to expand / collapse

Summary

Add a supported global opt-out for external CLI credential sync into OpenClaw auth profiles.

Problem to solve

OpenClaw currently syncs some external CLI credentials into the auth-profile store at runtime, including Codex CLI credentials. That is convenient in some setups, but it causes the wrong behavior when a user intentionally wants OpenClaw to use a different auth profile than the one configured in a local CLI.

A concrete case is Codex CLI: the local machine may already be authenticated for one account/profile, but OpenClaw should use a separate auth profile for a different account, org, or billing setup. Today, OpenClaw can still auto-import the local CLI credentials into the auth-profile store, which makes local CLI auth and OpenClaw auth feel coupled by default.

Existing behavior like OPENCLAW_AUTH_STORE_READONLY=1 is not sufficient because it only prevents persistence to disk. It does not disable the in-memory sync behavior.

Proposed solution

Add a generic auth-level opt-out for external CLI sync.

Recommended config:

{
  "auth": {
    "externalCliSync": {
      "enabled": false
    }
  }
}

Recommended env override:

OPENCLAW_AUTH_EXTERNAL_CLI_SYNC=0

Recommended precedence:

  1. env override
  2. config
  3. default true

This seems best implemented centrally in the auth-profile store load/hydration path rather than through provider-specific flags.

Alternatives considered

A provider-specific flag such as openai-codex.disableCliSync would solve one immediate case, but this behavior is not provider-specific. It is a generic auth-store hydration mechanism that already applies to multiple external CLIs, so the control belongs under auth, not under a specific provider.

Using plugin hooks or resolveSyntheticAuth also seems like the wrong seam, because the main behavior comes from auth-store external CLI sync rather than provider-specific fallback logic.

Relying on OPENCLAW_AUTH_STORE_READONLY=1 is also insufficient because it does not stop the sync from affecting runtime behavior.

Impact

Affected users/systems/channels: Users who run OpenClaw alongside local CLIs such as Codex CLI and want OpenClaw to use a different account, org, or auth profile than the local CLI.

Severity: Medium. It does not always break immediately, but it causes confusing and surprising auth behavior.

Frequency: Whenever external CLI sync runs and local CLI credentials are present.

Consequence: Unexpected credential coupling, wrong auth profile selection, stale or undesired credentials appearing in runtime behavior, and extra debugging after restarts or re-auth flows.

Evidence/examples

Concrete example:

  • Codex CLI is authenticated locally on the machine
  • OpenClaw is intended to use a different auth profile
  • OpenClaw auto-syncs external CLI credentials into the auth-profile store
  • there is no supported global way to disable that behavior

This request is specifically about the auth-profile external CLI sync path, not the separate provider-plugin resolveSyntheticAuth seam.

Additional information

This request is not asking to remove the feature entirely. Default-enabled behavior is probably fine for backward compatibility, but there should be a supported global opt-out so users can keep OpenClaw auth isolated from local CLI auth state.

If useful, a low-risk implementation would be:

  • add auth.externalCliSync.enabled
  • add OPENCLAW_AUTH_EXTERNAL_CLI_SYNC
  • gate the existing external CLI sync call sites through one helper in the auth-profile store

extent analysis

TL;DR

To fix the issue, add a global opt-out for external CLI credential sync into OpenClaw auth profiles by introducing a configuration option auth.externalCliSync.enabled and an environment variable override OPENCLAW_AUTH_EXTERNAL_CLI_SYNC.

Guidance

  • Introduce a new configuration option auth.externalCliSync.enabled with a default value of true to control the external CLI sync behavior.
  • Add an environment variable override OPENCLAW_AUTH_EXTERNAL_CLI_SYNC to allow users to opt-out of the external CLI sync.
  • Update the auth-profile store load/hydration path to respect the new configuration option and environment variable.
  • Gate the existing external CLI sync call sites through a single helper function in the auth-profile store to ensure consistent behavior.

Example

{
  "auth": {
    "externalCliSync": {
      "enabled": false
    }
  }
}

Alternatively, users can opt-out using the environment variable:

OPENCLAW_AUTH_EXTERNAL_CLI_SYNC=0

Notes

The proposed solution aims to provide a generic auth-level opt-out for external CLI sync, which should address the issue without removing the feature entirely. The implementation should be done centrally in the auth-profile store load/hydration path.

Recommendation

Apply the proposed solution by introducing the auth.externalCliSync.enabled configuration option and the OPENCLAW_AUTH_EXTERNAL_CLI_SYNC environment variable override. This will provide a supported global opt-out for users who want to keep OpenClaw auth isolated from local CLI auth state.

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