docs/auth-credential-semantics.md
This document defines the canonical credential eligibility and resolution semantics used across:
resolveAuthProfileOrderresolveApiKeyForProfilemodels status --probedoctor-authThe goal is to keep selection-time and runtime behavior aligned.
okexcluded_by_auth_ordermissing_credentialinvalid_expiresexpiredunresolved_refno_modelToken credentials (type: "token") support inline token and/or tokenRef.
token and tokenRef are absent.expires is optional.expires is present, it must be a finite number greater than 0.expires is invalid (NaN, 0, negative, non-finite, or wrong type), the profile is ineligible with invalid_expires.expires is in the past, the profile is ineligible with expired.tokenRef does not bypass expires validation.expires.tokenRef.unresolved_ref in models status --probe output.Agent auth inheritance is read-through. When an agent has no local profile, it
can resolve profiles from the default/main agent store at runtime without
copying secret material into its own auth-profiles.json.
Explicit copy flows, such as openclaw agents add, use this portability policy:
api_key profiles are portable unless copyToAgents: false.token profiles are portable unless copyToAgents: false.oauth profiles are not portable by default because refresh tokens can be
single-use or rotation-sensitive.copyToAgents: true only when
copying refresh material across agents is known safe.Non-portable profiles remain available through read-through inheritance unless the target agent signs in separately and creates its own local profile.
auth.order.<provider> or the auth-store order override is set for a
provider, models status --probe only probes profile ids that remain in the
resolved auth order for that provider.reasonCode: excluded_by_auth_order and the detail
Excluded by auth.order for this provider.models.json.models status --probe reports status: no_model with
reasonCode: no_model.none for persisted/plugin auth only, existing for refreshing already
stored external CLI profiles, or scoped for a concrete provider/profile set.allowKeychainPrompt: false; they use file-backed
external CLI credentials only and do not read or reuse macOS Keychain results.type: "oauth", SecretRef objects are not supported for that profile credential material.auth.profiles.<id>.mode is "oauth", SecretRef-backed keyRef/tokenRef input for that profile is rejected.For script compatibility, probe errors keep this first line unchanged:
Auth profile credentials are missing or expired.
Human-friendly detail and stable reason codes may be added on subsequent lines.