Skip to content

cursor-agent cannot start over TRAMP displaying Loading… forever #872

Closed

Description

@wojnilowicz

If M-x agent-shell won't start cursor-agent in 2-3 s then it hangs at "Loading…" forever. If it loads cursor-agent then I can use it.

Can you make the startup more robust?

Additional info:

  1. I set agent-shell-cursor-acp-command to absolute cursor-agent path specifically, because it's the only way it starts
  2. cursor-agent never started if I only added /home/myusername/.local/bin to tramp-remote-path
  3. no problem when not using TRAMP
  4. cursor-agent normally starts several seconds for me when using CLI only but never fails
  5. my ssh server displays its MOTD that I cannot get rid of
  6. I'm using Fedora 44 on WSL on Windows 11
  7. I use self compiled curl 7.76 and pass it to shell-maker through its configuration variable, because otherwise I cannot use cursor-agent event when it loads through agent-shell

Checklist

  • I agree to communicate with the author myself (not AI-generated).
  • I've read the README's Filing issues section.
  • I'm running the latest versions (fill in below).
    • agent-shell version: agent-shell-20260928.10
    • acp.el version: acp-20260914.1318
    • ACP package (e.g. claude-agent-acp) version: 2026-10-01
    • Agent CLI (e.g. claude, gemini) version: cursor-agent
  • For requesting new agent support, I'm including a link to the ACP-capable agent or related ACP package.
  • For issues, I'm including ACP traffic (as per README).

(((:direction . outgoing) (:kind . request)
  (:object (jsonrpc . "2.0") (method . "initialize") (id . 1)
           (params
            (clientInfo (name . "agent-shell")
                        (title . "Emacs Agent Shell")
                        (version . "0.81.1"))
            (protocolVersion . 1)
            (clientCapabilities
             (fs (readTextFile . t) (writeTextFile . t)))))))

OUTGOING OBJECT >

((jsonrpc . 2.0) (method . initialize) (id . 1) (params (clientInfo (name . agent-shell) (title . Emacs Agent Shell) (version . 0.81.1)) (protocolVersion . 1) (clientCapabilities (fs (readTextFile . t) (writeTextFile . t)))))

OUTGOING TEXT >

{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"clientInfo":{"name":"agent-shell","title":"Emacs Agent Shell","version":"0.81.1"},"protocolVersion":1,"clientCapabilities":{"fs":{"readTextFile":true,"writeTextFile":true}}}}
l

Activity

  1. xenodium commented on Oct 6, 2026

    @xenodium
    Owner

    Will need more details. Are you using https://github.com/junyi-hou/agent-shell-tramp? This is the only TRAMP mechanism known to work at present. Also please share the entire elisp snippet you've used to configure agent-shell.

  2. wojnilowicz commented on Oct 6, 2026

    @wojnilowicz
    Author

    Thanks for your attention. Yes, I'm using agent-shell-tramp but I believe it's not needed to make a connection to the cursor-agent binary.

      (add-to-list 'load-path "/home/myusername/.config/emacs/agent-shell-tramp")
      (add-to-list 'tramp-remote-path "/home/myusername/.local/bin/")
      (add-to-list 'tramp-remote-path "/path/to/self/compiled/curl-7.76.0/bin/")
      (require 'agent-shell-tramp)
      (require 'agent-shell)
      (require 'shell-maker)
      (agent-shell-tramp-mode 1)
      (setq shell-maker-curl-executable "/path/to/self/compiled/curl-7.76.0/bin/curl")
      (setq agent-shell-cursor-acp-command
            '("/path/to/cursor-agent/versions/version-designation/cursor-agent"
              "acp"))
  3. xenodium commented on Oct 7, 2026

    @xenodium
    Owner

    cc @junyi-hou who is likely better suited to troubleshoot this.

    Some things that may help... From your traffic, initialize goes out but nothing ever comes back, and the process doesn't exit either. Could you try:

    1. Enabling direct async processes for that host. It starts the agent directly instead of going through TRAMP's remote shell setup:
    (connection-local-set-profile-variables
     'remote-direct-async-process
     '((tramp-direct-async-process . t)))
    
    (connection-local-set-profiles
     '(:application tramp :machine "your-host")
     'remote-direct-async-process)

    Note this probably needs non-interactive auth (e.g. ssh keys/agent) and doesn't work with multi-hop connections.

    1. If it still hangs, please share the full ACP log from a hung run (any incoming text or stderr?), plus the debug tramp/... buffer with (setq tramp-verbose 6).

    Also, shell-maker-curl-executable shouldn't matter here. agent-shell talks to the agent over stdio, not curl.

  4. wojnilowicz commented on Oct 7, 2026

    @wojnilowicz
    Author

    direct async fails fast with "method not found: initialize" Error (-32601) . I attach the tramp and acp log for it. I also attach the tramp log for direct async disabled. The acp log for this case is the same as before so I'm not attaching it.

    I use a ssh key configured in my WSL to connect to the host, so I believe auth is non-interactive. How can I tell, if my host is multi-hop?

    traffic-direct-async.txt

    tramp-direct-async.txt

    tramp-no-direct-async.txt

  5. xenodium commented on Oct 8, 2026

    @xenodium
    Owner

    Thanks, these logs help. Direct async actually gets further. Your ACP log shows our own initialize request coming straight back to us as an incoming message. TRAMP runs ssh with -t -t for direct async, which gives cursor-agent a remote terminal, and that terminal echoes our input back. cursor-agent's real response does arrive right after, it's just too late.

    Could you try this alongside the direct async config? It tells TRAMP to skip the -t -t:

    (add-to-list 'tramp-connection-properties
                 (list (regexp-quote "/ssh:my-host-name:") "direct-async" t))

    You may need M-x tramp-cleanup-all-connections (or an Emacs restart) for it to take effect.

    Re multi-hop: from your log it's a single ssh hop, so you're probably fine there.

  6. wojnilowicz commented on Oct 8, 2026

    @wojnilowicz
    Author

    I tried it three times in a row and it always succeed. Thanks.

    Could you add these tips to your README file?

    BTW., the following error

    agent-shell--start: Executable "agent" not found.  Do you need (add-to-list 'exec-path "another/path/to/consider/")?  See https://cursor.com/docs/cli for installation.
    

    was not helpful in the context of TRAMP.

    It would be more helpful to mention that I need to add the path of cursor-agent relative to my host to tramp-remote-path.

  7. xenodium commented on Oct 9, 2026

    @xenodium
    Owner

    I tried it three times in a row and it always succeed. Thanks.

    Great to hear.

    Could you add these tips to your README file?

    Done in #872

    It would be more helpful to mention that I need to add the path of cursor-agent relative to my host to tramp-remote-path.

    Also done in #872

    Consider sponsoring (or getting your employer to do so) the project. Maintaining and providing support like in this instance takes daily effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions