fix(cosh): filter unavailable agents in key sharing prompt#394
Merged
kongche-jbw merged 1 commit intoalibaba:mainfrom Apr 28, 2026
Merged
Conversation
The Custom Provider auth flow previously rendered a hard-coded list of agents (OpenClaw, Qwen Code) whenever any single agent config dir was detected, so users without the corresponding install still saw import prompts for missing agents and got stuck if their only present agent failed key detection. Per-agent detection results are now used to filter the share list and the done-transition condition, so only agents whose config dir actually exists are offered, and the flow auto-skips to manual config once every detectable agent has failed. Closes alibaba#386
|
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
Collaborator
Author
|
Caution This PR was generated and submitted by AI. |
Collaborator
Author
|
Manual testing successful:
Confirmed the fix has no impact on other code logic. |
|
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
Collaborator
|
Consider deduplicating excludedChoices — using a Set prevents any future edge case. |
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.
Description
Fix the Custom Provider auth flow so the Agent Key Sharing prompt only
offers agents whose config directory actually exists on the host.
Previously the share list was hard-coded to
OpenClawandQwen Code,and the flow was gated by a single "any agent config dir present"
boolean. When only one of the two was installed, users still saw the
missing agent in the list (the exact scenario reported in #386 —
~/.qwenis absent but the Qwen Code option is shown anyway). Theauto-skip to manual config also required both agents to fail, so a
user with only one installed agent whose key could not be read got
stuck re-selecting the same agent instead of falling through to manual
entry.
Per-agent detection results (
hasOpenclawDir,hasQwenCodeDir) arenow computed once on entering the
USE_OPENAIflow and used both tofilter the
CustomAgentKeySharePrompt(missing agents are added toexcludedChoices) and to gate theidle → donetransition (alldetectable agents failed, not all agents). File I/O behavior is
unchanged: directory probing still uses
existsSynconly, no configfiles are read until the user picks an agent.
Related Issue
closes #386
Type of Change
Scope
cosh(copilot-shell)Checklist
cosh: Lint passes, type check passes, and tests passpackage-lock.json/Cargo.lock)Testing
Additional Notes