Skip to content

fix(models): show correct auth status for claude-cli routed anthropic models in models list - #11

Open
arena-ai-coding-agent[bot] wants to merge 1 commit into
mainfrom
fix/claude-cli-models-auth-status-130673
Open

arena-ai-coding-agent[bot] wants to merge 1 commit into
mainfrom
fix/claude-cli-models-auth-status-130673

Conversation

@arena-ai-coding-agent

Copy link
Copy Markdown

Closes openclaw#130673

What Problem This Solves

Fixes an issue where openclaw models list reported Auth - / available: null for Anthropic models configured with agentRuntime.id: "claude-cli", even when claude auth status --json confirmed loggedIn: true. The standalone openclaw models list disagreed with openclaw gateway call models.list which correctly returned available: true for the same model.

Why This Change Was Made

The standalone openclaw models list command created its auth index via createModelListAuthIndex without passing preparedRuntimeAuthModes. The auth evaluator received a store loaded via loadAuthProfileStoreWithoutExternalProfiles which strips external-CLI profile metadata — so the anthropic:claude-cli OAuth credential was never visible to the evaluator. With no profile evidence and no preparedRuntimeAuthModes hint, the evaluator fell through to the synthetic-auth path which returns availability: undefined (null in JSON).

The Gateway-side models.list passes preparedRuntimeAuthModes from the live runtime context (which has already run agent auth discovery) — that's why it returns the correct answer.

Fix in two parts:

  1. list.list-command.ts: After loading the base auth store, also call ensureAuthProfileStore with externalCliProfileIds: [CLAUDE_CLI_PROFILE_ID] (no keychain prompt). If the anthropic:claude-cli profile has usable OAuth material (non-expired access+refresh), synthesize preparedRuntimeAuthModes: { anthropic: "oauth" } and pass it to createModelListAuthIndex.

  2. list.auth-index.ts: Add the optional preparedRuntimeAuthModes field to CreateModelListAuthIndexParams and forward it to createModelAuthAvailabilityResolver.

User Impact

openclaw models list now shows Auth yes / available: true for Anthropic models routed through the native Claude CLI when the CLI is authenticated. The output matches openclaw gateway call models.list.

Evidence

  • Issue trace showing the divergence: standalone CLI → available: null, gateway call → available: true
  • Source-level confirmation: createModelAuthAvailabilityResolver checks preparedRuntimeAuthModes first (line 625-633) and returns early with the correct availability when present
  • The existing auth-list.test.ts shows anthropic:claude-cli is already treated as a valid OAuth profile in the auth list command

AI-assisted fix. I have reviewed the code and understand what it does.

… models in models list

Closes openclaw#130673

'openclaw models list' reported available: null for anthropic models
configured with agentRuntime.id: 'claude-cli', even when 'claude auth
status --json' showed loggedIn: true. The standalone CLI command
differed from 'gateway call models.list' which correctly returned
available: true.

Root cause: createModelListAuthIndex in the standalone command was
called without preparedRuntimeAuthModes.  The auth evaluator received
a store loaded via loadAuthProfileStoreWithoutExternalProfiles which
strips external-CLI profile metadata, so the anthropic:claude-cli OAuth
credential was never found.  The evaluator then returned availability:
null because synthetic-auth metadata alone does not prove a native login.

Fix:
1. In list.list-command.ts: after loading the base auth store, also
   call ensureAuthProfileStore with externalCliProfileIds:
   [CLAUDE_CLI_PROFILE_ID] to load the claude-cli credential without
   a keychain prompt. If the resulting anthropic:claude-cli profile
   has usable OAuth material (non-expired access+refresh), synthesize
   preparedRuntimeAuthModes: {anthropic: 'oauth'} and pass it to
   createModelListAuthIndex.

2. In list.auth-index.ts: add the optional preparedRuntimeAuthModes
   field to CreateModelListAuthIndexParams and forward it to
   createModelAuthAvailabilityResolver.

Co-authored-by: arena-agent <[email protected]>
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.

[Bug]: Authenticated Claude CLI models show unknown auth in models list

1 participant