Repository navigation
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
Open
arena-ai-coding-agent[bot] wants to merge 1 commit into
arena-ai-coding-agent[bot] wants to merge 1 commit into
Conversation
… 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes openclaw#130673
What Problem This Solves
Fixes an issue where
openclaw models listreportedAuth -/available: nullfor Anthropic models configured withagentRuntime.id: "claude-cli", even whenclaude auth status --jsonconfirmedloggedIn: true. The standaloneopenclaw models listdisagreed withopenclaw gateway call models.listwhich correctly returnedavailable: truefor the same model.Why This Change Was Made
The standalone
openclaw models listcommand created its auth index viacreateModelListAuthIndexwithout passingpreparedRuntimeAuthModes. The auth evaluator received a store loaded vialoadAuthProfileStoreWithoutExternalProfileswhich strips external-CLI profile metadata — so theanthropic:claude-cliOAuth credential was never visible to the evaluator. With no profile evidence and nopreparedRuntimeAuthModeshint, the evaluator fell through to the synthetic-auth path which returnsavailability: undefined(nullin JSON).The Gateway-side
models.listpassespreparedRuntimeAuthModesfrom the live runtime context (which has already run agent auth discovery) — that's why it returns the correct answer.Fix in two parts:
list.list-command.ts: After loading the base auth store, also callensureAuthProfileStorewithexternalCliProfileIds: [CLAUDE_CLI_PROFILE_ID](no keychain prompt). If theanthropic:claude-cliprofile has usable OAuth material (non-expired access+refresh), synthesizepreparedRuntimeAuthModes: { anthropic: "oauth" }and pass it tocreateModelListAuthIndex.list.auth-index.ts: Add the optionalpreparedRuntimeAuthModesfield toCreateModelListAuthIndexParamsand forward it tocreateModelAuthAvailabilityResolver.User Impact
openclaw models listnow showsAuth yes/available: truefor Anthropic models routed through the native Claude CLI when the CLI is authenticated. The output matchesopenclaw gateway call models.list.Evidence
available: null, gateway call →available: truecreateModelAuthAvailabilityResolvercheckspreparedRuntimeAuthModesfirst (line 625-633) and returns early with the correct availability when presentauth-list.test.tsshowsanthropic:claude-cliis already treated as a valid OAuth profile in the auth list commandAI-assisted fix. I have reviewed the code and understand what it does.