Repository navigation
Description
Is there an existing feature request for this?
- I have searched existing issues and feature requests, and this is not a duplicate.
Problem or Use Case
A client configuring an ACP agent (Agent Canvas onboarding and Settings → Agent) cannot learn which models the agent offers or which one it uses by default until a conversation has started. It falls back to a static, curated list in ACP_PROVIDERS, which is wrong whenever the catalogue depends on the user's credentials:
- Codex with a ChatGPT login offers
gpt-6-astra(default),gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna; the registry says defaultgpt-5.5. - Pi has no fixed default; its catalogue depends on which provider key is configured.
- OpenCode offers 11 free models without a key and ~114 with one.
- Kimi Code and custom servers have no curated list at all.
The live list already exists per conversation (ConversationInfo.available_models / current_model_id), but only after a session is created.
Separately, since the agent-client-protocol 0.10.1 → 0.12.1 bump (#5122) gemini-cli sessions report no models and silently ignore the requested model: 0.12 dropped the UNSTABLE models block from NewSessionResponse and removed ClientSideConnection.set_session_model, and gemini-cli (0.46 through the current 0.63) uses only those.
Desired Behavior
An agent-server endpoint that, given ACP agent settings and the same secrets map a conversation start takes, starts the ACP server in a throwaway session and returns the server's default model, its available models, and a typed error (ACPAuthRequired, ACPStartupTimeout, ACPSpawnError, ACPInitError) when it cannot start. It must reuse the conversation startup path so credentials behave exactly as in a real conversation, and work for every built-in provider, including Gemini.
Acceptance Criteria
-
POST /api/acp/modelsreturnscurrent_model_idandavailable_modelsfor claude-code, codex, gemini-cli, kimi-code, pi and opencode. - Missing credentials come back as
error.code == "ACPAuthRequired"in a 200 response. - Stored secrets can be passed by reference (
LookupSecret), as in a conversation start. - Gemini sessions list their models again and honour the requested model.
Alternatives Considered
Using only the per-conversation available_models (helps inside a conversation, not when configuring the agent), or keeping the curated lists up to date by hand (cannot follow credential-dependent catalogues).
Priority / Severity
Medium
Estimated Scope
Medium
Feature Area
Agent API / Core functionality
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Bounded scope: this repository owns the agent-server REST surface and the ACP/SDK agent layer (AGENTS.md, openhands-agent-server/AGENTS.md), so both halves belong here. Add an additive POST /api/acp/models endpoint that runs the normal ACP startup path in a throwaway session — from the same ACP agent_settings and secrets map a conversation start accepts — and reports the ACP server's own default and available models, plus a typed startup error. Separately, restore gemini-cli model reporting and selection under the pinned agent-client-protocol 0.12.x, which dropped the UNSTABLE models block and ClientSideConnection.set_session_model. An adjacent draft implementation (#5579) by the same author confirms the intended shape; a PR is not a readiness requirement.
Non-goals: no new ACP provider; no change to the curated ACP_PROVIDERS lists or to ConversationInfo.available_models/current_model_id semantics; not a substitute for the per-conversation model list; no Agent Canvas/client UI work (owned by OpenHands/OpenHands).
Acceptance Criteria
-
POST /api/acp/modelsreturns HTTP 200 withcurrent_model_idandavailable_modelsfor claude-code, codex, gemini-cli, kimi-code, pi, and opencode when the provider's credentials are present. - For credential-dependent catalogues the response reflects the live ACP server, not the static
ACP_PROVIDERSlist — e.g. codex with a ChatGPT login returns the ChatGPT default/models and opencode with no key returns its free catalogue; the result matches the same provider'sConversationInfo.current_model_id/available_modelsafter a real conversation start. - The request takes the same ACP
agent_settingsandsecretsmap asPOST /api/conversations;LookupSecretreferences to stored secrets resolve identically to a conversation start (same env assembly, file credentials, and auth-method selection). - Missing or invalid credentials return HTTP 200 with
error.code == "ACPAuthRequired"(not a 5xx or an uncaught exception). - Startup timeout, a missing/unlaunchable binary, and other handshake/init failures return HTTP 200 with
error.codeofACPStartupTimeout,ACPSpawnError, andACPInitErrorrespectively. - A custom/unknown ACP server with no curated provider entry returns a usable result or one of the typed errors, and non-ACP agent settings are rejected with a clear 4xx validation error rather than a 500.
- The call is side-effect free: no conversation appears in
GET /api/conversations, and no ACP subprocess or temporary directory remains after success or failure. - With the pinned
agent-client-protocol0.12.x, a gemini-cli session again reportsavailable_modelsand applies the requestedacp_model, both in discovery and in a running conversation, matching pre-chore(deps): bump agent-client-protocol from 0.10.1 to 0.12.1 #5122 behavior; an absent or malformed model block degrades gracefully instead of raising. - The change is additive: no existing
/api/**operation or response schema changes incompatibly (the agent-server REST breakage check passes), andConversationInfofields are unchanged. - Credentials do not appear in the response body, logs, or error text — only names or redacted values; stored secret values are resolved server-side.
- The endpoint is present in the agent-server OpenAPI schema and, per the SDK → OpenAPI →
clients/typescript→ Canvas flow, mirrored in the TypeScript client;OpenHands/docssdk/documentation is updated. - Automated tests cover the route (success, auth-error envelope, and no-conversation/no-leftover-process side effects) and the Gemini regression; live ACP coverage (
pytest -m acp_live) exercises the built-in providers where credentials are available.
Activity