nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Xcode hangs when the agent is started with "acp" instead of "--acp": no hint in 1.31.0, and no setup docs

Open barbaramartina opened this issue 1 month ago • 4 comments

Description

Xcode Intelligence won't connect to nanocoder local agent through ACP, But it does connect to opencode.

Environment

  • OS:macOS Apple Max M1
  • Node version: 26.4.0
  • Nanocoder version: 1.31.0
  • Provider: local ollama
  • Model: any

Steps to Reproduce

  1. go to xcode setting inteligence
  2. configure a new agent
  3. add the bin path to where nanocoder is in your mac
  4. add arguments: acp
  5. open a conversation in xcode

Expected Behavior

conversation should connect with the agent

Actual Behavior

it does not connect and hangs. It is not an xcode problem, opencode can be launched immediately

Logs/Screenshots

Image Image

Additional Context

  • [ x] I have searched existing issues to ensure this is not a duplicate
  • [ x] I can reproduce this issue consistently
  • [ x] This issue occurs with the latest version of nanocoder

barbaramartina avatar Oct 20 '26 19:10 barbaramartina

@addyCooks I'd like to work on this. I've reproduced the hang on macOS and tracked down what causes it, happy to put up a fix if you assign it to me.

me-adityaraj8 avatar Oct 25 '26 18:10 me-adityaraj8

Thanks for the report! Could you double-check the exact arguments you gave Xcode? Nanocoder's ACP mode is enabled with the flag --acp (e.g. nanocoder --acp), not a bare acp. In 1.31.0 a bare acp just starts the interactive UI, which never talks ACP, so the editor waits forever. That matches what you describe. In the next release it will exit with an "Unknown command" error instead.

If --acp still hangs, please share your Xcode version and the agent log from Xcode. If your folder isn't trusted yet, add --trust-directory to the arguments or run nanocoder there once.

@me-adityaraj8, thanks for offering to help. Could you share what you found on macOS? Let's confirm the cause before we assign it.

addyCooks avatar Oct 27 '26 05:10 addyCooks

Thanks @addyCooks, I came to the same conclusion. Here's what I ran on macOS, piping an ACP initialize request into nanocoder the way an editor does:

  • 1.31.0 (from npm), acp: starts the interactive UI instead of ACP. It prints the directory-trust prompt to stdout and never replies to initialize; the JSON the client sends just gets read as keypresses.
  • main, acp: exits 1 with Unknown command "acp".
  • main, --acp in an untrusted folder: exits 1 with the trust message.
  • main, --acp --trust-directory: gets past the trust check (it then stopped only because I have no provider configured).

Since opencode acp is a subcommand, people coming from opencode will likely type acp. Would you take a small PR for one of these, plus a short "Setup in Xcode" section in docs/features/acp.md (args --acp --trust-directory)?

  1. accept nanocoder acp as an alias for --acp, or
  2. make the error say Did you mean "--acp"?

Happy to do whichever you prefer.

me-adityaraj8 avatar Oct 27 '26 05:10 me-adityaraj8

Thanks @me-adityaraj8, that matches what I saw 👍 For the record, I also reproduced it on Windows with a scripted ACP client piping initialize into the 1.31.0 build:

  • acp: never answers initialize and keeps running, so the client waits forever
  • --acp: answers initialize in about 2s and session/new works
  • main with acp: exits 1 with Unknown command "acp"

I'd keep the fix small: please go ahead with the Did you mean "--acp"? hint (with a test) and a short "Setup in Xcode" section in docs/features/acp.md, and I'll assign it to you. Let's skip the acp alias for now, since it adds a new top-level command. For the docs, please suggest trusting the folder once rather than putting --trust-directory in the args by default, so every folder Xcode opens isn't trusted automatically. A changeset is needed too.

addyCooks avatar Oct 27 '26 06:10 addyCooks