Repository navigation
Bugfix/cursor signin status - #745
Open
QuanCheng-QC wants to merge 2 commits into
Open
QuanCheng-QC wants to merge 2 commits into
QuanCheng-QC wants to merge 2 commits into
Conversation
… as not signed in The readiness check read `authInfo` from ~/.cursor/cli-config.json, which is a profile the CLI caches and not the sign-in. The tokens live in the OS keychain on macOS, %APPDATA%\Cursor\auth.json on Windows and ~/.config/cursor/auth.json on Linux, and `cursor-agent status` answers from those alone. A signed-in user whose config had no authInfo (XDG_CONFIG_HOME or CURSOR_CONFIG_DIR set, a reset config) read "installed but not signed in" in the workspace, and the re-check repeated the same sentence because Cursor has no live probe. - check_ready gains status_args and logged_out_pattern, the rule the desktop app already uses. When nothing on disk or in the env proves a sign-in, the core runs the resolved CLI with status_args and reads its output. - Signed in gives Ready. "Not logged in" gives a definitive no_credentials, so the re-check returns the login guidance. No answer stays unknown. - authInfo on disk still settles it without starting the CLI, and nothing is spawned where the caller cannot block (the desktop app's main thread). - The not-ready message and the add-agent hint now say the CLI sign-in is separate from signing in to the Cursor editor.
…s survive Cursor's Windows install is not an npm shim. cursor-agent.cmd hands its arguments to PowerShell, and cursor-agent.ps1 runs the node.exe shipped under versions\<version> on that directory's index.js. The adapter could not resolve that to a script, so it launched through `cmd.exe /c`. cmd.exe stops reading a command line at its first newline, and every prompt has carried one since the identity header (which ends in a blank line) was added. The user's message and every flag after the prompt were dropped, --trust and --force among them. The CLI ran the header alone in an untrusted directory, exited 1 with "Workspace Trust Required", and the chat showed "No response generated". Trusting the directory by hand did not help, because the message itself never arrived. - resolveCursorNodeEntry finds the node.exe and index.js pair the way cursor-agent.ps1 does (beside the launcher, else the newest versions directory by date), and the adapter starts node itself. - CURSOR_INVOKED_AS and NODE_COMPILE_CACHE are set as the launcher script would have set them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes, and where it was reported
Two user reports about Cursor agents in the workspace.
Report 1: "not signed in" although the user is signed in (translated)
Report 2: no reply on Windows (translated)
Root cause
Sign-in. Since core 0.2.189 (3e2ff11) the readiness check reads
authInfofrom~/.cursor/cli-config.json. That field is a profile the CLI caches, not the sign-in. The tokens are in the OS keychain on macOS,%APPDATA%\Cursor\auth.jsonon Windows and~/.config/cursor/auth.jsonon Linux, andcursor-agent statusanswers from those alone. WhenauthInfois absent the core reports "not signed in", and Re-check cannot correct it, because Cursor has no live probe and the same static result comes back.The exact output in report 1, with its three guidance lines, comes from a core older than 0.2.189, where only
CURSOR_API_KEYcounted. Upgrading fixes that case. This PR fixes what remains after the upgrade.Windows. Cursor's Windows install is not an npm shim:
cursor-agent.cmd→ PowerShell →cursor-agent.ps1→node.exe index.js. The adapter could not resolve it to a script, so it launched throughcmd.exe /c. cmd.exe stops reading a command line at the first newline, and every prompt has carried one since the per-agent identity header was added (it ends in a blank line). Everything after it was dropped: the user's message, and--output-format,--trust,--force,--model,--workspace,--resume. The CLI ran the header alone in an untrusted directory and exited with "Workspace Trust Required". Trusting the directory by hand does not help, because the message itself never arrives.How to reproduce
Sign-in
cursor-agent login. Set noCURSOR_API_KEY.cursor-agent statusprints "Logged in".authInfoin~/.cursor/cli-config.json. This happens whenXDG_CONFIG_HOMEorCURSOR_CONFIG_DIRmoves the config, or when the config was reset.agn runtimes --json.Windows
%LOCALAPPDATA%\cursor-agent), signed in.Before and after
authInfopresentauthInfomissing or config moved byXDG_CONFIG_HOMEunknown, Re-check gives no guidanceno_credentials, Re-check returns the login stepscursor-agent statusfails or times outunknownunknown, unchangedImplementation
registry/cursor.json:check_readygainsstatus_args: ["status"]andlogged_out_pattern. This is the rule the launcher'sHOSTED_LOGIN_AGENTS.cursoralready uses, so the desktop app and the workspace agree.installer.js: when the env and the credential file prove nothing,_checkLoginStatusruns the resolved CLI withstatus_args, andloginVerdictreads the output (a port of the launcher'sloginVerdict). The check is generic, and only Cursor declares it. Nothing is spawned where the caller cannot block (Electron main).adapters/cursor.js:resolveCursorNodeEntryfindsnode.exeandindex.jsthe waycursor-agent.ps1does (beside the launcher, else the newestversions\<version>by date). The adapter then starts node itself and setsCURSOR_INVOKED_ASandNODE_COMPILE_CACHEas the script would.Behaviour changes to note
no_credentials, so the chat shows the failing-health banner with the login steps. Before, the status wasunknownand the banner stayed hidden.authInfois missing, each health check startscursor-agent status(1–3 s, cached for 10 s). Installs withauthInfopay nothing.Testing
test/cursor-readiness.test.js(19 cases) andtest/cursor-windows-launch.test.js(9 cases).npm testinpackages/agent-connector: 1875 pass, 1 fail. The failure iswsl.test.js› "an agent that only exists inside the distro", which fails the same way ondevelopon my machine.cursor-agent2026.10.01-e373342 on Linux in an isolatedHOME: signed out → not ready,no_credentials; tokens present withoutauthInfo→ Ready; config underXDG_CONFIG_HOME→ Ready. The signed-in state used placeholder tokens, sincestatusonly checks that both tokens exist.statuscommand the launcher already runs there.packages/agent-connector.