Local Agents Window blocked by SSH-started foreign agent host (ForeignDaemonError / enrollment-denied) while remotes keep working

Where does the bug appear (feature/product)?

Grok Build (formerly Cursor)

Describe the Bug

Where does the bug appear (feature/product)?

Grok Build (formerly Cursor) — local Agents Window / agent-host-daemon

Describe the Bug

I’m filing this with a clear root cause and a painful UX false lead. I’m pretty irritated about the time and token spend chasing a “sign in” problem that wasn’t sign-in — but I also know whoever reads this probably didn’t ship the bug, and whoever can fix it probably didn’t invent the misleading error. Please just help get this unstuck / fixed.

Summary: On the Mac that owns the machine (local Cursor / Agents Window), local Agents Window is dead: UI says sign-in / “the account that owns this agent signed out,” turns fail with unauthenticated + route_reason: enrollment-denied.

At the same time, Agents Window over SSH from other machines to this host works fine.

Editor Agent on the same Mac does work (fallback in-process host). Verified with a one-line turn (editor-agent-ok).

So this is not “logged out of Cursor.” Auth was a red herring. The real issue is daemon ownership.

Root cause (from logs): Local desktop repeatedly hits:

ForeignDaemonError: an agent host this app did not start holds
/Users/mike/.grok/agent-host-daemon/daemon.sock
(molten-glass-ssh:…-darwin-arm64-…:--remote:--trusted-workspaces:on)

Same message in molten:

An agent host this app did not start holds …/daemon.sock
(molten-glass-ssh:…:--remote:…)

The process holding the sock is daemon.cjs started with --remote (identity molten-glass-ssh), i.e. an Agents Window SSH client from another machine owns the single host daemon on this box. Local Agents Window then refuses that foreign host and surfaces it as auth failure (enrollment-denied / unauthenticated / “signed out”).

Sign out / sign in / browser login does nothing useful here. Of course it doesn’t — the sock isn’t ours.

Why this burned a lot of time / money

  1. The product UI blamed account / sign-in, so I burned cycles (and tokens) on keychain, login, “CLOUD_AUTH”-shaped naming, re-auth, etc.
  2. There was a useful popup about “this agent host wasn’t started in the Agents Window / sessions started here will only…” — the exact class of warning that matches ForeignDaemonError.
  3. That popup was clobbered by product advertising for a feature I did not ask for, so I couldn’t read the one message that pointed at the real failure.
  4. Meanwhile remotes keep working, which makes the local failure look like a flaky local account bug instead of exclusive foreign ownership of daemon.sock.

I’m fine paying for useful agent work. Paying to debug a misleading auth UX while the real error is “SSH foreign host owns the daemon” is a bad product experience.

What I want from the product

  1. Stop lying with auth UX when the failure is ForeignDaemonError / foreign sock ownership. Show the foreign-host message and keep it visible (don’t cover it with ads).
  2. Document / support coexistence or handoff: local desktop + SSH Agents Window clients sharing one machine without “first remote to grab the sock wins forever / local is dead.”
  3. If exclusive ownership is intentional for now: make that explicit in UI, with a one-click “reclaim local agent host” that doesn’t require spelunking pkill + hoping remotes don’t immediately steal it back.
  4. Please don’t make “sign in again” the first response to enrollment-denied when logs already know it’s a foreign daemon.

Steps to Reproduce

  1. On Mac host H, open Agents Window from remote machine R over SSH to H (this starts daemon.cjs with --remote / molten-glass-ssh owning ~/.grok/agent-host-daemon/daemon.sock).
  2. On host H, open local Cursor Agents Window and try a local agent turn.
  3. Observe UI: sign-in / “account that owns this agent signed out”; molten logs: ForeignDaemonError + route_reason: enrollment-denied / error_code: unauthenticated.
  4. Observe remotes still work; editor Agent on H may work via in-process fallback after the same ForeignDaemonError.

Expected Behavior

Local Agents Window on the machine that owns the host either shares the daemon with SSH Agents Window clients, or clearly tells me a foreign SSH agent host owns the sock and offers reclaim — not a fake signed-out / sign-in loop. The useful foreign-host warning must not be covered by ads.

Actual Behavior

Local Agents Window fails as unauthenticated / enrollment-denied / signed-out while daemon.sock is held by molten-glass-ssh … --remote. Remotes keep working. Editor Agent falls back and works.

Operating System

macOS 27.2.1 (darwin arm64) — machine used both as local desktop and as SSH Agents Window target

Version of Cursor

3.32.25

Additional Information

  • Daemon sock: ~/.grok/agent-host-daemon/daemon.sock
  • Holding process identity: molten-glass-ssh + --remote
  • Editor Agent: works after ForeignDaemonError (in-process host)
  • Workaround attempting: quiet remotes → pkill the --remote daemon.cjs → start local Agents Window first → reconnect remotes. Expect remotes may seize the sock again as molten-glass-ssh --remote and re-break local. If that’s expected, document it; if not, it’s a bug.
  • Happy to provide more log excerpts.

Steps to Reproduce

as above

Expected Behavior

doesn’t matter which agent window on what host local or not started, you should be able to start a local agents window and get to work

Operating System

MacOS

Version Information

all information included above

For AI issues: which model did you use?

all models fail

Does this stop you from using Grok

Yes - Grok is unusable

Hi @Mike_Hardy, your read is correct: this isn’t your sign-in. The Agents Window on that Mac won’t use an agent host that was started over SSH from another machine, and the turn then fails with a sign-in message that points the wrong way. Signing in again can’t change it.

Right now the two can’t share one machine, so it comes down to who starts the agent host. One started over SSH should stop by itself about a minute after the last remote client disconnects, as long as nothing is running on it. So instead of the pkill you can close the remote connections, wait a minute, then open the Agents Window on the Mac. Remote clients that reconnect later can take it over again, as you suspected. The editor’s agent on that Mac keeps working either way.

I’ve passed both parts to the team, the sharing gap and the misleading error. Do you remember what the promo was that covered the warning, and whether it was in the editor or the Agents Window?

Hi @Colin - not sure on exact promo but it looked the others pushed recently, like “hey try projects” or “we’re grok build now”. I think it was in IDE window but can’t be certain.

Bummer the remote agent session feature is no longer actually multi-machine on same host. That used to work and was a key unlock for me to get multiple agent windows at once on same host hardware by using display of other hosts but remoting in.