Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: ACP terminal sign-in appends the auth method's `args` to the agent's launch args instead of replacing them #48264

OpenHaroonTaufiq(GitHub profile, opens in a new tab) opened this issue 1 comment
  • 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

  1. 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, Arguments acp.
  2. Open the provider's Setup and pick the terminal sign-in method "Sign in with Command Code". The agent advertises it in initialize like this:
    { "type": "terminal", "id": "command-code-login", "name": "Sign in with Command Code", "args": ["login"] }
  3. 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.

  1. tanstack-source added labelsbug

  2. Some context I found after filing, so this doesn't look like an accidental bug:

    • The append is tested on purpose. auth.test.ts L287–293 asserts the terminal spawn is ["--acp", "login"], the agent's args followed by the method's.
    • The registry's AUTHENTICATION.md says the opposite: terminal-auth args/env "replace the default args/env for the agent during the setup flow", with my-agent serve --acp → my-agent --setup as the example.
    • #34892 reworks this same launch path. It explicitly keeps terminal-typed methods as "the agent's spawn command plus the method's args".

    So it's a question of which behavior you want:

    1. Follow the registry spec: swap the agent's own args (the distribution args, or the configured Arguments for a local command) for method.args, keeping the npx/uvx package part. Agents that already account for the append might need a look first.
    2. Keep appending: then agents launched with a subcommand need to accept <subcommand> <method args>, and I'll take it to Command Code to accept acp 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.

Sign in to join this conversation.