kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

[ACP] authMethods always advertises a terminal-type login method, even when the client didn't declare clientCapabilities.auth.terminal

Open agourakis82 opened this issue 2 months ago • 1 comments

Found by running the official acp-tck v1 suite against kimi acp (Kimi Code CLI 0.34.0).

ACP-AUTH-002 (MANDATORY): FAIL

No authMethods[*].type == "terminal" entry is advertised unless the client advertised clientCapabilities.auth.terminal (Req 23, AUTH-M4). (schema/v1/schema.json:2736-2782 AuthMethodTerminal; docs/protocol/v1/authentication.mdx:126-128, normative MUST NOT)

Reproduction

A plain initialize with empty clientCapabilities (i.e. the client does not declare clientCapabilities.auth.terminal):

--> {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{}}}
<-- {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":1, ...,
     "authMethods":[{
       "id":"login","type":"terminal",
       "name":"Login with Kimi account",
       "description":"Open the device-code login flow in a terminal.",
       "args":["--login"],"env":{},
       "_meta":{"terminal-auth":{"type":"terminal","label":"Login with Kimi account",
         "command":"/workspace/.home/openvscode-server/.kimi-code/bin/kimi","args":["login"],"env":{}}}
     }],
     "agentInfo":{"name":"Kimi Code CLI","version":"0.34.0"}}}

A terminal-type auth method is advertised unconditionally, regardless of whether the connecting client ever said it can host one. A client that can't run an interactive terminal (most headless/server-side ACP clients, including the multi-agent client I'm building) has no way to know this method is unusable without trying authenticate and getting a failure — the spec's intent with gating this behind clientCapabilities.auth.terminal is presumably to let such a client skip it up front.

Suggestion

Only include authMethods[*].type == "terminal" entries when initialize.params.clientCapabilities.auth.terminal was present on the request that's being answered.

agourakis82 avatar Oct 01 '26 09:10 agourakis82

Confirmed on Kimi Code CLI 2.8.1 (release commit 62402f173c5a838a1c1f8fa263b637a22486fa39), Linux x86_64, using kimi acp with a disposable empty home and no login.

I sent this single stdio request followed by a newline:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientInfo":{"name":"acp-fixture","version":"0.1.0"},"clientCapabilities":{}}}

The reply negotiated protocol 1 and included an authMethods entry with id:"login" and type:"terminal". The terminal capability was absent. The same entry was observed when omitting clientCapabilities.

Clients without a terminal-auth host need the terminal entry to be gated by clientCapabilities.auth.terminal: true in the ACP v1 authentication contract. This probe covered initialization before login. I can retest a candidate release with the same fixture.

Josepavese avatar Nov 28 '26 09:11 Josepavese