[Bug]: ACP terminal sign-in appends the auth method's `args` to the agent's launch args instead of replacing them #48264
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area: apps/server (the code is in packages/provider-acp-registry)
Steps to reproduce#
- Add an ACP provider (ACP Registry → Local command) for an agent whose launch args differ from its sign-in args. Command Code is one: Executable
command-code, Argumentsacp. - Open the provider's Setup and pick the terminal sign-in method "Sign in with Command Code". The agent advertises it in
initializelike this:{ "type": "terminal", "id": "command-code-login", "name": "Sign in with Command Code", "args": ["login"] } - Start or retry sign-in.
Expected behavior#
T3 runs command-code login. The registry's AUTHENTICATION.md says a terminal method's args "replace the default args/env for the agent during the setup flow". Its example turns my-agent serve --acp into my-agent --setup.
Actual behavior#
T3 runs command-code acp login, which the agent rejects. Setup then shows:
The provider login command did not finish successfully. error: too many arguments for 'acp'. Expected 0 arguments but got 1.
The cause is packages/provider-acp-registry/src/server/auth.ts (L219 on main @ 51ffe1792f):
args: [...resolved.spawn.args, ...(method.args ?? [])],
The same thing happens for the registry distribution. command-code's pending registry entry launches with acp --no-auto-update, so sign-in becomes acp --no-auto-update login.
Impact#
Major degradation or frequent failure. Terminal sign-in can't work for any ACP agent whose launch args are a subcommand, such as acp, serve --acp or --acp. The non-terminal method still works when the user is already signed in elsewhere.
Version or commit#
T3 Code 0.1.13 (desktop .deb). The code is unchanged on main @ 51ffe1792f.
Environment#
Ubuntu 26.04 x86_64, Node 24.21.0. Command Code 1.94.0 via nvm, run as a local ACP command.
Logs or stack traces#
The command T3 builds, run by hand:
$ command-code acp login
error: too many arguments for 'acp'. Expected 0 arguments but got 1.
$ command-code acp --no-auto-update login
error: too many arguments for 'acp'. Expected 0 arguments but got 1.
$ command-code login # what the method asks for: works
Workaround#
Wrap the executable in a script that drops the leading acp when more args follow ([ "$1" = acp ] && [ "$#" -gt 1 ] && shift). Or use the agent's non-terminal method if you're already signed in.
Note on the fix#
Replacing all of spawn.args would break npx/uvx agents, because the final spawn also has to carry the package spec. The catalog already keeps that separate: it resolves { args, env, packageName } from distribution.npx / distribution.uvx. So the fix can swap only the distribution's args (or the configured Arguments for a local command) for method.args before the runner prefix is added. The spec's env wording is "replace" too, but merging method.env over the launch env seems harmless.
tanstack-source added labelsbug
Sign in to join this conversation.
Some context I found after filing, so this doesn't look like an accidental bug:
auth.test.tsL287–293 asserts the terminal spawn is["--acp", "login"], the agent's args followed by the method's.args/env"replace the default args/env for the agent during the setup flow", withmy-agent serve --acp→my-agent --setupas the example.terminal-typed methods as "the agent's spawn command plus the method's args".So it's a question of which behavior you want:
args, or the configured Arguments for a local command) formethod.args, keeping the npx/uvx package part. Agents that already account for the append might need a look first.<subcommand> <method args>, and I'll take it to Command Code to acceptacp login.If you want (1), I'm happy to open a small PR with the test updated, based on top of #34892 or after it lands. If (2), feel free to close this and I'll raise it with Command Code.