mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-11-18 15:22:03 +00:00
When a `providers/set` gateway lists none of the allowed models Claude Code reports, session setup fails with an actionable standard ACP error before any prompt reaches the provider. The shared `narrowToGatewayModels` function now owns this check for both ACP versions. Empty catalogs, model rows without a resolved identity, and providers without model discovery retain their existing behavior. Open sessions also fail if they cannot restart under the new provider: v1 drops the session and reports a session failure to clients with the AIR capability; v2 preserves the error code and data and tells the client to fix the cause and then resume the session. Setting a compatible provider alone does not revive a stopped v2 session. Other standard restart errors, including authentication failures, also keep their details and the resume instruction; unknown restart failures retain the generic recovery message. Validation: 671 focused tests passed (3 skipped), TypeScript build and lint/format checks passed. Independent review accepted the exact commit and separately passed all 206 directly affected tests. The restart regression fails on the unchanged production code and passes with the fix. Tests cover a prompt after restoring a compatible provider but before resuming, preservation of authentication-error code/data, incompatible listings and cleanup in both protocols, and empty, alias-only, and mixed model catalogs. These checks use a fake SDK and gateway with an isolated Claude config directory; the full suite, installed Air, and a live provider were not exercised in this revision. --------- Co-authored-by: Codex <codex@openai.com>